graphlib.min.js 487 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.graphlib=f()}})(function(){var define,module,exports;return function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e}()({1:[function(require,module,exports){module.exports={Graph:require("./lib/graph"),json:require("./lib/json"),alg:require("./lib/alg")}},{"./lib/alg":8,"./lib/graph":16,"./lib/json":17}],2:[function(require,module,exports){var _=require("../lodash");module.exports=components;function components(g){const visited={};const cmpts=[];let cmpt;function dfs(v){if(_.has(visited,v))return;visited[v]=true;cmpt.push(v);_.each(g.successors(v),dfs);_.each(g.predecessors(v),dfs)}_.each(g.nodes(),function(v){cmpt=[];dfs(v);if(cmpt.length){cmpts.push(cmpt)}});return cmpts}},{"../lodash":18}],3:[function(require,module,exports){var _=require("../lodash");module.exports=dfs
  2. /*
  3. * A helper that preforms a pre- or post-order traversal on the input graph
  4. * and returns the nodes in the order they were visited. If the graph is
  5. * undirected then this algorithm will navigate using neighbors. If the graph
  6. * is directed then this algorithm will navigate using successors.
  7. *
  8. * Order must be one of "pre" or "post".
  9. */;function dfs(g,vs,order){if(!_.isArray(vs)){vs=[vs]}var navigation=(g.isDirected()?g.successors:g.neighbors).bind(g);const acc=[];const visited={};_.each(vs,function(v){if(!g.hasNode(v)){throw new Error("Graph does not have node: "+v)}doDfs(g,v,order==="post",visited,navigation,acc)});return acc}function doDfs(g,v,postorder,visited,navigation,acc){if(!_.has(visited,v)){visited[v]=true;if(!postorder){acc.push(v)}_.each(navigation(v),function(w){doDfs(g,w,postorder,visited,navigation,acc)});if(postorder){acc.push(v)}}}},{"../lodash":18}],4:[function(require,module,exports){const dijkstra=require("./dijkstra");const _=require("../lodash");module.exports=dijkstraAll;function dijkstraAll(g,weightFunc,edgeFunc){return _.transform(g.nodes(),function(acc,v){acc[v]=dijkstra(g,v,weightFunc,edgeFunc)},{})}},{"../lodash":18,"./dijkstra":5}],5:[function(require,module,exports){const _=require("../lodash");const PriorityQueue=require("../data/priority-queue");module.exports=dijkstra;var DEFAULT_WEIGHT_FUNC=_.constant(1);function dijkstra(g,source,weightFn,edgeFn){return runDijkstra(g,String(source),weightFn||DEFAULT_WEIGHT_FUNC,edgeFn||function(v){return g.outEdges(v)})}function runDijkstra(g,source,weightFn,edgeFn){const results={};const pq=new PriorityQueue;let v,vEntry;var updateNeighbors=function(edge){const w=edge.v!==v?edge.v:edge.w;const wEntry=results[w];const weight=weightFn(edge);const distance=vEntry.distance+weight;if(weight<0){throw new Error("dijkstra does not allow negative edge weights. "+"Bad edge: "+edge+" Weight: "+weight)}if(distance<wEntry.distance){wEntry.distance=distance;wEntry.predecessor=v;pq.decrease(w,distance)}};g.nodes().forEach(function(v){var distance=v===source?0:Number.POSITIVE_INFINITY;results[v]={distance};pq.add(v,distance)});while(pq.size()>0){v=pq.removeMin();vEntry=results[v];if(vEntry.distance===Number.POSITIVE_INFINITY){break}edgeFn(v).forEach(updateNeighbors)}return results}},{"../data/priority-queue":15,"../lodash":18}],6:[function(require,module,exports){const _=require("../lodash");const tarjan=require("./tarjan");module.exports=findCycles;function findCycles(g){return _.filter(tarjan(g),function(cmpt){return cmpt.length>1||cmpt.length===1&&g.hasEdge(cmpt[0],cmpt[0])})}},{"../lodash":18,"./tarjan":13}],7:[function(require,module,exports){var _=require("../lodash");module.exports=floydWarshall;var DEFAULT_WEIGHT_FUNC=_.constant(1);function floydWarshall(g,weightFn,edgeFn){return runFloydWarshall(g,weightFn||DEFAULT_WEIGHT_FUNC,edgeFn||function(v){return g.outEdges(v)})}function runFloydWarshall(g,weightFn,edgeFn){const results={};const nodes=g.nodes();nodes.forEach(function(v){results[v]={};results[v][v]={distance:0};nodes.forEach(function(w){if(v!==w){results[v][w]={distance:Number.POSITIVE_INFINITY}}});edgeFn(v).forEach(function(edge){const w=edge.v===v?edge.w:edge.v;const d=weightFn(edge);results[v][w]={distance:d,predecessor:v}})});nodes.forEach(function(k){var rowK=results[k];nodes.forEach(function(i){var rowI=results[i];nodes.forEach(function(j){var ik=rowI[k];var kj=rowK[j];var ij=rowI[j];var altDistance=ik.distance+kj.distance;if(altDistance<ij.distance){ij.distance=altDistance;ij.predecessor=kj.predecessor}})})});return results}},{"../lodash":18}],8:[function(require,module,exports){module.exports={components:require("./components"),dijkstra:require("./dijkstra"),dijkstraAll:require("./dijkstra-all"),findCycles:require("./find-cycles"),floydWarshall:require("./floyd-warshall"),isAcyclic:require("./is-acyclic"),postorder:require("./postorder"),preorder:require("./preorder"),prim:require("./prim"),tarjan:require("./tarjan"),topsort:require("./topsort")}},{"./components":2,"./dijkstra":5,"./dijkstra-all":4,"./find-cycles":6,"./floyd-warshall":7,"./is-acyclic":9,"./postorder":10,"./preorder":11,"./prim":12,"./tarjan":13,"./topsort":14}],9:[function(require,module,exports){var topsort=require("./topsort");module.exports=isAcyclic;function isAcyclic(g){try{topsort(g)}catch(e){if(e instanceof topsort.CycleException){return false}throw e}return true}},{"./topsort":14}],10:[function(require,module,exports){var dfs=require("./dfs");module.exports=postorder;function postorder(g,vs){return dfs(g,vs,"post")}},{"./dfs":3}],11:[function(require,module,exports){var dfs=require("./dfs");module.exports=preorder;function preorder(g,vs){return dfs(g,vs,"pre")}},{"./dfs":3}],12:[function(require,module,exports){const _=require("../lodash");const Graph=require("../graph");const PriorityQueue=require("../data/priority-queue");module.exports=prim;function prim(g,weightFunc){const result=new Graph;const parents={};const pq=new PriorityQueue;let v;function updateNeighbors(edge){const w=edge.v===v?edge.w:edge.v;const pri=pq.priority(w);if(pri!==undefined){var edgeWeight=weightFunc(edge);if(edgeWeight<pri){parents[w]=v;pq.decrease(w,edgeWeight)}}}if(g.nodeCount()===0){return result}_.each(g.nodes(),function(v){pq.add(v,Number.POSITIVE_INFINITY);result.setNode(v)});
  10. // Start from an arbitrary node
  11. pq.decrease(g.nodes()[0],0);var init=false;while(pq.size()>0){v=pq.removeMin();if(_.has(parents,v)){result.setEdge(v,parents[v])}else if(init){throw new Error("Input graph is not connected: "+g)}else{init=true}g.nodeEdges(v).forEach(updateNeighbors)}return result}},{"../data/priority-queue":15,"../graph":16,"../lodash":18}],13:[function(require,module,exports){var _=require("../lodash");module.exports=tarjan;function tarjan(g){let index=0;const stack=[];const visited={};// node id -> { onStack, lowlink, index }
  12. const results=[];function dfs(v){var entry=visited[v]={onStack:true,lowlink:index,index:index++};stack.push(v);g.successors(v).forEach(function(w){if(!_.has(visited,w)){dfs(w);entry.lowlink=Math.min(entry.lowlink,visited[w].lowlink)}else if(visited[w].onStack){entry.lowlink=Math.min(entry.lowlink,visited[w].index)}});if(entry.lowlink===entry.index){const cmpt=[];let w;do{w=stack.pop();visited[w].onStack=false;cmpt.push(w)}while(v!==w);results.push(cmpt)}}g.nodes().forEach(function(v){if(!_.has(visited,v)){dfs(v)}});return results}},{"../lodash":18}],14:[function(require,module,exports){const _=require("../lodash");module.exports=topsort;topsort.CycleException=CycleException;function topsort(g){const visited={};const stack={};const results=[];function visit(node){if(_.has(stack,node)){throw new CycleException}if(!_.has(visited,node)){stack[node]=true;visited[node]=true;_.each(g.predecessors(node),visit);delete stack[node];results.push(node)}}_.each(g.sinks(),visit);if(_.size(visited)!==g.nodeCount()){throw new CycleException}return results}function CycleException(){}CycleException.prototype=new Error;// must be an instance of Error to pass testing
  13. },{"../lodash":18}],15:[function(require,module,exports){const _=require("../lodash");module.exports=PriorityQueue
  14. /**
  15. * A min-priority queue data structure. This algorithm is derived from Cormen,
  16. * et al., "Introduction to Algorithms". The basic idea of a min-priority
  17. * queue is that you can efficiently (in O(1) time) get the smallest key in
  18. * the queue. Adding and removing elements takes O(log n) time. A key can
  19. * have its priority decreased in O(log n) time.
  20. */;function PriorityQueue(){this._arr=[];this._keyIndices={}}
  21. /**
  22. * Returns the number of elements in the queue. Takes `O(1)` time.
  23. */PriorityQueue.prototype.size=function(){return this._arr.length}
  24. /**
  25. * Returns the keys that are in the queue. Takes `O(n)` time.
  26. */;PriorityQueue.prototype.keys=function(){return this._arr.map(function(x){return x.key})}
  27. /**
  28. * Returns `true` if **key** is in the queue and `false` if not.
  29. */;PriorityQueue.prototype.has=function(key){return _.has(this._keyIndices,key)}
  30. /**
  31. * Returns the priority for **key**. If **key** is not present in the queue
  32. * then this function returns `undefined`. Takes `O(1)` time.
  33. *
  34. * @param {Object} key
  35. */;PriorityQueue.prototype.priority=function(key){var index=this._keyIndices[key];if(index!==undefined){return this._arr[index].priority}}
  36. /**
  37. * Returns the key for the minimum element in this queue. If the queue is
  38. * empty this function throws an Error. Takes `O(1)` time.
  39. */;PriorityQueue.prototype.min=function(){if(this.size()===0){throw new Error("Queue underflow")}return this._arr[0].key}
  40. /**
  41. * Inserts a new key into the priority queue. If the key already exists in
  42. * the queue this function returns `false`; otherwise it will return `true`.
  43. * Takes `O(n)` time.
  44. *
  45. * @param {Object} key the key to add
  46. * @param {Number} priority the initial priority for the key
  47. */;PriorityQueue.prototype.add=function(key,priority){var keyIndices=this._keyIndices;key=String(key);if(!_.has(keyIndices,key)){var arr=this._arr;var index=arr.length;keyIndices[key]=index;arr.push({key,priority});this._decrease(index);return true}return false}
  48. /**
  49. * Removes and returns the smallest key in the queue. Takes `O(log n)` time.
  50. */;PriorityQueue.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var min=this._arr.pop();delete this._keyIndices[min.key];this._heapify(0);return min.key}
  51. /**
  52. * Decreases the priority for **key** to **priority**. If the new priority is
  53. * greater than the previous priority, this function will throw an Error.
  54. *
  55. * @param {Object} key the key for which to raise priority
  56. * @param {Number} priority the new priority for the key
  57. */;PriorityQueue.prototype.decrease=function(key,priority){var index=this._keyIndices[key];if(priority>this._arr[index].priority){throw new Error("New priority is greater than current priority. "+"Key: "+key+" Old: "+this._arr[index].priority+" New: "+priority)}this._arr[index].priority=priority;this._decrease(index)};PriorityQueue.prototype._heapify=function(i){const arr=this._arr;const l=2*i;const r=l+1;let largest=i;if(l<arr.length){largest=arr[l].priority<arr[largest].priority?l:largest;if(r<arr.length){largest=arr[r].priority<arr[largest].priority?r:largest}if(largest!==i){this._swap(i,largest);this._heapify(largest)}}};PriorityQueue.prototype._decrease=function(index){var arr=this._arr;var priority=arr[index].priority;var parent;while(index!==0){parent=index>>1;if(arr[parent].priority<priority){break}this._swap(index,parent);index=parent}};PriorityQueue.prototype._swap=function(i,j){var arr=this._arr;var keyIndices=this._keyIndices;var origArrI=arr[i];var origArrJ=arr[j];arr[i]=origArrJ;arr[j]=origArrI;keyIndices[origArrJ.key]=i;keyIndices[origArrI.key]=j}},{"../lodash":18}],16:[function(require,module,exports){const _=require("./lodash");module.exports=Graph;const DEFAULT_EDGE_NAME="\0";const GRAPH_NODE="\0";const EDGE_KEY_DELIM="";
  58. // Implementation notes:
  59. //
  60. // * Node id query functions should return string ids for the nodes
  61. // * Edge id query functions should return an "edgeObj", edge object, that is
  62. // composed of enough information to uniquely identify an edge: {v, w, name}.
  63. // * Internally we use an "edgeId", a stringified form of the edgeObj, to
  64. // reference edges. This is because we need a performant way to look these
  65. // edges up and, object properties, which have string keys, are the closest
  66. // we're going to get to a performant hashtable in JavaScript.
  67. function Graph(opts){this._isDirected=_.has(opts,"directed")?opts.directed:true;this._isMultigraph=_.has(opts,"multigraph")?opts.multigraph:false;this._isCompound=_.has(opts,"compound")?opts.compound:false;
  68. // Label for the graph itself
  69. this._label=undefined;
  70. // Defaults to be set when creating a new node
  71. this._defaultNodeLabelFn=_.constant(undefined);
  72. // Defaults to be set when creating a new edge
  73. this._defaultEdgeLabelFn=_.constant(undefined);
  74. // v -> label
  75. this._nodes={};if(this._isCompound){
  76. // v -> parent
  77. this._parent={};
  78. // v -> children
  79. this._children={};this._children[GRAPH_NODE]={}}
  80. // v -> edgeObj
  81. this._in={};
  82. // u -> v -> Number
  83. this._preds={};
  84. // v -> edgeObj
  85. this._out={};
  86. // v -> w -> Number
  87. this._sucs={};
  88. // e -> edgeObj
  89. this._edgeObjs={};
  90. // e -> label
  91. this._edgeLabels={}}
  92. /* Number of nodes in the graph. Should only be changed by the implementation. */Graph.prototype._nodeCount=0
  93. /* Number of edges in the graph. Should only be changed by the implementation. */;Graph.prototype._edgeCount=0
  94. /* === Graph functions ========= */;Graph.prototype.isDirected=function(){return this._isDirected};Graph.prototype.isMultigraph=function(){return this._isMultigraph};Graph.prototype.isCompound=function(){return this._isCompound};Graph.prototype.setGraph=function(label){this._label=label;return this};Graph.prototype.graph=function(){return this._label}
  95. /* === Node functions ========== */;Graph.prototype.setDefaultNodeLabel=function(newDefault){if(!_.isFunction(newDefault)){newDefault=_.constant(newDefault)}this._defaultNodeLabelFn=newDefault;return this};Graph.prototype.nodeCount=function(){return this._nodeCount};Graph.prototype.nodes=function(){return _.keys(this._nodes)};Graph.prototype.sources=function(){var self=this;return _.filter(this.nodes(),function(v){return _.isEmpty(self._in[v])})};Graph.prototype.sinks=function(){var self=this;return _.filter(this.nodes(),function(v){return _.isEmpty(self._out[v])})};Graph.prototype.setNodes=function(vs,value){var args=arguments;var self=this;_.each(vs,function(v){if(args.length>1){self.setNode(v,value)}else{self.setNode(v)}});return this};Graph.prototype.setNode=function(v,value){if(_.has(this._nodes,v)){if(arguments.length>1){this._nodes[v]=value}return this}this._nodes[v]=arguments.length>1?value:this._defaultNodeLabelFn(v);if(this._isCompound){this._parent[v]=GRAPH_NODE;this._children[v]={};this._children[GRAPH_NODE][v]=true}this._in[v]={};this._preds[v]={};this._out[v]={};this._sucs[v]={};++this._nodeCount;return this};Graph.prototype.node=function(v){return this._nodes[v]};Graph.prototype.hasNode=function(v){return _.has(this._nodes,v)};Graph.prototype.removeNode=function(v){var self=this;if(_.has(this._nodes,v)){var removeEdge=function(e){self.removeEdge(self._edgeObjs[e])};delete this._nodes[v];if(this._isCompound){this._removeFromParentsChildList(v);delete this._parent[v];_.each(this.children(v),function(child){self.setParent(child)});delete this._children[v]}_.each(_.keys(this._in[v]),removeEdge);delete this._in[v];delete this._preds[v];_.each(_.keys(this._out[v]),removeEdge);delete this._out[v];delete this._sucs[v];--this._nodeCount}return this};Graph.prototype.setParent=function(v,parent){if(!this._isCompound){throw new Error("Cannot set parent in a non-compound graph")}if(_.isUndefined(parent)){parent=GRAPH_NODE}else{
  96. // Coerce parent to string
  97. parent+="";for(var ancestor=parent;!_.isUndefined(ancestor);ancestor=this.parent(ancestor)){if(ancestor===v){throw new Error("Setting "+parent+" as parent of "+v+" would create a cycle")}}this.setNode(parent)}this.setNode(v);this._removeFromParentsChildList(v);this._parent[v]=parent;this._children[parent][v]=true;return this};Graph.prototype._removeFromParentsChildList=function(v){delete this._children[this._parent[v]][v]};Graph.prototype.parent=function(v){if(this._isCompound){var parent=this._parent[v];if(parent!==GRAPH_NODE){return parent}}};Graph.prototype.children=function(v){if(_.isUndefined(v)){v=GRAPH_NODE}if(this._isCompound){var children=this._children[v];if(children){return _.keys(children)}}else if(v===GRAPH_NODE){return this.nodes()}else if(this.hasNode(v)){return[]}};Graph.prototype.predecessors=function(v){var predsV=this._preds[v];if(predsV){return _.keys(predsV)}};Graph.prototype.successors=function(v){var sucsV=this._sucs[v];if(sucsV){return _.keys(sucsV)}};Graph.prototype.neighbors=function(v){var preds=this.predecessors(v);if(preds){return _.union(preds,this.successors(v))}};Graph.prototype.isLeaf=function(v){var neighbors;if(this.isDirected()){neighbors=this.successors(v)}else{neighbors=this.neighbors(v)}return neighbors.length===0};Graph.prototype.filterNodes=function(filter){var copy=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});copy.setGraph(this.graph());var self=this;_.each(this._nodes,function(value,v){if(filter(v)){copy.setNode(v,value)}});_.each(this._edgeObjs,function(e){if(copy.hasNode(e.v)&&copy.hasNode(e.w)){copy.setEdge(e,self.edge(e))}});var parents={};function findParent(v){var parent=self.parent(v);if(parent===undefined||copy.hasNode(parent)){parents[v]=parent;return parent}else if(parent in parents){return parents[parent]}else{return findParent(parent)}}if(this._isCompound){_.each(copy.nodes(),function(v){copy.setParent(v,findParent(v))})}return copy}
  98. /* === Edge functions ========== */;Graph.prototype.setDefaultEdgeLabel=function(newDefault){if(!_.isFunction(newDefault)){newDefault=_.constant(newDefault)}this._defaultEdgeLabelFn=newDefault;return this};Graph.prototype.edgeCount=function(){return this._edgeCount};Graph.prototype.edges=function(){return _.values(this._edgeObjs)};Graph.prototype.setPath=function(vs,value){const self=this;const args=arguments;_.reduce(vs,function(v,w){if(args.length>1){self.setEdge(v,w,value)}else{self.setEdge(v,w)}return w});return this}
  99. /*
  100. * setEdge(v, w, [value, [name]])
  101. * setEdge({ v, w, [name] }, [value])
  102. */;Graph.prototype.setEdge=function(){let v,w,name,value;let valueSpecified=false;const arg0=arguments[0];if(typeof arg0==="object"&&arg0!==null&&"v"in arg0){v=arg0.v;w=arg0.w;name=arg0.name;if(arguments.length===2){value=arguments[1];valueSpecified=true}}else{v=arg0;w=arguments[1];name=arguments[3];if(arguments.length>2){value=arguments[2];valueSpecified=true}}v=""+v;w=""+w;if(!_.isUndefined(name)){name=""+name}var e=edgeArgsToId(this._isDirected,v,w,name);if(_.has(this._edgeLabels,e)){if(valueSpecified){this._edgeLabels[e]=value}return this}if(!_.isUndefined(name)&&!this._isMultigraph){throw new Error("Cannot set a named edge when isMultigraph = false")}
  103. // It didn't exist, so we need to create it.
  104. // First ensure the nodes exist.
  105. this.setNode(v);this.setNode(w);this._edgeLabels[e]=valueSpecified?value:this._defaultEdgeLabelFn(v,w,name);var edgeObj=edgeArgsToObj(this._isDirected,v,w,name);
  106. // Ensure we add undirected edges in a consistent way.
  107. v=edgeObj.v;w=edgeObj.w;Object.freeze(edgeObj);this._edgeObjs[e]=edgeObj;incrementOrInitEntry(this._preds[w],v);incrementOrInitEntry(this._sucs[v],w);this._in[w][e]=edgeObj;this._out[v][e]=edgeObj;this._edgeCount++;return this};Graph.prototype.edge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);return this._edgeLabels[e]};Graph.prototype.hasEdge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);return _.has(this._edgeLabels,e)};Graph.prototype.removeEdge=function(v,w,name){const e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);const edge=this._edgeObjs[e];if(edge){v=edge.v;w=edge.w;delete this._edgeLabels[e];delete this._edgeObjs[e];decrementOrRemoveEntry(this._preds[w],v);decrementOrRemoveEntry(this._sucs[v],w);delete this._in[w][e];delete this._out[v][e];this._edgeCount--}return this};Graph.prototype.inEdges=function(v,u){var inV=this._in[v];if(inV){var edges=_.values(inV);if(!u){return edges}return _.filter(edges,function(edge){return edge.v===u})}};Graph.prototype.outEdges=function(v,w){var outV=this._out[v];if(outV){var edges=_.values(outV);if(!w){return edges}return _.filter(edges,function(edge){return edge.w===w})}};Graph.prototype.nodeEdges=function(v,w){var inEdges=this.inEdges(v,w);if(inEdges){return inEdges.concat(this.outEdges(v,w))}};function incrementOrInitEntry(map,k){if(map[k]){map[k]++}else{map[k]=1}}function decrementOrRemoveEntry(map,k){if(!--map[k]){delete map[k]}}function edgeArgsToId(isDirected,v_,w_,name){var v=""+v_;var w=""+w_;if(!isDirected&&v>w){var tmp=v;v=w;w=tmp}return v+EDGE_KEY_DELIM+w+EDGE_KEY_DELIM+(_.isUndefined(name)?DEFAULT_EDGE_NAME:name)}function edgeArgsToObj(isDirected,v_,w_,name){var v=""+v_;var w=""+w_;if(!isDirected&&v>w){var tmp=v;v=w;w=tmp}var edgeObj={v,w};if(name){edgeObj.name=name}return edgeObj}function edgeObjToId(isDirected,edgeObj){return edgeArgsToId(isDirected,edgeObj.v,edgeObj.w,edgeObj.name)}},{"./lodash":18}],17:[function(require,module,exports){const _=require("./lodash");const Graph=require("./graph");module.exports={write,read};function write(g){var json={options:{directed:g.isDirected(),multigraph:g.isMultigraph(),compound:g.isCompound()},nodes:writeNodes(g),edges:writeEdges(g)};if(!_.isUndefined(g.graph())){json.value=_.clone(g.graph())}return json}function writeNodes(g){return _.map(g.nodes(),function(v){const nodeValue=g.node(v);const parent=g.parent(v);const node={v};if(!_.isUndefined(nodeValue)){node.value=nodeValue}if(!_.isUndefined(parent)){node.parent=parent}return node})}function writeEdges(g){return _.map(g.edges(),function(e){const edgeValue=g.edge(e);const edge={v:e.v,w:e.w};if(!_.isUndefined(e.name)){edge.name=e.name}if(!_.isUndefined(edgeValue)){edge.value=edgeValue}return edge})}function read(json){var g=new Graph(json.options).setGraph(json.value);_.each(json.nodes,function(entry){g.setNode(entry.v,entry.value);if(entry.parent){g.setParent(entry.v,entry.parent)}});_.each(json.edges,function(entry){g.setEdge({v:entry.v,w:entry.w,name:entry.name},entry.value)});return g}},{"./graph":16,"./lodash":18}],18:[function(require,module,exports){
  108. /* global window */
  109. var lodash;if(typeof require==="function"){try{lodash=require("lodash")}catch(e){}}if(!lodash){lodash=window._}module.exports=lodash},{lodash:19}],19:[function(require,module,exports){(function(global){(function(){
  110. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  111. var undefined;
  112. /** Used as the semantic version number. */var VERSION="4.17.5";
  113. /** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;
  114. /** Error message constants. */var CORE_ERROR_TEXT="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",FUNC_ERROR_TEXT="Expected a function";
  115. /** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED="__lodash_hash_undefined__";
  116. /** Used as the maximum memoize cache size. */var MAX_MEMOIZE_SIZE=500;
  117. /** Used as the internal argument placeholder. */var PLACEHOLDER="__lodash_placeholder__";
  118. /** Used to compose bitmasks for cloning. */var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;
  119. /** Used to compose bitmasks for value comparisons. */var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;
  120. /** Used to compose bitmasks for function metadata. */var WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG=8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,WRAP_FLIP_FLAG=512;
  121. /** Used as default options for `_.truncate`. */var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION="...";
  122. /** Used to detect hot functions by number of calls within a span of milliseconds. */var HOT_COUNT=800,HOT_SPAN=16;
  123. /** Used to indicate the type of lazy iteratees. */var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;
  124. /** Used as references for various `Number` constants. */var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157e308,NAN=0/0;
  125. /** Used as references for the maximum length and index of an array. */var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;
  126. /** Used to associate wrap methods with their bit flags. */var wrapFlags=[["ary",WRAP_ARY_FLAG],["bind",WRAP_BIND_FLAG],["bindKey",WRAP_BIND_KEY_FLAG],["curry",WRAP_CURRY_FLAG],["curryRight",WRAP_CURRY_RIGHT_FLAG],["flip",WRAP_FLIP_FLAG],["partial",WRAP_PARTIAL_FLAG],["partialRight",WRAP_PARTIAL_RIGHT_FLAG],["rearg",WRAP_REARG_FLAG]];
  127. /** `Object#toString` result references. */var argsTag="[object Arguments]",arrayTag="[object Array]",asyncTag="[object AsyncFunction]",boolTag="[object Boolean]",dateTag="[object Date]",domExcTag="[object DOMException]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",nullTag="[object Null]",objectTag="[object Object]",promiseTag="[object Promise]",proxyTag="[object Proxy]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",undefinedTag="[object Undefined]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";
  128. /** Used to match empty string literals in compiled template source. */var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;
  129. /** Used to match HTML entities and HTML characters. */var reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source);
  130. /** Used to match template delimiters. */var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;
  131. /** Used to match property names within property paths. */var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  132. /**
  133. * Used to match `RegExp`
  134. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  135. */var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);
  136. /** Used to match leading and trailing whitespace. */var reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/;
  137. /** Used to match wrap detail comments. */var reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;
  138. /** Used to match words composed of alphanumeric characters. */var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  139. /** Used to match backslashes in property paths. */var reEscapeChar=/\\(\\)?/g;
  140. /**
  141. * Used to match
  142. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  143. */var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  144. /** Used to match `RegExp` flags from their coerced string values. */var reFlags=/\w*$/;
  145. /** Used to detect bad signed hexadecimal string values. */var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;
  146. /** Used to detect binary string values. */var reIsBinary=/^0b[01]+$/i;
  147. /** Used to detect host constructors (Safari). */var reIsHostCtor=/^\[object .+?Constructor\]$/;
  148. /** Used to detect octal string values. */var reIsOctal=/^0o[0-7]+$/i;
  149. /** Used to detect unsigned integer values. */var reIsUint=/^(?:0|[1-9]\d*)$/;
  150. /** Used to match Latin Unicode letters (excluding mathematical operators). */var reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  151. /** Used to ensure capturing order of template delimiters. */var reNoMatch=/($^)/;
  152. /** Used to match unescaped characters in compiled string literals. */var reUnescapedString=/['\n\r\u2028\u2029\\]/g;
  153. /** Used to compose unicode character classes. */var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;
  154. /** Used to compose unicode capture groups. */var rsApos="['’]",rsAstral="["+rsAstralRange+"]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d";
  155. /** Used to compose unicode regexes. */var rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")";
  156. /** Used to match apostrophes. */var reApos=RegExp(rsApos,"g");
  157. /**
  158. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  159. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  160. */var reComboMark=RegExp(rsCombo,"g");
  161. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */var reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");
  162. /** Used to match complex or compound words. */var reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptContrLower+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");
  163. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */var reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboRange+rsVarRange+"]");
  164. /** Used to detect strings that need a more robust regexp to match words. */var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  165. /** Used to assign default `context` object properties. */var contextProps=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];
  166. /** Used to make template sourceURLs easier to identify. */var templateCounter=-1;
  167. /** Used to identify `toStringTag` values of typed arrays. */var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;
  168. /** Used to identify `toStringTag` values supported by `_.clone`. */var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;
  169. /** Used to map Latin Unicode letters to basic Latin letters. */var deburredLetters={
  170. // Latin-1 Supplement block.
  171. "À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss",
  172. // Latin Extended-A block.
  173. "Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"};
  174. /** Used to map characters to HTML entities. */var htmlEscapes={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};
  175. /** Used to map HTML entities to characters. */var htmlUnescapes={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};
  176. /** Used to escape characters for inclusion in compiled string literals. */var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};
  177. /** Built-in method references without a dependency on `root`. */var freeParseFloat=parseFloat,freeParseInt=parseInt;
  178. /** Detect free variable `global` from Node.js. */var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;
  179. /** Detect free variable `self`. */var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;
  180. /** Used as a reference to the global object. */var root=freeGlobal||freeSelf||Function("return this")();
  181. /** Detect free variable `exports`. */var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;
  182. /** Detect free variable `module`. */var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;
  183. /** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports;
  184. /** Detect free variable `process` from Node.js. */var freeProcess=moduleExports&&freeGlobal.process;
  185. /** Used to access faster Node.js helpers. */var nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();
  186. /* Node.js helper references. */var nodeIsArrayBuffer=nodeUtil&&nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;
  187. /*--------------------------------------------------------------------------*/
  188. /**
  189. * A faster alternative to `Function#apply`, this function invokes `func`
  190. * with the `this` binding of `thisArg` and the arguments of `args`.
  191. *
  192. * @private
  193. * @param {Function} func The function to invoke.
  194. * @param {*} thisArg The `this` binding of `func`.
  195. * @param {Array} args The arguments to invoke `func` with.
  196. * @returns {*} Returns the result of `func`.
  197. */function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}
  198. /**
  199. * A specialized version of `baseAggregator` for arrays.
  200. *
  201. * @private
  202. * @param {Array} [array] The array to iterate over.
  203. * @param {Function} setter The function to set `accumulator` values.
  204. * @param {Function} iteratee The iteratee to transform keys.
  205. * @param {Object} accumulator The initial aggregated object.
  206. * @returns {Function} Returns `accumulator`.
  207. */function arrayAggregator(array,setter,iteratee,accumulator){var index=-1,length=array==null?0:array.length;while(++index<length){var value=array[index];setter(accumulator,value,iteratee(value),array)}return accumulator}
  208. /**
  209. * A specialized version of `_.forEach` for arrays without support for
  210. * iteratee shorthands.
  211. *
  212. * @private
  213. * @param {Array} [array] The array to iterate over.
  214. * @param {Function} iteratee The function invoked per iteration.
  215. * @returns {Array} Returns `array`.
  216. */function arrayEach(array,iteratee){var index=-1,length=array==null?0:array.length;while(++index<length){if(iteratee(array[index],index,array)===false){break}}return array}
  217. /**
  218. * A specialized version of `_.forEachRight` for arrays without support for
  219. * iteratee shorthands.
  220. *
  221. * @private
  222. * @param {Array} [array] The array to iterate over.
  223. * @param {Function} iteratee The function invoked per iteration.
  224. * @returns {Array} Returns `array`.
  225. */function arrayEachRight(array,iteratee){var length=array==null?0:array.length;while(length--){if(iteratee(array[length],length,array)===false){break}}return array}
  226. /**
  227. * A specialized version of `_.every` for arrays without support for
  228. * iteratee shorthands.
  229. *
  230. * @private
  231. * @param {Array} [array] The array to iterate over.
  232. * @param {Function} predicate The function invoked per iteration.
  233. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  234. * else `false`.
  235. */function arrayEvery(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length){if(!predicate(array[index],index,array)){return false}}return true}
  236. /**
  237. * A specialized version of `_.filter` for arrays without support for
  238. * iteratee shorthands.
  239. *
  240. * @private
  241. * @param {Array} [array] The array to iterate over.
  242. * @param {Function} predicate The function invoked per iteration.
  243. * @returns {Array} Returns the new filtered array.
  244. */function arrayFilter(array,predicate){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array)){result[resIndex++]=value}}return result}
  245. /**
  246. * A specialized version of `_.includes` for arrays without support for
  247. * specifying an index to search from.
  248. *
  249. * @private
  250. * @param {Array} [array] The array to inspect.
  251. * @param {*} target The value to search for.
  252. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  253. */function arrayIncludes(array,value){var length=array==null?0:array.length;return!!length&&baseIndexOf(array,value,0)>-1}
  254. /**
  255. * This function is like `arrayIncludes` except that it accepts a comparator.
  256. *
  257. * @private
  258. * @param {Array} [array] The array to inspect.
  259. * @param {*} target The value to search for.
  260. * @param {Function} comparator The comparator invoked per element.
  261. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  262. */function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index<length){if(comparator(value,array[index])){return true}}return false}
  263. /**
  264. * A specialized version of `_.map` for arrays without support for iteratee
  265. * shorthands.
  266. *
  267. * @private
  268. * @param {Array} [array] The array to iterate over.
  269. * @param {Function} iteratee The function invoked per iteration.
  270. * @returns {Array} Returns the new mapped array.
  271. */function arrayMap(array,iteratee){var index=-1,length=array==null?0:array.length,result=Array(length);while(++index<length){result[index]=iteratee(array[index],index,array)}return result}
  272. /**
  273. * Appends the elements of `values` to `array`.
  274. *
  275. * @private
  276. * @param {Array} array The array to modify.
  277. * @param {Array} values The values to append.
  278. * @returns {Array} Returns `array`.
  279. */function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length){array[offset+index]=values[index]}return array}
  280. /**
  281. * A specialized version of `_.reduce` for arrays without support for
  282. * iteratee shorthands.
  283. *
  284. * @private
  285. * @param {Array} [array] The array to iterate over.
  286. * @param {Function} iteratee The function invoked per iteration.
  287. * @param {*} [accumulator] The initial value.
  288. * @param {boolean} [initAccum] Specify using the first element of `array` as
  289. * the initial value.
  290. * @returns {*} Returns the accumulated value.
  291. */function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array==null?0:array.length;if(initAccum&&length){accumulator=array[++index]}while(++index<length){accumulator=iteratee(accumulator,array[index],index,array)}return accumulator}
  292. /**
  293. * A specialized version of `_.reduceRight` for arrays without support for
  294. * iteratee shorthands.
  295. *
  296. * @private
  297. * @param {Array} [array] The array to iterate over.
  298. * @param {Function} iteratee The function invoked per iteration.
  299. * @param {*} [accumulator] The initial value.
  300. * @param {boolean} [initAccum] Specify using the last element of `array` as
  301. * the initial value.
  302. * @returns {*} Returns the accumulated value.
  303. */function arrayReduceRight(array,iteratee,accumulator,initAccum){var length=array==null?0:array.length;if(initAccum&&length){accumulator=array[--length]}while(length--){accumulator=iteratee(accumulator,array[length],length,array)}return accumulator}
  304. /**
  305. * A specialized version of `_.some` for arrays without support for iteratee
  306. * shorthands.
  307. *
  308. * @private
  309. * @param {Array} [array] The array to iterate over.
  310. * @param {Function} predicate The function invoked per iteration.
  311. * @returns {boolean} Returns `true` if any element passes the predicate check,
  312. * else `false`.
  313. */function arraySome(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length){if(predicate(array[index],index,array)){return true}}return false}
  314. /**
  315. * Gets the size of an ASCII `string`.
  316. *
  317. * @private
  318. * @param {string} string The string inspect.
  319. * @returns {number} Returns the string size.
  320. */var asciiSize=baseProperty("length");
  321. /**
  322. * Converts an ASCII `string` to an array.
  323. *
  324. * @private
  325. * @param {string} string The string to convert.
  326. * @returns {Array} Returns the converted array.
  327. */function asciiToArray(string){return string.split("")}
  328. /**
  329. * Splits an ASCII `string` into an array of its words.
  330. *
  331. * @private
  332. * @param {string} The string to inspect.
  333. * @returns {Array} Returns the words of `string`.
  334. */function asciiWords(string){return string.match(reAsciiWord)||[]}
  335. /**
  336. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  337. * without support for iteratee shorthands, which iterates over `collection`
  338. * using `eachFunc`.
  339. *
  340. * @private
  341. * @param {Array|Object} collection The collection to inspect.
  342. * @param {Function} predicate The function invoked per iteration.
  343. * @param {Function} eachFunc The function to iterate over `collection`.
  344. * @returns {*} Returns the found element or its key, else `undefined`.
  345. */function baseFindKey(collection,predicate,eachFunc){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=key;return false}});return result}
  346. /**
  347. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  348. * support for iteratee shorthands.
  349. *
  350. * @private
  351. * @param {Array} array The array to inspect.
  352. * @param {Function} predicate The function invoked per iteration.
  353. * @param {number} fromIndex The index to search from.
  354. * @param {boolean} [fromRight] Specify iterating from right to left.
  355. * @returns {number} Returns the index of the matched value, else `-1`.
  356. */function baseFindIndex(array,predicate,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?1:-1);while(fromRight?index--:++index<length){if(predicate(array[index],index,array)){return index}}return-1}
  357. /**
  358. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  359. *
  360. * @private
  361. * @param {Array} array The array to inspect.
  362. * @param {*} value The value to search for.
  363. * @param {number} fromIndex The index to search from.
  364. * @returns {number} Returns the index of the matched value, else `-1`.
  365. */function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(array,baseIsNaN,fromIndex)}
  366. /**
  367. * This function is like `baseIndexOf` except that it accepts a comparator.
  368. *
  369. * @private
  370. * @param {Array} array The array to inspect.
  371. * @param {*} value The value to search for.
  372. * @param {number} fromIndex The index to search from.
  373. * @param {Function} comparator The comparator invoked per element.
  374. * @returns {number} Returns the index of the matched value, else `-1`.
  375. */function baseIndexOfWith(array,value,fromIndex,comparator){var index=fromIndex-1,length=array.length;while(++index<length){if(comparator(array[index],value)){return index}}return-1}
  376. /**
  377. * The base implementation of `_.isNaN` without support for number objects.
  378. *
  379. * @private
  380. * @param {*} value The value to check.
  381. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  382. */function baseIsNaN(value){return value!==value}
  383. /**
  384. * The base implementation of `_.mean` and `_.meanBy` without support for
  385. * iteratee shorthands.
  386. *
  387. * @private
  388. * @param {Array} array The array to iterate over.
  389. * @param {Function} iteratee The function invoked per iteration.
  390. * @returns {number} Returns the mean.
  391. */function baseMean(array,iteratee){var length=array==null?0:array.length;return length?baseSum(array,iteratee)/length:NAN}
  392. /**
  393. * The base implementation of `_.property` without support for deep paths.
  394. *
  395. * @private
  396. * @param {string} key The key of the property to get.
  397. * @returns {Function} Returns the new accessor function.
  398. */function baseProperty(key){return function(object){return object==null?undefined:object[key]}}
  399. /**
  400. * The base implementation of `_.propertyOf` without support for deep paths.
  401. *
  402. * @private
  403. * @param {Object} object The object to query.
  404. * @returns {Function} Returns the new accessor function.
  405. */function basePropertyOf(object){return function(key){return object==null?undefined:object[key]}}
  406. /**
  407. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  408. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  409. *
  410. * @private
  411. * @param {Array|Object} collection The collection to iterate over.
  412. * @param {Function} iteratee The function invoked per iteration.
  413. * @param {*} accumulator The initial value.
  414. * @param {boolean} initAccum Specify using the first or last element of
  415. * `collection` as the initial value.
  416. * @param {Function} eachFunc The function to iterate over `collection`.
  417. * @returns {*} Returns the accumulated value.
  418. */function baseReduce(collection,iteratee,accumulator,initAccum,eachFunc){eachFunc(collection,function(value,index,collection){accumulator=initAccum?(initAccum=false,value):iteratee(accumulator,value,index,collection)});return accumulator}
  419. /**
  420. * The base implementation of `_.sortBy` which uses `comparer` to define the
  421. * sort order of `array` and replaces criteria objects with their corresponding
  422. * values.
  423. *
  424. * @private
  425. * @param {Array} array The array to sort.
  426. * @param {Function} comparer The function to define sort order.
  427. * @returns {Array} Returns `array`.
  428. */function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--){array[length]=array[length].value}return array}
  429. /**
  430. * The base implementation of `_.sum` and `_.sumBy` without support for
  431. * iteratee shorthands.
  432. *
  433. * @private
  434. * @param {Array} array The array to iterate over.
  435. * @param {Function} iteratee The function invoked per iteration.
  436. * @returns {number} Returns the sum.
  437. */function baseSum(array,iteratee){var result,index=-1,length=array.length;while(++index<length){var current=iteratee(array[index]);if(current!==undefined){result=result===undefined?current:result+current}}return result}
  438. /**
  439. * The base implementation of `_.times` without support for iteratee shorthands
  440. * or max array length checks.
  441. *
  442. * @private
  443. * @param {number} n The number of times to invoke `iteratee`.
  444. * @param {Function} iteratee The function invoked per iteration.
  445. * @returns {Array} Returns the array of results.
  446. */function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n){result[index]=iteratee(index)}return result}
  447. /**
  448. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  449. * of key-value pairs for `object` corresponding to the property names of `props`.
  450. *
  451. * @private
  452. * @param {Object} object The object to query.
  453. * @param {Array} props The property names to get values for.
  454. * @returns {Object} Returns the key-value pairs.
  455. */function baseToPairs(object,props){return arrayMap(props,function(key){return[key,object[key]]})}
  456. /**
  457. * The base implementation of `_.unary` without support for storing metadata.
  458. *
  459. * @private
  460. * @param {Function} func The function to cap arguments for.
  461. * @returns {Function} Returns the new capped function.
  462. */function baseUnary(func){return function(value){return func(value)}}
  463. /**
  464. * The base implementation of `_.values` and `_.valuesIn` which creates an
  465. * array of `object` property values corresponding to the property names
  466. * of `props`.
  467. *
  468. * @private
  469. * @param {Object} object The object to query.
  470. * @param {Array} props The property names to get values for.
  471. * @returns {Object} Returns the array of property values.
  472. */function baseValues(object,props){return arrayMap(props,function(key){return object[key]})}
  473. /**
  474. * Checks if a `cache` value for `key` exists.
  475. *
  476. * @private
  477. * @param {Object} cache The cache to query.
  478. * @param {string} key The key of the entry to check.
  479. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  480. */function cacheHas(cache,key){return cache.has(key)}
  481. /**
  482. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  483. * that is not found in the character symbols.
  484. *
  485. * @private
  486. * @param {Array} strSymbols The string symbols to inspect.
  487. * @param {Array} chrSymbols The character symbols to find.
  488. * @returns {number} Returns the index of the first unmatched string symbol.
  489. */function charsStartIndex(strSymbols,chrSymbols){var index=-1,length=strSymbols.length;while(++index<length&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index}
  490. /**
  491. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  492. * that is not found in the character symbols.
  493. *
  494. * @private
  495. * @param {Array} strSymbols The string symbols to inspect.
  496. * @param {Array} chrSymbols The character symbols to find.
  497. * @returns {number} Returns the index of the last unmatched string symbol.
  498. */function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index}
  499. /**
  500. * Gets the number of `placeholder` occurrences in `array`.
  501. *
  502. * @private
  503. * @param {Array} array The array to inspect.
  504. * @param {*} placeholder The placeholder to search for.
  505. * @returns {number} Returns the placeholder count.
  506. */function countHolders(array,placeholder){var length=array.length,result=0;while(length--){if(array[length]===placeholder){++result}}return result}
  507. /**
  508. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  509. * letters to basic Latin letters.
  510. *
  511. * @private
  512. * @param {string} letter The matched letter to deburr.
  513. * @returns {string} Returns the deburred letter.
  514. */var deburrLetter=basePropertyOf(deburredLetters);
  515. /**
  516. * Used by `_.escape` to convert characters to HTML entities.
  517. *
  518. * @private
  519. * @param {string} chr The matched character to escape.
  520. * @returns {string} Returns the escaped character.
  521. */var escapeHtmlChar=basePropertyOf(htmlEscapes);
  522. /**
  523. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  524. *
  525. * @private
  526. * @param {string} chr The matched character to escape.
  527. * @returns {string} Returns the escaped character.
  528. */function escapeStringChar(chr){return"\\"+stringEscapes[chr]}
  529. /**
  530. * Gets the value at `key` of `object`.
  531. *
  532. * @private
  533. * @param {Object} [object] The object to query.
  534. * @param {string} key The key of the property to get.
  535. * @returns {*} Returns the property value.
  536. */function getValue(object,key){return object==null?undefined:object[key]}
  537. /**
  538. * Checks if `string` contains Unicode symbols.
  539. *
  540. * @private
  541. * @param {string} string The string to inspect.
  542. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  543. */function hasUnicode(string){return reHasUnicode.test(string)}
  544. /**
  545. * Checks if `string` contains a word composed of Unicode symbols.
  546. *
  547. * @private
  548. * @param {string} string The string to inspect.
  549. * @returns {boolean} Returns `true` if a word is found, else `false`.
  550. */function hasUnicodeWord(string){return reHasUnicodeWord.test(string)}
  551. /**
  552. * Converts `iterator` to an array.
  553. *
  554. * @private
  555. * @param {Object} iterator The iterator to convert.
  556. * @returns {Array} Returns the converted array.
  557. */function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done){result.push(data.value)}return result}
  558. /**
  559. * Converts `map` to its key-value pairs.
  560. *
  561. * @private
  562. * @param {Object} map The map to convert.
  563. * @returns {Array} Returns the key-value pairs.
  564. */function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}
  565. /**
  566. * Creates a unary function that invokes `func` with its argument transformed.
  567. *
  568. * @private
  569. * @param {Function} func The function to wrap.
  570. * @param {Function} transform The argument transform.
  571. * @returns {Function} Returns the new function.
  572. */function overArg(func,transform){return function(arg){return func(transform(arg))}}
  573. /**
  574. * Replaces all `placeholder` elements in `array` with an internal placeholder
  575. * and returns an array of their indexes.
  576. *
  577. * @private
  578. * @param {Array} array The array to modify.
  579. * @param {*} placeholder The placeholder to replace.
  580. * @returns {Array} Returns the new array of placeholder indexes.
  581. */function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value===placeholder||value===PLACEHOLDER){array[index]=PLACEHOLDER;result[resIndex++]=index}}return result}
  582. /**
  583. * Gets the value at `key`, unless `key` is "__proto__".
  584. *
  585. * @private
  586. * @param {Object} object The object to query.
  587. * @param {string} key The key of the property to get.
  588. * @returns {*} Returns the property value.
  589. */function safeGet(object,key){return key=="__proto__"?undefined:object[key]}
  590. /**
  591. * Converts `set` to an array of its values.
  592. *
  593. * @private
  594. * @param {Object} set The set to convert.
  595. * @returns {Array} Returns the values.
  596. */function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value});return result}
  597. /**
  598. * Converts `set` to its value-value pairs.
  599. *
  600. * @private
  601. * @param {Object} set The set to convert.
  602. * @returns {Array} Returns the value-value pairs.
  603. */function setToPairs(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=[value,value]});return result}
  604. /**
  605. * A specialized version of `_.indexOf` which performs strict equality
  606. * comparisons of values, i.e. `===`.
  607. *
  608. * @private
  609. * @param {Array} array The array to inspect.
  610. * @param {*} value The value to search for.
  611. * @param {number} fromIndex The index to search from.
  612. * @returns {number} Returns the index of the matched value, else `-1`.
  613. */function strictIndexOf(array,value,fromIndex){var index=fromIndex-1,length=array.length;while(++index<length){if(array[index]===value){return index}}return-1}
  614. /**
  615. * A specialized version of `_.lastIndexOf` which performs strict equality
  616. * comparisons of values, i.e. `===`.
  617. *
  618. * @private
  619. * @param {Array} array The array to inspect.
  620. * @param {*} value The value to search for.
  621. * @param {number} fromIndex The index to search from.
  622. * @returns {number} Returns the index of the matched value, else `-1`.
  623. */function strictLastIndexOf(array,value,fromIndex){var index=fromIndex+1;while(index--){if(array[index]===value){return index}}return index}
  624. /**
  625. * Gets the number of symbols in `string`.
  626. *
  627. * @private
  628. * @param {string} string The string to inspect.
  629. * @returns {number} Returns the string size.
  630. */function stringSize(string){return hasUnicode(string)?unicodeSize(string):asciiSize(string)}
  631. /**
  632. * Converts `string` to an array.
  633. *
  634. * @private
  635. * @param {string} string The string to convert.
  636. * @returns {Array} Returns the converted array.
  637. */function stringToArray(string){return hasUnicode(string)?unicodeToArray(string):asciiToArray(string)}
  638. /**
  639. * Used by `_.unescape` to convert HTML entities to characters.
  640. *
  641. * @private
  642. * @param {string} chr The matched character to unescape.
  643. * @returns {string} Returns the unescaped character.
  644. */var unescapeHtmlChar=basePropertyOf(htmlUnescapes);
  645. /**
  646. * Gets the size of a Unicode `string`.
  647. *
  648. * @private
  649. * @param {string} string The string inspect.
  650. * @returns {number} Returns the string size.
  651. */function unicodeSize(string){var result=reUnicode.lastIndex=0;while(reUnicode.test(string)){++result}return result}
  652. /**
  653. * Converts a Unicode `string` to an array.
  654. *
  655. * @private
  656. * @param {string} string The string to convert.
  657. * @returns {Array} Returns the converted array.
  658. */function unicodeToArray(string){return string.match(reUnicode)||[]}
  659. /**
  660. * Splits a Unicode `string` into an array of its words.
  661. *
  662. * @private
  663. * @param {string} The string to inspect.
  664. * @returns {Array} Returns the words of `string`.
  665. */function unicodeWords(string){return string.match(reUnicodeWord)||[]}
  666. /*--------------------------------------------------------------------------*/
  667. /**
  668. * Create a new pristine `lodash` function using the `context` object.
  669. *
  670. * @static
  671. * @memberOf _
  672. * @since 1.1.0
  673. * @category Util
  674. * @param {Object} [context=root] The context object.
  675. * @returns {Function} Returns a new `lodash` function.
  676. * @example
  677. *
  678. * _.mixin({ 'foo': _.constant('foo') });
  679. *
  680. * var lodash = _.runInContext();
  681. * lodash.mixin({ 'bar': lodash.constant('bar') });
  682. *
  683. * _.isFunction(_.foo);
  684. * // => true
  685. * _.isFunction(_.bar);
  686. * // => false
  687. *
  688. * lodash.isFunction(lodash.foo);
  689. * // => false
  690. * lodash.isFunction(lodash.bar);
  691. * // => true
  692. *
  693. * // Create a suped-up `defer` in Node.js.
  694. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  695. */var runInContext=function runInContext(context){context=context==null?root:_.defaults(root.Object(),context,_.pick(root,contextProps));
  696. /** Built-in constructor references. */var Array=context.Array,Date=context.Date,Error=context.Error,Function=context.Function,Math=context.Math,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;
  697. /** Used for built-in method references. */var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;
  698. /** Used to detect overreaching core-js shims. */var coreJsData=context["__core-js_shared__"];
  699. /** Used to resolve the decompiled source of functions. */var funcToString=funcProto.toString;
  700. /** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty;
  701. /** Used to generate unique IDs. */var idCounter=0;
  702. /** Used to detect methods masquerading as native. */var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();
  703. /**
  704. * Used to resolve the
  705. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  706. * of values.
  707. */var nativeObjectToString=objectProto.toString;
  708. /** Used to infer the `Object` constructor. */var objectCtorString=funcToString.call(Object);
  709. /** Used to restore the original `_` reference in `_.noConflict`. */var oldDash=root._;
  710. /** Used to detect if a method is native. */var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");
  711. /** Built-in value references. */var Buffer=moduleExports?context.Buffer:undefined,Symbol=context.Symbol,Uint8Array=context.Uint8Array,allocUnsafe=Buffer?Buffer.allocUnsafe:undefined,getPrototype=overArg(Object.getPrototypeOf,Object),objectCreate=Object.create,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:undefined,symIterator=Symbol?Symbol.iterator:undefined,symToStringTag=Symbol?Symbol.toStringTag:undefined;var defineProperty=function(){try{var func=getNative(Object,"defineProperty");func({},"",{});return func}catch(e){}}();
  712. /** Mocked built-ins. */var ctxClearTimeout=context.clearTimeout!==root.clearTimeout&&context.clearTimeout,ctxNow=Date&&Date.now!==root.Date.now&&Date.now,ctxSetTimeout=context.setTimeout!==root.setTimeout&&context.setTimeout;
  713. /* Built-in method references for those with the same name as other `lodash` methods. */var nativeCeil=Math.ceil,nativeFloor=Math.floor,nativeGetSymbols=Object.getOwnPropertySymbols,nativeIsBuffer=Buffer?Buffer.isBuffer:undefined,nativeIsFinite=context.isFinite,nativeJoin=arrayProto.join,nativeKeys=overArg(Object.keys,Object),nativeMax=Math.max,nativeMin=Math.min,nativeNow=Date.now,nativeParseInt=context.parseInt,nativeRandom=Math.random,nativeReverse=arrayProto.reverse;
  714. /* Built-in method references that are verified to be native. */var DataView=getNative(context,"DataView"),Map=getNative(context,"Map"),Promise=getNative(context,"Promise"),Set=getNative(context,"Set"),WeakMap=getNative(context,"WeakMap"),nativeCreate=getNative(Object,"create");
  715. /** Used to store function metadata. */var metaMap=WeakMap&&new WeakMap;
  716. /** Used to lookup unminified function names. */var realNames={};
  717. /** Used to detect maps, sets, and weakmaps. */var dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap);
  718. /** Used to convert symbols to primitives and strings. */var symbolProto=Symbol?Symbol.prototype:undefined,symbolValueOf=symbolProto?symbolProto.valueOf:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;
  719. /*------------------------------------------------------------------------*/
  720. /**
  721. * Creates a `lodash` object which wraps `value` to enable implicit method
  722. * chain sequences. Methods that operate on and return arrays, collections,
  723. * and functions can be chained together. Methods that retrieve a single value
  724. * or may return a primitive value will automatically end the chain sequence
  725. * and return the unwrapped value. Otherwise, the value must be unwrapped
  726. * with `_#value`.
  727. *
  728. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  729. * enabled using `_.chain`.
  730. *
  731. * The execution of chained methods is lazy, that is, it's deferred until
  732. * `_#value` is implicitly or explicitly called.
  733. *
  734. * Lazy evaluation allows several methods to support shortcut fusion.
  735. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  736. * the creation of intermediate arrays and can greatly reduce the number of
  737. * iteratee executions. Sections of a chain sequence qualify for shortcut
  738. * fusion if the section is applied to an array and iteratees accept only
  739. * one argument. The heuristic for whether a section qualifies for shortcut
  740. * fusion is subject to change.
  741. *
  742. * Chaining is supported in custom builds as long as the `_#value` method is
  743. * directly or indirectly included in the build.
  744. *
  745. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  746. *
  747. * The wrapper `Array` methods are:
  748. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  749. *
  750. * The wrapper `String` methods are:
  751. * `replace` and `split`
  752. *
  753. * The wrapper methods that support shortcut fusion are:
  754. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  755. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  756. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  757. *
  758. * The chainable wrapper methods are:
  759. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  760. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  761. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  762. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  763. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  764. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  765. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  766. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  767. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  768. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  769. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  770. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  771. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  772. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  773. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  774. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  775. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  776. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  777. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  778. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  779. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  780. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  781. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  782. * `zipObject`, `zipObjectDeep`, and `zipWith`
  783. *
  784. * The wrapper methods that are **not** chainable by default are:
  785. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  786. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  787. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  788. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  789. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  790. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  791. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  792. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  793. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  794. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  795. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  796. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  797. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  798. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  799. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  800. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  801. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  802. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  803. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  804. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  805. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  806. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  807. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  808. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  809. * `upperFirst`, `value`, and `words`
  810. *
  811. * @name _
  812. * @constructor
  813. * @category Seq
  814. * @param {*} value The value to wrap in a `lodash` instance.
  815. * @returns {Object} Returns the new `lodash` wrapper instance.
  816. * @example
  817. *
  818. * function square(n) {
  819. * return n * n;
  820. * }
  821. *
  822. * var wrapped = _([1, 2, 3]);
  823. *
  824. * // Returns an unwrapped value.
  825. * wrapped.reduce(_.add);
  826. * // => 6
  827. *
  828. * // Returns a wrapped value.
  829. * var squares = wrapped.map(square);
  830. *
  831. * _.isArray(squares);
  832. * // => false
  833. *
  834. * _.isArray(squares.value());
  835. * // => true
  836. */function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper){return value}if(hasOwnProperty.call(value,"__wrapped__")){return wrapperClone(value)}}return new LodashWrapper(value)}
  837. /**
  838. * The base implementation of `_.create` without support for assigning
  839. * properties to the created object.
  840. *
  841. * @private
  842. * @param {Object} proto The object to inherit from.
  843. * @returns {Object} Returns the new object.
  844. */var baseCreate=function(){function object(){}return function(proto){if(!isObject(proto)){return{}}if(objectCreate){return objectCreate(proto)}object.prototype=proto;var result=new object;object.prototype=undefined;return result}}();
  845. /**
  846. * The function whose prototype chain sequence wrappers inherit from.
  847. *
  848. * @private
  849. */function baseLodash(){
  850. // No operation performed.
  851. }
  852. /**
  853. * The base constructor for creating `lodash` wrapper objects.
  854. *
  855. * @private
  856. * @param {*} value The value to wrap.
  857. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  858. */function LodashWrapper(value,chainAll){this.__wrapped__=value;this.__actions__=[];this.__chain__=!!chainAll;this.__index__=0;this.__values__=undefined}
  859. /**
  860. * By default, the template delimiters used by lodash are like those in
  861. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  862. * following template settings to use alternative delimiters.
  863. *
  864. * @static
  865. * @memberOf _
  866. * @type {Object}
  867. */lodash.templateSettings={
  868. /**
  869. * Used to detect `data` property values to be HTML-escaped.
  870. *
  871. * @memberOf _.templateSettings
  872. * @type {RegExp}
  873. */
  874. escape:reEscape,
  875. /**
  876. * Used to detect code to be evaluated.
  877. *
  878. * @memberOf _.templateSettings
  879. * @type {RegExp}
  880. */
  881. evaluate:reEvaluate,
  882. /**
  883. * Used to detect `data` property values to inject.
  884. *
  885. * @memberOf _.templateSettings
  886. * @type {RegExp}
  887. */
  888. interpolate:reInterpolate,
  889. /**
  890. * Used to reference the data object in the template text.
  891. *
  892. * @memberOf _.templateSettings
  893. * @type {string}
  894. */
  895. variable:"",
  896. /**
  897. * Used to import variables into the compiled template.
  898. *
  899. * @memberOf _.templateSettings
  900. * @type {Object}
  901. */
  902. imports:{
  903. /**
  904. * A reference to the `lodash` function.
  905. *
  906. * @memberOf _.templateSettings.imports
  907. * @type {Function}
  908. */
  909. _:lodash}};
  910. // Ensure wrappers are instances of `baseLodash`.
  911. lodash.prototype=baseLodash.prototype;lodash.prototype.constructor=lodash;LodashWrapper.prototype=baseCreate(baseLodash.prototype);LodashWrapper.prototype.constructor=LodashWrapper;
  912. /*------------------------------------------------------------------------*/
  913. /**
  914. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  915. *
  916. * @private
  917. * @constructor
  918. * @param {*} value The value to wrap.
  919. */function LazyWrapper(value){this.__wrapped__=value;this.__actions__=[];this.__dir__=1;this.__filtered__=false;this.__iteratees__=[];this.__takeCount__=MAX_ARRAY_LENGTH;this.__views__=[]}
  920. /**
  921. * Creates a clone of the lazy wrapper object.
  922. *
  923. * @private
  924. * @name clone
  925. * @memberOf LazyWrapper
  926. * @returns {Object} Returns the cloned `LazyWrapper` object.
  927. */function lazyClone(){var result=new LazyWrapper(this.__wrapped__);result.__actions__=copyArray(this.__actions__);result.__dir__=this.__dir__;result.__filtered__=this.__filtered__;result.__iteratees__=copyArray(this.__iteratees__);result.__takeCount__=this.__takeCount__;result.__views__=copyArray(this.__views__);return result}
  928. /**
  929. * Reverses the direction of lazy iteration.
  930. *
  931. * @private
  932. * @name reverse
  933. * @memberOf LazyWrapper
  934. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  935. */function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1;result.__filtered__=true}else{result=this.clone();result.__dir__*=-1}return result}
  936. /**
  937. * Extracts the unwrapped value from its lazy wrapper.
  938. *
  939. * @private
  940. * @name value
  941. * @memberOf LazyWrapper
  942. * @returns {*} Returns the unwrapped value.
  943. */function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__,iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||!isRight&&arrLength==length&&takeCount==length){return baseWrapperValue(array,this.__actions__)}var result=[];outer:while(length--&&resIndex<takeCount){index+=dir;var iterIndex=-1,value=array[index];while(++iterIndex<iterLength){var data=iteratees[iterIndex],iteratee=data.iteratee,type=data.type,computed=iteratee(value);if(type==LAZY_MAP_FLAG){value=computed}else if(!computed){if(type==LAZY_FILTER_FLAG){continue outer}else{break outer}}}result[resIndex++]=value}return result}
  944. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  945. LazyWrapper.prototype=baseCreate(baseLodash.prototype);LazyWrapper.prototype.constructor=LazyWrapper;
  946. /*------------------------------------------------------------------------*/
  947. /**
  948. * Creates a hash object.
  949. *
  950. * @private
  951. * @constructor
  952. * @param {Array} [entries] The key-value pairs to cache.
  953. */function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}
  954. /**
  955. * Removes all key-value entries from the hash.
  956. *
  957. * @private
  958. * @name clear
  959. * @memberOf Hash
  960. */function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{};this.size=0}
  961. /**
  962. * Removes `key` and its value from the hash.
  963. *
  964. * @private
  965. * @name delete
  966. * @memberOf Hash
  967. * @param {Object} hash The hash to modify.
  968. * @param {string} key The key of the value to remove.
  969. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  970. */function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];this.size-=result?1:0;return result}
  971. /**
  972. * Gets the hash value for `key`.
  973. *
  974. * @private
  975. * @name get
  976. * @memberOf Hash
  977. * @param {string} key The key of the value to get.
  978. * @returns {*} Returns the entry value.
  979. */function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}
  980. /**
  981. * Checks if a hash value for `key` exists.
  982. *
  983. * @private
  984. * @name has
  985. * @memberOf Hash
  986. * @param {string} key The key of the entry to check.
  987. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  988. */function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}
  989. /**
  990. * Sets the hash `key` to `value`.
  991. *
  992. * @private
  993. * @name set
  994. * @memberOf Hash
  995. * @param {string} key The key of the value to set.
  996. * @param {*} value The value to set.
  997. * @returns {Object} Returns the hash instance.
  998. */function hashSet(key,value){var data=this.__data__;this.size+=this.has(key)?0:1;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}
  999. // Add methods to `Hash`.
  1000. Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;
  1001. /*------------------------------------------------------------------------*/
  1002. /**
  1003. * Creates an list cache object.
  1004. *
  1005. * @private
  1006. * @constructor
  1007. * @param {Array} [entries] The key-value pairs to cache.
  1008. */function ListCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}
  1009. /**
  1010. * Removes all key-value entries from the list cache.
  1011. *
  1012. * @private
  1013. * @name clear
  1014. * @memberOf ListCache
  1015. */function listCacheClear(){this.__data__=[];this.size=0}
  1016. /**
  1017. * Removes `key` and its value from the list cache.
  1018. *
  1019. * @private
  1020. * @name delete
  1021. * @memberOf ListCache
  1022. * @param {string} key The key of the value to remove.
  1023. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1024. */function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}--this.size;return true}
  1025. /**
  1026. * Gets the list cache value for `key`.
  1027. *
  1028. * @private
  1029. * @name get
  1030. * @memberOf ListCache
  1031. * @param {string} key The key of the value to get.
  1032. * @returns {*} Returns the entry value.
  1033. */function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}
  1034. /**
  1035. * Checks if a list cache value for `key` exists.
  1036. *
  1037. * @private
  1038. * @name has
  1039. * @memberOf ListCache
  1040. * @param {string} key The key of the entry to check.
  1041. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1042. */function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}
  1043. /**
  1044. * Sets the list cache `key` to `value`.
  1045. *
  1046. * @private
  1047. * @name set
  1048. * @memberOf ListCache
  1049. * @param {string} key The key of the value to set.
  1050. * @param {*} value The value to set.
  1051. * @returns {Object} Returns the list cache instance.
  1052. */function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else{data[index][1]=value}return this}
  1053. // Add methods to `ListCache`.
  1054. ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;
  1055. /*------------------------------------------------------------------------*/
  1056. /**
  1057. * Creates a map cache object to store key-value pairs.
  1058. *
  1059. * @private
  1060. * @constructor
  1061. * @param {Array} [entries] The key-value pairs to cache.
  1062. */function MapCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}
  1063. /**
  1064. * Removes all key-value entries from the map.
  1065. *
  1066. * @private
  1067. * @name clear
  1068. * @memberOf MapCache
  1069. */function mapCacheClear(){this.size=0;this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}
  1070. /**
  1071. * Removes `key` and its value from the map.
  1072. *
  1073. * @private
  1074. * @name delete
  1075. * @memberOf MapCache
  1076. * @param {string} key The key of the value to remove.
  1077. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1078. */function mapCacheDelete(key){var result=getMapData(this,key)["delete"](key);this.size-=result?1:0;return result}
  1079. /**
  1080. * Gets the map value for `key`.
  1081. *
  1082. * @private
  1083. * @name get
  1084. * @memberOf MapCache
  1085. * @param {string} key The key of the value to get.
  1086. * @returns {*} Returns the entry value.
  1087. */function mapCacheGet(key){return getMapData(this,key).get(key)}
  1088. /**
  1089. * Checks if a map value for `key` exists.
  1090. *
  1091. * @private
  1092. * @name has
  1093. * @memberOf MapCache
  1094. * @param {string} key The key of the entry to check.
  1095. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1096. */function mapCacheHas(key){return getMapData(this,key).has(key)}
  1097. /**
  1098. * Sets the map `key` to `value`.
  1099. *
  1100. * @private
  1101. * @name set
  1102. * @memberOf MapCache
  1103. * @param {string} key The key of the value to set.
  1104. * @param {*} value The value to set.
  1105. * @returns {Object} Returns the map cache instance.
  1106. */function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this}
  1107. // Add methods to `MapCache`.
  1108. MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;
  1109. /*------------------------------------------------------------------------*/
  1110. /**
  1111. *
  1112. * Creates an array cache object to store unique values.
  1113. *
  1114. * @private
  1115. * @constructor
  1116. * @param {Array} [values] The values to cache.
  1117. */function SetCache(values){var index=-1,length=values==null?0:values.length;this.__data__=new MapCache;while(++index<length){this.add(values[index])}}
  1118. /**
  1119. * Adds `value` to the array cache.
  1120. *
  1121. * @private
  1122. * @name add
  1123. * @memberOf SetCache
  1124. * @alias push
  1125. * @param {*} value The value to cache.
  1126. * @returns {Object} Returns the cache instance.
  1127. */function setCacheAdd(value){this.__data__.set(value,HASH_UNDEFINED);return this}
  1128. /**
  1129. * Checks if `value` is in the array cache.
  1130. *
  1131. * @private
  1132. * @name has
  1133. * @memberOf SetCache
  1134. * @param {*} value The value to search for.
  1135. * @returns {number} Returns `true` if `value` is found, else `false`.
  1136. */function setCacheHas(value){return this.__data__.has(value)}
  1137. // Add methods to `SetCache`.
  1138. SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;
  1139. /*------------------------------------------------------------------------*/
  1140. /**
  1141. * Creates a stack cache object to store key-value pairs.
  1142. *
  1143. * @private
  1144. * @constructor
  1145. * @param {Array} [entries] The key-value pairs to cache.
  1146. */function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size}
  1147. /**
  1148. * Removes all key-value entries from the stack.
  1149. *
  1150. * @private
  1151. * @name clear
  1152. * @memberOf Stack
  1153. */function stackClear(){this.__data__=new ListCache;this.size=0}
  1154. /**
  1155. * Removes `key` and its value from the stack.
  1156. *
  1157. * @private
  1158. * @name delete
  1159. * @memberOf Stack
  1160. * @param {string} key The key of the value to remove.
  1161. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1162. */function stackDelete(key){var data=this.__data__,result=data["delete"](key);this.size=data.size;return result}
  1163. /**
  1164. * Gets the stack value for `key`.
  1165. *
  1166. * @private
  1167. * @name get
  1168. * @memberOf Stack
  1169. * @param {string} key The key of the value to get.
  1170. * @returns {*} Returns the entry value.
  1171. */function stackGet(key){return this.__data__.get(key)}
  1172. /**
  1173. * Checks if a stack value for `key` exists.
  1174. *
  1175. * @private
  1176. * @name has
  1177. * @memberOf Stack
  1178. * @param {string} key The key of the entry to check.
  1179. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1180. */function stackHas(key){return this.__data__.has(key)}
  1181. /**
  1182. * Sets the stack `key` to `value`.
  1183. *
  1184. * @private
  1185. * @name set
  1186. * @memberOf Stack
  1187. * @param {string} key The key of the value to set.
  1188. * @param {*} value The value to set.
  1189. * @returns {Object} Returns the stack cache instance.
  1190. */function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1){pairs.push([key,value]);this.size=++data.size;return this}data=this.__data__=new MapCache(pairs)}data.set(key,value);this.size=data.size;return this}
  1191. // Add methods to `Stack`.
  1192. Stack.prototype.clear=stackClear;Stack.prototype["delete"]=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;
  1193. /*------------------------------------------------------------------------*/
  1194. /**
  1195. * Creates an array of the enumerable property names of the array-like `value`.
  1196. *
  1197. * @private
  1198. * @param {*} value The value to query.
  1199. * @param {boolean} inherited Specify returning inherited property names.
  1200. * @returns {Array} Returns the array of property names.
  1201. */function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?baseTimes(value.length,String):[],length=result.length;for(var key in value){if((inherited||hasOwnProperty.call(value,key))&&!(skipIndexes&&(
  1202. // Safari 9 has enumerable `arguments.length` in strict mode.
  1203. key=="length"||
  1204. // Node.js 0.10 has enumerable non-index properties on buffers.
  1205. isBuff&&(key=="offset"||key=="parent")||
  1206. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  1207. isType&&(key=="buffer"||key=="byteLength"||key=="byteOffset")||
  1208. // Skip index properties.
  1209. isIndex(key,length)))){result.push(key)}}return result}
  1210. /**
  1211. * A specialized version of `_.sample` for arrays.
  1212. *
  1213. * @private
  1214. * @param {Array} array The array to sample.
  1215. * @returns {*} Returns the random element.
  1216. */function arraySample(array){var length=array.length;return length?array[baseRandom(0,length-1)]:undefined}
  1217. /**
  1218. * A specialized version of `_.sampleSize` for arrays.
  1219. *
  1220. * @private
  1221. * @param {Array} array The array to sample.
  1222. * @param {number} n The number of elements to sample.
  1223. * @returns {Array} Returns the random elements.
  1224. */function arraySampleSize(array,n){return shuffleSelf(copyArray(array),baseClamp(n,0,array.length))}
  1225. /**
  1226. * A specialized version of `_.shuffle` for arrays.
  1227. *
  1228. * @private
  1229. * @param {Array} array The array to shuffle.
  1230. * @returns {Array} Returns the new shuffled array.
  1231. */function arrayShuffle(array){return shuffleSelf(copyArray(array))}
  1232. /**
  1233. * This function is like `assignValue` except that it doesn't assign
  1234. * `undefined` values.
  1235. *
  1236. * @private
  1237. * @param {Object} object The object to modify.
  1238. * @param {string} key The key of the property to assign.
  1239. * @param {*} value The value to assign.
  1240. */function assignMergeValue(object,key,value){if(value!==undefined&&!eq(object[key],value)||value===undefined&&!(key in object)){baseAssignValue(object,key,value)}}
  1241. /**
  1242. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  1243. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  1244. * for equality comparisons.
  1245. *
  1246. * @private
  1247. * @param {Object} object The object to modify.
  1248. * @param {string} key The key of the property to assign.
  1249. * @param {*} value The value to assign.
  1250. */function assignValue(object,key,value){var objValue=object[key];if(!(hasOwnProperty.call(object,key)&&eq(objValue,value))||value===undefined&&!(key in object)){baseAssignValue(object,key,value)}}
  1251. /**
  1252. * Gets the index at which the `key` is found in `array` of key-value pairs.
  1253. *
  1254. * @private
  1255. * @param {Array} array The array to inspect.
  1256. * @param {*} key The key to search for.
  1257. * @returns {number} Returns the index of the matched value, else `-1`.
  1258. */function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}
  1259. /**
  1260. * Aggregates elements of `collection` on `accumulator` with keys transformed
  1261. * by `iteratee` and values set by `setter`.
  1262. *
  1263. * @private
  1264. * @param {Array|Object} collection The collection to iterate over.
  1265. * @param {Function} setter The function to set `accumulator` values.
  1266. * @param {Function} iteratee The iteratee to transform keys.
  1267. * @param {Object} accumulator The initial aggregated object.
  1268. * @returns {Function} Returns `accumulator`.
  1269. */function baseAggregator(collection,setter,iteratee,accumulator){baseEach(collection,function(value,key,collection){setter(accumulator,value,iteratee(value),collection)});return accumulator}
  1270. /**
  1271. * The base implementation of `_.assign` without support for multiple sources
  1272. * or `customizer` functions.
  1273. *
  1274. * @private
  1275. * @param {Object} object The destination object.
  1276. * @param {Object} source The source object.
  1277. * @returns {Object} Returns `object`.
  1278. */function baseAssign(object,source){return object&&copyObject(source,keys(source),object)}
  1279. /**
  1280. * The base implementation of `_.assignIn` without support for multiple sources
  1281. * or `customizer` functions.
  1282. *
  1283. * @private
  1284. * @param {Object} object The destination object.
  1285. * @param {Object} source The source object.
  1286. * @returns {Object} Returns `object`.
  1287. */function baseAssignIn(object,source){return object&&copyObject(source,keysIn(source),object)}
  1288. /**
  1289. * The base implementation of `assignValue` and `assignMergeValue` without
  1290. * value checks.
  1291. *
  1292. * @private
  1293. * @param {Object} object The object to modify.
  1294. * @param {string} key The key of the property to assign.
  1295. * @param {*} value The value to assign.
  1296. */function baseAssignValue(object,key,value){if(key=="__proto__"&&defineProperty){defineProperty(object,key,{configurable:true,enumerable:true,value,writable:true})}else{object[key]=value}}
  1297. /**
  1298. * The base implementation of `_.at` without support for individual paths.
  1299. *
  1300. * @private
  1301. * @param {Object} object The object to iterate over.
  1302. * @param {string[]} paths The property paths to pick.
  1303. * @returns {Array} Returns the picked elements.
  1304. */function baseAt(object,paths){var index=-1,length=paths.length,result=Array(length),skip=object==null;while(++index<length){result[index]=skip?undefined:get(object,paths[index])}return result}
  1305. /**
  1306. * The base implementation of `_.clamp` which doesn't coerce arguments.
  1307. *
  1308. * @private
  1309. * @param {number} number The number to clamp.
  1310. * @param {number} [lower] The lower bound.
  1311. * @param {number} upper The upper bound.
  1312. * @returns {number} Returns the clamped number.
  1313. */function baseClamp(number,lower,upper){if(number===number){if(upper!==undefined){number=number<=upper?number:upper}if(lower!==undefined){number=number>=lower?number:lower}}return number}
  1314. /**
  1315. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  1316. * traversed objects.
  1317. *
  1318. * @private
  1319. * @param {*} value The value to clone.
  1320. * @param {boolean} bitmask The bitmask flags.
  1321. * 1 - Deep clone
  1322. * 2 - Flatten inherited properties
  1323. * 4 - Clone symbols
  1324. * @param {Function} [customizer] The function to customize cloning.
  1325. * @param {string} [key] The key of `value`.
  1326. * @param {Object} [object] The parent object of `value`.
  1327. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  1328. * @returns {*} Returns the cloned value.
  1329. */function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer){result=object?customizer(value,key,object,stack):customizer(value)}if(result!==undefined){return result}if(!isObject(value)){return value}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return copyArray(value,result)}}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value)){return cloneBuffer(value,isDeep)}if(tag==objectTag||tag==argsTag||isFunc&&!object){result=isFlat||isFunc?{}:initCloneObject(value);if(!isDeep){return isFlat?copySymbolsIn(value,baseAssignIn(result,value)):copySymbols(value,baseAssign(result,value))}}else{if(!cloneableTags[tag]){return object?value:{}}result=initCloneByTag(value,tag,isDeep)}}
  1330. // Check for circular references and return its corresponding clone.
  1331. stack||(stack=new Stack);var stacked=stack.get(value);if(stacked){return stacked}stack.set(value,result);if(isSet(value)){value.forEach(function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack))});return result}if(isMap(value)){value.forEach(function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys;var props=isArr?undefined:keysFunc(value);arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key]}
  1332. // Recursively populate clone (susceptible to call stack limits).
  1333. assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}
  1334. /**
  1335. * The base implementation of `_.conforms` which doesn't clone `source`.
  1336. *
  1337. * @private
  1338. * @param {Object} source The object of property predicates to conform to.
  1339. * @returns {Function} Returns the new spec function.
  1340. */function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props)}}
  1341. /**
  1342. * The base implementation of `_.conformsTo` which accepts `props` to check.
  1343. *
  1344. * @private
  1345. * @param {Object} object The object to inspect.
  1346. * @param {Object} source The object of property predicates to conform to.
  1347. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  1348. */function baseConformsTo(object,source,props){var length=props.length;if(object==null){return!length}object=Object(object);while(length--){var key=props[length],predicate=source[key],value=object[key];if(value===undefined&&!(key in object)||!predicate(value)){return false}}return true}
  1349. /**
  1350. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  1351. * to provide to `func`.
  1352. *
  1353. * @private
  1354. * @param {Function} func The function to delay.
  1355. * @param {number} wait The number of milliseconds to delay invocation.
  1356. * @param {Array} args The arguments to provide to `func`.
  1357. * @returns {number|Object} Returns the timer id or timeout object.
  1358. */function baseDelay(func,wait,args){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return setTimeout(function(){func.apply(undefined,args)},wait)}
  1359. /**
  1360. * The base implementation of methods like `_.difference` without support
  1361. * for excluding multiple arrays or iteratee shorthands.
  1362. *
  1363. * @private
  1364. * @param {Array} array The array to inspect.
  1365. * @param {Array} values The values to exclude.
  1366. * @param {Function} [iteratee] The iteratee invoked per element.
  1367. * @param {Function} [comparator] The comparator invoked per element.
  1368. * @returns {Array} Returns the new array of filtered values.
  1369. */function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=true,length=array.length,result=[],valuesLength=values.length;if(!length){return result}if(iteratee){values=arrayMap(values,baseUnary(iteratee))}if(comparator){includes=arrayIncludesWith;isCommon=false}else if(values.length>=LARGE_ARRAY_SIZE){includes=cacheHas;isCommon=false;values=new SetCache(values)}outer:while(++index<length){var value=array[index],computed=iteratee==null?value:iteratee(value);value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var valuesIndex=valuesLength;while(valuesIndex--){if(values[valuesIndex]===computed){continue outer}}result.push(value)}else if(!includes(values,computed,comparator)){result.push(value)}}return result}
  1370. /**
  1371. * The base implementation of `_.forEach` without support for iteratee shorthands.
  1372. *
  1373. * @private
  1374. * @param {Array|Object} collection The collection to iterate over.
  1375. * @param {Function} iteratee The function invoked per iteration.
  1376. * @returns {Array|Object} Returns `collection`.
  1377. */var baseEach=createBaseEach(baseForOwn);
  1378. /**
  1379. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  1380. *
  1381. * @private
  1382. * @param {Array|Object} collection The collection to iterate over.
  1383. * @param {Function} iteratee The function invoked per iteration.
  1384. * @returns {Array|Object} Returns `collection`.
  1385. */var baseEachRight=createBaseEach(baseForOwnRight,true);
  1386. /**
  1387. * The base implementation of `_.every` without support for iteratee shorthands.
  1388. *
  1389. * @private
  1390. * @param {Array|Object} collection The collection to iterate over.
  1391. * @param {Function} predicate The function invoked per iteration.
  1392. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1393. * else `false`
  1394. */function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result});return result}
  1395. /**
  1396. * The base implementation of methods like `_.max` and `_.min` which accepts a
  1397. * `comparator` to determine the extremum value.
  1398. *
  1399. * @private
  1400. * @param {Array} array The array to iterate over.
  1401. * @param {Function} iteratee The iteratee invoked per iteration.
  1402. * @param {Function} comparator The comparator used to compare values.
  1403. * @returns {*} Returns the extremum value.
  1404. */function baseExtremum(array,iteratee,comparator){var index=-1,length=array.length;while(++index<length){var value=array[index],current=iteratee(value);if(current!=null&&(computed===undefined?current===current&&!isSymbol(current):comparator(current,computed))){var computed=current,result=value}}return result}
  1405. /**
  1406. * The base implementation of `_.fill` without an iteratee call guard.
  1407. *
  1408. * @private
  1409. * @param {Array} array The array to fill.
  1410. * @param {*} value The value to fill `array` with.
  1411. * @param {number} [start=0] The start position.
  1412. * @param {number} [end=array.length] The end position.
  1413. * @returns {Array} Returns `array`.
  1414. */function baseFill(array,value,start,end){var length=array.length;start=toInteger(start);if(start<0){start=-start>length?0:length+start}end=end===undefined||end>length?length:toInteger(end);if(end<0){end+=length}end=start>end?0:toLength(end);while(start<end){array[start++]=value}return array}
  1415. /**
  1416. * The base implementation of `_.filter` without support for iteratee shorthands.
  1417. *
  1418. * @private
  1419. * @param {Array|Object} collection The collection to iterate over.
  1420. * @param {Function} predicate The function invoked per iteration.
  1421. * @returns {Array} Returns the new filtered array.
  1422. */function baseFilter(collection,predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection)){result.push(value)}});return result}
  1423. /**
  1424. * The base implementation of `_.flatten` with support for restricting flattening.
  1425. *
  1426. * @private
  1427. * @param {Array} array The array to flatten.
  1428. * @param {number} depth The maximum recursion depth.
  1429. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  1430. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  1431. * @param {Array} [result=[]] The initial result value.
  1432. * @returns {Array} Returns the new flattened array.
  1433. */function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;predicate||(predicate=isFlattenable);result||(result=[]);while(++index<length){var value=array[index];if(depth>0&&predicate(value)){if(depth>1){
  1434. // Recursively flatten arrays (susceptible to call stack limits).
  1435. baseFlatten(value,depth-1,predicate,isStrict,result)}else{arrayPush(result,value)}}else if(!isStrict){result[result.length]=value}}return result}
  1436. /**
  1437. * The base implementation of `baseForOwn` which iterates over `object`
  1438. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  1439. * Iteratee functions may exit iteration early by explicitly returning `false`.
  1440. *
  1441. * @private
  1442. * @param {Object} object The object to iterate over.
  1443. * @param {Function} iteratee The function invoked per iteration.
  1444. * @param {Function} keysFunc The function to get the keys of `object`.
  1445. * @returns {Object} Returns `object`.
  1446. */var baseFor=createBaseFor();
  1447. /**
  1448. * This function is like `baseFor` except that it iterates over properties
  1449. * in the opposite order.
  1450. *
  1451. * @private
  1452. * @param {Object} object The object to iterate over.
  1453. * @param {Function} iteratee The function invoked per iteration.
  1454. * @param {Function} keysFunc The function to get the keys of `object`.
  1455. * @returns {Object} Returns `object`.
  1456. */var baseForRight=createBaseFor(true);
  1457. /**
  1458. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  1459. *
  1460. * @private
  1461. * @param {Object} object The object to iterate over.
  1462. * @param {Function} iteratee The function invoked per iteration.
  1463. * @returns {Object} Returns `object`.
  1464. */function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}
  1465. /**
  1466. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  1467. *
  1468. * @private
  1469. * @param {Object} object The object to iterate over.
  1470. * @param {Function} iteratee The function invoked per iteration.
  1471. * @returns {Object} Returns `object`.
  1472. */function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}
  1473. /**
  1474. * The base implementation of `_.functions` which creates an array of
  1475. * `object` function property names filtered from `props`.
  1476. *
  1477. * @private
  1478. * @param {Object} object The object to inspect.
  1479. * @param {Array} props The property names to filter.
  1480. * @returns {Array} Returns the function names.
  1481. */function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}
  1482. /**
  1483. * The base implementation of `_.get` without support for default values.
  1484. *
  1485. * @private
  1486. * @param {Object} object The object to query.
  1487. * @param {Array|string} path The path of the property to get.
  1488. * @returns {*} Returns the resolved value.
  1489. */function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&index<length){object=object[toKey(path[index++])]}return index&&index==length?object:undefined}
  1490. /**
  1491. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  1492. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  1493. * symbols of `object`.
  1494. *
  1495. * @private
  1496. * @param {Object} object The object to query.
  1497. * @param {Function} keysFunc The function to get the keys of `object`.
  1498. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  1499. * @returns {Array} Returns the array of property names and symbols.
  1500. */function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object))}
  1501. /**
  1502. * The base implementation of `getTag` without fallbacks for buggy environments.
  1503. *
  1504. * @private
  1505. * @param {*} value The value to query.
  1506. * @returns {string} Returns the `toStringTag`.
  1507. */function baseGetTag(value){if(value==null){return value===undefined?undefinedTag:nullTag}return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}
  1508. /**
  1509. * The base implementation of `_.gt` which doesn't coerce arguments.
  1510. *
  1511. * @private
  1512. * @param {*} value The value to compare.
  1513. * @param {*} other The other value to compare.
  1514. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  1515. * else `false`.
  1516. */function baseGt(value,other){return value>other}
  1517. /**
  1518. * The base implementation of `_.has` without support for deep paths.
  1519. *
  1520. * @private
  1521. * @param {Object} [object] The object to query.
  1522. * @param {Array|string} key The key to check.
  1523. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  1524. */function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key)}
  1525. /**
  1526. * The base implementation of `_.hasIn` without support for deep paths.
  1527. *
  1528. * @private
  1529. * @param {Object} [object] The object to query.
  1530. * @param {Array|string} key The key to check.
  1531. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  1532. */function baseHasIn(object,key){return object!=null&&key in Object(object)}
  1533. /**
  1534. * The base implementation of `_.inRange` which doesn't coerce arguments.
  1535. *
  1536. * @private
  1537. * @param {number} number The number to check.
  1538. * @param {number} start The start of the range.
  1539. * @param {number} end The end of the range.
  1540. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  1541. */function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number<nativeMax(start,end)}
  1542. /**
  1543. * The base implementation of methods like `_.intersection`, without support
  1544. * for iteratee shorthands, that accepts an array of arrays to inspect.
  1545. *
  1546. * @private
  1547. * @param {Array} arrays The arrays to inspect.
  1548. * @param {Function} [iteratee] The iteratee invoked per element.
  1549. * @param {Function} [comparator] The comparator invoked per element.
  1550. * @returns {Array} Returns the new array of shared values.
  1551. */function baseIntersection(arrays,iteratee,comparator){var includes=comparator?arrayIncludesWith:arrayIncludes,length=arrays[0].length,othLength=arrays.length,othIndex=othLength,caches=Array(othLength),maxLength=Infinity,result=[];while(othIndex--){var array=arrays[othIndex];if(othIndex&&iteratee){array=arrayMap(array,baseUnary(iteratee))}maxLength=nativeMin(array.length,maxLength);caches[othIndex]=!comparator&&(iteratee||length>=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:while(++index<length&&result.length<maxLength){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(!(seen?cacheHas(seen,computed):includes(result,computed,comparator))){othIndex=othLength;while(--othIndex){var cache=caches[othIndex];if(!(cache?cacheHas(cache,computed):includes(arrays[othIndex],computed,comparator))){continue outer}}if(seen){seen.push(computed)}result.push(value)}}return result}
  1552. /**
  1553. * The base implementation of `_.invert` and `_.invertBy` which inverts
  1554. * `object` with values transformed by `iteratee` and set by `setter`.
  1555. *
  1556. * @private
  1557. * @param {Object} object The object to iterate over.
  1558. * @param {Function} setter The function to set `accumulator` values.
  1559. * @param {Function} iteratee The iteratee to transform values.
  1560. * @param {Object} accumulator The initial inverted object.
  1561. * @returns {Function} Returns `accumulator`.
  1562. */function baseInverter(object,setter,iteratee,accumulator){baseForOwn(object,function(value,key,object){setter(accumulator,iteratee(value),key,object)});return accumulator}
  1563. /**
  1564. * The base implementation of `_.invoke` without support for individual
  1565. * method arguments.
  1566. *
  1567. * @private
  1568. * @param {Object} object The object to query.
  1569. * @param {Array|string} path The path of the method to invoke.
  1570. * @param {Array} args The arguments to invoke the method with.
  1571. * @returns {*} Returns the result of the invoked method.
  1572. */function baseInvoke(object,path,args){path=castPath(path,object);object=parent(object,path);var func=object==null?object:object[toKey(last(path))];return func==null?undefined:apply(func,object,args)}
  1573. /**
  1574. * The base implementation of `_.isArguments`.
  1575. *
  1576. * @private
  1577. * @param {*} value The value to check.
  1578. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  1579. */function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag}
  1580. /**
  1581. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  1582. *
  1583. * @private
  1584. * @param {*} value The value to check.
  1585. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  1586. */function baseIsArrayBuffer(value){return isObjectLike(value)&&baseGetTag(value)==arrayBufferTag}
  1587. /**
  1588. * The base implementation of `_.isDate` without Node.js optimizations.
  1589. *
  1590. * @private
  1591. * @param {*} value The value to check.
  1592. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  1593. */function baseIsDate(value){return isObjectLike(value)&&baseGetTag(value)==dateTag}
  1594. /**
  1595. * The base implementation of `_.isEqual` which supports partial comparisons
  1596. * and tracks traversed objects.
  1597. *
  1598. * @private
  1599. * @param {*} value The value to compare.
  1600. * @param {*} other The other value to compare.
  1601. * @param {boolean} bitmask The bitmask flags.
  1602. * 1 - Unordered comparison
  1603. * 2 - Partial comparison
  1604. * @param {Function} [customizer] The function to customize comparisons.
  1605. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  1606. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  1607. */function baseIsEqual(value,other,bitmask,customizer,stack){if(value===other){return true}if(value==null||other==null||!isObjectLike(value)&&!isObjectLike(other)){return value!==value&&other!==other}return baseIsEqualDeep(value,other,bitmask,customizer,baseIsEqual,stack)}
  1608. /**
  1609. * A specialized version of `baseIsEqual` for arrays and objects which performs
  1610. * deep comparisons and tracks traversed objects enabling objects with circular
  1611. * references to be compared.
  1612. *
  1613. * @private
  1614. * @param {Object} object The object to compare.
  1615. * @param {Object} other The other object to compare.
  1616. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  1617. * @param {Function} customizer The function to customize comparisons.
  1618. * @param {Function} equalFunc The function to determine equivalents of values.
  1619. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  1620. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1621. */function baseIsEqualDeep(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=objIsArr?arrayTag:getTag(object),othTag=othIsArr?arrayTag:getTag(other);objTag=objTag==argsTag?objectTag:objTag;othTag=othTag==argsTag?objectTag:othTag;var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&isBuffer(object)){if(!isBuffer(other)){return false}objIsArr=true;objIsObj=false}if(isSameTag&&!objIsObj){stack||(stack=new Stack);return objIsArr||isTypedArray(object)?equalArrays(object,other,bitmask,customizer,equalFunc,stack):equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack)}if(!(bitmask&COMPARE_PARTIAL_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;stack||(stack=new Stack);return equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack)}}if(!isSameTag){return false}stack||(stack=new Stack);return equalObjects(object,other,bitmask,customizer,equalFunc,stack)}
  1622. /**
  1623. * The base implementation of `_.isMap` without Node.js optimizations.
  1624. *
  1625. * @private
  1626. * @param {*} value The value to check.
  1627. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  1628. */function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag}
  1629. /**
  1630. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  1631. *
  1632. * @private
  1633. * @param {Object} object The object to inspect.
  1634. * @param {Object} source The object of property values to match.
  1635. * @param {Array} matchData The property names, values, and compare flags to match.
  1636. * @param {Function} [customizer] The function to customize comparisons.
  1637. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  1638. */function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(object==null){return!length}object=Object(object);while(index--){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object)){return false}}while(++index<length){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(objValue===undefined&&!(key in object)){return false}}else{var stack=new Stack;if(customizer){var result=customizer(objValue,srcValue,key,object,source,stack)}if(!(result===undefined?baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG,customizer,stack):result)){return false}}}return true}
  1639. /**
  1640. * The base implementation of `_.isNative` without bad shim checks.
  1641. *
  1642. * @private
  1643. * @param {*} value The value to check.
  1644. * @returns {boolean} Returns `true` if `value` is a native function,
  1645. * else `false`.
  1646. */function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}
  1647. /**
  1648. * The base implementation of `_.isRegExp` without Node.js optimizations.
  1649. *
  1650. * @private
  1651. * @param {*} value The value to check.
  1652. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  1653. */function baseIsRegExp(value){return isObjectLike(value)&&baseGetTag(value)==regexpTag}
  1654. /**
  1655. * The base implementation of `_.isSet` without Node.js optimizations.
  1656. *
  1657. * @private
  1658. * @param {*} value The value to check.
  1659. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  1660. */function baseIsSet(value){return isObjectLike(value)&&getTag(value)==setTag}
  1661. /**
  1662. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  1663. *
  1664. * @private
  1665. * @param {*} value The value to check.
  1666. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  1667. */function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]}
  1668. /**
  1669. * The base implementation of `_.iteratee`.
  1670. *
  1671. * @private
  1672. * @param {*} [value=_.identity] The value to convert to an iteratee.
  1673. * @returns {Function} Returns the iteratee.
  1674. */function baseIteratee(value){
  1675. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  1676. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  1677. if(typeof value=="function"){return value}if(value==null){return identity}if(typeof value=="object"){return isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value)}return property(value)}
  1678. /**
  1679. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  1680. *
  1681. * @private
  1682. * @param {Object} object The object to query.
  1683. * @returns {Array} Returns the array of property names.
  1684. */function baseKeys(object){if(!isPrototype(object)){return nativeKeys(object)}var result=[];for(var key in Object(object)){if(hasOwnProperty.call(object,key)&&key!="constructor"){result.push(key)}}return result}
  1685. /**
  1686. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  1687. *
  1688. * @private
  1689. * @param {Object} object The object to query.
  1690. * @returns {Array} Returns the array of property names.
  1691. */function baseKeysIn(object){if(!isObject(object)){return nativeKeysIn(object)}var isProto=isPrototype(object),result=[];for(var key in object){if(!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}
  1692. /**
  1693. * The base implementation of `_.lt` which doesn't coerce arguments.
  1694. *
  1695. * @private
  1696. * @param {*} value The value to compare.
  1697. * @param {*} other The other value to compare.
  1698. * @returns {boolean} Returns `true` if `value` is less than `other`,
  1699. * else `false`.
  1700. */function baseLt(value,other){return value<other}
  1701. /**
  1702. * The base implementation of `_.map` without support for iteratee shorthands.
  1703. *
  1704. * @private
  1705. * @param {Array|Object} collection The collection to iterate over.
  1706. * @param {Function} iteratee The function invoked per iteration.
  1707. * @returns {Array} Returns the new mapped array.
  1708. */function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)});return result}
  1709. /**
  1710. * The base implementation of `_.matches` which doesn't clone `source`.
  1711. *
  1712. * @private
  1713. * @param {Object} source The object of property values to match.
  1714. * @returns {Function} Returns the new spec function.
  1715. */function baseMatches(source){var matchData=getMatchData(source);if(matchData.length==1&&matchData[0][2]){return matchesStrictComparable(matchData[0][0],matchData[0][1])}return function(object){return object===source||baseIsMatch(object,source,matchData)}}
  1716. /**
  1717. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  1718. *
  1719. * @private
  1720. * @param {string} path The path of the property to get.
  1721. * @param {*} srcValue The value to match.
  1722. * @returns {Function} Returns the new spec function.
  1723. */function baseMatchesProperty(path,srcValue){if(isKey(path)&&isStrictComparable(srcValue)){return matchesStrictComparable(toKey(path),srcValue)}return function(object){var objValue=get(object,path);return objValue===undefined&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}
  1724. /**
  1725. * The base implementation of `_.merge` without support for multiple sources.
  1726. *
  1727. * @private
  1728. * @param {Object} object The destination object.
  1729. * @param {Object} source The source object.
  1730. * @param {number} srcIndex The index of `source`.
  1731. * @param {Function} [customizer] The function to customize merged values.
  1732. * @param {Object} [stack] Tracks traversed source values and their merged
  1733. * counterparts.
  1734. */function baseMerge(object,source,srcIndex,customizer,stack){if(object===source){return}baseFor(source,function(srcValue,key){if(isObject(srcValue)){stack||(stack=new Stack);baseMergeDeep(object,source,key,srcIndex,baseMerge,customizer,stack)}else{var newValue=customizer?customizer(safeGet(object,key),srcValue,key+"",object,source,stack):undefined;if(newValue===undefined){newValue=srcValue}assignMergeValue(object,key,newValue)}},keysIn)}
  1735. /**
  1736. * A specialized version of `baseMerge` for arrays and objects which performs
  1737. * deep merges and tracks traversed objects enabling objects with circular
  1738. * references to be merged.
  1739. *
  1740. * @private
  1741. * @param {Object} object The destination object.
  1742. * @param {Object} source The source object.
  1743. * @param {string} key The key of the value to merge.
  1744. * @param {number} srcIndex The index of `source`.
  1745. * @param {Function} mergeFunc The function to merge values.
  1746. * @param {Function} [customizer] The function to customize assigned values.
  1747. * @param {Object} [stack] Tracks traversed source values and their merged
  1748. * counterparts.
  1749. */function baseMergeDeep(object,source,key,srcIndex,mergeFunc,customizer,stack){var objValue=safeGet(object,key),srcValue=safeGet(source,key),stacked=stack.get(srcValue);if(stacked){assignMergeValue(object,key,stacked);return}var newValue=customizer?customizer(objValue,srcValue,key+"",object,source,stack):undefined;var isCommon=newValue===undefined;if(isCommon){var isArr=isArray(srcValue),isBuff=!isArr&&isBuffer(srcValue),isTyped=!isArr&&!isBuff&&isTypedArray(srcValue);newValue=srcValue;if(isArr||isBuff||isTyped){if(isArray(objValue)){newValue=objValue}else if(isArrayLikeObject(objValue)){newValue=copyArray(objValue)}else if(isBuff){isCommon=false;newValue=cloneBuffer(srcValue,true)}else if(isTyped){isCommon=false;newValue=cloneTypedArray(srcValue,true)}else{newValue=[]}}else if(isPlainObject(srcValue)||isArguments(srcValue)){newValue=objValue;if(isArguments(objValue)){newValue=toPlainObject(objValue)}else if(!isObject(objValue)||srcIndex&&isFunction(objValue)){newValue=initCloneObject(srcValue)}}else{isCommon=false}}if(isCommon){
  1750. // Recursively merge objects and arrays (susceptible to call stack limits).
  1751. stack.set(srcValue,newValue);mergeFunc(newValue,srcValue,srcIndex,customizer,stack);stack["delete"](srcValue)}assignMergeValue(object,key,newValue)}
  1752. /**
  1753. * The base implementation of `_.nth` which doesn't coerce arguments.
  1754. *
  1755. * @private
  1756. * @param {Array} array The array to query.
  1757. * @param {number} n The index of the element to return.
  1758. * @returns {*} Returns the nth element of `array`.
  1759. */function baseNth(array,n){var length=array.length;if(!length){return}n+=n<0?length:0;return isIndex(n,length)?array[n]:undefined}
  1760. /**
  1761. * The base implementation of `_.orderBy` without param guards.
  1762. *
  1763. * @private
  1764. * @param {Array|Object} collection The collection to iterate over.
  1765. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  1766. * @param {string[]} orders The sort orders of `iteratees`.
  1767. * @returns {Array} Returns the new sorted array.
  1768. */function baseOrderBy(collection,iteratees,orders){var index=-1;iteratees=arrayMap(iteratees.length?iteratees:[identity],baseUnary(getIteratee()));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value)});return{criteria,index:++index,value}});return baseSortBy(result,function(object,other){return compareMultiple(object,other,orders)})}
  1769. /**
  1770. * The base implementation of `_.pick` without support for individual
  1771. * property identifiers.
  1772. *
  1773. * @private
  1774. * @param {Object} object The source object.
  1775. * @param {string[]} paths The property paths to pick.
  1776. * @returns {Object} Returns the new object.
  1777. */function basePick(object,paths){return basePickBy(object,paths,function(value,path){return hasIn(object,path)})}
  1778. /**
  1779. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  1780. *
  1781. * @private
  1782. * @param {Object} object The source object.
  1783. * @param {string[]} paths The property paths to pick.
  1784. * @param {Function} predicate The function invoked per property.
  1785. * @returns {Object} Returns the new object.
  1786. */function basePickBy(object,paths,predicate){var index=-1,length=paths.length,result={};while(++index<length){var path=paths[index],value=baseGet(object,path);if(predicate(value,path)){baseSet(result,castPath(path,object),value)}}return result}
  1787. /**
  1788. * A specialized version of `baseProperty` which supports deep paths.
  1789. *
  1790. * @private
  1791. * @param {Array|string} path The path of the property to get.
  1792. * @returns {Function} Returns the new accessor function.
  1793. */function basePropertyDeep(path){return function(object){return baseGet(object,path)}}
  1794. /**
  1795. * The base implementation of `_.pullAllBy` without support for iteratee
  1796. * shorthands.
  1797. *
  1798. * @private
  1799. * @param {Array} array The array to modify.
  1800. * @param {Array} values The values to remove.
  1801. * @param {Function} [iteratee] The iteratee invoked per element.
  1802. * @param {Function} [comparator] The comparator invoked per element.
  1803. * @returns {Array} Returns `array`.
  1804. */function basePullAll(array,values,iteratee,comparator){var indexOf=comparator?baseIndexOfWith:baseIndexOf,index=-1,length=values.length,seen=array;if(array===values){values=copyArray(values)}if(iteratee){seen=arrayMap(array,baseUnary(iteratee))}while(++index<length){var fromIndex=0,value=values[index],computed=iteratee?iteratee(value):value;while((fromIndex=indexOf(seen,computed,fromIndex,comparator))>-1){if(seen!==array){splice.call(seen,fromIndex,1)}splice.call(array,fromIndex,1)}}return array}
  1805. /**
  1806. * The base implementation of `_.pullAt` without support for individual
  1807. * indexes or capturing the removed elements.
  1808. *
  1809. * @private
  1810. * @param {Array} array The array to modify.
  1811. * @param {number[]} indexes The indexes of elements to remove.
  1812. * @returns {Array} Returns `array`.
  1813. */function basePullAt(array,indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index)){splice.call(array,index,1)}else{baseUnset(array,index)}}}return array}
  1814. /**
  1815. * The base implementation of `_.random` without support for returning
  1816. * floating-point numbers.
  1817. *
  1818. * @private
  1819. * @param {number} lower The lower bound.
  1820. * @param {number} upper The upper bound.
  1821. * @returns {number} Returns the random number.
  1822. */function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}
  1823. /**
  1824. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  1825. * coerce arguments.
  1826. *
  1827. * @private
  1828. * @param {number} start The start of the range.
  1829. * @param {number} end The end of the range.
  1830. * @param {number} step The value to increment or decrement by.
  1831. * @param {boolean} [fromRight] Specify iterating from right to left.
  1832. * @returns {Array} Returns the range of numbers.
  1833. */function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight?length:++index]=start;start+=step}return result}
  1834. /**
  1835. * The base implementation of `_.repeat` which doesn't coerce arguments.
  1836. *
  1837. * @private
  1838. * @param {string} string The string to repeat.
  1839. * @param {number} n The number of times to repeat the string.
  1840. * @returns {string} Returns the repeated string.
  1841. */function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER){return result}
  1842. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  1843. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  1844. do{if(n%2){result+=string}n=nativeFloor(n/2);if(n){string+=string}}while(n);return result}
  1845. /**
  1846. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  1847. *
  1848. * @private
  1849. * @param {Function} func The function to apply a rest parameter to.
  1850. * @param {number} [start=func.length-1] The start position of the rest parameter.
  1851. * @returns {Function} Returns the new function.
  1852. */function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}
  1853. /**
  1854. * The base implementation of `_.sample`.
  1855. *
  1856. * @private
  1857. * @param {Array|Object} collection The collection to sample.
  1858. * @returns {*} Returns the random element.
  1859. */function baseSample(collection){return arraySample(values(collection))}
  1860. /**
  1861. * The base implementation of `_.sampleSize` without param guards.
  1862. *
  1863. * @private
  1864. * @param {Array|Object} collection The collection to sample.
  1865. * @param {number} n The number of elements to sample.
  1866. * @returns {Array} Returns the random elements.
  1867. */function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length))}
  1868. /**
  1869. * The base implementation of `_.set`.
  1870. *
  1871. * @private
  1872. * @param {Object} object The object to modify.
  1873. * @param {Array|string} path The path of the property to set.
  1874. * @param {*} value The value to set.
  1875. * @param {Function} [customizer] The function to customize path creation.
  1876. * @returns {Object} Returns `object`.
  1877. */function baseSet(object,path,value,customizer){if(!isObject(object)){return object}path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]),newValue=value;if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined;if(newValue===undefined){newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{}}}assignValue(nested,key,newValue);nested=nested[key]}return object}
  1878. /**
  1879. * The base implementation of `setData` without support for hot loop shorting.
  1880. *
  1881. * @private
  1882. * @param {Function} func The function to associate metadata with.
  1883. * @param {*} data The metadata.
  1884. * @returns {Function} Returns `func`.
  1885. */var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func};
  1886. /**
  1887. * The base implementation of `setToString` without support for hot loop shorting.
  1888. *
  1889. * @private
  1890. * @param {Function} func The function to modify.
  1891. * @param {Function} string The `toString` result.
  1892. * @returns {Function} Returns `func`.
  1893. */var baseSetToString=!defineProperty?identity:function(func,string){return defineProperty(func,"toString",{configurable:true,enumerable:false,value:constant(string),writable:true})};
  1894. /**
  1895. * The base implementation of `_.shuffle`.
  1896. *
  1897. * @private
  1898. * @param {Array|Object} collection The collection to shuffle.
  1899. * @returns {Array} Returns the new shuffled array.
  1900. */function baseShuffle(collection){return shuffleSelf(values(collection))}
  1901. /**
  1902. * The base implementation of `_.slice` without an iteratee call guard.
  1903. *
  1904. * @private
  1905. * @param {Array} array The array to slice.
  1906. * @param {number} [start=0] The start position.
  1907. * @param {number} [end=array.length] The end position.
  1908. * @returns {Array} Returns the slice of `array`.
  1909. */function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0){start=-start>length?0:length+start}end=end>length?length:end;if(end<0){end+=length}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length){result[index]=array[index+start]}return result}
  1910. /**
  1911. * The base implementation of `_.some` without support for iteratee shorthands.
  1912. *
  1913. * @private
  1914. * @param {Array|Object} collection The collection to iterate over.
  1915. * @param {Function} predicate The function invoked per iteration.
  1916. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1917. * else `false`.
  1918. */function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return!result});return!!result}
  1919. /**
  1920. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  1921. * performs a binary search of `array` to determine the index at which `value`
  1922. * should be inserted into `array` in order to maintain its sort order.
  1923. *
  1924. * @private
  1925. * @param {Array} array The sorted array to inspect.
  1926. * @param {*} value The value to evaluate.
  1927. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  1928. * @returns {number} Returns the index at which `value` should be inserted
  1929. * into `array`.
  1930. */function baseSortedIndex(array,value,retHighest){var low=0,high=array==null?low:array.length;if(typeof value=="number"&&value===value&&high<=HALF_MAX_ARRAY_LENGTH){while(low<high){var mid=low+high>>>1,computed=array[mid];if(computed!==null&&!isSymbol(computed)&&(retHighest?computed<=value:computed<value)){low=mid+1}else{high=mid}}return high}return baseSortedIndexBy(array,value,identity,retHighest)}
  1931. /**
  1932. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  1933. * which invokes `iteratee` for `value` and each element of `array` to compute
  1934. * their sort ranking. The iteratee is invoked with one argument; (value).
  1935. *
  1936. * @private
  1937. * @param {Array} array The sorted array to inspect.
  1938. * @param {*} value The value to evaluate.
  1939. * @param {Function} iteratee The iteratee invoked per element.
  1940. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  1941. * @returns {number} Returns the index at which `value` should be inserted
  1942. * into `array`.
  1943. */function baseSortedIndexBy(array,value,iteratee,retHighest){value=iteratee(value);var low=0,high=array==null?0:array.length,valIsNaN=value!==value,valIsNull=value===null,valIsSymbol=isSymbol(value),valIsUndefined=value===undefined;while(low<high){var mid=nativeFloor((low+high)/2),computed=iteratee(array[mid]),othIsDefined=computed!==undefined,othIsNull=computed===null,othIsReflexive=computed===computed,othIsSymbol=isSymbol(computed);if(valIsNaN){var setLow=retHighest||othIsReflexive}else if(valIsUndefined){setLow=othIsReflexive&&(retHighest||othIsDefined)}else if(valIsNull){setLow=othIsReflexive&&othIsDefined&&(retHighest||!othIsNull)}else if(valIsSymbol){setLow=othIsReflexive&&othIsDefined&&!othIsNull&&(retHighest||!othIsSymbol)}else if(othIsNull||othIsSymbol){setLow=false}else{setLow=retHighest?computed<=value:computed<value}if(setLow){low=mid+1}else{high=mid}}return nativeMin(high,MAX_ARRAY_INDEX)}
  1944. /**
  1945. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  1946. * support for iteratee shorthands.
  1947. *
  1948. * @private
  1949. * @param {Array} array The array to inspect.
  1950. * @param {Function} [iteratee] The iteratee invoked per element.
  1951. * @returns {Array} Returns the new duplicate free array.
  1952. */function baseSortedUniq(array,iteratee){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;if(!index||!eq(computed,seen)){var seen=computed;result[resIndex++]=value===0?0:value}}return result}
  1953. /**
  1954. * The base implementation of `_.toNumber` which doesn't ensure correct
  1955. * conversions of binary, hexadecimal, or octal string values.
  1956. *
  1957. * @private
  1958. * @param {*} value The value to process.
  1959. * @returns {number} Returns the number.
  1960. */function baseToNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}return+value}
  1961. /**
  1962. * The base implementation of `_.toString` which doesn't convert nullish
  1963. * values to empty strings.
  1964. *
  1965. * @private
  1966. * @param {*} value The value to process.
  1967. * @returns {string} Returns the string.
  1968. */function baseToString(value){
  1969. // Exit early for strings to avoid a performance hit in some environments.
  1970. if(typeof value=="string"){return value}if(isArray(value)){
  1971. // Recursively convert values (susceptible to call stack limits).
  1972. return arrayMap(value,baseToString)+""}if(isSymbol(value)){return symbolToString?symbolToString.call(value):""}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}
  1973. /**
  1974. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  1975. *
  1976. * @private
  1977. * @param {Array} array The array to inspect.
  1978. * @param {Function} [iteratee] The iteratee invoked per element.
  1979. * @param {Function} [comparator] The comparator invoked per element.
  1980. * @returns {Array} Returns the new duplicate free array.
  1981. */function baseUniq(array,iteratee,comparator){var index=-1,includes=arrayIncludes,length=array.length,isCommon=true,result=[],seen=result;if(comparator){isCommon=false;includes=arrayIncludesWith}else if(length>=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set){return setToArray(set)}isCommon=false;includes=cacheHas;seen=new SetCache}else{seen=iteratee?[]:result}outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var seenIndex=seen.length;while(seenIndex--){if(seen[seenIndex]===computed){continue outer}}if(iteratee){seen.push(computed)}result.push(value)}else if(!includes(seen,computed,comparator)){if(seen!==result){seen.push(computed)}result.push(value)}}return result}
  1982. /**
  1983. * The base implementation of `_.unset`.
  1984. *
  1985. * @private
  1986. * @param {Object} object The object to modify.
  1987. * @param {Array|string} path The property path to unset.
  1988. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  1989. */function baseUnset(object,path){path=castPath(path,object);object=parent(object,path);return object==null||delete object[toKey(last(path))]}
  1990. /**
  1991. * The base implementation of `_.update`.
  1992. *
  1993. * @private
  1994. * @param {Object} object The object to modify.
  1995. * @param {Array|string} path The path of the property to update.
  1996. * @param {Function} updater The function to produce the updated value.
  1997. * @param {Function} [customizer] The function to customize path creation.
  1998. * @returns {Object} Returns `object`.
  1999. */function baseUpdate(object,path,updater,customizer){return baseSet(object,path,updater(baseGet(object,path)),customizer)}
  2000. /**
  2001. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  2002. * without support for iteratee shorthands.
  2003. *
  2004. * @private
  2005. * @param {Array} array The array to query.
  2006. * @param {Function} predicate The function invoked per iteration.
  2007. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  2008. * @param {boolean} [fromRight] Specify iterating from right to left.
  2009. * @returns {Array} Returns the slice of `array`.
  2010. */function baseWhile(array,predicate,isDrop,fromRight){var length=array.length,index=fromRight?length:-1;while((fromRight?index--:++index<length)&&predicate(array[index],index,array)){}return isDrop?baseSlice(array,fromRight?0:index,fromRight?index+1:length):baseSlice(array,fromRight?index+1:0,fromRight?length:index)}
  2011. /**
  2012. * The base implementation of `wrapperValue` which returns the result of
  2013. * performing a sequence of actions on the unwrapped `value`, where each
  2014. * successive action is supplied the return value of the previous.
  2015. *
  2016. * @private
  2017. * @param {*} value The unwrapped value.
  2018. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  2019. * @returns {*} Returns the resolved value.
  2020. */function baseWrapperValue(value,actions){var result=value;if(result instanceof LazyWrapper){result=result.value()}return arrayReduce(actions,function(result,action){return action.func.apply(action.thisArg,arrayPush([result],action.args))},result)}
  2021. /**
  2022. * The base implementation of methods like `_.xor`, without support for
  2023. * iteratee shorthands, that accepts an array of arrays to inspect.
  2024. *
  2025. * @private
  2026. * @param {Array} arrays The arrays to inspect.
  2027. * @param {Function} [iteratee] The iteratee invoked per element.
  2028. * @param {Function} [comparator] The comparator invoked per element.
  2029. * @returns {Array} Returns the new array of values.
  2030. */function baseXor(arrays,iteratee,comparator){var length=arrays.length;if(length<2){return length?baseUniq(arrays[0]):[]}var index=-1,result=Array(length);while(++index<length){var array=arrays[index],othIndex=-1;while(++othIndex<length){if(othIndex!=index){result[index]=baseDifference(result[index]||array,arrays[othIndex],iteratee,comparator)}}}return baseUniq(baseFlatten(result,1),iteratee,comparator)}
  2031. /**
  2032. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  2033. *
  2034. * @private
  2035. * @param {Array} props The property identifiers.
  2036. * @param {Array} values The property values.
  2037. * @param {Function} assignFunc The function to assign values.
  2038. * @returns {Object} Returns the new object.
  2039. */function baseZipObject(props,values,assignFunc){var index=-1,length=props.length,valsLength=values.length,result={};while(++index<length){var value=index<valsLength?values[index]:undefined;assignFunc(result,props[index],value)}return result}
  2040. /**
  2041. * Casts `value` to an empty array if it's not an array like object.
  2042. *
  2043. * @private
  2044. * @param {*} value The value to inspect.
  2045. * @returns {Array|Object} Returns the cast array-like object.
  2046. */function castArrayLikeObject(value){return isArrayLikeObject(value)?value:[]}
  2047. /**
  2048. * Casts `value` to `identity` if it's not a function.
  2049. *
  2050. * @private
  2051. * @param {*} value The value to inspect.
  2052. * @returns {Function} Returns cast function.
  2053. */function castFunction(value){return typeof value=="function"?value:identity}
  2054. /**
  2055. * Casts `value` to a path array if it's not one.
  2056. *
  2057. * @private
  2058. * @param {*} value The value to inspect.
  2059. * @param {Object} [object] The object to query keys on.
  2060. * @returns {Array} Returns the cast property path array.
  2061. */function castPath(value,object){if(isArray(value)){return value}return isKey(value,object)?[value]:stringToPath(toString(value))}
  2062. /**
  2063. * A `baseRest` alias which can be replaced with `identity` by module
  2064. * replacement plugins.
  2065. *
  2066. * @private
  2067. * @type {Function}
  2068. * @param {Function} func The function to apply a rest parameter to.
  2069. * @returns {Function} Returns the new function.
  2070. */var castRest=baseRest;
  2071. /**
  2072. * Casts `array` to a slice if it's needed.
  2073. *
  2074. * @private
  2075. * @param {Array} array The array to inspect.
  2076. * @param {number} start The start position.
  2077. * @param {number} [end=array.length] The end position.
  2078. * @returns {Array} Returns the cast slice.
  2079. */function castSlice(array,start,end){var length=array.length;end=end===undefined?length:end;return!start&&end>=length?array:baseSlice(array,start,end)}
  2080. /**
  2081. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  2082. *
  2083. * @private
  2084. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  2085. */var clearTimeout=ctxClearTimeout||function(id){return root.clearTimeout(id)};
  2086. /**
  2087. * Creates a clone of `buffer`.
  2088. *
  2089. * @private
  2090. * @param {Buffer} buffer The buffer to clone.
  2091. * @param {boolean} [isDeep] Specify a deep clone.
  2092. * @returns {Buffer} Returns the cloned buffer.
  2093. */function cloneBuffer(buffer,isDeep){if(isDeep){return buffer.slice()}var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);buffer.copy(result);return result}
  2094. /**
  2095. * Creates a clone of `arrayBuffer`.
  2096. *
  2097. * @private
  2098. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  2099. * @returns {ArrayBuffer} Returns the cloned array buffer.
  2100. */function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);new Uint8Array(result).set(new Uint8Array(arrayBuffer));return result}
  2101. /**
  2102. * Creates a clone of `dataView`.
  2103. *
  2104. * @private
  2105. * @param {Object} dataView The data view to clone.
  2106. * @param {boolean} [isDeep] Specify a deep clone.
  2107. * @returns {Object} Returns the cloned data view.
  2108. */function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}
  2109. /**
  2110. * Creates a clone of `regexp`.
  2111. *
  2112. * @private
  2113. * @param {Object} regexp The regexp to clone.
  2114. * @returns {Object} Returns the cloned regexp.
  2115. */function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result}
  2116. /**
  2117. * Creates a clone of the `symbol` object.
  2118. *
  2119. * @private
  2120. * @param {Object} symbol The symbol object to clone.
  2121. * @returns {Object} Returns the cloned symbol object.
  2122. */function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}
  2123. /**
  2124. * Creates a clone of `typedArray`.
  2125. *
  2126. * @private
  2127. * @param {Object} typedArray The typed array to clone.
  2128. * @param {boolean} [isDeep] Specify a deep clone.
  2129. * @returns {Object} Returns the cloned typed array.
  2130. */function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}
  2131. /**
  2132. * Compares values to sort them in ascending order.
  2133. *
  2134. * @private
  2135. * @param {*} value The value to compare.
  2136. * @param {*} other The other value to compare.
  2137. * @returns {number} Returns the sort order indicator for `value`.
  2138. */function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=value===null,valIsReflexive=value===value,valIsSymbol=isSymbol(value);var othIsDefined=other!==undefined,othIsNull=other===null,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive){return 1}if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value<other||othIsSymbol&&valIsDefined&&valIsReflexive&&!valIsNull&&!valIsSymbol||othIsNull&&valIsDefined&&valIsReflexive||!othIsDefined&&valIsReflexive||!othIsReflexive){return-1}}return 0}
  2139. /**
  2140. * Used by `_.orderBy` to compare multiple properties of a value to another
  2141. * and stable sort them.
  2142. *
  2143. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  2144. * specify an order of "desc" for descending or "asc" for ascending sort order
  2145. * of corresponding values.
  2146. *
  2147. * @private
  2148. * @param {Object} object The object to compare.
  2149. * @param {Object} other The other object to compare.
  2150. * @param {boolean[]|string[]} orders The order to sort by for each property.
  2151. * @returns {number} Returns the sort order indicator for `object`.
  2152. */function compareMultiple(object,other,orders){var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length,ordersLength=orders.length;while(++index<length){var result=compareAscending(objCriteria[index],othCriteria[index]);if(result){if(index>=ordersLength){return result}var order=orders[index];return result*(order=="desc"?-1:1)}}
  2153. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  2154. // that causes it, under certain circumstances, to provide the same value for
  2155. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  2156. // for more details.
  2157. //
  2158. // This also ensures a stable sort in V8 and other engines.
  2159. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  2160. return object.index-other.index}
  2161. /**
  2162. * Creates an array that is the composition of partially applied arguments,
  2163. * placeholders, and provided arguments into a single array of arguments.
  2164. *
  2165. * @private
  2166. * @param {Array} args The provided arguments.
  2167. * @param {Array} partials The arguments to prepend to those provided.
  2168. * @param {Array} holders The `partials` placeholder indexes.
  2169. * @params {boolean} [isCurried] Specify composing for a curried function.
  2170. * @returns {Array} Returns the new array of composed arguments.
  2171. */function composeArgs(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;while(++leftIndex<leftLength){result[leftIndex]=partials[leftIndex]}while(++argsIndex<holdersLength){if(isUncurried||argsIndex<argsLength){result[holders[argsIndex]]=args[argsIndex]}}while(rangeLength--){result[leftIndex++]=args[argsIndex++]}return result}
  2172. /**
  2173. * This function is like `composeArgs` except that the arguments composition
  2174. * is tailored for `_.partialRight`.
  2175. *
  2176. * @private
  2177. * @param {Array} args The provided arguments.
  2178. * @param {Array} partials The arguments to append to those provided.
  2179. * @param {Array} holders The `partials` placeholder indexes.
  2180. * @params {boolean} [isCurried] Specify composing for a curried function.
  2181. * @returns {Array} Returns the new array of composed arguments.
  2182. */function composeArgsRight(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersIndex=-1,holdersLength=holders.length,rightIndex=-1,rightLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(rangeLength+rightLength),isUncurried=!isCurried;while(++argsIndex<rangeLength){result[argsIndex]=args[argsIndex]}var offset=argsIndex;while(++rightIndex<rightLength){result[offset+rightIndex]=partials[rightIndex]}while(++holdersIndex<holdersLength){if(isUncurried||argsIndex<argsLength){result[offset+holders[holdersIndex]]=args[argsIndex++]}}return result}
  2183. /**
  2184. * Copies the values of `source` to `array`.
  2185. *
  2186. * @private
  2187. * @param {Array} source The array to copy values from.
  2188. * @param {Array} [array=[]] The array to copy values to.
  2189. * @returns {Array} Returns `array`.
  2190. */function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index]}return array}
  2191. /**
  2192. * Copies properties of `source` to `object`.
  2193. *
  2194. * @private
  2195. * @param {Object} source The object to copy properties from.
  2196. * @param {Array} props The property identifiers to copy.
  2197. * @param {Object} [object={}] The object to copy properties to.
  2198. * @param {Function} [customizer] The function to customize copied values.
  2199. * @returns {Object} Returns `object`.
  2200. */function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});var index=-1,length=props.length;while(++index<length){var key=props[index];var newValue=customizer?customizer(object[key],source[key],key,object,source):undefined;if(newValue===undefined){newValue=source[key]}if(isNew){baseAssignValue(object,key,newValue)}else{assignValue(object,key,newValue)}}return object}
  2201. /**
  2202. * Copies own symbols of `source` to `object`.
  2203. *
  2204. * @private
  2205. * @param {Object} source The object to copy symbols from.
  2206. * @param {Object} [object={}] The object to copy symbols to.
  2207. * @returns {Object} Returns `object`.
  2208. */function copySymbols(source,object){return copyObject(source,getSymbols(source),object)}
  2209. /**
  2210. * Copies own and inherited symbols of `source` to `object`.
  2211. *
  2212. * @private
  2213. * @param {Object} source The object to copy symbols from.
  2214. * @param {Object} [object={}] The object to copy symbols to.
  2215. * @returns {Object} Returns `object`.
  2216. */function copySymbolsIn(source,object){return copyObject(source,getSymbolsIn(source),object)}
  2217. /**
  2218. * Creates a function like `_.groupBy`.
  2219. *
  2220. * @private
  2221. * @param {Function} setter The function to set accumulator values.
  2222. * @param {Function} [initializer] The accumulator object initializer.
  2223. * @returns {Function} Returns the new aggregator function.
  2224. */function createAggregator(setter,initializer){return function(collection,iteratee){var func=isArray(collection)?arrayAggregator:baseAggregator,accumulator=initializer?initializer():{};return func(collection,setter,getIteratee(iteratee,2),accumulator)}}
  2225. /**
  2226. * Creates a function like `_.assign`.
  2227. *
  2228. * @private
  2229. * @param {Function} assigner The function to assign values.
  2230. * @returns {Function} Returns the new assigner function.
  2231. */function createAssigner(assigner){return baseRest(function(object,sources){var index=-1,length=sources.length,customizer=length>1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object);while(++index<length){var source=sources[index];if(source){assigner(object,source,index,customizer)}}return object})}
  2232. /**
  2233. * Creates a `baseEach` or `baseEachRight` function.
  2234. *
  2235. * @private
  2236. * @param {Function} eachFunc The function to iterate over a collection.
  2237. * @param {boolean} [fromRight] Specify iterating from right to left.
  2238. * @returns {Function} Returns the new base function.
  2239. */function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){if(collection==null){return collection}if(!isArrayLike(collection)){return eachFunc(collection,iteratee)}var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);while(fromRight?index--:++index<length){if(iteratee(iterable[index],index,iterable)===false){break}}return collection}}
  2240. /**
  2241. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  2242. *
  2243. * @private
  2244. * @param {boolean} [fromRight] Specify iterating from right to left.
  2245. * @returns {Function} Returns the new base function.
  2246. */function createBaseFor(fromRight){return function(object,iteratee,keysFunc){var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;while(length--){var key=props[fromRight?length:++index];if(iteratee(iterable[key],key,iterable)===false){break}}return object}}
  2247. /**
  2248. * Creates a function that wraps `func` to invoke it with the optional `this`
  2249. * binding of `thisArg`.
  2250. *
  2251. * @private
  2252. * @param {Function} func The function to wrap.
  2253. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2254. * @param {*} [thisArg] The `this` binding of `func`.
  2255. * @returns {Function} Returns the new wrapped function.
  2256. */function createBind(func,bitmask,thisArg){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return fn.apply(isBind?thisArg:this,arguments)}return wrapper}
  2257. /**
  2258. * Creates a function like `_.lowerFirst`.
  2259. *
  2260. * @private
  2261. * @param {string} methodName The name of the `String` case method to use.
  2262. * @returns {Function} Returns the new case function.
  2263. */function createCaseFirst(methodName){return function(string){string=toString(string);var strSymbols=hasUnicode(string)?stringToArray(string):undefined;var chr=strSymbols?strSymbols[0]:string.charAt(0);var trailing=strSymbols?castSlice(strSymbols,1).join(""):string.slice(1);return chr[methodName]()+trailing}}
  2264. /**
  2265. * Creates a function like `_.camelCase`.
  2266. *
  2267. * @private
  2268. * @param {Function} callback The function to combine each word.
  2269. * @returns {Function} Returns the new compounder function.
  2270. */function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,"")),callback,"")}}
  2271. /**
  2272. * Creates a function that produces an instance of `Ctor` regardless of
  2273. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  2274. *
  2275. * @private
  2276. * @param {Function} Ctor The constructor to wrap.
  2277. * @returns {Function} Returns the new wrapped function.
  2278. */function createCtor(Ctor){return function(){
  2279. // Use a `switch` statement to work with class constructors. See
  2280. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  2281. // for more details.
  2282. var args=arguments;switch(args.length){case 0:return new Ctor;case 1:return new Ctor(args[0]);case 2:return new Ctor(args[0],args[1]);case 3:return new Ctor(args[0],args[1],args[2]);case 4:return new Ctor(args[0],args[1],args[2],args[3]);case 5:return new Ctor(args[0],args[1],args[2],args[3],args[4]);case 6:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5]);case 7:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5],args[6])}var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,args);
  2283. // Mimic the constructor's `return` behavior.
  2284. // See https://es5.github.io/#x13.2.2 for more details.
  2285. return isObject(result)?result:thisBinding}}
  2286. /**
  2287. * Creates a function that wraps `func` to enable currying.
  2288. *
  2289. * @private
  2290. * @param {Function} func The function to wrap.
  2291. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2292. * @param {number} arity The arity of `func`.
  2293. * @returns {Function} Returns the new wrapped function.
  2294. */function createCurry(func,bitmask,arity){var Ctor=createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length,placeholder=getHolder(wrapper);while(index--){args[index]=arguments[index]}var holders=length<3&&args[0]!==placeholder&&args[length-1]!==placeholder?[]:replaceHolders(args,placeholder);length-=holders.length;if(length<arity){return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,undefined,args,holders,undefined,undefined,arity-length)}var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return apply(fn,this,args)}return wrapper}
  2295. /**
  2296. * Creates a `_.find` or `_.findLast` function.
  2297. *
  2298. * @private
  2299. * @param {Function} findIndexFunc The function to find the collection index.
  2300. * @returns {Function} Returns the new find function.
  2301. */function createFind(findIndexFunc){return function(collection,predicate,fromIndex){var iterable=Object(collection);if(!isArrayLike(collection)){var iteratee=getIteratee(predicate,3);collection=keys(collection);predicate=function(key){return iteratee(iterable[key],key,iterable)}}var index=findIndexFunc(collection,predicate,fromIndex);return index>-1?iterable[iteratee?collection[index]:index]:undefined}}
  2302. /**
  2303. * Creates a `_.flow` or `_.flowRight` function.
  2304. *
  2305. * @private
  2306. * @param {boolean} [fromRight] Specify iterating from right to left.
  2307. * @returns {Function} Returns the new flow function.
  2308. */function createFlow(fromRight){return flatRest(function(funcs){var length=funcs.length,index=length,prereq=LodashWrapper.prototype.thru;if(fromRight){funcs.reverse()}while(index--){var func=funcs[index];if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}if(prereq&&!wrapper&&getFuncName(func)=="wrapper"){var wrapper=new LodashWrapper([],true)}}index=wrapper?index:length;while(++index<length){func=funcs[index];var funcName=getFuncName(func),data=funcName=="wrapper"?getData(func):undefined;if(data&&isLaziable(data[0])&&data[1]==(WRAP_ARY_FLAG|WRAP_CURRY_FLAG|WRAP_PARTIAL_FLAG|WRAP_REARG_FLAG)&&!data[4].length&&data[9]==1){wrapper=wrapper[getFuncName(data[0])].apply(wrapper,data[3])}else{wrapper=func.length==1&&isLaziable(func)?wrapper[funcName]():wrapper.thru(func)}}return function(){var args=arguments,value=args[0];if(wrapper&&args.length==1&&isArray(value)){return wrapper.plant(value).value()}var index=0,result=length?funcs[index].apply(this,args):value;while(++index<length){result=funcs[index].call(this,result)}return result}})}
  2309. /**
  2310. * Creates a function that wraps `func` to invoke it with optional `this`
  2311. * binding of `thisArg`, partial application, and currying.
  2312. *
  2313. * @private
  2314. * @param {Function|string} func The function or method name to wrap.
  2315. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2316. * @param {*} [thisArg] The `this` binding of `func`.
  2317. * @param {Array} [partials] The arguments to prepend to those provided to
  2318. * the new function.
  2319. * @param {Array} [holders] The `partials` placeholder indexes.
  2320. * @param {Array} [partialsRight] The arguments to append to those provided
  2321. * to the new function.
  2322. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  2323. * @param {Array} [argPos] The argument positions of the new function.
  2324. * @param {number} [ary] The arity cap of `func`.
  2325. * @param {number} [arity] The arity of `func`.
  2326. * @returns {Function} Returns the new wrapped function.
  2327. */function createHybrid(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&WRAP_ARY_FLAG,isBind=bitmask&WRAP_BIND_FLAG,isBindKey=bitmask&WRAP_BIND_KEY_FLAG,isCurried=bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG),isFlip=bitmask&WRAP_FLIP_FLAG,Ctor=isBindKey?undefined:createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length;while(index--){args[index]=arguments[index]}if(isCurried){var placeholder=getHolder(wrapper),holdersCount=countHolders(args,placeholder)}if(partials){args=composeArgs(args,partials,holders,isCurried)}if(partialsRight){args=composeArgsRight(args,partialsRight,holdersRight,isCurried)}length-=holdersCount;if(isCurried&&length<arity){var newHolders=replaceHolders(args,placeholder);return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,thisArg,args,newHolders,argPos,ary,arity-length)}var thisBinding=isBind?thisArg:this,fn=isBindKey?thisBinding[func]:func;length=args.length;if(argPos){args=reorder(args,argPos)}else if(isFlip&&length>1){args.reverse()}if(isAry&&ary<length){args.length=ary}if(this&&this!==root&&this instanceof wrapper){fn=Ctor||createCtor(fn)}return fn.apply(thisBinding,args)}return wrapper}
  2328. /**
  2329. * Creates a function like `_.invertBy`.
  2330. *
  2331. * @private
  2332. * @param {Function} setter The function to set accumulator values.
  2333. * @param {Function} toIteratee The function to resolve iteratees.
  2334. * @returns {Function} Returns the new inverter function.
  2335. */function createInverter(setter,toIteratee){return function(object,iteratee){return baseInverter(object,setter,toIteratee(iteratee),{})}}
  2336. /**
  2337. * Creates a function that performs a mathematical operation on two values.
  2338. *
  2339. * @private
  2340. * @param {Function} operator The function to perform the operation.
  2341. * @param {number} [defaultValue] The value used for `undefined` arguments.
  2342. * @returns {Function} Returns the new mathematical operation function.
  2343. */function createMathOperation(operator,defaultValue){return function(value,other){var result;if(value===undefined&&other===undefined){return defaultValue}if(value!==undefined){result=value}if(other!==undefined){if(result===undefined){return other}if(typeof value=="string"||typeof other=="string"){value=baseToString(value);other=baseToString(other)}else{value=baseToNumber(value);other=baseToNumber(other)}result=operator(value,other)}return result}}
  2344. /**
  2345. * Creates a function like `_.over`.
  2346. *
  2347. * @private
  2348. * @param {Function} arrayFunc The function to iterate over iteratees.
  2349. * @returns {Function} Returns the new over function.
  2350. */function createOver(arrayFunc){return flatRest(function(iteratees){iteratees=arrayMap(iteratees,baseUnary(getIteratee()));return baseRest(function(args){var thisArg=this;return arrayFunc(iteratees,function(iteratee){return apply(iteratee,thisArg,args)})})})}
  2351. /**
  2352. * Creates the padding for `string` based on `length`. The `chars` string
  2353. * is truncated if the number of characters exceeds `length`.
  2354. *
  2355. * @private
  2356. * @param {number} length The padding length.
  2357. * @param {string} [chars=' '] The string used as padding.
  2358. * @returns {string} Returns the padding for `string`.
  2359. */function createPadding(length,chars){chars=chars===undefined?" ":baseToString(chars);var charsLength=chars.length;if(charsLength<2){return charsLength?baseRepeat(chars,length):chars}var result=baseRepeat(chars,nativeCeil(length/stringSize(chars)));return hasUnicode(chars)?castSlice(stringToArray(result),0,length).join(""):result.slice(0,length)}
  2360. /**
  2361. * Creates a function that wraps `func` to invoke it with the `this` binding
  2362. * of `thisArg` and `partials` prepended to the arguments it receives.
  2363. *
  2364. * @private
  2365. * @param {Function} func The function to wrap.
  2366. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2367. * @param {*} thisArg The `this` binding of `func`.
  2368. * @param {Array} partials The arguments to prepend to those provided to
  2369. * the new function.
  2370. * @returns {Function} Returns the new wrapped function.
  2371. */function createPartial(func,bitmask,thisArg,partials){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var argsIndex=-1,argsLength=arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(leftLength+argsLength),fn=this&&this!==root&&this instanceof wrapper?Ctor:func;while(++leftIndex<leftLength){args[leftIndex]=partials[leftIndex]}while(argsLength--){args[leftIndex++]=arguments[++argsIndex]}return apply(fn,isBind?thisArg:this,args)}return wrapper}
  2372. /**
  2373. * Creates a `_.range` or `_.rangeRight` function.
  2374. *
  2375. * @private
  2376. * @param {boolean} [fromRight] Specify iterating from right to left.
  2377. * @returns {Function} Returns the new range function.
  2378. */function createRange(fromRight){return function(start,end,step){if(step&&typeof step!="number"&&isIterateeCall(start,end,step)){end=step=undefined}
  2379. // Ensure the sign of `-0` is preserved.
  2380. start=toFinite(start);if(end===undefined){end=start;start=0}else{end=toFinite(end)}step=step===undefined?start<end?1:-1:toFinite(step);return baseRange(start,end,step,fromRight)}}
  2381. /**
  2382. * Creates a function that performs a relational operation on two values.
  2383. *
  2384. * @private
  2385. * @param {Function} operator The function to perform the operation.
  2386. * @returns {Function} Returns the new relational operation function.
  2387. */function createRelationalOperation(operator){return function(value,other){if(!(typeof value=="string"&&typeof other=="string")){value=toNumber(value);other=toNumber(other)}return operator(value,other)}}
  2388. /**
  2389. * Creates a function that wraps `func` to continue currying.
  2390. *
  2391. * @private
  2392. * @param {Function} func The function to wrap.
  2393. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2394. * @param {Function} wrapFunc The function to create the `func` wrapper.
  2395. * @param {*} placeholder The placeholder value.
  2396. * @param {*} [thisArg] The `this` binding of `func`.
  2397. * @param {Array} [partials] The arguments to prepend to those provided to
  2398. * the new function.
  2399. * @param {Array} [holders] The `partials` placeholder indexes.
  2400. * @param {Array} [argPos] The argument positions of the new function.
  2401. * @param {number} [ary] The arity cap of `func`.
  2402. * @param {number} [arity] The arity of `func`.
  2403. * @returns {Function} Returns the new wrapped function.
  2404. */function createRecurry(func,bitmask,wrapFunc,placeholder,thisArg,partials,holders,argPos,ary,arity){var isCurry=bitmask&WRAP_CURRY_FLAG,newHolders=isCurry?holders:undefined,newHoldersRight=isCurry?undefined:holders,newPartials=isCurry?partials:undefined,newPartialsRight=isCurry?undefined:partials;bitmask|=isCurry?WRAP_PARTIAL_FLAG:WRAP_PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?WRAP_PARTIAL_RIGHT_FLAG:WRAP_PARTIAL_FLAG);if(!(bitmask&WRAP_CURRY_BOUND_FLAG)){bitmask&=~(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG)}var newData=[func,bitmask,thisArg,newPartials,newHolders,newPartialsRight,newHoldersRight,argPos,ary,arity];var result=wrapFunc.apply(undefined,newData);if(isLaziable(func)){setData(result,newData)}result.placeholder=placeholder;return setWrapToString(result,func,bitmask)}
  2405. /**
  2406. * Creates a function like `_.round`.
  2407. *
  2408. * @private
  2409. * @param {string} methodName The name of the `Math` method to use when rounding.
  2410. * @returns {Function} Returns the new round function.
  2411. */function createRound(methodName){var func=Math[methodName];return function(number,precision){number=toNumber(number);precision=precision==null?0:nativeMin(toInteger(precision),292);if(precision){
  2412. // Shift with exponential notation to avoid floating-point issues.
  2413. // See [MDN](https://mdn.io/round#Examples) for more details.
  2414. var pair=(toString(number)+"e").split("e"),value=func(pair[0]+"e"+(+pair[1]+precision));pair=(toString(value)+"e").split("e");return+(pair[0]+"e"+(+pair[1]-precision))}return func(number)}}
  2415. /**
  2416. * Creates a set object of `values`.
  2417. *
  2418. * @private
  2419. * @param {Array} values The values to add to the set.
  2420. * @returns {Object} Returns the new set.
  2421. */var createSet=!(Set&&1/setToArray(new Set([,-0]))[1]==INFINITY)?noop:function(values){return new Set(values)};
  2422. /**
  2423. * Creates a `_.toPairs` or `_.toPairsIn` function.
  2424. *
  2425. * @private
  2426. * @param {Function} keysFunc The function to get the keys of a given object.
  2427. * @returns {Function} Returns the new pairs function.
  2428. */function createToPairs(keysFunc){return function(object){var tag=getTag(object);if(tag==mapTag){return mapToArray(object)}if(tag==setTag){return setToPairs(object)}return baseToPairs(object,keysFunc(object))}}
  2429. /**
  2430. * Creates a function that either curries or invokes `func` with optional
  2431. * `this` binding and partially applied arguments.
  2432. *
  2433. * @private
  2434. * @param {Function|string} func The function or method name to wrap.
  2435. * @param {number} bitmask The bitmask flags.
  2436. * 1 - `_.bind`
  2437. * 2 - `_.bindKey`
  2438. * 4 - `_.curry` or `_.curryRight` of a bound function
  2439. * 8 - `_.curry`
  2440. * 16 - `_.curryRight`
  2441. * 32 - `_.partial`
  2442. * 64 - `_.partialRight`
  2443. * 128 - `_.rearg`
  2444. * 256 - `_.ary`
  2445. * 512 - `_.flip`
  2446. * @param {*} [thisArg] The `this` binding of `func`.
  2447. * @param {Array} [partials] The arguments to be partially applied.
  2448. * @param {Array} [holders] The `partials` placeholder indexes.
  2449. * @param {Array} [argPos] The argument positions of the new function.
  2450. * @param {number} [ary] The arity cap of `func`.
  2451. * @param {number} [arity] The arity of `func`.
  2452. * @returns {Function} Returns the new wrapped function.
  2453. */function createWrap(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&WRAP_BIND_KEY_FLAG;if(!isBindKey&&typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var length=partials?partials.length:0;if(!length){bitmask&=~(WRAP_PARTIAL_FLAG|WRAP_PARTIAL_RIGHT_FLAG);partials=holders=undefined}ary=ary===undefined?ary:nativeMax(toInteger(ary),0);arity=arity===undefined?arity:toInteger(arity);length-=holders?holders.length:0;if(bitmask&WRAP_PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=undefined}var data=isBindKey?undefined:getData(func);var newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];if(data){mergeData(newData,data)}func=newData[0];bitmask=newData[1];thisArg=newData[2];partials=newData[3];holders=newData[4];arity=newData[9]=newData[9]===undefined?isBindKey?0:func.length:nativeMax(newData[9]-length,0);if(!arity&&bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG)){bitmask&=~(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG)}if(!bitmask||bitmask==WRAP_BIND_FLAG){var result=createBind(func,bitmask,thisArg)}else if(bitmask==WRAP_CURRY_FLAG||bitmask==WRAP_CURRY_RIGHT_FLAG){result=createCurry(func,bitmask,arity)}else if((bitmask==WRAP_PARTIAL_FLAG||bitmask==(WRAP_BIND_FLAG|WRAP_PARTIAL_FLAG))&&!holders.length){result=createPartial(func,bitmask,thisArg,partials)}else{result=createHybrid.apply(undefined,newData)}var setter=data?baseSetData:setData;return setWrapToString(setter(result,newData),func,bitmask)}
  2454. /**
  2455. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  2456. * of source objects to the destination object for all destination properties
  2457. * that resolve to `undefined`.
  2458. *
  2459. * @private
  2460. * @param {*} objValue The destination value.
  2461. * @param {*} srcValue The source value.
  2462. * @param {string} key The key of the property to assign.
  2463. * @param {Object} object The parent object of `objValue`.
  2464. * @returns {*} Returns the value to assign.
  2465. */function customDefaultsAssignIn(objValue,srcValue,key,object){if(objValue===undefined||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key)){return srcValue}return objValue}
  2466. /**
  2467. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  2468. * objects into destination objects that are passed thru.
  2469. *
  2470. * @private
  2471. * @param {*} objValue The destination value.
  2472. * @param {*} srcValue The source value.
  2473. * @param {string} key The key of the property to merge.
  2474. * @param {Object} object The parent object of `objValue`.
  2475. * @param {Object} source The parent object of `srcValue`.
  2476. * @param {Object} [stack] Tracks traversed source values and their merged
  2477. * counterparts.
  2478. * @returns {*} Returns the value to assign.
  2479. */function customDefaultsMerge(objValue,srcValue,key,object,source,stack){if(isObject(objValue)&&isObject(srcValue)){
  2480. // Recursively merge objects and arrays (susceptible to call stack limits).
  2481. stack.set(srcValue,objValue);baseMerge(objValue,srcValue,undefined,customDefaultsMerge,stack);stack["delete"](srcValue)}return objValue}
  2482. /**
  2483. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  2484. * objects.
  2485. *
  2486. * @private
  2487. * @param {*} value The value to inspect.
  2488. * @param {string} key The key of the property to inspect.
  2489. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  2490. */function customOmitClone(value){return isPlainObject(value)?undefined:value}
  2491. /**
  2492. * A specialized version of `baseIsEqualDeep` for arrays with support for
  2493. * partial deep comparisons.
  2494. *
  2495. * @private
  2496. * @param {Array} array The array to compare.
  2497. * @param {Array} other The other array to compare.
  2498. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  2499. * @param {Function} customizer The function to customize comparisons.
  2500. * @param {Function} equalFunc The function to determine equivalents of values.
  2501. * @param {Object} stack Tracks traversed `array` and `other` objects.
  2502. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  2503. */function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength)){return false}
  2504. // Assume cyclic values are equal.
  2505. var stacked=stack.get(array);if(stacked&&stack.get(other)){return stacked==other}var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;stack.set(array,other);stack.set(other,array);
  2506. // Ignore non-index properties.
  2507. while(++index<arrLength){var arrValue=array[index],othValue=other[index];if(customizer){var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack)}if(compared!==undefined){if(compared){continue}result=false;break}
  2508. // Recursively compare arrays (susceptible to call stack limits).
  2509. if(seen){if(!arraySome(other,function(othValue,othIndex){if(!cacheHas(seen,othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){return seen.push(othIndex)}})){result=false;break}}else if(!(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){result=false;break}}stack["delete"](array);stack["delete"](other);return result}
  2510. /**
  2511. * A specialized version of `baseIsEqualDeep` for comparing objects of
  2512. * the same `toStringTag`.
  2513. *
  2514. * **Note:** This function only supports comparing values with tags of
  2515. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  2516. *
  2517. * @private
  2518. * @param {Object} object The object to compare.
  2519. * @param {Object} other The other object to compare.
  2520. * @param {string} tag The `toStringTag` of the objects to compare.
  2521. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  2522. * @param {Function} customizer The function to customize comparisons.
  2523. * @param {Function} equalFunc The function to determine equivalents of values.
  2524. * @param {Object} stack Tracks traversed `object` and `other` objects.
  2525. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2526. */function equalByTag(object,other,tag,bitmask,customizer,equalFunc,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=other.byteOffset){return false}object=object.buffer;other=other.buffer;case arrayBufferTag:if(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other))){return false}return true;case boolTag:case dateTag:case numberTag:
  2527. // Coerce booleans to `1` or `0` and dates to milliseconds.
  2528. // Invalid dates are coerced to `NaN`.
  2529. return eq(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:
  2530. // Coerce regexes to strings and treat strings, primitives and objects,
  2531. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  2532. // for more details.
  2533. return object==other+"";case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&COMPARE_PARTIAL_FLAG;convert||(convert=setToArray);if(object.size!=other.size&&!isPartial){return false}
  2534. // Assume cyclic values are equal.
  2535. var stacked=stack.get(object);if(stacked){return stacked==other}bitmask|=COMPARE_UNORDERED_FLAG;
  2536. // Recursively compare objects (susceptible to call stack limits).
  2537. stack.set(object,other);var result=equalArrays(convert(object),convert(other),bitmask,customizer,equalFunc,stack);stack["delete"](object);return result;case symbolTag:if(symbolValueOf){return symbolValueOf.call(object)==symbolValueOf.call(other)}}return false}
  2538. /**
  2539. * A specialized version of `baseIsEqualDeep` for objects with support for
  2540. * partial deep comparisons.
  2541. *
  2542. * @private
  2543. * @param {Object} object The object to compare.
  2544. * @param {Object} other The other object to compare.
  2545. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  2546. * @param {Function} customizer The function to customize comparisons.
  2547. * @param {Function} equalFunc The function to determine equivalents of values.
  2548. * @param {Object} stack Tracks traversed `object` and `other` objects.
  2549. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2550. */function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial){return false}var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key))){return false}}
  2551. // Assume cyclic values are equal.
  2552. var stacked=stack.get(object);if(stacked&&stack.get(other)){return stacked==other}var result=true;stack.set(object,other);stack.set(other,object);var skipCtor=isPartial;while(++index<objLength){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer){var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack)}
  2553. // Recursively compare objects (susceptible to call stack limits).
  2554. if(!(compared===undefined?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=false;break}skipCtor||(skipCtor=key=="constructor")}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;
  2555. // Non `Object` object instances with different constructors are not equal.
  2556. if(objCtor!=othCtor&&("constructor"in object&&"constructor"in other)&&!(typeof objCtor=="function"&&objCtor instanceof objCtor&&typeof othCtor=="function"&&othCtor instanceof othCtor)){result=false}}stack["delete"](object);stack["delete"](other);return result}
  2557. /**
  2558. * A specialized version of `baseRest` which flattens the rest array.
  2559. *
  2560. * @private
  2561. * @param {Function} func The function to apply a rest parameter to.
  2562. * @returns {Function} Returns the new function.
  2563. */function flatRest(func){return setToString(overRest(func,undefined,flatten),func+"")}
  2564. /**
  2565. * Creates an array of own enumerable property names and symbols of `object`.
  2566. *
  2567. * @private
  2568. * @param {Object} object The object to query.
  2569. * @returns {Array} Returns the array of property names and symbols.
  2570. */function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols)}
  2571. /**
  2572. * Creates an array of own and inherited enumerable property names and
  2573. * symbols of `object`.
  2574. *
  2575. * @private
  2576. * @param {Object} object The object to query.
  2577. * @returns {Array} Returns the array of property names and symbols.
  2578. */function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}
  2579. /**
  2580. * Gets metadata for `func`.
  2581. *
  2582. * @private
  2583. * @param {Function} func The function to query.
  2584. * @returns {*} Returns the metadata for `func`.
  2585. */var getData=!metaMap?noop:function(func){return metaMap.get(func)};
  2586. /**
  2587. * Gets the name of `func`.
  2588. *
  2589. * @private
  2590. * @param {Function} func The function to query.
  2591. * @returns {string} Returns the function name.
  2592. */function getFuncName(func){var result=func.name+"",array=realNames[result],length=hasOwnProperty.call(realNames,result)?array.length:0;while(length--){var data=array[length],otherFunc=data.func;if(otherFunc==null||otherFunc==func){return data.name}}return result}
  2593. /**
  2594. * Gets the argument placeholder value for `func`.
  2595. *
  2596. * @private
  2597. * @param {Function} func The function to inspect.
  2598. * @returns {*} Returns the placeholder value.
  2599. */function getHolder(func){var object=hasOwnProperty.call(lodash,"placeholder")?lodash:func;return object.placeholder}
  2600. /**
  2601. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  2602. * this function returns the custom method, otherwise it returns `baseIteratee`.
  2603. * If arguments are provided, the chosen function is invoked with them and
  2604. * its result is returned.
  2605. *
  2606. * @private
  2607. * @param {*} [value] The value to convert to an iteratee.
  2608. * @param {number} [arity] The arity of the created iteratee.
  2609. * @returns {Function} Returns the chosen function or its result.
  2610. */function getIteratee(){var result=lodash.iteratee||iteratee;result=result===iteratee?baseIteratee:result;return arguments.length?result(arguments[0],arguments[1]):result}
  2611. /**
  2612. * Gets the data for `map`.
  2613. *
  2614. * @private
  2615. * @param {Object} map The map to query.
  2616. * @param {string} key The reference key.
  2617. * @returns {*} Returns the map data.
  2618. */function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}
  2619. /**
  2620. * Gets the property names, values, and compare flags of `object`.
  2621. *
  2622. * @private
  2623. * @param {Object} object The object to query.
  2624. * @returns {Array} Returns the match data of `object`.
  2625. */function getMatchData(object){var result=keys(object),length=result.length;while(length--){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}
  2626. /**
  2627. * Gets the native function at `key` of `object`.
  2628. *
  2629. * @private
  2630. * @param {Object} object The object to query.
  2631. * @param {string} key The key of the method to get.
  2632. * @returns {*} Returns the function if it's native, else `undefined`.
  2633. */function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}
  2634. /**
  2635. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  2636. *
  2637. * @private
  2638. * @param {*} value The value to query.
  2639. * @returns {string} Returns the raw `toStringTag`.
  2640. */function getRawTag(value){var isOwn=hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=undefined;var unmasked=true}catch(e){}var result=nativeObjectToString.call(value);if(unmasked){if(isOwn){value[symToStringTag]=tag}else{delete value[symToStringTag]}}return result}
  2641. /**
  2642. * Creates an array of the own enumerable symbols of `object`.
  2643. *
  2644. * @private
  2645. * @param {Object} object The object to query.
  2646. * @returns {Array} Returns the array of symbols.
  2647. */var getSymbols=!nativeGetSymbols?stubArray:function(object){if(object==null){return[]}object=Object(object);return arrayFilter(nativeGetSymbols(object),function(symbol){return propertyIsEnumerable.call(object,symbol)})};
  2648. /**
  2649. * Creates an array of the own and inherited enumerable symbols of `object`.
  2650. *
  2651. * @private
  2652. * @param {Object} object The object to query.
  2653. * @returns {Array} Returns the array of symbols.
  2654. */var getSymbolsIn=!nativeGetSymbols?stubArray:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object)}return result};
  2655. /**
  2656. * Gets the `toStringTag` of `value`.
  2657. *
  2658. * @private
  2659. * @param {*} value The value to query.
  2660. * @returns {string} Returns the `toStringTag`.
  2661. */var getTag=baseGetTag;
  2662. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  2663. if(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag){getTag=function(value){var result=baseGetTag(value),Ctor=result==objectTag?value.constructor:undefined,ctorString=Ctor?toSource(Ctor):"";if(ctorString){switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}}return result}}
  2664. /**
  2665. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  2666. *
  2667. * @private
  2668. * @param {number} start The start of the view.
  2669. * @param {number} end The end of the view.
  2670. * @param {Array} transforms The transformations to apply to the view.
  2671. * @returns {Object} Returns an object containing the `start` and `end`
  2672. * positions of the view.
  2673. */function getView(start,end,transforms){var index=-1,length=transforms.length;while(++index<length){var data=transforms[index],size=data.size;switch(data.type){case"drop":start+=size;break;case"dropRight":end-=size;break;case"take":end=nativeMin(end,start+size);break;case"takeRight":start=nativeMax(start,end-size);break}}return{start,end}}
  2674. /**
  2675. * Extracts wrapper details from the `source` body comment.
  2676. *
  2677. * @private
  2678. * @param {string} source The source to inspect.
  2679. * @returns {Array} Returns the wrapper details.
  2680. */function getWrapDetails(source){var match=source.match(reWrapDetails);return match?match[1].split(reSplitDetails):[]}
  2681. /**
  2682. * Checks if `path` exists on `object`.
  2683. *
  2684. * @private
  2685. * @param {Object} object The object to query.
  2686. * @param {Array|string} path The path to check.
  2687. * @param {Function} hasFunc The function to check properties.
  2688. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  2689. */function hasPath(object,path,hasFunc){path=castPath(path,object);var index=-1,length=path.length,result=false;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key))){break}object=object[key]}if(result||++index!=length){return result}length=object==null?0:object.length;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object))}
  2690. /**
  2691. * Initializes an array clone.
  2692. *
  2693. * @private
  2694. * @param {Array} array The array to clone.
  2695. * @returns {Array} Returns the initialized clone.
  2696. */function initCloneArray(array){var length=array.length,result=new array.constructor(length);
  2697. // Add properties assigned by `RegExp#exec`.
  2698. if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}
  2699. /**
  2700. * Initializes an object clone.
  2701. *
  2702. * @private
  2703. * @param {Object} object The object to clone.
  2704. * @returns {Object} Returns the initialized clone.
  2705. */function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}
  2706. /**
  2707. * Initializes an object clone based on its `toStringTag`.
  2708. *
  2709. * **Note:** This function only supports cloning values with tags of
  2710. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  2711. *
  2712. * @private
  2713. * @param {Object} object The object to clone.
  2714. * @param {string} tag The `toStringTag` of the object to clone.
  2715. * @param {boolean} [isDeep] Specify a deep clone.
  2716. * @returns {Object} Returns the initialized clone.
  2717. */function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return cloneArrayBuffer(object);case boolTag:case dateTag:return new Ctor(+object);case dataViewTag:return cloneDataView(object,isDeep);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:return cloneTypedArray(object,isDeep);case mapTag:return new Ctor;case numberTag:case stringTag:return new Ctor(object);case regexpTag:return cloneRegExp(object);case setTag:return new Ctor;case symbolTag:return cloneSymbol(object)}}
  2718. /**
  2719. * Inserts wrapper `details` in a comment at the top of the `source` body.
  2720. *
  2721. * @private
  2722. * @param {string} source The source to modify.
  2723. * @returns {Array} details The details to insert.
  2724. * @returns {string} Returns the modified source.
  2725. */function insertWrapDetails(source,details){var length=details.length;if(!length){return source}var lastIndex=length-1;details[lastIndex]=(length>1?"& ":"")+details[lastIndex];details=details.join(length>2?", ":" ");return source.replace(reWrapComment,"{\n/* [wrapped with "+details+"] */\n")}
  2726. /**
  2727. * Checks if `value` is a flattenable `arguments` object or array.
  2728. *
  2729. * @private
  2730. * @param {*} value The value to check.
  2731. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  2732. */function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}
  2733. /**
  2734. * Checks if `value` is a valid array-like index.
  2735. *
  2736. * @private
  2737. * @param {*} value The value to check.
  2738. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  2739. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  2740. */function isIndex(value,length){var type=typeof value;length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(type=="number"||type!="symbol"&&reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}
  2741. /**
  2742. * Checks if the given arguments are from an iteratee call.
  2743. *
  2744. * @private
  2745. * @param {*} value The potential iteratee value argument.
  2746. * @param {*} index The potential iteratee index or key argument.
  2747. * @param {*} object The potential iteratee object argument.
  2748. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  2749. * else `false`.
  2750. */function isIterateeCall(value,index,object){if(!isObject(object)){return false}var type=typeof index;if(type=="number"?isArrayLike(object)&&isIndex(index,object.length):type=="string"&&index in object){return eq(object[index],value)}return false}
  2751. /**
  2752. * Checks if `value` is a property name and not a property path.
  2753. *
  2754. * @private
  2755. * @param {*} value The value to check.
  2756. * @param {Object} [object] The object to query keys on.
  2757. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  2758. */function isKey(value,object){if(isArray(value)){return false}var type=typeof value;if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)){return true}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}
  2759. /**
  2760. * Checks if `value` is suitable for use as unique object key.
  2761. *
  2762. * @private
  2763. * @param {*} value The value to check.
  2764. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2765. */function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}
  2766. /**
  2767. * Checks if `func` has a lazy counterpart.
  2768. *
  2769. * @private
  2770. * @param {Function} func The function to check.
  2771. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  2772. * else `false`.
  2773. */function isLaziable(func){var funcName=getFuncName(func),other=lodash[funcName];if(typeof other!="function"||!(funcName in LazyWrapper.prototype)){return false}if(func===other){return true}var data=getData(other);return!!data&&func===data[0]}
  2774. /**
  2775. * Checks if `func` has its source masked.
  2776. *
  2777. * @private
  2778. * @param {Function} func The function to check.
  2779. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2780. */function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}
  2781. /**
  2782. * Checks if `func` is capable of being masked.
  2783. *
  2784. * @private
  2785. * @param {*} value The value to check.
  2786. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  2787. */var isMaskable=coreJsData?isFunction:stubFalse;
  2788. /**
  2789. * Checks if `value` is likely a prototype object.
  2790. *
  2791. * @private
  2792. * @param {*} value The value to check.
  2793. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  2794. */function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto;return value===proto}
  2795. /**
  2796. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  2797. *
  2798. * @private
  2799. * @param {*} value The value to check.
  2800. * @returns {boolean} Returns `true` if `value` if suitable for strict
  2801. * equality comparisons, else `false`.
  2802. */function isStrictComparable(value){return value===value&&!isObject(value)}
  2803. /**
  2804. * A specialized version of `matchesProperty` for source values suitable
  2805. * for strict equality comparisons, i.e. `===`.
  2806. *
  2807. * @private
  2808. * @param {string} key The key of the property to get.
  2809. * @param {*} srcValue The value to match.
  2810. * @returns {Function} Returns the new spec function.
  2811. */function matchesStrictComparable(key,srcValue){return function(object){if(object==null){return false}return object[key]===srcValue&&(srcValue!==undefined||key in Object(object))}}
  2812. /**
  2813. * A specialized version of `_.memoize` which clears the memoized function's
  2814. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  2815. *
  2816. * @private
  2817. * @param {Function} func The function to have its output memoized.
  2818. * @returns {Function} Returns the new memoized function.
  2819. */function memoizeCapped(func){var result=memoize(func,function(key){if(cache.size===MAX_MEMOIZE_SIZE){cache.clear()}return key});var cache=result.cache;return result}
  2820. /**
  2821. * Merges the function metadata of `source` into `data`.
  2822. *
  2823. * Merging metadata reduces the number of wrappers used to invoke a function.
  2824. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  2825. * may be applied regardless of execution order. Methods like `_.ary` and
  2826. * `_.rearg` modify function arguments, making the order in which they are
  2827. * executed important, preventing the merging of metadata. However, we make
  2828. * an exception for a safe combined case where curried functions have `_.ary`
  2829. * and or `_.rearg` applied.
  2830. *
  2831. * @private
  2832. * @param {Array} data The destination metadata.
  2833. * @param {Array} source The source metadata.
  2834. * @returns {Array} Returns `data`.
  2835. */function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask<(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG|WRAP_ARY_FLAG);var isCombo=srcBitmask==WRAP_ARY_FLAG&&bitmask==WRAP_CURRY_FLAG||srcBitmask==WRAP_ARY_FLAG&&bitmask==WRAP_REARG_FLAG&&data[7].length<=source[8]||srcBitmask==(WRAP_ARY_FLAG|WRAP_REARG_FLAG)&&source[7].length<=source[8]&&bitmask==WRAP_CURRY_FLAG;
  2836. // Exit early if metadata can't be merged.
  2837. if(!(isCommon||isCombo)){return data}
  2838. // Use source `thisArg` if available.
  2839. if(srcBitmask&WRAP_BIND_FLAG){data[2]=source[2];
  2840. // Set when currying a bound function.
  2841. newBitmask|=bitmask&WRAP_BIND_FLAG?0:WRAP_CURRY_BOUND_FLAG}
  2842. // Compose partial arguments.
  2843. var value=source[3];if(value){var partials=data[3];data[3]=partials?composeArgs(partials,value,source[4]):value;data[4]=partials?replaceHolders(data[3],PLACEHOLDER):source[4]}
  2844. // Compose partial right arguments.
  2845. value=source[5];if(value){partials=data[5];data[5]=partials?composeArgsRight(partials,value,source[6]):value;data[6]=partials?replaceHolders(data[5],PLACEHOLDER):source[6]}
  2846. // Use source `argPos` if available.
  2847. value=source[7];if(value){data[7]=value}
  2848. // Use source `ary` if it's smaller.
  2849. if(srcBitmask&WRAP_ARY_FLAG){data[8]=data[8]==null?source[8]:nativeMin(data[8],source[8])}
  2850. // Use source `arity` if one is not provided.
  2851. if(data[9]==null){data[9]=source[9]}
  2852. // Use source `func` and merge bitmasks.
  2853. data[0]=source[0];data[1]=newBitmask;return data}
  2854. /**
  2855. * This function is like
  2856. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2857. * except that it includes inherited enumerable properties.
  2858. *
  2859. * @private
  2860. * @param {Object} object The object to query.
  2861. * @returns {Array} Returns the array of property names.
  2862. */function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key)}}return result}
  2863. /**
  2864. * Converts `value` to a string using `Object.prototype.toString`.
  2865. *
  2866. * @private
  2867. * @param {*} value The value to convert.
  2868. * @returns {string} Returns the converted string.
  2869. */function objectToString(value){return nativeObjectToString.call(value)}
  2870. /**
  2871. * A specialized version of `baseRest` which transforms the rest array.
  2872. *
  2873. * @private
  2874. * @param {Function} func The function to apply a rest parameter to.
  2875. * @param {number} [start=func.length-1] The start position of the rest parameter.
  2876. * @param {Function} transform The rest array transform.
  2877. * @returns {Function} Returns the new function.
  2878. */function overRest(func,start,transform){start=nativeMax(start===undefined?func.length-1:start,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index<length){array[index]=args[start+index]}index=-1;var otherArgs=Array(start+1);while(++index<start){otherArgs[index]=args[index]}otherArgs[start]=transform(array);return apply(func,this,otherArgs)}}
  2879. /**
  2880. * Gets the parent value at `path` of `object`.
  2881. *
  2882. * @private
  2883. * @param {Object} object The object to query.
  2884. * @param {Array} path The path to get the parent value of.
  2885. * @returns {*} Returns the parent value.
  2886. */function parent(object,path){return path.length<2?object:baseGet(object,baseSlice(path,0,-1))}
  2887. /**
  2888. * Reorder `array` according to the specified indexes where the element at
  2889. * the first index is assigned as the first element, the element at
  2890. * the second index is assigned as the second element, and so on.
  2891. *
  2892. * @private
  2893. * @param {Array} array The array to reorder.
  2894. * @param {Array} indexes The arranged array indexes.
  2895. * @returns {Array} Returns `array`.
  2896. */function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=copyArray(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined}return array}
  2897. /**
  2898. * Sets metadata for `func`.
  2899. *
  2900. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  2901. * period of time, it will trip its breaker and transition to an identity
  2902. * function to avoid garbage collection pauses in V8. See
  2903. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  2904. * for more details.
  2905. *
  2906. * @private
  2907. * @param {Function} func The function to associate metadata with.
  2908. * @param {*} data The metadata.
  2909. * @returns {Function} Returns `func`.
  2910. */var setData=shortOut(baseSetData);
  2911. /**
  2912. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  2913. *
  2914. * @private
  2915. * @param {Function} func The function to delay.
  2916. * @param {number} wait The number of milliseconds to delay invocation.
  2917. * @returns {number|Object} Returns the timer id or timeout object.
  2918. */var setTimeout=ctxSetTimeout||function(func,wait){return root.setTimeout(func,wait)};
  2919. /**
  2920. * Sets the `toString` method of `func` to return `string`.
  2921. *
  2922. * @private
  2923. * @param {Function} func The function to modify.
  2924. * @param {Function} string The `toString` result.
  2925. * @returns {Function} Returns `func`.
  2926. */var setToString=shortOut(baseSetToString);
  2927. /**
  2928. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  2929. * with wrapper details in a comment at the top of the source body.
  2930. *
  2931. * @private
  2932. * @param {Function} wrapper The function to modify.
  2933. * @param {Function} reference The reference function.
  2934. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2935. * @returns {Function} Returns `wrapper`.
  2936. */function setWrapToString(wrapper,reference,bitmask){var source=reference+"";return setToString(wrapper,insertWrapDetails(source,updateWrapDetails(getWrapDetails(source),bitmask)))}
  2937. /**
  2938. * Creates a function that'll short out and invoke `identity` instead
  2939. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  2940. * milliseconds.
  2941. *
  2942. * @private
  2943. * @param {Function} func The function to restrict.
  2944. * @returns {Function} Returns the new shortable function.
  2945. */function shortOut(func){var count=0,lastCalled=0;return function(){var stamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT){return arguments[0]}}else{count=0}return func.apply(undefined,arguments)}}
  2946. /**
  2947. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  2948. *
  2949. * @private
  2950. * @param {Array} array The array to shuffle.
  2951. * @param {number} [size=array.length] The size of `array`.
  2952. * @returns {Array} Returns `array`.
  2953. */function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;size=size===undefined?length:size;while(++index<size){var rand=baseRandom(index,lastIndex),value=array[rand];array[rand]=array[index];array[index]=value}array.length=size;return array}
  2954. /**
  2955. * Converts `string` to a property path array.
  2956. *
  2957. * @private
  2958. * @param {string} string The string to convert.
  2959. * @returns {Array} Returns the property path array.
  2960. */var stringToPath=memoizeCapped(function(string){var result=[];if(string.charCodeAt(0)===46/* . */){result.push("")}string.replace(rePropName,function(match,number,quote,subString){result.push(quote?subString.replace(reEscapeChar,"$1"):number||match)});return result});
  2961. /**
  2962. * Converts `value` to a string key if it's not a string or symbol.
  2963. *
  2964. * @private
  2965. * @param {*} value The value to inspect.
  2966. * @returns {string|symbol} Returns the key.
  2967. */function toKey(value){if(typeof value=="string"||isSymbol(value)){return value}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}
  2968. /**
  2969. * Converts `func` to its source code.
  2970. *
  2971. * @private
  2972. * @param {Function} func The function to convert.
  2973. * @returns {string} Returns the source code.
  2974. */function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}
  2975. /**
  2976. * Updates wrapper `details` based on `bitmask` flags.
  2977. *
  2978. * @private
  2979. * @returns {Array} details The details to modify.
  2980. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  2981. * @returns {Array} Returns `details`.
  2982. */function updateWrapDetails(details,bitmask){arrayEach(wrapFlags,function(pair){var value="_."+pair[0];if(bitmask&pair[1]&&!arrayIncludes(details,value)){details.push(value)}});return details.sort()}
  2983. /**
  2984. * Creates a clone of `wrapper`.
  2985. *
  2986. * @private
  2987. * @param {Object} wrapper The wrapper to clone.
  2988. * @returns {Object} Returns the cloned wrapper.
  2989. */function wrapperClone(wrapper){if(wrapper instanceof LazyWrapper){return wrapper.clone()}var result=new LodashWrapper(wrapper.__wrapped__,wrapper.__chain__);result.__actions__=copyArray(wrapper.__actions__);result.__index__=wrapper.__index__;result.__values__=wrapper.__values__;return result}
  2990. /*------------------------------------------------------------------------*/
  2991. /**
  2992. * Creates an array of elements split into groups the length of `size`.
  2993. * If `array` can't be split evenly, the final chunk will be the remaining
  2994. * elements.
  2995. *
  2996. * @static
  2997. * @memberOf _
  2998. * @since 3.0.0
  2999. * @category Array
  3000. * @param {Array} array The array to process.
  3001. * @param {number} [size=1] The length of each chunk
  3002. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3003. * @returns {Array} Returns the new array of chunks.
  3004. * @example
  3005. *
  3006. * _.chunk(['a', 'b', 'c', 'd'], 2);
  3007. * // => [['a', 'b'], ['c', 'd']]
  3008. *
  3009. * _.chunk(['a', 'b', 'c', 'd'], 3);
  3010. * // => [['a', 'b', 'c'], ['d']]
  3011. */function chunk(array,size,guard){if(guard?isIterateeCall(array,size,guard):size===undefined){size=1}else{size=nativeMax(toInteger(size),0)}var length=array==null?0:array.length;if(!length||size<1){return[]}var index=0,resIndex=0,result=Array(nativeCeil(length/size));while(index<length){result[resIndex++]=baseSlice(array,index,index+=size)}return result}
  3012. /**
  3013. * Creates an array with all falsey values removed. The values `false`, `null`,
  3014. * `0`, `""`, `undefined`, and `NaN` are falsey.
  3015. *
  3016. * @static
  3017. * @memberOf _
  3018. * @since 0.1.0
  3019. * @category Array
  3020. * @param {Array} array The array to compact.
  3021. * @returns {Array} Returns the new array of filtered values.
  3022. * @example
  3023. *
  3024. * _.compact([0, 1, false, 2, '', 3]);
  3025. * // => [1, 2, 3]
  3026. */function compact(array){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value){result[resIndex++]=value}}return result}
  3027. /**
  3028. * Creates a new array concatenating `array` with any additional arrays
  3029. * and/or values.
  3030. *
  3031. * @static
  3032. * @memberOf _
  3033. * @since 4.0.0
  3034. * @category Array
  3035. * @param {Array} array The array to concatenate.
  3036. * @param {...*} [values] The values to concatenate.
  3037. * @returns {Array} Returns the new concatenated array.
  3038. * @example
  3039. *
  3040. * var array = [1];
  3041. * var other = _.concat(array, 2, [3], [[4]]);
  3042. *
  3043. * console.log(other);
  3044. * // => [1, 2, 3, [4]]
  3045. *
  3046. * console.log(array);
  3047. * // => [1]
  3048. */function concat(){var length=arguments.length;if(!length){return[]}var args=Array(length-1),array=arguments[0],index=length;while(index--){args[index-1]=arguments[index]}return arrayPush(isArray(array)?copyArray(array):[array],baseFlatten(args,1))}
  3049. /**
  3050. * Creates an array of `array` values not included in the other given arrays
  3051. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3052. * for equality comparisons. The order and references of result values are
  3053. * determined by the first array.
  3054. *
  3055. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  3056. *
  3057. * @static
  3058. * @memberOf _
  3059. * @since 0.1.0
  3060. * @category Array
  3061. * @param {Array} array The array to inspect.
  3062. * @param {...Array} [values] The values to exclude.
  3063. * @returns {Array} Returns the new array of filtered values.
  3064. * @see _.without, _.xor
  3065. * @example
  3066. *
  3067. * _.difference([2, 1], [2, 3]);
  3068. * // => [1]
  3069. */var difference=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true)):[]});
  3070. /**
  3071. * This method is like `_.difference` except that it accepts `iteratee` which
  3072. * is invoked for each element of `array` and `values` to generate the criterion
  3073. * by which they're compared. The order and references of result values are
  3074. * determined by the first array. The iteratee is invoked with one argument:
  3075. * (value).
  3076. *
  3077. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  3078. *
  3079. * @static
  3080. * @memberOf _
  3081. * @since 4.0.0
  3082. * @category Array
  3083. * @param {Array} array The array to inspect.
  3084. * @param {...Array} [values] The values to exclude.
  3085. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3086. * @returns {Array} Returns the new array of filtered values.
  3087. * @example
  3088. *
  3089. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  3090. * // => [1.2]
  3091. *
  3092. * // The `_.property` iteratee shorthand.
  3093. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  3094. * // => [{ 'x': 2 }]
  3095. */var differenceBy=baseRest(function(array,values){var iteratee=last(values);if(isArrayLikeObject(iteratee)){iteratee=undefined}return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),getIteratee(iteratee,2)):[]});
  3096. /**
  3097. * This method is like `_.difference` except that it accepts `comparator`
  3098. * which is invoked to compare elements of `array` to `values`. The order and
  3099. * references of result values are determined by the first array. The comparator
  3100. * is invoked with two arguments: (arrVal, othVal).
  3101. *
  3102. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  3103. *
  3104. * @static
  3105. * @memberOf _
  3106. * @since 4.0.0
  3107. * @category Array
  3108. * @param {Array} array The array to inspect.
  3109. * @param {...Array} [values] The values to exclude.
  3110. * @param {Function} [comparator] The comparator invoked per element.
  3111. * @returns {Array} Returns the new array of filtered values.
  3112. * @example
  3113. *
  3114. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  3115. *
  3116. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  3117. * // => [{ 'x': 2, 'y': 1 }]
  3118. */var differenceWith=baseRest(function(array,values){var comparator=last(values);if(isArrayLikeObject(comparator)){comparator=undefined}return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),undefined,comparator):[]});
  3119. /**
  3120. * Creates a slice of `array` with `n` elements dropped from the beginning.
  3121. *
  3122. * @static
  3123. * @memberOf _
  3124. * @since 0.5.0
  3125. * @category Array
  3126. * @param {Array} array The array to query.
  3127. * @param {number} [n=1] The number of elements to drop.
  3128. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3129. * @returns {Array} Returns the slice of `array`.
  3130. * @example
  3131. *
  3132. * _.drop([1, 2, 3]);
  3133. * // => [2, 3]
  3134. *
  3135. * _.drop([1, 2, 3], 2);
  3136. * // => [3]
  3137. *
  3138. * _.drop([1, 2, 3], 5);
  3139. * // => []
  3140. *
  3141. * _.drop([1, 2, 3], 0);
  3142. * // => [1, 2, 3]
  3143. */function drop(array,n,guard){var length=array==null?0:array.length;if(!length){return[]}n=guard||n===undefined?1:toInteger(n);return baseSlice(array,n<0?0:n,length)}
  3144. /**
  3145. * Creates a slice of `array` with `n` elements dropped from the end.
  3146. *
  3147. * @static
  3148. * @memberOf _
  3149. * @since 3.0.0
  3150. * @category Array
  3151. * @param {Array} array The array to query.
  3152. * @param {number} [n=1] The number of elements to drop.
  3153. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3154. * @returns {Array} Returns the slice of `array`.
  3155. * @example
  3156. *
  3157. * _.dropRight([1, 2, 3]);
  3158. * // => [1, 2]
  3159. *
  3160. * _.dropRight([1, 2, 3], 2);
  3161. * // => [1]
  3162. *
  3163. * _.dropRight([1, 2, 3], 5);
  3164. * // => []
  3165. *
  3166. * _.dropRight([1, 2, 3], 0);
  3167. * // => [1, 2, 3]
  3168. */function dropRight(array,n,guard){var length=array==null?0:array.length;if(!length){return[]}n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,0,n<0?0:n)}
  3169. /**
  3170. * Creates a slice of `array` excluding elements dropped from the end.
  3171. * Elements are dropped until `predicate` returns falsey. The predicate is
  3172. * invoked with three arguments: (value, index, array).
  3173. *
  3174. * @static
  3175. * @memberOf _
  3176. * @since 3.0.0
  3177. * @category Array
  3178. * @param {Array} array The array to query.
  3179. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3180. * @returns {Array} Returns the slice of `array`.
  3181. * @example
  3182. *
  3183. * var users = [
  3184. * { 'user': 'barney', 'active': true },
  3185. * { 'user': 'fred', 'active': false },
  3186. * { 'user': 'pebbles', 'active': false }
  3187. * ];
  3188. *
  3189. * _.dropRightWhile(users, function(o) { return !o.active; });
  3190. * // => objects for ['barney']
  3191. *
  3192. * // The `_.matches` iteratee shorthand.
  3193. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  3194. * // => objects for ['barney', 'fred']
  3195. *
  3196. * // The `_.matchesProperty` iteratee shorthand.
  3197. * _.dropRightWhile(users, ['active', false]);
  3198. * // => objects for ['barney']
  3199. *
  3200. * // The `_.property` iteratee shorthand.
  3201. * _.dropRightWhile(users, 'active');
  3202. * // => objects for ['barney', 'fred', 'pebbles']
  3203. */function dropRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true,true):[]}
  3204. /**
  3205. * Creates a slice of `array` excluding elements dropped from the beginning.
  3206. * Elements are dropped until `predicate` returns falsey. The predicate is
  3207. * invoked with three arguments: (value, index, array).
  3208. *
  3209. * @static
  3210. * @memberOf _
  3211. * @since 3.0.0
  3212. * @category Array
  3213. * @param {Array} array The array to query.
  3214. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3215. * @returns {Array} Returns the slice of `array`.
  3216. * @example
  3217. *
  3218. * var users = [
  3219. * { 'user': 'barney', 'active': false },
  3220. * { 'user': 'fred', 'active': false },
  3221. * { 'user': 'pebbles', 'active': true }
  3222. * ];
  3223. *
  3224. * _.dropWhile(users, function(o) { return !o.active; });
  3225. * // => objects for ['pebbles']
  3226. *
  3227. * // The `_.matches` iteratee shorthand.
  3228. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  3229. * // => objects for ['fred', 'pebbles']
  3230. *
  3231. * // The `_.matchesProperty` iteratee shorthand.
  3232. * _.dropWhile(users, ['active', false]);
  3233. * // => objects for ['pebbles']
  3234. *
  3235. * // The `_.property` iteratee shorthand.
  3236. * _.dropWhile(users, 'active');
  3237. * // => objects for ['barney', 'fred', 'pebbles']
  3238. */function dropWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true):[]}
  3239. /**
  3240. * Fills elements of `array` with `value` from `start` up to, but not
  3241. * including, `end`.
  3242. *
  3243. * **Note:** This method mutates `array`.
  3244. *
  3245. * @static
  3246. * @memberOf _
  3247. * @since 3.2.0
  3248. * @category Array
  3249. * @param {Array} array The array to fill.
  3250. * @param {*} value The value to fill `array` with.
  3251. * @param {number} [start=0] The start position.
  3252. * @param {number} [end=array.length] The end position.
  3253. * @returns {Array} Returns `array`.
  3254. * @example
  3255. *
  3256. * var array = [1, 2, 3];
  3257. *
  3258. * _.fill(array, 'a');
  3259. * console.log(array);
  3260. * // => ['a', 'a', 'a']
  3261. *
  3262. * _.fill(Array(3), 2);
  3263. * // => [2, 2, 2]
  3264. *
  3265. * _.fill([4, 6, 8, 10], '*', 1, 3);
  3266. * // => [4, '*', '*', 10]
  3267. */function fill(array,value,start,end){var length=array==null?0:array.length;if(!length){return[]}if(start&&typeof start!="number"&&isIterateeCall(array,value,start)){start=0;end=length}return baseFill(array,value,start,end)}
  3268. /**
  3269. * This method is like `_.find` except that it returns the index of the first
  3270. * element `predicate` returns truthy for instead of the element itself.
  3271. *
  3272. * @static
  3273. * @memberOf _
  3274. * @since 1.1.0
  3275. * @category Array
  3276. * @param {Array} array The array to inspect.
  3277. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3278. * @param {number} [fromIndex=0] The index to search from.
  3279. * @returns {number} Returns the index of the found element, else `-1`.
  3280. * @example
  3281. *
  3282. * var users = [
  3283. * { 'user': 'barney', 'active': false },
  3284. * { 'user': 'fred', 'active': false },
  3285. * { 'user': 'pebbles', 'active': true }
  3286. * ];
  3287. *
  3288. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  3289. * // => 0
  3290. *
  3291. * // The `_.matches` iteratee shorthand.
  3292. * _.findIndex(users, { 'user': 'fred', 'active': false });
  3293. * // => 1
  3294. *
  3295. * // The `_.matchesProperty` iteratee shorthand.
  3296. * _.findIndex(users, ['active', false]);
  3297. * // => 0
  3298. *
  3299. * // The `_.property` iteratee shorthand.
  3300. * _.findIndex(users, 'active');
  3301. * // => 2
  3302. */function findIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length){return-1}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0)}return baseFindIndex(array,getIteratee(predicate,3),index)}
  3303. /**
  3304. * This method is like `_.findIndex` except that it iterates over elements
  3305. * of `collection` from right to left.
  3306. *
  3307. * @static
  3308. * @memberOf _
  3309. * @since 2.0.0
  3310. * @category Array
  3311. * @param {Array} array The array to inspect.
  3312. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3313. * @param {number} [fromIndex=array.length-1] The index to search from.
  3314. * @returns {number} Returns the index of the found element, else `-1`.
  3315. * @example
  3316. *
  3317. * var users = [
  3318. * { 'user': 'barney', 'active': true },
  3319. * { 'user': 'fred', 'active': false },
  3320. * { 'user': 'pebbles', 'active': false }
  3321. * ];
  3322. *
  3323. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  3324. * // => 2
  3325. *
  3326. * // The `_.matches` iteratee shorthand.
  3327. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  3328. * // => 0
  3329. *
  3330. * // The `_.matchesProperty` iteratee shorthand.
  3331. * _.findLastIndex(users, ['active', false]);
  3332. * // => 2
  3333. *
  3334. * // The `_.property` iteratee shorthand.
  3335. * _.findLastIndex(users, 'active');
  3336. * // => 0
  3337. */function findLastIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length){return-1}var index=length-1;if(fromIndex!==undefined){index=toInteger(fromIndex);index=fromIndex<0?nativeMax(length+index,0):nativeMin(index,length-1)}return baseFindIndex(array,getIteratee(predicate,3),index,true)}
  3338. /**
  3339. * Flattens `array` a single level deep.
  3340. *
  3341. * @static
  3342. * @memberOf _
  3343. * @since 0.1.0
  3344. * @category Array
  3345. * @param {Array} array The array to flatten.
  3346. * @returns {Array} Returns the new flattened array.
  3347. * @example
  3348. *
  3349. * _.flatten([1, [2, [3, [4]], 5]]);
  3350. * // => [1, 2, [3, [4]], 5]
  3351. */function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[]}
  3352. /**
  3353. * Recursively flattens `array`.
  3354. *
  3355. * @static
  3356. * @memberOf _
  3357. * @since 3.0.0
  3358. * @category Array
  3359. * @param {Array} array The array to flatten.
  3360. * @returns {Array} Returns the new flattened array.
  3361. * @example
  3362. *
  3363. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  3364. * // => [1, 2, 3, 4, 5]
  3365. */function flattenDeep(array){var length=array==null?0:array.length;return length?baseFlatten(array,INFINITY):[]}
  3366. /**
  3367. * Recursively flatten `array` up to `depth` times.
  3368. *
  3369. * @static
  3370. * @memberOf _
  3371. * @since 4.4.0
  3372. * @category Array
  3373. * @param {Array} array The array to flatten.
  3374. * @param {number} [depth=1] The maximum recursion depth.
  3375. * @returns {Array} Returns the new flattened array.
  3376. * @example
  3377. *
  3378. * var array = [1, [2, [3, [4]], 5]];
  3379. *
  3380. * _.flattenDepth(array, 1);
  3381. * // => [1, 2, [3, [4]], 5]
  3382. *
  3383. * _.flattenDepth(array, 2);
  3384. * // => [1, 2, 3, [4], 5]
  3385. */function flattenDepth(array,depth){var length=array==null?0:array.length;if(!length){return[]}depth=depth===undefined?1:toInteger(depth);return baseFlatten(array,depth)}
  3386. /**
  3387. * The inverse of `_.toPairs`; this method returns an object composed
  3388. * from key-value `pairs`.
  3389. *
  3390. * @static
  3391. * @memberOf _
  3392. * @since 4.0.0
  3393. * @category Array
  3394. * @param {Array} pairs The key-value pairs.
  3395. * @returns {Object} Returns the new object.
  3396. * @example
  3397. *
  3398. * _.fromPairs([['a', 1], ['b', 2]]);
  3399. * // => { 'a': 1, 'b': 2 }
  3400. */function fromPairs(pairs){var index=-1,length=pairs==null?0:pairs.length,result={};while(++index<length){var pair=pairs[index];result[pair[0]]=pair[1]}return result}
  3401. /**
  3402. * Gets the first element of `array`.
  3403. *
  3404. * @static
  3405. * @memberOf _
  3406. * @since 0.1.0
  3407. * @alias first
  3408. * @category Array
  3409. * @param {Array} array The array to query.
  3410. * @returns {*} Returns the first element of `array`.
  3411. * @example
  3412. *
  3413. * _.head([1, 2, 3]);
  3414. * // => 1
  3415. *
  3416. * _.head([]);
  3417. * // => undefined
  3418. */function head(array){return array&&array.length?array[0]:undefined}
  3419. /**
  3420. * Gets the index at which the first occurrence of `value` is found in `array`
  3421. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3422. * for equality comparisons. If `fromIndex` is negative, it's used as the
  3423. * offset from the end of `array`.
  3424. *
  3425. * @static
  3426. * @memberOf _
  3427. * @since 0.1.0
  3428. * @category Array
  3429. * @param {Array} array The array to inspect.
  3430. * @param {*} value The value to search for.
  3431. * @param {number} [fromIndex=0] The index to search from.
  3432. * @returns {number} Returns the index of the matched value, else `-1`.
  3433. * @example
  3434. *
  3435. * _.indexOf([1, 2, 1, 2], 2);
  3436. * // => 1
  3437. *
  3438. * // Search from the `fromIndex`.
  3439. * _.indexOf([1, 2, 1, 2], 2, 2);
  3440. * // => 3
  3441. */function indexOf(array,value,fromIndex){var length=array==null?0:array.length;if(!length){return-1}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0)}return baseIndexOf(array,value,index)}
  3442. /**
  3443. * Gets all but the last element of `array`.
  3444. *
  3445. * @static
  3446. * @memberOf _
  3447. * @since 0.1.0
  3448. * @category Array
  3449. * @param {Array} array The array to query.
  3450. * @returns {Array} Returns the slice of `array`.
  3451. * @example
  3452. *
  3453. * _.initial([1, 2, 3]);
  3454. * // => [1, 2]
  3455. */function initial(array){var length=array==null?0:array.length;return length?baseSlice(array,0,-1):[]}
  3456. /**
  3457. * Creates an array of unique values that are included in all given arrays
  3458. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3459. * for equality comparisons. The order and references of result values are
  3460. * determined by the first array.
  3461. *
  3462. * @static
  3463. * @memberOf _
  3464. * @since 0.1.0
  3465. * @category Array
  3466. * @param {...Array} [arrays] The arrays to inspect.
  3467. * @returns {Array} Returns the new array of intersecting values.
  3468. * @example
  3469. *
  3470. * _.intersection([2, 1], [2, 3]);
  3471. * // => [2]
  3472. */var intersection=baseRest(function(arrays){var mapped=arrayMap(arrays,castArrayLikeObject);return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped):[]});
  3473. /**
  3474. * This method is like `_.intersection` except that it accepts `iteratee`
  3475. * which is invoked for each element of each `arrays` to generate the criterion
  3476. * by which they're compared. The order and references of result values are
  3477. * determined by the first array. The iteratee is invoked with one argument:
  3478. * (value).
  3479. *
  3480. * @static
  3481. * @memberOf _
  3482. * @since 4.0.0
  3483. * @category Array
  3484. * @param {...Array} [arrays] The arrays to inspect.
  3485. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3486. * @returns {Array} Returns the new array of intersecting values.
  3487. * @example
  3488. *
  3489. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  3490. * // => [2.1]
  3491. *
  3492. * // The `_.property` iteratee shorthand.
  3493. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  3494. * // => [{ 'x': 1 }]
  3495. */var intersectionBy=baseRest(function(arrays){var iteratee=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);if(iteratee===last(mapped)){iteratee=undefined}else{mapped.pop()}return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,getIteratee(iteratee,2)):[]});
  3496. /**
  3497. * This method is like `_.intersection` except that it accepts `comparator`
  3498. * which is invoked to compare elements of `arrays`. The order and references
  3499. * of result values are determined by the first array. The comparator is
  3500. * invoked with two arguments: (arrVal, othVal).
  3501. *
  3502. * @static
  3503. * @memberOf _
  3504. * @since 4.0.0
  3505. * @category Array
  3506. * @param {...Array} [arrays] The arrays to inspect.
  3507. * @param {Function} [comparator] The comparator invoked per element.
  3508. * @returns {Array} Returns the new array of intersecting values.
  3509. * @example
  3510. *
  3511. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  3512. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  3513. *
  3514. * _.intersectionWith(objects, others, _.isEqual);
  3515. * // => [{ 'x': 1, 'y': 2 }]
  3516. */var intersectionWith=baseRest(function(arrays){var comparator=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);comparator=typeof comparator=="function"?comparator:undefined;if(comparator){mapped.pop()}return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,undefined,comparator):[]});
  3517. /**
  3518. * Converts all elements in `array` into a string separated by `separator`.
  3519. *
  3520. * @static
  3521. * @memberOf _
  3522. * @since 4.0.0
  3523. * @category Array
  3524. * @param {Array} array The array to convert.
  3525. * @param {string} [separator=','] The element separator.
  3526. * @returns {string} Returns the joined string.
  3527. * @example
  3528. *
  3529. * _.join(['a', 'b', 'c'], '~');
  3530. * // => 'a~b~c'
  3531. */function join(array,separator){return array==null?"":nativeJoin.call(array,separator)}
  3532. /**
  3533. * Gets the last element of `array`.
  3534. *
  3535. * @static
  3536. * @memberOf _
  3537. * @since 0.1.0
  3538. * @category Array
  3539. * @param {Array} array The array to query.
  3540. * @returns {*} Returns the last element of `array`.
  3541. * @example
  3542. *
  3543. * _.last([1, 2, 3]);
  3544. * // => 3
  3545. */function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined}
  3546. /**
  3547. * This method is like `_.indexOf` except that it iterates over elements of
  3548. * `array` from right to left.
  3549. *
  3550. * @static
  3551. * @memberOf _
  3552. * @since 0.1.0
  3553. * @category Array
  3554. * @param {Array} array The array to inspect.
  3555. * @param {*} value The value to search for.
  3556. * @param {number} [fromIndex=array.length-1] The index to search from.
  3557. * @returns {number} Returns the index of the matched value, else `-1`.
  3558. * @example
  3559. *
  3560. * _.lastIndexOf([1, 2, 1, 2], 2);
  3561. * // => 3
  3562. *
  3563. * // Search from the `fromIndex`.
  3564. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  3565. * // => 1
  3566. */function lastIndexOf(array,value,fromIndex){var length=array==null?0:array.length;if(!length){return-1}var index=length;if(fromIndex!==undefined){index=toInteger(fromIndex);index=index<0?nativeMax(length+index,0):nativeMin(index,length-1)}return value===value?strictLastIndexOf(array,value,index):baseFindIndex(array,baseIsNaN,index,true)}
  3567. /**
  3568. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  3569. * element from the end is returned.
  3570. *
  3571. * @static
  3572. * @memberOf _
  3573. * @since 4.11.0
  3574. * @category Array
  3575. * @param {Array} array The array to query.
  3576. * @param {number} [n=0] The index of the element to return.
  3577. * @returns {*} Returns the nth element of `array`.
  3578. * @example
  3579. *
  3580. * var array = ['a', 'b', 'c', 'd'];
  3581. *
  3582. * _.nth(array, 1);
  3583. * // => 'b'
  3584. *
  3585. * _.nth(array, -2);
  3586. * // => 'c';
  3587. */function nth(array,n){return array&&array.length?baseNth(array,toInteger(n)):undefined}
  3588. /**
  3589. * Removes all given values from `array` using
  3590. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3591. * for equality comparisons.
  3592. *
  3593. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  3594. * to remove elements from an array by predicate.
  3595. *
  3596. * @static
  3597. * @memberOf _
  3598. * @since 2.0.0
  3599. * @category Array
  3600. * @param {Array} array The array to modify.
  3601. * @param {...*} [values] The values to remove.
  3602. * @returns {Array} Returns `array`.
  3603. * @example
  3604. *
  3605. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  3606. *
  3607. * _.pull(array, 'a', 'c');
  3608. * console.log(array);
  3609. * // => ['b', 'b']
  3610. */var pull=baseRest(pullAll);
  3611. /**
  3612. * This method is like `_.pull` except that it accepts an array of values to remove.
  3613. *
  3614. * **Note:** Unlike `_.difference`, this method mutates `array`.
  3615. *
  3616. * @static
  3617. * @memberOf _
  3618. * @since 4.0.0
  3619. * @category Array
  3620. * @param {Array} array The array to modify.
  3621. * @param {Array} values The values to remove.
  3622. * @returns {Array} Returns `array`.
  3623. * @example
  3624. *
  3625. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  3626. *
  3627. * _.pullAll(array, ['a', 'c']);
  3628. * console.log(array);
  3629. * // => ['b', 'b']
  3630. */function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array}
  3631. /**
  3632. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  3633. * invoked for each element of `array` and `values` to generate the criterion
  3634. * by which they're compared. The iteratee is invoked with one argument: (value).
  3635. *
  3636. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  3637. *
  3638. * @static
  3639. * @memberOf _
  3640. * @since 4.0.0
  3641. * @category Array
  3642. * @param {Array} array The array to modify.
  3643. * @param {Array} values The values to remove.
  3644. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3645. * @returns {Array} Returns `array`.
  3646. * @example
  3647. *
  3648. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  3649. *
  3650. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  3651. * console.log(array);
  3652. * // => [{ 'x': 2 }]
  3653. */function pullAllBy(array,values,iteratee){return array&&array.length&&values&&values.length?basePullAll(array,values,getIteratee(iteratee,2)):array}
  3654. /**
  3655. * This method is like `_.pullAll` except that it accepts `comparator` which
  3656. * is invoked to compare elements of `array` to `values`. The comparator is
  3657. * invoked with two arguments: (arrVal, othVal).
  3658. *
  3659. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  3660. *
  3661. * @static
  3662. * @memberOf _
  3663. * @since 4.6.0
  3664. * @category Array
  3665. * @param {Array} array The array to modify.
  3666. * @param {Array} values The values to remove.
  3667. * @param {Function} [comparator] The comparator invoked per element.
  3668. * @returns {Array} Returns `array`.
  3669. * @example
  3670. *
  3671. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  3672. *
  3673. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  3674. * console.log(array);
  3675. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  3676. */function pullAllWith(array,values,comparator){return array&&array.length&&values&&values.length?basePullAll(array,values,undefined,comparator):array}
  3677. /**
  3678. * Removes elements from `array` corresponding to `indexes` and returns an
  3679. * array of removed elements.
  3680. *
  3681. * **Note:** Unlike `_.at`, this method mutates `array`.
  3682. *
  3683. * @static
  3684. * @memberOf _
  3685. * @since 3.0.0
  3686. * @category Array
  3687. * @param {Array} array The array to modify.
  3688. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  3689. * @returns {Array} Returns the new array of removed elements.
  3690. * @example
  3691. *
  3692. * var array = ['a', 'b', 'c', 'd'];
  3693. * var pulled = _.pullAt(array, [1, 3]);
  3694. *
  3695. * console.log(array);
  3696. * // => ['a', 'c']
  3697. *
  3698. * console.log(pulled);
  3699. * // => ['b', 'd']
  3700. */var pullAt=flatRest(function(array,indexes){var length=array==null?0:array.length,result=baseAt(array,indexes);basePullAt(array,arrayMap(indexes,function(index){return isIndex(index,length)?+index:index}).sort(compareAscending));return result});
  3701. /**
  3702. * Removes all elements from `array` that `predicate` returns truthy for
  3703. * and returns an array of the removed elements. The predicate is invoked
  3704. * with three arguments: (value, index, array).
  3705. *
  3706. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  3707. * to pull elements from an array by value.
  3708. *
  3709. * @static
  3710. * @memberOf _
  3711. * @since 2.0.0
  3712. * @category Array
  3713. * @param {Array} array The array to modify.
  3714. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3715. * @returns {Array} Returns the new array of removed elements.
  3716. * @example
  3717. *
  3718. * var array = [1, 2, 3, 4];
  3719. * var evens = _.remove(array, function(n) {
  3720. * return n % 2 == 0;
  3721. * });
  3722. *
  3723. * console.log(array);
  3724. * // => [1, 3]
  3725. *
  3726. * console.log(evens);
  3727. * // => [2, 4]
  3728. */function remove(array,predicate){var result=[];if(!(array&&array.length)){return result}var index=-1,indexes=[],length=array.length;predicate=getIteratee(predicate,3);while(++index<length){var value=array[index];if(predicate(value,index,array)){result.push(value);indexes.push(index)}}basePullAt(array,indexes);return result}
  3729. /**
  3730. * Reverses `array` so that the first element becomes the last, the second
  3731. * element becomes the second to last, and so on.
  3732. *
  3733. * **Note:** This method mutates `array` and is based on
  3734. * [`Array#reverse`](https://mdn.io/Array/reverse).
  3735. *
  3736. * @static
  3737. * @memberOf _
  3738. * @since 4.0.0
  3739. * @category Array
  3740. * @param {Array} array The array to modify.
  3741. * @returns {Array} Returns `array`.
  3742. * @example
  3743. *
  3744. * var array = [1, 2, 3];
  3745. *
  3746. * _.reverse(array);
  3747. * // => [3, 2, 1]
  3748. *
  3749. * console.log(array);
  3750. * // => [3, 2, 1]
  3751. */function reverse(array){return array==null?array:nativeReverse.call(array)}
  3752. /**
  3753. * Creates a slice of `array` from `start` up to, but not including, `end`.
  3754. *
  3755. * **Note:** This method is used instead of
  3756. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  3757. * returned.
  3758. *
  3759. * @static
  3760. * @memberOf _
  3761. * @since 3.0.0
  3762. * @category Array
  3763. * @param {Array} array The array to slice.
  3764. * @param {number} [start=0] The start position.
  3765. * @param {number} [end=array.length] The end position.
  3766. * @returns {Array} Returns the slice of `array`.
  3767. */function slice(array,start,end){var length=array==null?0:array.length;if(!length){return[]}if(end&&typeof end!="number"&&isIterateeCall(array,start,end)){start=0;end=length}else{start=start==null?0:toInteger(start);end=end===undefined?length:toInteger(end)}return baseSlice(array,start,end)}
  3768. /**
  3769. * Uses a binary search to determine the lowest index at which `value`
  3770. * should be inserted into `array` in order to maintain its sort order.
  3771. *
  3772. * @static
  3773. * @memberOf _
  3774. * @since 0.1.0
  3775. * @category Array
  3776. * @param {Array} array The sorted array to inspect.
  3777. * @param {*} value The value to evaluate.
  3778. * @returns {number} Returns the index at which `value` should be inserted
  3779. * into `array`.
  3780. * @example
  3781. *
  3782. * _.sortedIndex([30, 50], 40);
  3783. * // => 1
  3784. */function sortedIndex(array,value){return baseSortedIndex(array,value)}
  3785. /**
  3786. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  3787. * which is invoked for `value` and each element of `array` to compute their
  3788. * sort ranking. The iteratee is invoked with one argument: (value).
  3789. *
  3790. * @static
  3791. * @memberOf _
  3792. * @since 4.0.0
  3793. * @category Array
  3794. * @param {Array} array The sorted array to inspect.
  3795. * @param {*} value The value to evaluate.
  3796. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3797. * @returns {number} Returns the index at which `value` should be inserted
  3798. * into `array`.
  3799. * @example
  3800. *
  3801. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  3802. *
  3803. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  3804. * // => 0
  3805. *
  3806. * // The `_.property` iteratee shorthand.
  3807. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  3808. * // => 0
  3809. */function sortedIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2))}
  3810. /**
  3811. * This method is like `_.indexOf` except that it performs a binary
  3812. * search on a sorted `array`.
  3813. *
  3814. * @static
  3815. * @memberOf _
  3816. * @since 4.0.0
  3817. * @category Array
  3818. * @param {Array} array The array to inspect.
  3819. * @param {*} value The value to search for.
  3820. * @returns {number} Returns the index of the matched value, else `-1`.
  3821. * @example
  3822. *
  3823. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  3824. * // => 1
  3825. */function sortedIndexOf(array,value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value);if(index<length&&eq(array[index],value)){return index}}return-1}
  3826. /**
  3827. * This method is like `_.sortedIndex` except that it returns the highest
  3828. * index at which `value` should be inserted into `array` in order to
  3829. * maintain its sort order.
  3830. *
  3831. * @static
  3832. * @memberOf _
  3833. * @since 3.0.0
  3834. * @category Array
  3835. * @param {Array} array The sorted array to inspect.
  3836. * @param {*} value The value to evaluate.
  3837. * @returns {number} Returns the index at which `value` should be inserted
  3838. * into `array`.
  3839. * @example
  3840. *
  3841. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  3842. * // => 4
  3843. */function sortedLastIndex(array,value){return baseSortedIndex(array,value,true)}
  3844. /**
  3845. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  3846. * which is invoked for `value` and each element of `array` to compute their
  3847. * sort ranking. The iteratee is invoked with one argument: (value).
  3848. *
  3849. * @static
  3850. * @memberOf _
  3851. * @since 4.0.0
  3852. * @category Array
  3853. * @param {Array} array The sorted array to inspect.
  3854. * @param {*} value The value to evaluate.
  3855. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  3856. * @returns {number} Returns the index at which `value` should be inserted
  3857. * into `array`.
  3858. * @example
  3859. *
  3860. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  3861. *
  3862. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  3863. * // => 1
  3864. *
  3865. * // The `_.property` iteratee shorthand.
  3866. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  3867. * // => 1
  3868. */function sortedLastIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2),true)}
  3869. /**
  3870. * This method is like `_.lastIndexOf` except that it performs a binary
  3871. * search on a sorted `array`.
  3872. *
  3873. * @static
  3874. * @memberOf _
  3875. * @since 4.0.0
  3876. * @category Array
  3877. * @param {Array} array The array to inspect.
  3878. * @param {*} value The value to search for.
  3879. * @returns {number} Returns the index of the matched value, else `-1`.
  3880. * @example
  3881. *
  3882. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  3883. * // => 3
  3884. */function sortedLastIndexOf(array,value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value,true)-1;if(eq(array[index],value)){return index}}return-1}
  3885. /**
  3886. * This method is like `_.uniq` except that it's designed and optimized
  3887. * for sorted arrays.
  3888. *
  3889. * @static
  3890. * @memberOf _
  3891. * @since 4.0.0
  3892. * @category Array
  3893. * @param {Array} array The array to inspect.
  3894. * @returns {Array} Returns the new duplicate free array.
  3895. * @example
  3896. *
  3897. * _.sortedUniq([1, 1, 2]);
  3898. * // => [1, 2]
  3899. */function sortedUniq(array){return array&&array.length?baseSortedUniq(array):[]}
  3900. /**
  3901. * This method is like `_.uniqBy` except that it's designed and optimized
  3902. * for sorted arrays.
  3903. *
  3904. * @static
  3905. * @memberOf _
  3906. * @since 4.0.0
  3907. * @category Array
  3908. * @param {Array} array The array to inspect.
  3909. * @param {Function} [iteratee] The iteratee invoked per element.
  3910. * @returns {Array} Returns the new duplicate free array.
  3911. * @example
  3912. *
  3913. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  3914. * // => [1.1, 2.3]
  3915. */function sortedUniqBy(array,iteratee){return array&&array.length?baseSortedUniq(array,getIteratee(iteratee,2)):[]}
  3916. /**
  3917. * Gets all but the first element of `array`.
  3918. *
  3919. * @static
  3920. * @memberOf _
  3921. * @since 4.0.0
  3922. * @category Array
  3923. * @param {Array} array The array to query.
  3924. * @returns {Array} Returns the slice of `array`.
  3925. * @example
  3926. *
  3927. * _.tail([1, 2, 3]);
  3928. * // => [2, 3]
  3929. */function tail(array){var length=array==null?0:array.length;return length?baseSlice(array,1,length):[]}
  3930. /**
  3931. * Creates a slice of `array` with `n` elements taken from the beginning.
  3932. *
  3933. * @static
  3934. * @memberOf _
  3935. * @since 0.1.0
  3936. * @category Array
  3937. * @param {Array} array The array to query.
  3938. * @param {number} [n=1] The number of elements to take.
  3939. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3940. * @returns {Array} Returns the slice of `array`.
  3941. * @example
  3942. *
  3943. * _.take([1, 2, 3]);
  3944. * // => [1]
  3945. *
  3946. * _.take([1, 2, 3], 2);
  3947. * // => [1, 2]
  3948. *
  3949. * _.take([1, 2, 3], 5);
  3950. * // => [1, 2, 3]
  3951. *
  3952. * _.take([1, 2, 3], 0);
  3953. * // => []
  3954. */function take(array,n,guard){if(!(array&&array.length)){return[]}n=guard||n===undefined?1:toInteger(n);return baseSlice(array,0,n<0?0:n)}
  3955. /**
  3956. * Creates a slice of `array` with `n` elements taken from the end.
  3957. *
  3958. * @static
  3959. * @memberOf _
  3960. * @since 3.0.0
  3961. * @category Array
  3962. * @param {Array} array The array to query.
  3963. * @param {number} [n=1] The number of elements to take.
  3964. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  3965. * @returns {Array} Returns the slice of `array`.
  3966. * @example
  3967. *
  3968. * _.takeRight([1, 2, 3]);
  3969. * // => [3]
  3970. *
  3971. * _.takeRight([1, 2, 3], 2);
  3972. * // => [2, 3]
  3973. *
  3974. * _.takeRight([1, 2, 3], 5);
  3975. * // => [1, 2, 3]
  3976. *
  3977. * _.takeRight([1, 2, 3], 0);
  3978. * // => []
  3979. */function takeRight(array,n,guard){var length=array==null?0:array.length;if(!length){return[]}n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,n<0?0:n,length)}
  3980. /**
  3981. * Creates a slice of `array` with elements taken from the end. Elements are
  3982. * taken until `predicate` returns falsey. The predicate is invoked with
  3983. * three arguments: (value, index, array).
  3984. *
  3985. * @static
  3986. * @memberOf _
  3987. * @since 3.0.0
  3988. * @category Array
  3989. * @param {Array} array The array to query.
  3990. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  3991. * @returns {Array} Returns the slice of `array`.
  3992. * @example
  3993. *
  3994. * var users = [
  3995. * { 'user': 'barney', 'active': true },
  3996. * { 'user': 'fred', 'active': false },
  3997. * { 'user': 'pebbles', 'active': false }
  3998. * ];
  3999. *
  4000. * _.takeRightWhile(users, function(o) { return !o.active; });
  4001. * // => objects for ['fred', 'pebbles']
  4002. *
  4003. * // The `_.matches` iteratee shorthand.
  4004. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  4005. * // => objects for ['pebbles']
  4006. *
  4007. * // The `_.matchesProperty` iteratee shorthand.
  4008. * _.takeRightWhile(users, ['active', false]);
  4009. * // => objects for ['fred', 'pebbles']
  4010. *
  4011. * // The `_.property` iteratee shorthand.
  4012. * _.takeRightWhile(users, 'active');
  4013. * // => []
  4014. */function takeRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),false,true):[]}
  4015. /**
  4016. * Creates a slice of `array` with elements taken from the beginning. Elements
  4017. * are taken until `predicate` returns falsey. The predicate is invoked with
  4018. * three arguments: (value, index, array).
  4019. *
  4020. * @static
  4021. * @memberOf _
  4022. * @since 3.0.0
  4023. * @category Array
  4024. * @param {Array} array The array to query.
  4025. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4026. * @returns {Array} Returns the slice of `array`.
  4027. * @example
  4028. *
  4029. * var users = [
  4030. * { 'user': 'barney', 'active': false },
  4031. * { 'user': 'fred', 'active': false },
  4032. * { 'user': 'pebbles', 'active': true }
  4033. * ];
  4034. *
  4035. * _.takeWhile(users, function(o) { return !o.active; });
  4036. * // => objects for ['barney', 'fred']
  4037. *
  4038. * // The `_.matches` iteratee shorthand.
  4039. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  4040. * // => objects for ['barney']
  4041. *
  4042. * // The `_.matchesProperty` iteratee shorthand.
  4043. * _.takeWhile(users, ['active', false]);
  4044. * // => objects for ['barney', 'fred']
  4045. *
  4046. * // The `_.property` iteratee shorthand.
  4047. * _.takeWhile(users, 'active');
  4048. * // => []
  4049. */function takeWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3)):[]}
  4050. /**
  4051. * Creates an array of unique values, in order, from all given arrays using
  4052. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4053. * for equality comparisons.
  4054. *
  4055. * @static
  4056. * @memberOf _
  4057. * @since 0.1.0
  4058. * @category Array
  4059. * @param {...Array} [arrays] The arrays to inspect.
  4060. * @returns {Array} Returns the new array of combined values.
  4061. * @example
  4062. *
  4063. * _.union([2], [1, 2]);
  4064. * // => [2, 1]
  4065. */var union=baseRest(function(arrays){return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true))});
  4066. /**
  4067. * This method is like `_.union` except that it accepts `iteratee` which is
  4068. * invoked for each element of each `arrays` to generate the criterion by
  4069. * which uniqueness is computed. Result values are chosen from the first
  4070. * array in which the value occurs. The iteratee is invoked with one argument:
  4071. * (value).
  4072. *
  4073. * @static
  4074. * @memberOf _
  4075. * @since 4.0.0
  4076. * @category Array
  4077. * @param {...Array} [arrays] The arrays to inspect.
  4078. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  4079. * @returns {Array} Returns the new array of combined values.
  4080. * @example
  4081. *
  4082. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  4083. * // => [2.1, 1.2]
  4084. *
  4085. * // The `_.property` iteratee shorthand.
  4086. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  4087. * // => [{ 'x': 1 }, { 'x': 2 }]
  4088. */var unionBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined}return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),getIteratee(iteratee,2))});
  4089. /**
  4090. * This method is like `_.union` except that it accepts `comparator` which
  4091. * is invoked to compare elements of `arrays`. Result values are chosen from
  4092. * the first array in which the value occurs. The comparator is invoked
  4093. * with two arguments: (arrVal, othVal).
  4094. *
  4095. * @static
  4096. * @memberOf _
  4097. * @since 4.0.0
  4098. * @category Array
  4099. * @param {...Array} [arrays] The arrays to inspect.
  4100. * @param {Function} [comparator] The comparator invoked per element.
  4101. * @returns {Array} Returns the new array of combined values.
  4102. * @example
  4103. *
  4104. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  4105. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  4106. *
  4107. * _.unionWith(objects, others, _.isEqual);
  4108. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  4109. */var unionWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=="function"?comparator:undefined;return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),undefined,comparator)});
  4110. /**
  4111. * Creates a duplicate-free version of an array, using
  4112. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4113. * for equality comparisons, in which only the first occurrence of each element
  4114. * is kept. The order of result values is determined by the order they occur
  4115. * in the array.
  4116. *
  4117. * @static
  4118. * @memberOf _
  4119. * @since 0.1.0
  4120. * @category Array
  4121. * @param {Array} array The array to inspect.
  4122. * @returns {Array} Returns the new duplicate free array.
  4123. * @example
  4124. *
  4125. * _.uniq([2, 1, 2]);
  4126. * // => [2, 1]
  4127. */function uniq(array){return array&&array.length?baseUniq(array):[]}
  4128. /**
  4129. * This method is like `_.uniq` except that it accepts `iteratee` which is
  4130. * invoked for each element in `array` to generate the criterion by which
  4131. * uniqueness is computed. The order of result values is determined by the
  4132. * order they occur in the array. The iteratee is invoked with one argument:
  4133. * (value).
  4134. *
  4135. * @static
  4136. * @memberOf _
  4137. * @since 4.0.0
  4138. * @category Array
  4139. * @param {Array} array The array to inspect.
  4140. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  4141. * @returns {Array} Returns the new duplicate free array.
  4142. * @example
  4143. *
  4144. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  4145. * // => [2.1, 1.2]
  4146. *
  4147. * // The `_.property` iteratee shorthand.
  4148. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  4149. * // => [{ 'x': 1 }, { 'x': 2 }]
  4150. */function uniqBy(array,iteratee){return array&&array.length?baseUniq(array,getIteratee(iteratee,2)):[]}
  4151. /**
  4152. * This method is like `_.uniq` except that it accepts `comparator` which
  4153. * is invoked to compare elements of `array`. The order of result values is
  4154. * determined by the order they occur in the array.The comparator is invoked
  4155. * with two arguments: (arrVal, othVal).
  4156. *
  4157. * @static
  4158. * @memberOf _
  4159. * @since 4.0.0
  4160. * @category Array
  4161. * @param {Array} array The array to inspect.
  4162. * @param {Function} [comparator] The comparator invoked per element.
  4163. * @returns {Array} Returns the new duplicate free array.
  4164. * @example
  4165. *
  4166. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  4167. *
  4168. * _.uniqWith(objects, _.isEqual);
  4169. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  4170. */function uniqWith(array,comparator){comparator=typeof comparator=="function"?comparator:undefined;return array&&array.length?baseUniq(array,undefined,comparator):[]}
  4171. /**
  4172. * This method is like `_.zip` except that it accepts an array of grouped
  4173. * elements and creates an array regrouping the elements to their pre-zip
  4174. * configuration.
  4175. *
  4176. * @static
  4177. * @memberOf _
  4178. * @since 1.2.0
  4179. * @category Array
  4180. * @param {Array} array The array of grouped elements to process.
  4181. * @returns {Array} Returns the new array of regrouped elements.
  4182. * @example
  4183. *
  4184. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  4185. * // => [['a', 1, true], ['b', 2, false]]
  4186. *
  4187. * _.unzip(zipped);
  4188. * // => [['a', 'b'], [1, 2], [true, false]]
  4189. */function unzip(array){if(!(array&&array.length)){return[]}var length=0;array=arrayFilter(array,function(group){if(isArrayLikeObject(group)){length=nativeMax(group.length,length);return true}});return baseTimes(length,function(index){return arrayMap(array,baseProperty(index))})}
  4190. /**
  4191. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  4192. * how regrouped values should be combined. The iteratee is invoked with the
  4193. * elements of each group: (...group).
  4194. *
  4195. * @static
  4196. * @memberOf _
  4197. * @since 3.8.0
  4198. * @category Array
  4199. * @param {Array} array The array of grouped elements to process.
  4200. * @param {Function} [iteratee=_.identity] The function to combine
  4201. * regrouped values.
  4202. * @returns {Array} Returns the new array of regrouped elements.
  4203. * @example
  4204. *
  4205. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  4206. * // => [[1, 10, 100], [2, 20, 200]]
  4207. *
  4208. * _.unzipWith(zipped, _.add);
  4209. * // => [3, 30, 300]
  4210. */function unzipWith(array,iteratee){if(!(array&&array.length)){return[]}var result=unzip(array);if(iteratee==null){return result}return arrayMap(result,function(group){return apply(iteratee,undefined,group)})}
  4211. /**
  4212. * Creates an array excluding all given values using
  4213. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4214. * for equality comparisons.
  4215. *
  4216. * **Note:** Unlike `_.pull`, this method returns a new array.
  4217. *
  4218. * @static
  4219. * @memberOf _
  4220. * @since 0.1.0
  4221. * @category Array
  4222. * @param {Array} array The array to inspect.
  4223. * @param {...*} [values] The values to exclude.
  4224. * @returns {Array} Returns the new array of filtered values.
  4225. * @see _.difference, _.xor
  4226. * @example
  4227. *
  4228. * _.without([2, 1, 2, 3], 1, 2);
  4229. * // => [3]
  4230. */var without=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,values):[]});
  4231. /**
  4232. * Creates an array of unique values that is the
  4233. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  4234. * of the given arrays. The order of result values is determined by the order
  4235. * they occur in the arrays.
  4236. *
  4237. * @static
  4238. * @memberOf _
  4239. * @since 2.4.0
  4240. * @category Array
  4241. * @param {...Array} [arrays] The arrays to inspect.
  4242. * @returns {Array} Returns the new array of filtered values.
  4243. * @see _.difference, _.without
  4244. * @example
  4245. *
  4246. * _.xor([2, 1], [2, 3]);
  4247. * // => [1, 3]
  4248. */var xor=baseRest(function(arrays){return baseXor(arrayFilter(arrays,isArrayLikeObject))});
  4249. /**
  4250. * This method is like `_.xor` except that it accepts `iteratee` which is
  4251. * invoked for each element of each `arrays` to generate the criterion by
  4252. * which by which they're compared. The order of result values is determined
  4253. * by the order they occur in the arrays. The iteratee is invoked with one
  4254. * argument: (value).
  4255. *
  4256. * @static
  4257. * @memberOf _
  4258. * @since 4.0.0
  4259. * @category Array
  4260. * @param {...Array} [arrays] The arrays to inspect.
  4261. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  4262. * @returns {Array} Returns the new array of filtered values.
  4263. * @example
  4264. *
  4265. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  4266. * // => [1.2, 3.4]
  4267. *
  4268. * // The `_.property` iteratee shorthand.
  4269. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  4270. * // => [{ 'x': 2 }]
  4271. */var xorBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined}return baseXor(arrayFilter(arrays,isArrayLikeObject),getIteratee(iteratee,2))});
  4272. /**
  4273. * This method is like `_.xor` except that it accepts `comparator` which is
  4274. * invoked to compare elements of `arrays`. The order of result values is
  4275. * determined by the order they occur in the arrays. The comparator is invoked
  4276. * with two arguments: (arrVal, othVal).
  4277. *
  4278. * @static
  4279. * @memberOf _
  4280. * @since 4.0.0
  4281. * @category Array
  4282. * @param {...Array} [arrays] The arrays to inspect.
  4283. * @param {Function} [comparator] The comparator invoked per element.
  4284. * @returns {Array} Returns the new array of filtered values.
  4285. * @example
  4286. *
  4287. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  4288. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  4289. *
  4290. * _.xorWith(objects, others, _.isEqual);
  4291. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  4292. */var xorWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=="function"?comparator:undefined;return baseXor(arrayFilter(arrays,isArrayLikeObject),undefined,comparator)});
  4293. /**
  4294. * Creates an array of grouped elements, the first of which contains the
  4295. * first elements of the given arrays, the second of which contains the
  4296. * second elements of the given arrays, and so on.
  4297. *
  4298. * @static
  4299. * @memberOf _
  4300. * @since 0.1.0
  4301. * @category Array
  4302. * @param {...Array} [arrays] The arrays to process.
  4303. * @returns {Array} Returns the new array of grouped elements.
  4304. * @example
  4305. *
  4306. * _.zip(['a', 'b'], [1, 2], [true, false]);
  4307. * // => [['a', 1, true], ['b', 2, false]]
  4308. */var zip=baseRest(unzip);
  4309. /**
  4310. * This method is like `_.fromPairs` except that it accepts two arrays,
  4311. * one of property identifiers and one of corresponding values.
  4312. *
  4313. * @static
  4314. * @memberOf _
  4315. * @since 0.4.0
  4316. * @category Array
  4317. * @param {Array} [props=[]] The property identifiers.
  4318. * @param {Array} [values=[]] The property values.
  4319. * @returns {Object} Returns the new object.
  4320. * @example
  4321. *
  4322. * _.zipObject(['a', 'b'], [1, 2]);
  4323. * // => { 'a': 1, 'b': 2 }
  4324. */function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue)}
  4325. /**
  4326. * This method is like `_.zipObject` except that it supports property paths.
  4327. *
  4328. * @static
  4329. * @memberOf _
  4330. * @since 4.1.0
  4331. * @category Array
  4332. * @param {Array} [props=[]] The property identifiers.
  4333. * @param {Array} [values=[]] The property values.
  4334. * @returns {Object} Returns the new object.
  4335. * @example
  4336. *
  4337. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  4338. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  4339. */function zipObjectDeep(props,values){return baseZipObject(props||[],values||[],baseSet)}
  4340. /**
  4341. * This method is like `_.zip` except that it accepts `iteratee` to specify
  4342. * how grouped values should be combined. The iteratee is invoked with the
  4343. * elements of each group: (...group).
  4344. *
  4345. * @static
  4346. * @memberOf _
  4347. * @since 3.8.0
  4348. * @category Array
  4349. * @param {...Array} [arrays] The arrays to process.
  4350. * @param {Function} [iteratee=_.identity] The function to combine
  4351. * grouped values.
  4352. * @returns {Array} Returns the new array of grouped elements.
  4353. * @example
  4354. *
  4355. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  4356. * return a + b + c;
  4357. * });
  4358. * // => [111, 222]
  4359. */var zipWith=baseRest(function(arrays){var length=arrays.length,iteratee=length>1?arrays[length-1]:undefined;iteratee=typeof iteratee=="function"?(arrays.pop(),iteratee):undefined;return unzipWith(arrays,iteratee)});
  4360. /*------------------------------------------------------------------------*/
  4361. /**
  4362. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  4363. * chain sequences enabled. The result of such sequences must be unwrapped
  4364. * with `_#value`.
  4365. *
  4366. * @static
  4367. * @memberOf _
  4368. * @since 1.3.0
  4369. * @category Seq
  4370. * @param {*} value The value to wrap.
  4371. * @returns {Object} Returns the new `lodash` wrapper instance.
  4372. * @example
  4373. *
  4374. * var users = [
  4375. * { 'user': 'barney', 'age': 36 },
  4376. * { 'user': 'fred', 'age': 40 },
  4377. * { 'user': 'pebbles', 'age': 1 }
  4378. * ];
  4379. *
  4380. * var youngest = _
  4381. * .chain(users)
  4382. * .sortBy('age')
  4383. * .map(function(o) {
  4384. * return o.user + ' is ' + o.age;
  4385. * })
  4386. * .head()
  4387. * .value();
  4388. * // => 'pebbles is 1'
  4389. */function chain(value){var result=lodash(value);result.__chain__=true;return result}
  4390. /**
  4391. * This method invokes `interceptor` and returns `value`. The interceptor
  4392. * is invoked with one argument; (value). The purpose of this method is to
  4393. * "tap into" a method chain sequence in order to modify intermediate results.
  4394. *
  4395. * @static
  4396. * @memberOf _
  4397. * @since 0.1.0
  4398. * @category Seq
  4399. * @param {*} value The value to provide to `interceptor`.
  4400. * @param {Function} interceptor The function to invoke.
  4401. * @returns {*} Returns `value`.
  4402. * @example
  4403. *
  4404. * _([1, 2, 3])
  4405. * .tap(function(array) {
  4406. * // Mutate input array.
  4407. * array.pop();
  4408. * })
  4409. * .reverse()
  4410. * .value();
  4411. * // => [2, 1]
  4412. */function tap(value,interceptor){interceptor(value);return value}
  4413. /**
  4414. * This method is like `_.tap` except that it returns the result of `interceptor`.
  4415. * The purpose of this method is to "pass thru" values replacing intermediate
  4416. * results in a method chain sequence.
  4417. *
  4418. * @static
  4419. * @memberOf _
  4420. * @since 3.0.0
  4421. * @category Seq
  4422. * @param {*} value The value to provide to `interceptor`.
  4423. * @param {Function} interceptor The function to invoke.
  4424. * @returns {*} Returns the result of `interceptor`.
  4425. * @example
  4426. *
  4427. * _(' abc ')
  4428. * .chain()
  4429. * .trim()
  4430. * .thru(function(value) {
  4431. * return [value];
  4432. * })
  4433. * .value();
  4434. * // => ['abc']
  4435. */function thru(value,interceptor){return interceptor(value)}
  4436. /**
  4437. * This method is the wrapper version of `_.at`.
  4438. *
  4439. * @name at
  4440. * @memberOf _
  4441. * @since 1.0.0
  4442. * @category Seq
  4443. * @param {...(string|string[])} [paths] The property paths to pick.
  4444. * @returns {Object} Returns the new `lodash` wrapper instance.
  4445. * @example
  4446. *
  4447. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  4448. *
  4449. * _(object).at(['a[0].b.c', 'a[1]']).value();
  4450. * // => [3, 4]
  4451. */var wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value=this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};if(length>1||this.__actions__.length||!(value instanceof LazyWrapper)||!isIndex(start)){return this.thru(interceptor)}value=value.slice(start,+start+(length?1:0));value.__actions__.push({func:thru,args:[interceptor],thisArg:undefined});return new LodashWrapper(value,this.__chain__).thru(function(array){if(length&&!array.length){array.push(undefined)}return array})});
  4452. /**
  4453. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  4454. *
  4455. * @name chain
  4456. * @memberOf _
  4457. * @since 0.1.0
  4458. * @category Seq
  4459. * @returns {Object} Returns the new `lodash` wrapper instance.
  4460. * @example
  4461. *
  4462. * var users = [
  4463. * { 'user': 'barney', 'age': 36 },
  4464. * { 'user': 'fred', 'age': 40 }
  4465. * ];
  4466. *
  4467. * // A sequence without explicit chaining.
  4468. * _(users).head();
  4469. * // => { 'user': 'barney', 'age': 36 }
  4470. *
  4471. * // A sequence with explicit chaining.
  4472. * _(users)
  4473. * .chain()
  4474. * .head()
  4475. * .pick('user')
  4476. * .value();
  4477. * // => { 'user': 'barney' }
  4478. */function wrapperChain(){return chain(this)}
  4479. /**
  4480. * Executes the chain sequence and returns the wrapped result.
  4481. *
  4482. * @name commit
  4483. * @memberOf _
  4484. * @since 3.2.0
  4485. * @category Seq
  4486. * @returns {Object} Returns the new `lodash` wrapper instance.
  4487. * @example
  4488. *
  4489. * var array = [1, 2];
  4490. * var wrapped = _(array).push(3);
  4491. *
  4492. * console.log(array);
  4493. * // => [1, 2]
  4494. *
  4495. * wrapped = wrapped.commit();
  4496. * console.log(array);
  4497. * // => [1, 2, 3]
  4498. *
  4499. * wrapped.last();
  4500. * // => 3
  4501. *
  4502. * console.log(array);
  4503. * // => [1, 2, 3]
  4504. */function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}
  4505. /**
  4506. * Gets the next value on a wrapped object following the
  4507. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  4508. *
  4509. * @name next
  4510. * @memberOf _
  4511. * @since 4.0.0
  4512. * @category Seq
  4513. * @returns {Object} Returns the next iterator value.
  4514. * @example
  4515. *
  4516. * var wrapped = _([1, 2]);
  4517. *
  4518. * wrapped.next();
  4519. * // => { 'done': false, 'value': 1 }
  4520. *
  4521. * wrapped.next();
  4522. * // => { 'done': false, 'value': 2 }
  4523. *
  4524. * wrapped.next();
  4525. * // => { 'done': true, 'value': undefined }
  4526. */function wrapperNext(){if(this.__values__===undefined){this.__values__=toArray(this.value())}var done=this.__index__>=this.__values__.length,value=done?undefined:this.__values__[this.__index__++];return{done,value}}
  4527. /**
  4528. * Enables the wrapper to be iterable.
  4529. *
  4530. * @name Symbol.iterator
  4531. * @memberOf _
  4532. * @since 4.0.0
  4533. * @category Seq
  4534. * @returns {Object} Returns the wrapper object.
  4535. * @example
  4536. *
  4537. * var wrapped = _([1, 2]);
  4538. *
  4539. * wrapped[Symbol.iterator]() === wrapped;
  4540. * // => true
  4541. *
  4542. * Array.from(wrapped);
  4543. * // => [1, 2]
  4544. */function wrapperToIterator(){return this}
  4545. /**
  4546. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  4547. *
  4548. * @name plant
  4549. * @memberOf _
  4550. * @since 3.2.0
  4551. * @category Seq
  4552. * @param {*} value The value to plant.
  4553. * @returns {Object} Returns the new `lodash` wrapper instance.
  4554. * @example
  4555. *
  4556. * function square(n) {
  4557. * return n * n;
  4558. * }
  4559. *
  4560. * var wrapped = _([1, 2]).map(square);
  4561. * var other = wrapped.plant([3, 4]);
  4562. *
  4563. * other.value();
  4564. * // => [9, 16]
  4565. *
  4566. * wrapped.value();
  4567. * // => [1, 4]
  4568. */function wrapperPlant(value){var result,parent=this;while(parent instanceof baseLodash){var clone=wrapperClone(parent);clone.__index__=0;clone.__values__=undefined;if(result){previous.__wrapped__=clone}else{result=clone}var previous=clone;parent=parent.__wrapped__}previous.__wrapped__=value;return result}
  4569. /**
  4570. * This method is the wrapper version of `_.reverse`.
  4571. *
  4572. * **Note:** This method mutates the wrapped array.
  4573. *
  4574. * @name reverse
  4575. * @memberOf _
  4576. * @since 0.1.0
  4577. * @category Seq
  4578. * @returns {Object} Returns the new `lodash` wrapper instance.
  4579. * @example
  4580. *
  4581. * var array = [1, 2, 3];
  4582. *
  4583. * _(array).reverse().value()
  4584. * // => [3, 2, 1]
  4585. *
  4586. * console.log(array);
  4587. * // => [3, 2, 1]
  4588. */function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;if(this.__actions__.length){wrapped=new LazyWrapper(this)}wrapped=wrapped.reverse();wrapped.__actions__.push({func:thru,args:[reverse],thisArg:undefined});return new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}
  4589. /**
  4590. * Executes the chain sequence to resolve the unwrapped value.
  4591. *
  4592. * @name value
  4593. * @memberOf _
  4594. * @since 0.1.0
  4595. * @alias toJSON, valueOf
  4596. * @category Seq
  4597. * @returns {*} Returns the resolved unwrapped value.
  4598. * @example
  4599. *
  4600. * _([1, 2, 3]).value();
  4601. * // => [1, 2, 3]
  4602. */function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}
  4603. /*------------------------------------------------------------------------*/
  4604. /**
  4605. * Creates an object composed of keys generated from the results of running
  4606. * each element of `collection` thru `iteratee`. The corresponding value of
  4607. * each key is the number of times the key was returned by `iteratee`. The
  4608. * iteratee is invoked with one argument: (value).
  4609. *
  4610. * @static
  4611. * @memberOf _
  4612. * @since 0.5.0
  4613. * @category Collection
  4614. * @param {Array|Object} collection The collection to iterate over.
  4615. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  4616. * @returns {Object} Returns the composed aggregate object.
  4617. * @example
  4618. *
  4619. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  4620. * // => { '4': 1, '6': 2 }
  4621. *
  4622. * // The `_.property` iteratee shorthand.
  4623. * _.countBy(['one', 'two', 'three'], 'length');
  4624. * // => { '3': 2, '5': 1 }
  4625. */var countBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){++result[key]}else{baseAssignValue(result,key,1)}});
  4626. /**
  4627. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  4628. * Iteration is stopped once `predicate` returns falsey. The predicate is
  4629. * invoked with three arguments: (value, index|key, collection).
  4630. *
  4631. * **Note:** This method returns `true` for
  4632. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  4633. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  4634. * elements of empty collections.
  4635. *
  4636. * @static
  4637. * @memberOf _
  4638. * @since 0.1.0
  4639. * @category Collection
  4640. * @param {Array|Object} collection The collection to iterate over.
  4641. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4642. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  4643. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  4644. * else `false`.
  4645. * @example
  4646. *
  4647. * _.every([true, 1, null, 'yes'], Boolean);
  4648. * // => false
  4649. *
  4650. * var users = [
  4651. * { 'user': 'barney', 'age': 36, 'active': false },
  4652. * { 'user': 'fred', 'age': 40, 'active': false }
  4653. * ];
  4654. *
  4655. * // The `_.matches` iteratee shorthand.
  4656. * _.every(users, { 'user': 'barney', 'active': false });
  4657. * // => false
  4658. *
  4659. * // The `_.matchesProperty` iteratee shorthand.
  4660. * _.every(users, ['active', false]);
  4661. * // => true
  4662. *
  4663. * // The `_.property` iteratee shorthand.
  4664. * _.every(users, 'active');
  4665. * // => false
  4666. */function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined}return func(collection,getIteratee(predicate,3))}
  4667. /**
  4668. * Iterates over elements of `collection`, returning an array of all elements
  4669. * `predicate` returns truthy for. The predicate is invoked with three
  4670. * arguments: (value, index|key, collection).
  4671. *
  4672. * **Note:** Unlike `_.remove`, this method returns a new array.
  4673. *
  4674. * @static
  4675. * @memberOf _
  4676. * @since 0.1.0
  4677. * @category Collection
  4678. * @param {Array|Object} collection The collection to iterate over.
  4679. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4680. * @returns {Array} Returns the new filtered array.
  4681. * @see _.reject
  4682. * @example
  4683. *
  4684. * var users = [
  4685. * { 'user': 'barney', 'age': 36, 'active': true },
  4686. * { 'user': 'fred', 'age': 40, 'active': false }
  4687. * ];
  4688. *
  4689. * _.filter(users, function(o) { return !o.active; });
  4690. * // => objects for ['fred']
  4691. *
  4692. * // The `_.matches` iteratee shorthand.
  4693. * _.filter(users, { 'age': 36, 'active': true });
  4694. * // => objects for ['barney']
  4695. *
  4696. * // The `_.matchesProperty` iteratee shorthand.
  4697. * _.filter(users, ['active', false]);
  4698. * // => objects for ['fred']
  4699. *
  4700. * // The `_.property` iteratee shorthand.
  4701. * _.filter(users, 'active');
  4702. * // => objects for ['barney']
  4703. */function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3))}
  4704. /**
  4705. * Iterates over elements of `collection`, returning the first element
  4706. * `predicate` returns truthy for. The predicate is invoked with three
  4707. * arguments: (value, index|key, collection).
  4708. *
  4709. * @static
  4710. * @memberOf _
  4711. * @since 0.1.0
  4712. * @category Collection
  4713. * @param {Array|Object} collection The collection to inspect.
  4714. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4715. * @param {number} [fromIndex=0] The index to search from.
  4716. * @returns {*} Returns the matched element, else `undefined`.
  4717. * @example
  4718. *
  4719. * var users = [
  4720. * { 'user': 'barney', 'age': 36, 'active': true },
  4721. * { 'user': 'fred', 'age': 40, 'active': false },
  4722. * { 'user': 'pebbles', 'age': 1, 'active': true }
  4723. * ];
  4724. *
  4725. * _.find(users, function(o) { return o.age < 40; });
  4726. * // => object for 'barney'
  4727. *
  4728. * // The `_.matches` iteratee shorthand.
  4729. * _.find(users, { 'age': 1, 'active': true });
  4730. * // => object for 'pebbles'
  4731. *
  4732. * // The `_.matchesProperty` iteratee shorthand.
  4733. * _.find(users, ['active', false]);
  4734. * // => object for 'fred'
  4735. *
  4736. * // The `_.property` iteratee shorthand.
  4737. * _.find(users, 'active');
  4738. * // => object for 'barney'
  4739. */var find=createFind(findIndex);
  4740. /**
  4741. * This method is like `_.find` except that it iterates over elements of
  4742. * `collection` from right to left.
  4743. *
  4744. * @static
  4745. * @memberOf _
  4746. * @since 2.0.0
  4747. * @category Collection
  4748. * @param {Array|Object} collection The collection to inspect.
  4749. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  4750. * @param {number} [fromIndex=collection.length-1] The index to search from.
  4751. * @returns {*} Returns the matched element, else `undefined`.
  4752. * @example
  4753. *
  4754. * _.findLast([1, 2, 3, 4], function(n) {
  4755. * return n % 2 == 1;
  4756. * });
  4757. * // => 3
  4758. */var findLast=createFind(findLastIndex);
  4759. /**
  4760. * Creates a flattened array of values by running each element in `collection`
  4761. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  4762. * with three arguments: (value, index|key, collection).
  4763. *
  4764. * @static
  4765. * @memberOf _
  4766. * @since 4.0.0
  4767. * @category Collection
  4768. * @param {Array|Object} collection The collection to iterate over.
  4769. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4770. * @returns {Array} Returns the new flattened array.
  4771. * @example
  4772. *
  4773. * function duplicate(n) {
  4774. * return [n, n];
  4775. * }
  4776. *
  4777. * _.flatMap([1, 2], duplicate);
  4778. * // => [1, 1, 2, 2]
  4779. */function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}
  4780. /**
  4781. * This method is like `_.flatMap` except that it recursively flattens the
  4782. * mapped results.
  4783. *
  4784. * @static
  4785. * @memberOf _
  4786. * @since 4.7.0
  4787. * @category Collection
  4788. * @param {Array|Object} collection The collection to iterate over.
  4789. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4790. * @returns {Array} Returns the new flattened array.
  4791. * @example
  4792. *
  4793. * function duplicate(n) {
  4794. * return [[[n, n]]];
  4795. * }
  4796. *
  4797. * _.flatMapDeep([1, 2], duplicate);
  4798. * // => [1, 1, 2, 2]
  4799. */function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}
  4800. /**
  4801. * This method is like `_.flatMap` except that it recursively flattens the
  4802. * mapped results up to `depth` times.
  4803. *
  4804. * @static
  4805. * @memberOf _
  4806. * @since 4.7.0
  4807. * @category Collection
  4808. * @param {Array|Object} collection The collection to iterate over.
  4809. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4810. * @param {number} [depth=1] The maximum recursion depth.
  4811. * @returns {Array} Returns the new flattened array.
  4812. * @example
  4813. *
  4814. * function duplicate(n) {
  4815. * return [[[n, n]]];
  4816. * }
  4817. *
  4818. * _.flatMapDepth([1, 2], duplicate, 2);
  4819. * // => [[1, 1], [2, 2]]
  4820. */function flatMapDepth(collection,iteratee,depth){depth=depth===undefined?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth)}
  4821. /**
  4822. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  4823. * The iteratee is invoked with three arguments: (value, index|key, collection).
  4824. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4825. *
  4826. * **Note:** As with other "Collections" methods, objects with a "length"
  4827. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  4828. * or `_.forOwn` for object iteration.
  4829. *
  4830. * @static
  4831. * @memberOf _
  4832. * @since 0.1.0
  4833. * @alias each
  4834. * @category Collection
  4835. * @param {Array|Object} collection The collection to iterate over.
  4836. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4837. * @returns {Array|Object} Returns `collection`.
  4838. * @see _.forEachRight
  4839. * @example
  4840. *
  4841. * _.forEach([1, 2], function(value) {
  4842. * console.log(value);
  4843. * });
  4844. * // => Logs `1` then `2`.
  4845. *
  4846. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  4847. * console.log(key);
  4848. * });
  4849. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  4850. */function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee,3))}
  4851. /**
  4852. * This method is like `_.forEach` except that it iterates over elements of
  4853. * `collection` from right to left.
  4854. *
  4855. * @static
  4856. * @memberOf _
  4857. * @since 2.0.0
  4858. * @alias eachRight
  4859. * @category Collection
  4860. * @param {Array|Object} collection The collection to iterate over.
  4861. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4862. * @returns {Array|Object} Returns `collection`.
  4863. * @see _.forEach
  4864. * @example
  4865. *
  4866. * _.forEachRight([1, 2], function(value) {
  4867. * console.log(value);
  4868. * });
  4869. * // => Logs `2` then `1`.
  4870. */function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3))}
  4871. /**
  4872. * Creates an object composed of keys generated from the results of running
  4873. * each element of `collection` thru `iteratee`. The order of grouped values
  4874. * is determined by the order they occur in `collection`. The corresponding
  4875. * value of each key is an array of elements responsible for generating the
  4876. * key. The iteratee is invoked with one argument: (value).
  4877. *
  4878. * @static
  4879. * @memberOf _
  4880. * @since 0.1.0
  4881. * @category Collection
  4882. * @param {Array|Object} collection The collection to iterate over.
  4883. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  4884. * @returns {Object} Returns the composed aggregate object.
  4885. * @example
  4886. *
  4887. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  4888. * // => { '4': [4.2], '6': [6.1, 6.3] }
  4889. *
  4890. * // The `_.property` iteratee shorthand.
  4891. * _.groupBy(['one', 'two', 'three'], 'length');
  4892. * // => { '3': ['one', 'two'], '5': ['three'] }
  4893. */var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){result[key].push(value)}else{baseAssignValue(result,key,[value])}});
  4894. /**
  4895. * Checks if `value` is in `collection`. If `collection` is a string, it's
  4896. * checked for a substring of `value`, otherwise
  4897. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4898. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  4899. * the offset from the end of `collection`.
  4900. *
  4901. * @static
  4902. * @memberOf _
  4903. * @since 0.1.0
  4904. * @category Collection
  4905. * @param {Array|Object|string} collection The collection to inspect.
  4906. * @param {*} value The value to search for.
  4907. * @param {number} [fromIndex=0] The index to search from.
  4908. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  4909. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  4910. * @example
  4911. *
  4912. * _.includes([1, 2, 3], 1);
  4913. * // => true
  4914. *
  4915. * _.includes([1, 2, 3], 1, 2);
  4916. * // => false
  4917. *
  4918. * _.includes({ 'a': 1, 'b': 2 }, 1);
  4919. * // => true
  4920. *
  4921. * _.includes('abcd', 'bc');
  4922. * // => true
  4923. */function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection);fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;if(fromIndex<0){fromIndex=nativeMax(length+fromIndex,0)}return isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}
  4924. /**
  4925. * Invokes the method at `path` of each element in `collection`, returning
  4926. * an array of the results of each invoked method. Any additional arguments
  4927. * are provided to each invoked method. If `path` is a function, it's invoked
  4928. * for, and `this` bound to, each element in `collection`.
  4929. *
  4930. * @static
  4931. * @memberOf _
  4932. * @since 4.0.0
  4933. * @category Collection
  4934. * @param {Array|Object} collection The collection to iterate over.
  4935. * @param {Array|Function|string} path The path of the method to invoke or
  4936. * the function invoked per iteration.
  4937. * @param {...*} [args] The arguments to invoke each method with.
  4938. * @returns {Array} Returns the array of results.
  4939. * @example
  4940. *
  4941. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  4942. * // => [[1, 5, 7], [1, 2, 3]]
  4943. *
  4944. * _.invokeMap([123, 456], String.prototype.split, '');
  4945. * // => [['1', '2', '3'], ['4', '5', '6']]
  4946. */var invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc=typeof path=="function",result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args)});return result});
  4947. /**
  4948. * Creates an object composed of keys generated from the results of running
  4949. * each element of `collection` thru `iteratee`. The corresponding value of
  4950. * each key is the last element responsible for generating the key. The
  4951. * iteratee is invoked with one argument: (value).
  4952. *
  4953. * @static
  4954. * @memberOf _
  4955. * @since 4.0.0
  4956. * @category Collection
  4957. * @param {Array|Object} collection The collection to iterate over.
  4958. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  4959. * @returns {Object} Returns the composed aggregate object.
  4960. * @example
  4961. *
  4962. * var array = [
  4963. * { 'dir': 'left', 'code': 97 },
  4964. * { 'dir': 'right', 'code': 100 }
  4965. * ];
  4966. *
  4967. * _.keyBy(array, function(o) {
  4968. * return String.fromCharCode(o.code);
  4969. * });
  4970. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  4971. *
  4972. * _.keyBy(array, 'dir');
  4973. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  4974. */var keyBy=createAggregator(function(result,value,key){baseAssignValue(result,key,value)});
  4975. /**
  4976. * Creates an array of values by running each element in `collection` thru
  4977. * `iteratee`. The iteratee is invoked with three arguments:
  4978. * (value, index|key, collection).
  4979. *
  4980. * Many lodash methods are guarded to work as iteratees for methods like
  4981. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  4982. *
  4983. * The guarded methods are:
  4984. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  4985. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  4986. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  4987. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  4988. *
  4989. * @static
  4990. * @memberOf _
  4991. * @since 0.1.0
  4992. * @category Collection
  4993. * @param {Array|Object} collection The collection to iterate over.
  4994. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  4995. * @returns {Array} Returns the new mapped array.
  4996. * @example
  4997. *
  4998. * function square(n) {
  4999. * return n * n;
  5000. * }
  5001. *
  5002. * _.map([4, 8], square);
  5003. * // => [16, 64]
  5004. *
  5005. * _.map({ 'a': 4, 'b': 8 }, square);
  5006. * // => [16, 64] (iteration order is not guaranteed)
  5007. *
  5008. * var users = [
  5009. * { 'user': 'barney' },
  5010. * { 'user': 'fred' }
  5011. * ];
  5012. *
  5013. * // The `_.property` iteratee shorthand.
  5014. * _.map(users, 'user');
  5015. * // => ['barney', 'fred']
  5016. */function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3))}
  5017. /**
  5018. * This method is like `_.sortBy` except that it allows specifying the sort
  5019. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  5020. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  5021. * descending or "asc" for ascending sort order of corresponding values.
  5022. *
  5023. * @static
  5024. * @memberOf _
  5025. * @since 4.0.0
  5026. * @category Collection
  5027. * @param {Array|Object} collection The collection to iterate over.
  5028. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  5029. * The iteratees to sort by.
  5030. * @param {string[]} [orders] The sort orders of `iteratees`.
  5031. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  5032. * @returns {Array} Returns the new sorted array.
  5033. * @example
  5034. *
  5035. * var users = [
  5036. * { 'user': 'fred', 'age': 48 },
  5037. * { 'user': 'barney', 'age': 34 },
  5038. * { 'user': 'fred', 'age': 40 },
  5039. * { 'user': 'barney', 'age': 36 }
  5040. * ];
  5041. *
  5042. * // Sort by `user` in ascending order and by `age` in descending order.
  5043. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  5044. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  5045. */function orderBy(collection,iteratees,orders,guard){if(collection==null){return[]}if(!isArray(iteratees)){iteratees=iteratees==null?[]:[iteratees]}orders=guard?undefined:orders;if(!isArray(orders)){orders=orders==null?[]:[orders]}return baseOrderBy(collection,iteratees,orders)}
  5046. /**
  5047. * Creates an array of elements split into two groups, the first of which
  5048. * contains elements `predicate` returns truthy for, the second of which
  5049. * contains elements `predicate` returns falsey for. The predicate is
  5050. * invoked with one argument: (value).
  5051. *
  5052. * @static
  5053. * @memberOf _
  5054. * @since 3.0.0
  5055. * @category Collection
  5056. * @param {Array|Object} collection The collection to iterate over.
  5057. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  5058. * @returns {Array} Returns the array of grouped elements.
  5059. * @example
  5060. *
  5061. * var users = [
  5062. * { 'user': 'barney', 'age': 36, 'active': false },
  5063. * { 'user': 'fred', 'age': 40, 'active': true },
  5064. * { 'user': 'pebbles', 'age': 1, 'active': false }
  5065. * ];
  5066. *
  5067. * _.partition(users, function(o) { return o.active; });
  5068. * // => objects for [['fred'], ['barney', 'pebbles']]
  5069. *
  5070. * // The `_.matches` iteratee shorthand.
  5071. * _.partition(users, { 'age': 1, 'active': false });
  5072. * // => objects for [['pebbles'], ['barney', 'fred']]
  5073. *
  5074. * // The `_.matchesProperty` iteratee shorthand.
  5075. * _.partition(users, ['active', false]);
  5076. * // => objects for [['barney', 'pebbles'], ['fred']]
  5077. *
  5078. * // The `_.property` iteratee shorthand.
  5079. * _.partition(users, 'active');
  5080. * // => objects for [['fred'], ['barney', 'pebbles']]
  5081. */var partition=createAggregator(function(result,value,key){result[key?0:1].push(value)},function(){return[[],[]]});
  5082. /**
  5083. * Reduces `collection` to a value which is the accumulated result of running
  5084. * each element in `collection` thru `iteratee`, where each successive
  5085. * invocation is supplied the return value of the previous. If `accumulator`
  5086. * is not given, the first element of `collection` is used as the initial
  5087. * value. The iteratee is invoked with four arguments:
  5088. * (accumulator, value, index|key, collection).
  5089. *
  5090. * Many lodash methods are guarded to work as iteratees for methods like
  5091. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  5092. *
  5093. * The guarded methods are:
  5094. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  5095. * and `sortBy`
  5096. *
  5097. * @static
  5098. * @memberOf _
  5099. * @since 0.1.0
  5100. * @category Collection
  5101. * @param {Array|Object} collection The collection to iterate over.
  5102. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  5103. * @param {*} [accumulator] The initial value.
  5104. * @returns {*} Returns the accumulated value.
  5105. * @see _.reduceRight
  5106. * @example
  5107. *
  5108. * _.reduce([1, 2], function(sum, n) {
  5109. * return sum + n;
  5110. * }, 0);
  5111. * // => 3
  5112. *
  5113. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  5114. * (result[value] || (result[value] = [])).push(key);
  5115. * return result;
  5116. * }, {});
  5117. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  5118. */function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}
  5119. /**
  5120. * This method is like `_.reduce` except that it iterates over elements of
  5121. * `collection` from right to left.
  5122. *
  5123. * @static
  5124. * @memberOf _
  5125. * @since 0.1.0
  5126. * @category Collection
  5127. * @param {Array|Object} collection The collection to iterate over.
  5128. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  5129. * @param {*} [accumulator] The initial value.
  5130. * @returns {*} Returns the accumulated value.
  5131. * @see _.reduce
  5132. * @example
  5133. *
  5134. * var array = [[0, 1], [2, 3], [4, 5]];
  5135. *
  5136. * _.reduceRight(array, function(flattened, other) {
  5137. * return flattened.concat(other);
  5138. * }, []);
  5139. * // => [4, 5, 2, 3, 0, 1]
  5140. */function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}
  5141. /**
  5142. * The opposite of `_.filter`; this method returns the elements of `collection`
  5143. * that `predicate` does **not** return truthy for.
  5144. *
  5145. * @static
  5146. * @memberOf _
  5147. * @since 0.1.0
  5148. * @category Collection
  5149. * @param {Array|Object} collection The collection to iterate over.
  5150. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  5151. * @returns {Array} Returns the new filtered array.
  5152. * @see _.filter
  5153. * @example
  5154. *
  5155. * var users = [
  5156. * { 'user': 'barney', 'age': 36, 'active': false },
  5157. * { 'user': 'fred', 'age': 40, 'active': true }
  5158. * ];
  5159. *
  5160. * _.reject(users, function(o) { return !o.active; });
  5161. * // => objects for ['fred']
  5162. *
  5163. * // The `_.matches` iteratee shorthand.
  5164. * _.reject(users, { 'age': 40, 'active': true });
  5165. * // => objects for ['barney']
  5166. *
  5167. * // The `_.matchesProperty` iteratee shorthand.
  5168. * _.reject(users, ['active', false]);
  5169. * // => objects for ['fred']
  5170. *
  5171. * // The `_.property` iteratee shorthand.
  5172. * _.reject(users, 'active');
  5173. * // => objects for ['barney']
  5174. */function reject(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,negate(getIteratee(predicate,3)))}
  5175. /**
  5176. * Gets a random element from `collection`.
  5177. *
  5178. * @static
  5179. * @memberOf _
  5180. * @since 2.0.0
  5181. * @category Collection
  5182. * @param {Array|Object} collection The collection to sample.
  5183. * @returns {*} Returns the random element.
  5184. * @example
  5185. *
  5186. * _.sample([1, 2, 3, 4]);
  5187. * // => 2
  5188. */function sample(collection){var func=isArray(collection)?arraySample:baseSample;return func(collection)}
  5189. /**
  5190. * Gets `n` random elements at unique keys from `collection` up to the
  5191. * size of `collection`.
  5192. *
  5193. * @static
  5194. * @memberOf _
  5195. * @since 4.0.0
  5196. * @category Collection
  5197. * @param {Array|Object} collection The collection to sample.
  5198. * @param {number} [n=1] The number of elements to sample.
  5199. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5200. * @returns {Array} Returns the random elements.
  5201. * @example
  5202. *
  5203. * _.sampleSize([1, 2, 3], 2);
  5204. * // => [3, 1]
  5205. *
  5206. * _.sampleSize([1, 2, 3], 4);
  5207. * // => [2, 3, 1]
  5208. */function sampleSize(collection,n,guard){if(guard?isIterateeCall(collection,n,guard):n===undefined){n=1}else{n=toInteger(n)}var func=isArray(collection)?arraySampleSize:baseSampleSize;return func(collection,n)}
  5209. /**
  5210. * Creates an array of shuffled values, using a version of the
  5211. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  5212. *
  5213. * @static
  5214. * @memberOf _
  5215. * @since 0.1.0
  5216. * @category Collection
  5217. * @param {Array|Object} collection The collection to shuffle.
  5218. * @returns {Array} Returns the new shuffled array.
  5219. * @example
  5220. *
  5221. * _.shuffle([1, 2, 3, 4]);
  5222. * // => [4, 1, 3, 2]
  5223. */function shuffle(collection){var func=isArray(collection)?arrayShuffle:baseShuffle;return func(collection)}
  5224. /**
  5225. * Gets the size of `collection` by returning its length for array-like
  5226. * values or the number of own enumerable string keyed properties for objects.
  5227. *
  5228. * @static
  5229. * @memberOf _
  5230. * @since 0.1.0
  5231. * @category Collection
  5232. * @param {Array|Object|string} collection The collection to inspect.
  5233. * @returns {number} Returns the collection size.
  5234. * @example
  5235. *
  5236. * _.size([1, 2, 3]);
  5237. * // => 3
  5238. *
  5239. * _.size({ 'a': 1, 'b': 2 });
  5240. * // => 2
  5241. *
  5242. * _.size('pebbles');
  5243. * // => 7
  5244. */function size(collection){if(collection==null){return 0}if(isArrayLike(collection)){return isString(collection)?stringSize(collection):collection.length}var tag=getTag(collection);if(tag==mapTag||tag==setTag){return collection.size}return baseKeys(collection).length}
  5245. /**
  5246. * Checks if `predicate` returns truthy for **any** element of `collection`.
  5247. * Iteration is stopped once `predicate` returns truthy. The predicate is
  5248. * invoked with three arguments: (value, index|key, collection).
  5249. *
  5250. * @static
  5251. * @memberOf _
  5252. * @since 0.1.0
  5253. * @category Collection
  5254. * @param {Array|Object} collection The collection to iterate over.
  5255. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  5256. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5257. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5258. * else `false`.
  5259. * @example
  5260. *
  5261. * _.some([null, 0, 'yes', false], Boolean);
  5262. * // => true
  5263. *
  5264. * var users = [
  5265. * { 'user': 'barney', 'active': true },
  5266. * { 'user': 'fred', 'active': false }
  5267. * ];
  5268. *
  5269. * // The `_.matches` iteratee shorthand.
  5270. * _.some(users, { 'user': 'barney', 'active': false });
  5271. * // => false
  5272. *
  5273. * // The `_.matchesProperty` iteratee shorthand.
  5274. * _.some(users, ['active', false]);
  5275. * // => true
  5276. *
  5277. * // The `_.property` iteratee shorthand.
  5278. * _.some(users, 'active');
  5279. * // => true
  5280. */function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined}return func(collection,getIteratee(predicate,3))}
  5281. /**
  5282. * Creates an array of elements, sorted in ascending order by the results of
  5283. * running each element in a collection thru each iteratee. This method
  5284. * performs a stable sort, that is, it preserves the original sort order of
  5285. * equal elements. The iteratees are invoked with one argument: (value).
  5286. *
  5287. * @static
  5288. * @memberOf _
  5289. * @since 0.1.0
  5290. * @category Collection
  5291. * @param {Array|Object} collection The collection to iterate over.
  5292. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  5293. * The iteratees to sort by.
  5294. * @returns {Array} Returns the new sorted array.
  5295. * @example
  5296. *
  5297. * var users = [
  5298. * { 'user': 'fred', 'age': 48 },
  5299. * { 'user': 'barney', 'age': 36 },
  5300. * { 'user': 'fred', 'age': 40 },
  5301. * { 'user': 'barney', 'age': 34 }
  5302. * ];
  5303. *
  5304. * _.sortBy(users, [function(o) { return o.user; }]);
  5305. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  5306. *
  5307. * _.sortBy(users, ['user', 'age']);
  5308. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  5309. */var sortBy=baseRest(function(collection,iteratees){if(collection==null){return[]}var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])){iteratees=[]}else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])){iteratees=[iteratees[0]]}return baseOrderBy(collection,baseFlatten(iteratees,1),[])});
  5310. /*------------------------------------------------------------------------*/
  5311. /**
  5312. * Gets the timestamp of the number of milliseconds that have elapsed since
  5313. * the Unix epoch (1 January 1970 00:00:00 UTC).
  5314. *
  5315. * @static
  5316. * @memberOf _
  5317. * @since 2.4.0
  5318. * @category Date
  5319. * @returns {number} Returns the timestamp.
  5320. * @example
  5321. *
  5322. * _.defer(function(stamp) {
  5323. * console.log(_.now() - stamp);
  5324. * }, _.now());
  5325. * // => Logs the number of milliseconds it took for the deferred invocation.
  5326. */var now=ctxNow||function(){return root.Date.now()};
  5327. /*------------------------------------------------------------------------*/
  5328. /**
  5329. * The opposite of `_.before`; this method creates a function that invokes
  5330. * `func` once it's called `n` or more times.
  5331. *
  5332. * @static
  5333. * @memberOf _
  5334. * @since 0.1.0
  5335. * @category Function
  5336. * @param {number} n The number of calls before `func` is invoked.
  5337. * @param {Function} func The function to restrict.
  5338. * @returns {Function} Returns the new restricted function.
  5339. * @example
  5340. *
  5341. * var saves = ['profile', 'settings'];
  5342. *
  5343. * var done = _.after(saves.length, function() {
  5344. * console.log('done saving!');
  5345. * });
  5346. *
  5347. * _.forEach(saves, function(type) {
  5348. * asyncSave({ 'type': type, 'complete': done });
  5349. * });
  5350. * // => Logs 'done saving!' after the two async saves have completed.
  5351. */function after(n,func){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}n=toInteger(n);return function(){if(--n<1){return func.apply(this,arguments)}}}
  5352. /**
  5353. * Creates a function that invokes `func`, with up to `n` arguments,
  5354. * ignoring any additional arguments.
  5355. *
  5356. * @static
  5357. * @memberOf _
  5358. * @since 3.0.0
  5359. * @category Function
  5360. * @param {Function} func The function to cap arguments for.
  5361. * @param {number} [n=func.length] The arity cap.
  5362. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5363. * @returns {Function} Returns the new capped function.
  5364. * @example
  5365. *
  5366. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  5367. * // => [6, 8, 10]
  5368. */function ary(func,n,guard){n=guard?undefined:n;n=func&&n==null?func.length:n;return createWrap(func,WRAP_ARY_FLAG,undefined,undefined,undefined,undefined,n)}
  5369. /**
  5370. * Creates a function that invokes `func`, with the `this` binding and arguments
  5371. * of the created function, while it's called less than `n` times. Subsequent
  5372. * calls to the created function return the result of the last `func` invocation.
  5373. *
  5374. * @static
  5375. * @memberOf _
  5376. * @since 3.0.0
  5377. * @category Function
  5378. * @param {number} n The number of calls at which `func` is no longer invoked.
  5379. * @param {Function} func The function to restrict.
  5380. * @returns {Function} Returns the new restricted function.
  5381. * @example
  5382. *
  5383. * jQuery(element).on('click', _.before(5, addContactToList));
  5384. * // => Allows adding up to 4 contacts to the list.
  5385. */function before(n,func){var result;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}n=toInteger(n);return function(){if(--n>0){result=func.apply(this,arguments)}if(n<=1){func=undefined}return result}}
  5386. /**
  5387. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  5388. * and `partials` prepended to the arguments it receives.
  5389. *
  5390. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  5391. * may be used as a placeholder for partially applied arguments.
  5392. *
  5393. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  5394. * property of bound functions.
  5395. *
  5396. * @static
  5397. * @memberOf _
  5398. * @since 0.1.0
  5399. * @category Function
  5400. * @param {Function} func The function to bind.
  5401. * @param {*} thisArg The `this` binding of `func`.
  5402. * @param {...*} [partials] The arguments to be partially applied.
  5403. * @returns {Function} Returns the new bound function.
  5404. * @example
  5405. *
  5406. * function greet(greeting, punctuation) {
  5407. * return greeting + ' ' + this.user + punctuation;
  5408. * }
  5409. *
  5410. * var object = { 'user': 'fred' };
  5411. *
  5412. * var bound = _.bind(greet, object, 'hi');
  5413. * bound('!');
  5414. * // => 'hi fred!'
  5415. *
  5416. * // Bound with placeholders.
  5417. * var bound = _.bind(greet, object, _, '!');
  5418. * bound('hi');
  5419. * // => 'hi fred!'
  5420. */var bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(func,bitmask,thisArg,partials,holders)});
  5421. /**
  5422. * Creates a function that invokes the method at `object[key]` with `partials`
  5423. * prepended to the arguments it receives.
  5424. *
  5425. * This method differs from `_.bind` by allowing bound functions to reference
  5426. * methods that may be redefined or don't yet exist. See
  5427. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  5428. * for more details.
  5429. *
  5430. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  5431. * builds, may be used as a placeholder for partially applied arguments.
  5432. *
  5433. * @static
  5434. * @memberOf _
  5435. * @since 0.10.0
  5436. * @category Function
  5437. * @param {Object} object The object to invoke the method on.
  5438. * @param {string} key The key of the method.
  5439. * @param {...*} [partials] The arguments to be partially applied.
  5440. * @returns {Function} Returns the new bound function.
  5441. * @example
  5442. *
  5443. * var object = {
  5444. * 'user': 'fred',
  5445. * 'greet': function(greeting, punctuation) {
  5446. * return greeting + ' ' + this.user + punctuation;
  5447. * }
  5448. * };
  5449. *
  5450. * var bound = _.bindKey(object, 'greet', 'hi');
  5451. * bound('!');
  5452. * // => 'hi fred!'
  5453. *
  5454. * object.greet = function(greeting, punctuation) {
  5455. * return greeting + 'ya ' + this.user + punctuation;
  5456. * };
  5457. *
  5458. * bound('!');
  5459. * // => 'hiya fred!'
  5460. *
  5461. * // Bound with placeholders.
  5462. * var bound = _.bindKey(object, 'greet', _, '!');
  5463. * bound('hi');
  5464. * // => 'hiya fred!'
  5465. */var bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(key,bitmask,object,partials,holders)});
  5466. /**
  5467. * Creates a function that accepts arguments of `func` and either invokes
  5468. * `func` returning its result, if at least `arity` number of arguments have
  5469. * been provided, or returns a function that accepts the remaining `func`
  5470. * arguments, and so on. The arity of `func` may be specified if `func.length`
  5471. * is not sufficient.
  5472. *
  5473. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  5474. * may be used as a placeholder for provided arguments.
  5475. *
  5476. * **Note:** This method doesn't set the "length" property of curried functions.
  5477. *
  5478. * @static
  5479. * @memberOf _
  5480. * @since 2.0.0
  5481. * @category Function
  5482. * @param {Function} func The function to curry.
  5483. * @param {number} [arity=func.length] The arity of `func`.
  5484. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5485. * @returns {Function} Returns the new curried function.
  5486. * @example
  5487. *
  5488. * var abc = function(a, b, c) {
  5489. * return [a, b, c];
  5490. * };
  5491. *
  5492. * var curried = _.curry(abc);
  5493. *
  5494. * curried(1)(2)(3);
  5495. * // => [1, 2, 3]
  5496. *
  5497. * curried(1, 2)(3);
  5498. * // => [1, 2, 3]
  5499. *
  5500. * curried(1, 2, 3);
  5501. * // => [1, 2, 3]
  5502. *
  5503. * // Curried with placeholders.
  5504. * curried(1)(_, 3)(2);
  5505. * // => [1, 2, 3]
  5506. */function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curry.placeholder;return result}
  5507. /**
  5508. * This method is like `_.curry` except that arguments are applied to `func`
  5509. * in the manner of `_.partialRight` instead of `_.partial`.
  5510. *
  5511. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  5512. * builds, may be used as a placeholder for provided arguments.
  5513. *
  5514. * **Note:** This method doesn't set the "length" property of curried functions.
  5515. *
  5516. * @static
  5517. * @memberOf _
  5518. * @since 3.0.0
  5519. * @category Function
  5520. * @param {Function} func The function to curry.
  5521. * @param {number} [arity=func.length] The arity of `func`.
  5522. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  5523. * @returns {Function} Returns the new curried function.
  5524. * @example
  5525. *
  5526. * var abc = function(a, b, c) {
  5527. * return [a, b, c];
  5528. * };
  5529. *
  5530. * var curried = _.curryRight(abc);
  5531. *
  5532. * curried(3)(2)(1);
  5533. * // => [1, 2, 3]
  5534. *
  5535. * curried(2, 3)(1);
  5536. * // => [1, 2, 3]
  5537. *
  5538. * curried(1, 2, 3);
  5539. * // => [1, 2, 3]
  5540. *
  5541. * // Curried with placeholders.
  5542. * curried(3)(1, _)(2);
  5543. * // => [1, 2, 3]
  5544. */function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curryRight.placeholder;return result}
  5545. /**
  5546. * Creates a debounced function that delays invoking `func` until after `wait`
  5547. * milliseconds have elapsed since the last time the debounced function was
  5548. * invoked. The debounced function comes with a `cancel` method to cancel
  5549. * delayed `func` invocations and a `flush` method to immediately invoke them.
  5550. * Provide `options` to indicate whether `func` should be invoked on the
  5551. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  5552. * with the last arguments provided to the debounced function. Subsequent
  5553. * calls to the debounced function return the result of the last `func`
  5554. * invocation.
  5555. *
  5556. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  5557. * invoked on the trailing edge of the timeout only if the debounced function
  5558. * is invoked more than once during the `wait` timeout.
  5559. *
  5560. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  5561. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  5562. *
  5563. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  5564. * for details over the differences between `_.debounce` and `_.throttle`.
  5565. *
  5566. * @static
  5567. * @memberOf _
  5568. * @since 0.1.0
  5569. * @category Function
  5570. * @param {Function} func The function to debounce.
  5571. * @param {number} [wait=0] The number of milliseconds to delay.
  5572. * @param {Object} [options={}] The options object.
  5573. * @param {boolean} [options.leading=false]
  5574. * Specify invoking on the leading edge of the timeout.
  5575. * @param {number} [options.maxWait]
  5576. * The maximum time `func` is allowed to be delayed before it's invoked.
  5577. * @param {boolean} [options.trailing=true]
  5578. * Specify invoking on the trailing edge of the timeout.
  5579. * @returns {Function} Returns the new debounced function.
  5580. * @example
  5581. *
  5582. * // Avoid costly calculations while the window size is in flux.
  5583. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  5584. *
  5585. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  5586. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  5587. * 'leading': true,
  5588. * 'trailing': false
  5589. * }));
  5590. *
  5591. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  5592. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  5593. * var source = new EventSource('/stream');
  5594. * jQuery(source).on('message', debounced);
  5595. *
  5596. * // Cancel the trailing debounced invocation.
  5597. * jQuery(window).on('popstate', debounced.cancel);
  5598. */function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=false,maxing=false,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}wait=toNumber(wait)||0;if(isObject(options)){leading=!!options.leading;maxing="maxWait"in options;maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait;trailing="trailing"in options?!!options.trailing:trailing}function invokeFunc(time){var args=lastArgs,thisArg=lastThis;lastArgs=lastThis=undefined;lastInvokeTime=time;result=func.apply(thisArg,args);return result}function leadingEdge(time){
  5599. // Reset any `maxWait` timer.
  5600. lastInvokeTime=time;
  5601. // Start the timer for the trailing edge.
  5602. timerId=setTimeout(timerExpired,wait);
  5603. // Invoke the leading edge.
  5604. return leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;
  5605. // Either this is the first call, activity has stopped and we're at the
  5606. // trailing edge, the system time has gone backwards and we're treating
  5607. // it as the trailing edge, or we've hit the `maxWait` limit.
  5608. return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time)){return trailingEdge(time)}
  5609. // Restart the timer.
  5610. timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){timerId=undefined;
  5611. // Only invoke if we have `lastArgs` which means `func` has been
  5612. // debounced at least once.
  5613. if(trailing&&lastArgs){return invokeFunc(time)}lastArgs=lastThis=undefined;return result}function cancel(){if(timerId!==undefined){clearTimeout(timerId)}lastInvokeTime=0;lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);lastArgs=arguments;lastThis=this;lastCallTime=time;if(isInvoking){if(timerId===undefined){return leadingEdge(lastCallTime)}if(maxing){
  5614. // Handle invocations in a tight loop.
  5615. timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime)}}if(timerId===undefined){timerId=setTimeout(timerExpired,wait)}return result}debounced.cancel=cancel;debounced.flush=flush;return debounced}
  5616. /**
  5617. * Defers invoking the `func` until the current call stack has cleared. Any
  5618. * additional arguments are provided to `func` when it's invoked.
  5619. *
  5620. * @static
  5621. * @memberOf _
  5622. * @since 0.1.0
  5623. * @category Function
  5624. * @param {Function} func The function to defer.
  5625. * @param {...*} [args] The arguments to invoke `func` with.
  5626. * @returns {number} Returns the timer id.
  5627. * @example
  5628. *
  5629. * _.defer(function(text) {
  5630. * console.log(text);
  5631. * }, 'deferred');
  5632. * // => Logs 'deferred' after one millisecond.
  5633. */var defer=baseRest(function(func,args){return baseDelay(func,1,args)});
  5634. /**
  5635. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  5636. * provided to `func` when it's invoked.
  5637. *
  5638. * @static
  5639. * @memberOf _
  5640. * @since 0.1.0
  5641. * @category Function
  5642. * @param {Function} func The function to delay.
  5643. * @param {number} wait The number of milliseconds to delay invocation.
  5644. * @param {...*} [args] The arguments to invoke `func` with.
  5645. * @returns {number} Returns the timer id.
  5646. * @example
  5647. *
  5648. * _.delay(function(text) {
  5649. * console.log(text);
  5650. * }, 1000, 'later');
  5651. * // => Logs 'later' after one second.
  5652. */var delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)});
  5653. /**
  5654. * Creates a function that invokes `func` with arguments reversed.
  5655. *
  5656. * @static
  5657. * @memberOf _
  5658. * @since 4.0.0
  5659. * @category Function
  5660. * @param {Function} func The function to flip arguments for.
  5661. * @returns {Function} Returns the new flipped function.
  5662. * @example
  5663. *
  5664. * var flipped = _.flip(function() {
  5665. * return _.toArray(arguments);
  5666. * });
  5667. *
  5668. * flipped('a', 'b', 'c', 'd');
  5669. * // => ['d', 'c', 'b', 'a']
  5670. */function flip(func){return createWrap(func,WRAP_FLIP_FLAG)}
  5671. /**
  5672. * Creates a function that memoizes the result of `func`. If `resolver` is
  5673. * provided, it determines the cache key for storing the result based on the
  5674. * arguments provided to the memoized function. By default, the first argument
  5675. * provided to the memoized function is used as the map cache key. The `func`
  5676. * is invoked with the `this` binding of the memoized function.
  5677. *
  5678. * **Note:** The cache is exposed as the `cache` property on the memoized
  5679. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  5680. * constructor with one whose instances implement the
  5681. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  5682. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  5683. *
  5684. * @static
  5685. * @memberOf _
  5686. * @since 0.1.0
  5687. * @category Function
  5688. * @param {Function} func The function to have its output memoized.
  5689. * @param {Function} [resolver] The function to resolve the cache key.
  5690. * @returns {Function} Returns the new memoized function.
  5691. * @example
  5692. *
  5693. * var object = { 'a': 1, 'b': 2 };
  5694. * var other = { 'c': 3, 'd': 4 };
  5695. *
  5696. * var values = _.memoize(_.values);
  5697. * values(object);
  5698. * // => [1, 2]
  5699. *
  5700. * values(other);
  5701. * // => [3, 4]
  5702. *
  5703. * object.a = 2;
  5704. * values(object);
  5705. * // => [1, 2]
  5706. *
  5707. * // Modify the result cache.
  5708. * values.cache.set(object, ['a', 'b']);
  5709. * values(object);
  5710. * // => ['a', 'b']
  5711. *
  5712. * // Replace `_.memoize.Cache`.
  5713. * _.memoize.Cache = WeakMap;
  5714. */function memoize(func,resolver){if(typeof func!="function"||resolver!=null&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}
  5715. // Expose `MapCache`.
  5716. memoize.Cache=MapCache;
  5717. /**
  5718. * Creates a function that negates the result of the predicate `func`. The
  5719. * `func` predicate is invoked with the `this` binding and arguments of the
  5720. * created function.
  5721. *
  5722. * @static
  5723. * @memberOf _
  5724. * @since 3.0.0
  5725. * @category Function
  5726. * @param {Function} predicate The predicate to negate.
  5727. * @returns {Function} Returns the new negated function.
  5728. * @example
  5729. *
  5730. * function isEven(n) {
  5731. * return n % 2 == 0;
  5732. * }
  5733. *
  5734. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  5735. * // => [1, 3, 5]
  5736. */function negate(predicate){if(typeof predicate!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return function(){var args=arguments;switch(args.length){case 0:return!predicate.call(this);case 1:return!predicate.call(this,args[0]);case 2:return!predicate.call(this,args[0],args[1]);case 3:return!predicate.call(this,args[0],args[1],args[2])}return!predicate.apply(this,args)}}
  5737. /**
  5738. * Creates a function that is restricted to invoking `func` once. Repeat calls
  5739. * to the function return the value of the first invocation. The `func` is
  5740. * invoked with the `this` binding and arguments of the created function.
  5741. *
  5742. * @static
  5743. * @memberOf _
  5744. * @since 0.1.0
  5745. * @category Function
  5746. * @param {Function} func The function to restrict.
  5747. * @returns {Function} Returns the new restricted function.
  5748. * @example
  5749. *
  5750. * var initialize = _.once(createApplication);
  5751. * initialize();
  5752. * initialize();
  5753. * // => `createApplication` is invoked once
  5754. */function once(func){return before(2,func)}
  5755. /**
  5756. * Creates a function that invokes `func` with its arguments transformed.
  5757. *
  5758. * @static
  5759. * @since 4.0.0
  5760. * @memberOf _
  5761. * @category Function
  5762. * @param {Function} func The function to wrap.
  5763. * @param {...(Function|Function[])} [transforms=[_.identity]]
  5764. * The argument transforms.
  5765. * @returns {Function} Returns the new function.
  5766. * @example
  5767. *
  5768. * function doubled(n) {
  5769. * return n * 2;
  5770. * }
  5771. *
  5772. * function square(n) {
  5773. * return n * n;
  5774. * }
  5775. *
  5776. * var func = _.overArgs(function(x, y) {
  5777. * return [x, y];
  5778. * }, [square, doubled]);
  5779. *
  5780. * func(9, 3);
  5781. * // => [81, 6]
  5782. *
  5783. * func(10, 5);
  5784. * // => [100, 10]
  5785. */var overArgs=castRest(function(func,transforms){transforms=transforms.length==1&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){var index=-1,length=nativeMin(args.length,funcsLength);while(++index<length){args[index]=transforms[index].call(this,args[index])}return apply(func,this,args)})});
  5786. /**
  5787. * Creates a function that invokes `func` with `partials` prepended to the
  5788. * arguments it receives. This method is like `_.bind` except it does **not**
  5789. * alter the `this` binding.
  5790. *
  5791. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  5792. * builds, may be used as a placeholder for partially applied arguments.
  5793. *
  5794. * **Note:** This method doesn't set the "length" property of partially
  5795. * applied functions.
  5796. *
  5797. * @static
  5798. * @memberOf _
  5799. * @since 0.2.0
  5800. * @category Function
  5801. * @param {Function} func The function to partially apply arguments to.
  5802. * @param {...*} [partials] The arguments to be partially applied.
  5803. * @returns {Function} Returns the new partially applied function.
  5804. * @example
  5805. *
  5806. * function greet(greeting, name) {
  5807. * return greeting + ' ' + name;
  5808. * }
  5809. *
  5810. * var sayHelloTo = _.partial(greet, 'hello');
  5811. * sayHelloTo('fred');
  5812. * // => 'hello fred'
  5813. *
  5814. * // Partially applied with placeholders.
  5815. * var greetFred = _.partial(greet, _, 'fred');
  5816. * greetFred('hi');
  5817. * // => 'hi fred'
  5818. */var partial=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partial));return createWrap(func,WRAP_PARTIAL_FLAG,undefined,partials,holders)});
  5819. /**
  5820. * This method is like `_.partial` except that partially applied arguments
  5821. * are appended to the arguments it receives.
  5822. *
  5823. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  5824. * builds, may be used as a placeholder for partially applied arguments.
  5825. *
  5826. * **Note:** This method doesn't set the "length" property of partially
  5827. * applied functions.
  5828. *
  5829. * @static
  5830. * @memberOf _
  5831. * @since 1.0.0
  5832. * @category Function
  5833. * @param {Function} func The function to partially apply arguments to.
  5834. * @param {...*} [partials] The arguments to be partially applied.
  5835. * @returns {Function} Returns the new partially applied function.
  5836. * @example
  5837. *
  5838. * function greet(greeting, name) {
  5839. * return greeting + ' ' + name;
  5840. * }
  5841. *
  5842. * var greetFred = _.partialRight(greet, 'fred');
  5843. * greetFred('hi');
  5844. * // => 'hi fred'
  5845. *
  5846. * // Partially applied with placeholders.
  5847. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  5848. * sayHelloTo('fred');
  5849. * // => 'hello fred'
  5850. */var partialRight=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partialRight));return createWrap(func,WRAP_PARTIAL_RIGHT_FLAG,undefined,partials,holders)});
  5851. /**
  5852. * Creates a function that invokes `func` with arguments arranged according
  5853. * to the specified `indexes` where the argument value at the first index is
  5854. * provided as the first argument, the argument value at the second index is
  5855. * provided as the second argument, and so on.
  5856. *
  5857. * @static
  5858. * @memberOf _
  5859. * @since 3.0.0
  5860. * @category Function
  5861. * @param {Function} func The function to rearrange arguments for.
  5862. * @param {...(number|number[])} indexes The arranged argument indexes.
  5863. * @returns {Function} Returns the new function.
  5864. * @example
  5865. *
  5866. * var rearged = _.rearg(function(a, b, c) {
  5867. * return [a, b, c];
  5868. * }, [2, 0, 1]);
  5869. *
  5870. * rearged('b', 'c', 'a')
  5871. * // => ['a', 'b', 'c']
  5872. */var rearg=flatRest(function(func,indexes){return createWrap(func,WRAP_REARG_FLAG,undefined,undefined,undefined,indexes)});
  5873. /**
  5874. * Creates a function that invokes `func` with the `this` binding of the
  5875. * created function and arguments from `start` and beyond provided as
  5876. * an array.
  5877. *
  5878. * **Note:** This method is based on the
  5879. * [rest parameter](https://mdn.io/rest_parameters).
  5880. *
  5881. * @static
  5882. * @memberOf _
  5883. * @since 4.0.0
  5884. * @category Function
  5885. * @param {Function} func The function to apply a rest parameter to.
  5886. * @param {number} [start=func.length-1] The start position of the rest parameter.
  5887. * @returns {Function} Returns the new function.
  5888. * @example
  5889. *
  5890. * var say = _.rest(function(what, names) {
  5891. * return what + ' ' + _.initial(names).join(', ') +
  5892. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  5893. * });
  5894. *
  5895. * say('hello', 'fred', 'barney', 'pebbles');
  5896. * // => 'hello fred, barney, & pebbles'
  5897. */function rest(func,start){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}start=start===undefined?start:toInteger(start);return baseRest(func,start)}
  5898. /**
  5899. * Creates a function that invokes `func` with the `this` binding of the
  5900. * create function and an array of arguments much like
  5901. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  5902. *
  5903. * **Note:** This method is based on the
  5904. * [spread operator](https://mdn.io/spread_operator).
  5905. *
  5906. * @static
  5907. * @memberOf _
  5908. * @since 3.2.0
  5909. * @category Function
  5910. * @param {Function} func The function to spread arguments over.
  5911. * @param {number} [start=0] The start position of the spread.
  5912. * @returns {Function} Returns the new function.
  5913. * @example
  5914. *
  5915. * var say = _.spread(function(who, what) {
  5916. * return who + ' says ' + what;
  5917. * });
  5918. *
  5919. * say(['fred', 'hello']);
  5920. * // => 'fred says hello'
  5921. *
  5922. * var numbers = Promise.all([
  5923. * Promise.resolve(40),
  5924. * Promise.resolve(36)
  5925. * ]);
  5926. *
  5927. * numbers.then(_.spread(function(x, y) {
  5928. * return x + y;
  5929. * }));
  5930. * // => a Promise of 76
  5931. */function spread(func,start){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}start=start==null?0:nativeMax(toInteger(start),0);return baseRest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);if(array){arrayPush(otherArgs,array)}return apply(func,this,otherArgs)})}
  5932. /**
  5933. * Creates a throttled function that only invokes `func` at most once per
  5934. * every `wait` milliseconds. The throttled function comes with a `cancel`
  5935. * method to cancel delayed `func` invocations and a `flush` method to
  5936. * immediately invoke them. Provide `options` to indicate whether `func`
  5937. * should be invoked on the leading and/or trailing edge of the `wait`
  5938. * timeout. The `func` is invoked with the last arguments provided to the
  5939. * throttled function. Subsequent calls to the throttled function return the
  5940. * result of the last `func` invocation.
  5941. *
  5942. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  5943. * invoked on the trailing edge of the timeout only if the throttled function
  5944. * is invoked more than once during the `wait` timeout.
  5945. *
  5946. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  5947. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  5948. *
  5949. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  5950. * for details over the differences between `_.throttle` and `_.debounce`.
  5951. *
  5952. * @static
  5953. * @memberOf _
  5954. * @since 0.1.0
  5955. * @category Function
  5956. * @param {Function} func The function to throttle.
  5957. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  5958. * @param {Object} [options={}] The options object.
  5959. * @param {boolean} [options.leading=true]
  5960. * Specify invoking on the leading edge of the timeout.
  5961. * @param {boolean} [options.trailing=true]
  5962. * Specify invoking on the trailing edge of the timeout.
  5963. * @returns {Function} Returns the new throttled function.
  5964. * @example
  5965. *
  5966. * // Avoid excessively updating the position while scrolling.
  5967. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  5968. *
  5969. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  5970. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  5971. * jQuery(element).on('click', throttled);
  5972. *
  5973. * // Cancel the trailing throttled invocation.
  5974. * jQuery(window).on('popstate', throttled.cancel);
  5975. */function throttle(func,wait,options){var leading=true,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}if(isObject(options)){leading="leading"in options?!!options.leading:leading;trailing="trailing"in options?!!options.trailing:trailing}return debounce(func,wait,{leading,maxWait:wait,trailing})}
  5976. /**
  5977. * Creates a function that accepts up to one argument, ignoring any
  5978. * additional arguments.
  5979. *
  5980. * @static
  5981. * @memberOf _
  5982. * @since 4.0.0
  5983. * @category Function
  5984. * @param {Function} func The function to cap arguments for.
  5985. * @returns {Function} Returns the new capped function.
  5986. * @example
  5987. *
  5988. * _.map(['6', '8', '10'], _.unary(parseInt));
  5989. * // => [6, 8, 10]
  5990. */function unary(func){return ary(func,1)}
  5991. /**
  5992. * Creates a function that provides `value` to `wrapper` as its first
  5993. * argument. Any additional arguments provided to the function are appended
  5994. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  5995. * binding of the created function.
  5996. *
  5997. * @static
  5998. * @memberOf _
  5999. * @since 0.1.0
  6000. * @category Function
  6001. * @param {*} value The value to wrap.
  6002. * @param {Function} [wrapper=identity] The wrapper function.
  6003. * @returns {Function} Returns the new function.
  6004. * @example
  6005. *
  6006. * var p = _.wrap(_.escape, function(func, text) {
  6007. * return '<p>' + func(text) + '</p>';
  6008. * });
  6009. *
  6010. * p('fred, barney, & pebbles');
  6011. * // => '<p>fred, barney, &amp; pebbles</p>'
  6012. */function wrap(value,wrapper){return partial(castFunction(wrapper),value)}
  6013. /*------------------------------------------------------------------------*/
  6014. /**
  6015. * Casts `value` as an array if it's not one.
  6016. *
  6017. * @static
  6018. * @memberOf _
  6019. * @since 4.4.0
  6020. * @category Lang
  6021. * @param {*} value The value to inspect.
  6022. * @returns {Array} Returns the cast array.
  6023. * @example
  6024. *
  6025. * _.castArray(1);
  6026. * // => [1]
  6027. *
  6028. * _.castArray({ 'a': 1 });
  6029. * // => [{ 'a': 1 }]
  6030. *
  6031. * _.castArray('abc');
  6032. * // => ['abc']
  6033. *
  6034. * _.castArray(null);
  6035. * // => [null]
  6036. *
  6037. * _.castArray(undefined);
  6038. * // => [undefined]
  6039. *
  6040. * _.castArray();
  6041. * // => []
  6042. *
  6043. * var array = [1, 2, 3];
  6044. * console.log(_.castArray(array) === array);
  6045. * // => true
  6046. */function castArray(){if(!arguments.length){return[]}var value=arguments[0];return isArray(value)?value:[value]}
  6047. /**
  6048. * Creates a shallow clone of `value`.
  6049. *
  6050. * **Note:** This method is loosely based on the
  6051. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  6052. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  6053. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  6054. * arrays. The own enumerable properties of `arguments` objects are cloned
  6055. * as plain objects. An empty object is returned for uncloneable values such
  6056. * as error objects, functions, DOM nodes, and WeakMaps.
  6057. *
  6058. * @static
  6059. * @memberOf _
  6060. * @since 0.1.0
  6061. * @category Lang
  6062. * @param {*} value The value to clone.
  6063. * @returns {*} Returns the cloned value.
  6064. * @see _.cloneDeep
  6065. * @example
  6066. *
  6067. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  6068. *
  6069. * var shallow = _.clone(objects);
  6070. * console.log(shallow[0] === objects[0]);
  6071. * // => true
  6072. */function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG)}
  6073. /**
  6074. * This method is like `_.clone` except that it accepts `customizer` which
  6075. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  6076. * cloning is handled by the method instead. The `customizer` is invoked with
  6077. * up to four arguments; (value [, index|key, object, stack]).
  6078. *
  6079. * @static
  6080. * @memberOf _
  6081. * @since 4.0.0
  6082. * @category Lang
  6083. * @param {*} value The value to clone.
  6084. * @param {Function} [customizer] The function to customize cloning.
  6085. * @returns {*} Returns the cloned value.
  6086. * @see _.cloneDeepWith
  6087. * @example
  6088. *
  6089. * function customizer(value) {
  6090. * if (_.isElement(value)) {
  6091. * return value.cloneNode(false);
  6092. * }
  6093. * }
  6094. *
  6095. * var el = _.cloneWith(document.body, customizer);
  6096. *
  6097. * console.log(el === document.body);
  6098. * // => false
  6099. * console.log(el.nodeName);
  6100. * // => 'BODY'
  6101. * console.log(el.childNodes.length);
  6102. * // => 0
  6103. */function cloneWith(value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseClone(value,CLONE_SYMBOLS_FLAG,customizer)}
  6104. /**
  6105. * This method is like `_.clone` except that it recursively clones `value`.
  6106. *
  6107. * @static
  6108. * @memberOf _
  6109. * @since 1.0.0
  6110. * @category Lang
  6111. * @param {*} value The value to recursively clone.
  6112. * @returns {*} Returns the deep cloned value.
  6113. * @see _.clone
  6114. * @example
  6115. *
  6116. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  6117. *
  6118. * var deep = _.cloneDeep(objects);
  6119. * console.log(deep[0] === objects[0]);
  6120. * // => false
  6121. */function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}
  6122. /**
  6123. * This method is like `_.cloneWith` except that it recursively clones `value`.
  6124. *
  6125. * @static
  6126. * @memberOf _
  6127. * @since 4.0.0
  6128. * @category Lang
  6129. * @param {*} value The value to recursively clone.
  6130. * @param {Function} [customizer] The function to customize cloning.
  6131. * @returns {*} Returns the deep cloned value.
  6132. * @see _.cloneWith
  6133. * @example
  6134. *
  6135. * function customizer(value) {
  6136. * if (_.isElement(value)) {
  6137. * return value.cloneNode(true);
  6138. * }
  6139. * }
  6140. *
  6141. * var el = _.cloneDeepWith(document.body, customizer);
  6142. *
  6143. * console.log(el === document.body);
  6144. * // => false
  6145. * console.log(el.nodeName);
  6146. * // => 'BODY'
  6147. * console.log(el.childNodes.length);
  6148. * // => 20
  6149. */function cloneDeepWith(value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer)}
  6150. /**
  6151. * Checks if `object` conforms to `source` by invoking the predicate
  6152. * properties of `source` with the corresponding property values of `object`.
  6153. *
  6154. * **Note:** This method is equivalent to `_.conforms` when `source` is
  6155. * partially applied.
  6156. *
  6157. * @static
  6158. * @memberOf _
  6159. * @since 4.14.0
  6160. * @category Lang
  6161. * @param {Object} object The object to inspect.
  6162. * @param {Object} source The object of property predicates to conform to.
  6163. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  6164. * @example
  6165. *
  6166. * var object = { 'a': 1, 'b': 2 };
  6167. *
  6168. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  6169. * // => true
  6170. *
  6171. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  6172. * // => false
  6173. */function conformsTo(object,source){return source==null||baseConformsTo(object,source,keys(source))}
  6174. /**
  6175. * Performs a
  6176. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  6177. * comparison between two values to determine if they are equivalent.
  6178. *
  6179. * @static
  6180. * @memberOf _
  6181. * @since 4.0.0
  6182. * @category Lang
  6183. * @param {*} value The value to compare.
  6184. * @param {*} other The other value to compare.
  6185. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  6186. * @example
  6187. *
  6188. * var object = { 'a': 1 };
  6189. * var other = { 'a': 1 };
  6190. *
  6191. * _.eq(object, object);
  6192. * // => true
  6193. *
  6194. * _.eq(object, other);
  6195. * // => false
  6196. *
  6197. * _.eq('a', 'a');
  6198. * // => true
  6199. *
  6200. * _.eq('a', Object('a'));
  6201. * // => false
  6202. *
  6203. * _.eq(NaN, NaN);
  6204. * // => true
  6205. */function eq(value,other){return value===other||value!==value&&other!==other}
  6206. /**
  6207. * Checks if `value` is greater than `other`.
  6208. *
  6209. * @static
  6210. * @memberOf _
  6211. * @since 3.9.0
  6212. * @category Lang
  6213. * @param {*} value The value to compare.
  6214. * @param {*} other The other value to compare.
  6215. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  6216. * else `false`.
  6217. * @see _.lt
  6218. * @example
  6219. *
  6220. * _.gt(3, 1);
  6221. * // => true
  6222. *
  6223. * _.gt(3, 3);
  6224. * // => false
  6225. *
  6226. * _.gt(1, 3);
  6227. * // => false
  6228. */var gt=createRelationalOperation(baseGt);
  6229. /**
  6230. * Checks if `value` is greater than or equal to `other`.
  6231. *
  6232. * @static
  6233. * @memberOf _
  6234. * @since 3.9.0
  6235. * @category Lang
  6236. * @param {*} value The value to compare.
  6237. * @param {*} other The other value to compare.
  6238. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  6239. * `other`, else `false`.
  6240. * @see _.lte
  6241. * @example
  6242. *
  6243. * _.gte(3, 1);
  6244. * // => true
  6245. *
  6246. * _.gte(3, 3);
  6247. * // => true
  6248. *
  6249. * _.gte(1, 3);
  6250. * // => false
  6251. */var gte=createRelationalOperation(function(value,other){return value>=other});
  6252. /**
  6253. * Checks if `value` is likely an `arguments` object.
  6254. *
  6255. * @static
  6256. * @memberOf _
  6257. * @since 0.1.0
  6258. * @category Lang
  6259. * @param {*} value The value to check.
  6260. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  6261. * else `false`.
  6262. * @example
  6263. *
  6264. * _.isArguments(function() { return arguments; }());
  6265. * // => true
  6266. *
  6267. * _.isArguments([1, 2, 3]);
  6268. * // => false
  6269. */var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};
  6270. /**
  6271. * Checks if `value` is classified as an `Array` object.
  6272. *
  6273. * @static
  6274. * @memberOf _
  6275. * @since 0.1.0
  6276. * @category Lang
  6277. * @param {*} value The value to check.
  6278. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6279. * @example
  6280. *
  6281. * _.isArray([1, 2, 3]);
  6282. * // => true
  6283. *
  6284. * _.isArray(document.body.children);
  6285. * // => false
  6286. *
  6287. * _.isArray('abc');
  6288. * // => false
  6289. *
  6290. * _.isArray(_.noop);
  6291. * // => false
  6292. */var isArray=Array.isArray;
  6293. /**
  6294. * Checks if `value` is classified as an `ArrayBuffer` object.
  6295. *
  6296. * @static
  6297. * @memberOf _
  6298. * @since 4.3.0
  6299. * @category Lang
  6300. * @param {*} value The value to check.
  6301. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  6302. * @example
  6303. *
  6304. * _.isArrayBuffer(new ArrayBuffer(2));
  6305. * // => true
  6306. *
  6307. * _.isArrayBuffer(new Array(2));
  6308. * // => false
  6309. */var isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer;
  6310. /**
  6311. * Checks if `value` is array-like. A value is considered array-like if it's
  6312. * not a function and has a `value.length` that's an integer greater than or
  6313. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  6314. *
  6315. * @static
  6316. * @memberOf _
  6317. * @since 4.0.0
  6318. * @category Lang
  6319. * @param {*} value The value to check.
  6320. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  6321. * @example
  6322. *
  6323. * _.isArrayLike([1, 2, 3]);
  6324. * // => true
  6325. *
  6326. * _.isArrayLike(document.body.children);
  6327. * // => true
  6328. *
  6329. * _.isArrayLike('abc');
  6330. * // => true
  6331. *
  6332. * _.isArrayLike(_.noop);
  6333. * // => false
  6334. */function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}
  6335. /**
  6336. * This method is like `_.isArrayLike` except that it also checks if `value`
  6337. * is an object.
  6338. *
  6339. * @static
  6340. * @memberOf _
  6341. * @since 4.0.0
  6342. * @category Lang
  6343. * @param {*} value The value to check.
  6344. * @returns {boolean} Returns `true` if `value` is an array-like object,
  6345. * else `false`.
  6346. * @example
  6347. *
  6348. * _.isArrayLikeObject([1, 2, 3]);
  6349. * // => true
  6350. *
  6351. * _.isArrayLikeObject(document.body.children);
  6352. * // => true
  6353. *
  6354. * _.isArrayLikeObject('abc');
  6355. * // => false
  6356. *
  6357. * _.isArrayLikeObject(_.noop);
  6358. * // => false
  6359. */function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}
  6360. /**
  6361. * Checks if `value` is classified as a boolean primitive or object.
  6362. *
  6363. * @static
  6364. * @memberOf _
  6365. * @since 0.1.0
  6366. * @category Lang
  6367. * @param {*} value The value to check.
  6368. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  6369. * @example
  6370. *
  6371. * _.isBoolean(false);
  6372. * // => true
  6373. *
  6374. * _.isBoolean(null);
  6375. * // => false
  6376. */function isBoolean(value){return value===true||value===false||isObjectLike(value)&&baseGetTag(value)==boolTag}
  6377. /**
  6378. * Checks if `value` is a buffer.
  6379. *
  6380. * @static
  6381. * @memberOf _
  6382. * @since 4.3.0
  6383. * @category Lang
  6384. * @param {*} value The value to check.
  6385. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  6386. * @example
  6387. *
  6388. * _.isBuffer(new Buffer(2));
  6389. * // => true
  6390. *
  6391. * _.isBuffer(new Uint8Array(2));
  6392. * // => false
  6393. */var isBuffer=nativeIsBuffer||stubFalse;
  6394. /**
  6395. * Checks if `value` is classified as a `Date` object.
  6396. *
  6397. * @static
  6398. * @memberOf _
  6399. * @since 0.1.0
  6400. * @category Lang
  6401. * @param {*} value The value to check.
  6402. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  6403. * @example
  6404. *
  6405. * _.isDate(new Date);
  6406. * // => true
  6407. *
  6408. * _.isDate('Mon April 23 2012');
  6409. * // => false
  6410. */var isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate;
  6411. /**
  6412. * Checks if `value` is likely a DOM element.
  6413. *
  6414. * @static
  6415. * @memberOf _
  6416. * @since 0.1.0
  6417. * @category Lang
  6418. * @param {*} value The value to check.
  6419. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  6420. * @example
  6421. *
  6422. * _.isElement(document.body);
  6423. * // => true
  6424. *
  6425. * _.isElement('<body>');
  6426. * // => false
  6427. */function isElement(value){return isObjectLike(value)&&value.nodeType===1&&!isPlainObject(value)}
  6428. /**
  6429. * Checks if `value` is an empty object, collection, map, or set.
  6430. *
  6431. * Objects are considered empty if they have no own enumerable string keyed
  6432. * properties.
  6433. *
  6434. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  6435. * jQuery-like collections are considered empty if they have a `length` of `0`.
  6436. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  6437. *
  6438. * @static
  6439. * @memberOf _
  6440. * @since 0.1.0
  6441. * @category Lang
  6442. * @param {*} value The value to check.
  6443. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  6444. * @example
  6445. *
  6446. * _.isEmpty(null);
  6447. * // => true
  6448. *
  6449. * _.isEmpty(true);
  6450. * // => true
  6451. *
  6452. * _.isEmpty(1);
  6453. * // => true
  6454. *
  6455. * _.isEmpty([1, 2, 3]);
  6456. * // => false
  6457. *
  6458. * _.isEmpty({ 'a': 1 });
  6459. * // => false
  6460. */function isEmpty(value){if(value==null){return true}if(isArrayLike(value)&&(isArray(value)||typeof value=="string"||typeof value.splice=="function"||isBuffer(value)||isTypedArray(value)||isArguments(value))){return!value.length}var tag=getTag(value);if(tag==mapTag||tag==setTag){return!value.size}if(isPrototype(value)){return!baseKeys(value).length}for(var key in value){if(hasOwnProperty.call(value,key)){return false}}return true}
  6461. /**
  6462. * Performs a deep comparison between two values to determine if they are
  6463. * equivalent.
  6464. *
  6465. * **Note:** This method supports comparing arrays, array buffers, booleans,
  6466. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  6467. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  6468. * by their own, not inherited, enumerable properties. Functions and DOM
  6469. * nodes are compared by strict equality, i.e. `===`.
  6470. *
  6471. * @static
  6472. * @memberOf _
  6473. * @since 0.1.0
  6474. * @category Lang
  6475. * @param {*} value The value to compare.
  6476. * @param {*} other The other value to compare.
  6477. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  6478. * @example
  6479. *
  6480. * var object = { 'a': 1 };
  6481. * var other = { 'a': 1 };
  6482. *
  6483. * _.isEqual(object, other);
  6484. * // => true
  6485. *
  6486. * object === other;
  6487. * // => false
  6488. */function isEqual(value,other){return baseIsEqual(value,other)}
  6489. /**
  6490. * This method is like `_.isEqual` except that it accepts `customizer` which
  6491. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  6492. * are handled by the method instead. The `customizer` is invoked with up to
  6493. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  6494. *
  6495. * @static
  6496. * @memberOf _
  6497. * @since 4.0.0
  6498. * @category Lang
  6499. * @param {*} value The value to compare.
  6500. * @param {*} other The other value to compare.
  6501. * @param {Function} [customizer] The function to customize comparisons.
  6502. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  6503. * @example
  6504. *
  6505. * function isGreeting(value) {
  6506. * return /^h(?:i|ello)$/.test(value);
  6507. * }
  6508. *
  6509. * function customizer(objValue, othValue) {
  6510. * if (isGreeting(objValue) && isGreeting(othValue)) {
  6511. * return true;
  6512. * }
  6513. * }
  6514. *
  6515. * var array = ['hello', 'goodbye'];
  6516. * var other = ['hi', 'goodbye'];
  6517. *
  6518. * _.isEqualWith(array, other, customizer);
  6519. * // => true
  6520. */function isEqualWith(value,other,customizer){customizer=typeof customizer=="function"?customizer:undefined;var result=customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,undefined,customizer):!!result}
  6521. /**
  6522. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  6523. * `SyntaxError`, `TypeError`, or `URIError` object.
  6524. *
  6525. * @static
  6526. * @memberOf _
  6527. * @since 3.0.0
  6528. * @category Lang
  6529. * @param {*} value The value to check.
  6530. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  6531. * @example
  6532. *
  6533. * _.isError(new Error);
  6534. * // => true
  6535. *
  6536. * _.isError(Error);
  6537. * // => false
  6538. */function isError(value){if(!isObjectLike(value)){return false}var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||typeof value.message=="string"&&typeof value.name=="string"&&!isPlainObject(value)}
  6539. /**
  6540. * Checks if `value` is a finite primitive number.
  6541. *
  6542. * **Note:** This method is based on
  6543. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  6544. *
  6545. * @static
  6546. * @memberOf _
  6547. * @since 0.1.0
  6548. * @category Lang
  6549. * @param {*} value The value to check.
  6550. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  6551. * @example
  6552. *
  6553. * _.isFinite(3);
  6554. * // => true
  6555. *
  6556. * _.isFinite(Number.MIN_VALUE);
  6557. * // => true
  6558. *
  6559. * _.isFinite(Infinity);
  6560. * // => false
  6561. *
  6562. * _.isFinite('3');
  6563. * // => false
  6564. */function isFinite(value){return typeof value=="number"&&nativeIsFinite(value)}
  6565. /**
  6566. * Checks if `value` is classified as a `Function` object.
  6567. *
  6568. * @static
  6569. * @memberOf _
  6570. * @since 0.1.0
  6571. * @category Lang
  6572. * @param {*} value The value to check.
  6573. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  6574. * @example
  6575. *
  6576. * _.isFunction(_);
  6577. * // => true
  6578. *
  6579. * _.isFunction(/abc/);
  6580. * // => false
  6581. */function isFunction(value){if(!isObject(value)){return false}
  6582. // The use of `Object#toString` avoids issues with the `typeof` operator
  6583. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  6584. var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}
  6585. /**
  6586. * Checks if `value` is an integer.
  6587. *
  6588. * **Note:** This method is based on
  6589. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  6590. *
  6591. * @static
  6592. * @memberOf _
  6593. * @since 4.0.0
  6594. * @category Lang
  6595. * @param {*} value The value to check.
  6596. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  6597. * @example
  6598. *
  6599. * _.isInteger(3);
  6600. * // => true
  6601. *
  6602. * _.isInteger(Number.MIN_VALUE);
  6603. * // => false
  6604. *
  6605. * _.isInteger(Infinity);
  6606. * // => false
  6607. *
  6608. * _.isInteger('3');
  6609. * // => false
  6610. */function isInteger(value){return typeof value=="number"&&value==toInteger(value)}
  6611. /**
  6612. * Checks if `value` is a valid array-like length.
  6613. *
  6614. * **Note:** This method is loosely based on
  6615. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6616. *
  6617. * @static
  6618. * @memberOf _
  6619. * @since 4.0.0
  6620. * @category Lang
  6621. * @param {*} value The value to check.
  6622. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  6623. * @example
  6624. *
  6625. * _.isLength(3);
  6626. * // => true
  6627. *
  6628. * _.isLength(Number.MIN_VALUE);
  6629. * // => false
  6630. *
  6631. * _.isLength(Infinity);
  6632. * // => false
  6633. *
  6634. * _.isLength('3');
  6635. * // => false
  6636. */function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}
  6637. /**
  6638. * Checks if `value` is the
  6639. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6640. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6641. *
  6642. * @static
  6643. * @memberOf _
  6644. * @since 0.1.0
  6645. * @category Lang
  6646. * @param {*} value The value to check.
  6647. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6648. * @example
  6649. *
  6650. * _.isObject({});
  6651. * // => true
  6652. *
  6653. * _.isObject([1, 2, 3]);
  6654. * // => true
  6655. *
  6656. * _.isObject(_.noop);
  6657. * // => true
  6658. *
  6659. * _.isObject(null);
  6660. * // => false
  6661. */function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}
  6662. /**
  6663. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6664. * and has a `typeof` result of "object".
  6665. *
  6666. * @static
  6667. * @memberOf _
  6668. * @since 4.0.0
  6669. * @category Lang
  6670. * @param {*} value The value to check.
  6671. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6672. * @example
  6673. *
  6674. * _.isObjectLike({});
  6675. * // => true
  6676. *
  6677. * _.isObjectLike([1, 2, 3]);
  6678. * // => true
  6679. *
  6680. * _.isObjectLike(_.noop);
  6681. * // => false
  6682. *
  6683. * _.isObjectLike(null);
  6684. * // => false
  6685. */function isObjectLike(value){return value!=null&&typeof value=="object"}
  6686. /**
  6687. * Checks if `value` is classified as a `Map` object.
  6688. *
  6689. * @static
  6690. * @memberOf _
  6691. * @since 4.3.0
  6692. * @category Lang
  6693. * @param {*} value The value to check.
  6694. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  6695. * @example
  6696. *
  6697. * _.isMap(new Map);
  6698. * // => true
  6699. *
  6700. * _.isMap(new WeakMap);
  6701. * // => false
  6702. */var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;
  6703. /**
  6704. * Performs a partial deep comparison between `object` and `source` to
  6705. * determine if `object` contains equivalent property values.
  6706. *
  6707. * **Note:** This method is equivalent to `_.matches` when `source` is
  6708. * partially applied.
  6709. *
  6710. * Partial comparisons will match empty array and empty object `source`
  6711. * values against any array or object value, respectively. See `_.isEqual`
  6712. * for a list of supported value comparisons.
  6713. *
  6714. * @static
  6715. * @memberOf _
  6716. * @since 3.0.0
  6717. * @category Lang
  6718. * @param {Object} object The object to inspect.
  6719. * @param {Object} source The object of property values to match.
  6720. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  6721. * @example
  6722. *
  6723. * var object = { 'a': 1, 'b': 2 };
  6724. *
  6725. * _.isMatch(object, { 'b': 2 });
  6726. * // => true
  6727. *
  6728. * _.isMatch(object, { 'b': 1 });
  6729. * // => false
  6730. */function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source))}
  6731. /**
  6732. * This method is like `_.isMatch` except that it accepts `customizer` which
  6733. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  6734. * are handled by the method instead. The `customizer` is invoked with five
  6735. * arguments: (objValue, srcValue, index|key, object, source).
  6736. *
  6737. * @static
  6738. * @memberOf _
  6739. * @since 4.0.0
  6740. * @category Lang
  6741. * @param {Object} object The object to inspect.
  6742. * @param {Object} source The object of property values to match.
  6743. * @param {Function} [customizer] The function to customize comparisons.
  6744. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  6745. * @example
  6746. *
  6747. * function isGreeting(value) {
  6748. * return /^h(?:i|ello)$/.test(value);
  6749. * }
  6750. *
  6751. * function customizer(objValue, srcValue) {
  6752. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  6753. * return true;
  6754. * }
  6755. * }
  6756. *
  6757. * var object = { 'greeting': 'hello' };
  6758. * var source = { 'greeting': 'hi' };
  6759. *
  6760. * _.isMatchWith(object, source, customizer);
  6761. * // => true
  6762. */function isMatchWith(object,source,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseIsMatch(object,source,getMatchData(source),customizer)}
  6763. /**
  6764. * Checks if `value` is `NaN`.
  6765. *
  6766. * **Note:** This method is based on
  6767. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  6768. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  6769. * `undefined` and other non-number values.
  6770. *
  6771. * @static
  6772. * @memberOf _
  6773. * @since 0.1.0
  6774. * @category Lang
  6775. * @param {*} value The value to check.
  6776. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  6777. * @example
  6778. *
  6779. * _.isNaN(NaN);
  6780. * // => true
  6781. *
  6782. * _.isNaN(new Number(NaN));
  6783. * // => true
  6784. *
  6785. * isNaN(undefined);
  6786. * // => true
  6787. *
  6788. * _.isNaN(undefined);
  6789. * // => false
  6790. */function isNaN(value){
  6791. // An `NaN` primitive is the only value that is not equal to itself.
  6792. // Perform the `toStringTag` check first to avoid errors with some
  6793. // ActiveX objects in IE.
  6794. return isNumber(value)&&value!=+value}
  6795. /**
  6796. * Checks if `value` is a pristine native function.
  6797. *
  6798. * **Note:** This method can't reliably detect native functions in the presence
  6799. * of the core-js package because core-js circumvents this kind of detection.
  6800. * Despite multiple requests, the core-js maintainer has made it clear: any
  6801. * attempt to fix the detection will be obstructed. As a result, we're left
  6802. * with little choice but to throw an error. Unfortunately, this also affects
  6803. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  6804. * which rely on core-js.
  6805. *
  6806. * @static
  6807. * @memberOf _
  6808. * @since 3.0.0
  6809. * @category Lang
  6810. * @param {*} value The value to check.
  6811. * @returns {boolean} Returns `true` if `value` is a native function,
  6812. * else `false`.
  6813. * @example
  6814. *
  6815. * _.isNative(Array.prototype.push);
  6816. * // => true
  6817. *
  6818. * _.isNative(_);
  6819. * // => false
  6820. */function isNative(value){if(isMaskable(value)){throw new Error(CORE_ERROR_TEXT)}return baseIsNative(value)}
  6821. /**
  6822. * Checks if `value` is `null`.
  6823. *
  6824. * @static
  6825. * @memberOf _
  6826. * @since 0.1.0
  6827. * @category Lang
  6828. * @param {*} value The value to check.
  6829. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  6830. * @example
  6831. *
  6832. * _.isNull(null);
  6833. * // => true
  6834. *
  6835. * _.isNull(void 0);
  6836. * // => false
  6837. */function isNull(value){return value===null}
  6838. /**
  6839. * Checks if `value` is `null` or `undefined`.
  6840. *
  6841. * @static
  6842. * @memberOf _
  6843. * @since 4.0.0
  6844. * @category Lang
  6845. * @param {*} value The value to check.
  6846. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  6847. * @example
  6848. *
  6849. * _.isNil(null);
  6850. * // => true
  6851. *
  6852. * _.isNil(void 0);
  6853. * // => true
  6854. *
  6855. * _.isNil(NaN);
  6856. * // => false
  6857. */function isNil(value){return value==null}
  6858. /**
  6859. * Checks if `value` is classified as a `Number` primitive or object.
  6860. *
  6861. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  6862. * classified as numbers, use the `_.isFinite` method.
  6863. *
  6864. * @static
  6865. * @memberOf _
  6866. * @since 0.1.0
  6867. * @category Lang
  6868. * @param {*} value The value to check.
  6869. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  6870. * @example
  6871. *
  6872. * _.isNumber(3);
  6873. * // => true
  6874. *
  6875. * _.isNumber(Number.MIN_VALUE);
  6876. * // => true
  6877. *
  6878. * _.isNumber(Infinity);
  6879. * // => true
  6880. *
  6881. * _.isNumber('3');
  6882. * // => false
  6883. */function isNumber(value){return typeof value=="number"||isObjectLike(value)&&baseGetTag(value)==numberTag}
  6884. /**
  6885. * Checks if `value` is a plain object, that is, an object created by the
  6886. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  6887. *
  6888. * @static
  6889. * @memberOf _
  6890. * @since 0.8.0
  6891. * @category Lang
  6892. * @param {*} value The value to check.
  6893. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  6894. * @example
  6895. *
  6896. * function Foo() {
  6897. * this.a = 1;
  6898. * }
  6899. *
  6900. * _.isPlainObject(new Foo);
  6901. * // => false
  6902. *
  6903. * _.isPlainObject([1, 2, 3]);
  6904. * // => false
  6905. *
  6906. * _.isPlainObject({ 'x': 0, 'y': 0 });
  6907. * // => true
  6908. *
  6909. * _.isPlainObject(Object.create(null));
  6910. * // => true
  6911. */function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag){return false}var proto=getPrototype(value);if(proto===null){return true}var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}
  6912. /**
  6913. * Checks if `value` is classified as a `RegExp` object.
  6914. *
  6915. * @static
  6916. * @memberOf _
  6917. * @since 0.1.0
  6918. * @category Lang
  6919. * @param {*} value The value to check.
  6920. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  6921. * @example
  6922. *
  6923. * _.isRegExp(/abc/);
  6924. * // => true
  6925. *
  6926. * _.isRegExp('/abc/');
  6927. * // => false
  6928. */var isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp;
  6929. /**
  6930. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  6931. * double precision number which isn't the result of a rounded unsafe integer.
  6932. *
  6933. * **Note:** This method is based on
  6934. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  6935. *
  6936. * @static
  6937. * @memberOf _
  6938. * @since 4.0.0
  6939. * @category Lang
  6940. * @param {*} value The value to check.
  6941. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  6942. * @example
  6943. *
  6944. * _.isSafeInteger(3);
  6945. * // => true
  6946. *
  6947. * _.isSafeInteger(Number.MIN_VALUE);
  6948. * // => false
  6949. *
  6950. * _.isSafeInteger(Infinity);
  6951. * // => false
  6952. *
  6953. * _.isSafeInteger('3');
  6954. * // => false
  6955. */function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}
  6956. /**
  6957. * Checks if `value` is classified as a `Set` object.
  6958. *
  6959. * @static
  6960. * @memberOf _
  6961. * @since 4.3.0
  6962. * @category Lang
  6963. * @param {*} value The value to check.
  6964. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  6965. * @example
  6966. *
  6967. * _.isSet(new Set);
  6968. * // => true
  6969. *
  6970. * _.isSet(new WeakSet);
  6971. * // => false
  6972. */var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;
  6973. /**
  6974. * Checks if `value` is classified as a `String` primitive or object.
  6975. *
  6976. * @static
  6977. * @since 0.1.0
  6978. * @memberOf _
  6979. * @category Lang
  6980. * @param {*} value The value to check.
  6981. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  6982. * @example
  6983. *
  6984. * _.isString('abc');
  6985. * // => true
  6986. *
  6987. * _.isString(1);
  6988. * // => false
  6989. */function isString(value){return typeof value=="string"||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}
  6990. /**
  6991. * Checks if `value` is classified as a `Symbol` primitive or object.
  6992. *
  6993. * @static
  6994. * @memberOf _
  6995. * @since 4.0.0
  6996. * @category Lang
  6997. * @param {*} value The value to check.
  6998. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  6999. * @example
  7000. *
  7001. * _.isSymbol(Symbol.iterator);
  7002. * // => true
  7003. *
  7004. * _.isSymbol('abc');
  7005. * // => false
  7006. */function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}
  7007. /**
  7008. * Checks if `value` is classified as a typed array.
  7009. *
  7010. * @static
  7011. * @memberOf _
  7012. * @since 3.0.0
  7013. * @category Lang
  7014. * @param {*} value The value to check.
  7015. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  7016. * @example
  7017. *
  7018. * _.isTypedArray(new Uint8Array);
  7019. * // => true
  7020. *
  7021. * _.isTypedArray([]);
  7022. * // => false
  7023. */var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;
  7024. /**
  7025. * Checks if `value` is `undefined`.
  7026. *
  7027. * @static
  7028. * @since 0.1.0
  7029. * @memberOf _
  7030. * @category Lang
  7031. * @param {*} value The value to check.
  7032. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  7033. * @example
  7034. *
  7035. * _.isUndefined(void 0);
  7036. * // => true
  7037. *
  7038. * _.isUndefined(null);
  7039. * // => false
  7040. */function isUndefined(value){return value===undefined}
  7041. /**
  7042. * Checks if `value` is classified as a `WeakMap` object.
  7043. *
  7044. * @static
  7045. * @memberOf _
  7046. * @since 4.3.0
  7047. * @category Lang
  7048. * @param {*} value The value to check.
  7049. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  7050. * @example
  7051. *
  7052. * _.isWeakMap(new WeakMap);
  7053. * // => true
  7054. *
  7055. * _.isWeakMap(new Map);
  7056. * // => false
  7057. */function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag}
  7058. /**
  7059. * Checks if `value` is classified as a `WeakSet` object.
  7060. *
  7061. * @static
  7062. * @memberOf _
  7063. * @since 4.3.0
  7064. * @category Lang
  7065. * @param {*} value The value to check.
  7066. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  7067. * @example
  7068. *
  7069. * _.isWeakSet(new WeakSet);
  7070. * // => true
  7071. *
  7072. * _.isWeakSet(new Set);
  7073. * // => false
  7074. */function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag}
  7075. /**
  7076. * Checks if `value` is less than `other`.
  7077. *
  7078. * @static
  7079. * @memberOf _
  7080. * @since 3.9.0
  7081. * @category Lang
  7082. * @param {*} value The value to compare.
  7083. * @param {*} other The other value to compare.
  7084. * @returns {boolean} Returns `true` if `value` is less than `other`,
  7085. * else `false`.
  7086. * @see _.gt
  7087. * @example
  7088. *
  7089. * _.lt(1, 3);
  7090. * // => true
  7091. *
  7092. * _.lt(3, 3);
  7093. * // => false
  7094. *
  7095. * _.lt(3, 1);
  7096. * // => false
  7097. */var lt=createRelationalOperation(baseLt);
  7098. /**
  7099. * Checks if `value` is less than or equal to `other`.
  7100. *
  7101. * @static
  7102. * @memberOf _
  7103. * @since 3.9.0
  7104. * @category Lang
  7105. * @param {*} value The value to compare.
  7106. * @param {*} other The other value to compare.
  7107. * @returns {boolean} Returns `true` if `value` is less than or equal to
  7108. * `other`, else `false`.
  7109. * @see _.gte
  7110. * @example
  7111. *
  7112. * _.lte(1, 3);
  7113. * // => true
  7114. *
  7115. * _.lte(3, 3);
  7116. * // => true
  7117. *
  7118. * _.lte(3, 1);
  7119. * // => false
  7120. */var lte=createRelationalOperation(function(value,other){return value<=other});
  7121. /**
  7122. * Converts `value` to an array.
  7123. *
  7124. * @static
  7125. * @since 0.1.0
  7126. * @memberOf _
  7127. * @category Lang
  7128. * @param {*} value The value to convert.
  7129. * @returns {Array} Returns the converted array.
  7130. * @example
  7131. *
  7132. * _.toArray({ 'a': 1, 'b': 2 });
  7133. * // => [1, 2]
  7134. *
  7135. * _.toArray('abc');
  7136. * // => ['a', 'b', 'c']
  7137. *
  7138. * _.toArray(1);
  7139. * // => []
  7140. *
  7141. * _.toArray(null);
  7142. * // => []
  7143. */function toArray(value){if(!value){return[]}if(isArrayLike(value)){return isString(value)?stringToArray(value):copyArray(value)}if(symIterator&&value[symIterator]){return iteratorToArray(value[symIterator]())}var tag=getTag(value),func=tag==mapTag?mapToArray:tag==setTag?setToArray:values;return func(value)}
  7144. /**
  7145. * Converts `value` to a finite number.
  7146. *
  7147. * @static
  7148. * @memberOf _
  7149. * @since 4.12.0
  7150. * @category Lang
  7151. * @param {*} value The value to convert.
  7152. * @returns {number} Returns the converted number.
  7153. * @example
  7154. *
  7155. * _.toFinite(3.2);
  7156. * // => 3.2
  7157. *
  7158. * _.toFinite(Number.MIN_VALUE);
  7159. * // => 5e-324
  7160. *
  7161. * _.toFinite(Infinity);
  7162. * // => 1.7976931348623157e+308
  7163. *
  7164. * _.toFinite('3.2');
  7165. * // => 3.2
  7166. */function toFinite(value){if(!value){return value===0?value:0}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}
  7167. /**
  7168. * Converts `value` to an integer.
  7169. *
  7170. * **Note:** This method is loosely based on
  7171. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  7172. *
  7173. * @static
  7174. * @memberOf _
  7175. * @since 4.0.0
  7176. * @category Lang
  7177. * @param {*} value The value to convert.
  7178. * @returns {number} Returns the converted integer.
  7179. * @example
  7180. *
  7181. * _.toInteger(3.2);
  7182. * // => 3
  7183. *
  7184. * _.toInteger(Number.MIN_VALUE);
  7185. * // => 0
  7186. *
  7187. * _.toInteger(Infinity);
  7188. * // => 1.7976931348623157e+308
  7189. *
  7190. * _.toInteger('3.2');
  7191. * // => 3
  7192. */function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}
  7193. /**
  7194. * Converts `value` to an integer suitable for use as the length of an
  7195. * array-like object.
  7196. *
  7197. * **Note:** This method is based on
  7198. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  7199. *
  7200. * @static
  7201. * @memberOf _
  7202. * @since 4.0.0
  7203. * @category Lang
  7204. * @param {*} value The value to convert.
  7205. * @returns {number} Returns the converted integer.
  7206. * @example
  7207. *
  7208. * _.toLength(3.2);
  7209. * // => 3
  7210. *
  7211. * _.toLength(Number.MIN_VALUE);
  7212. * // => 0
  7213. *
  7214. * _.toLength(Infinity);
  7215. * // => 4294967295
  7216. *
  7217. * _.toLength('3.2');
  7218. * // => 3
  7219. */function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}
  7220. /**
  7221. * Converts `value` to a number.
  7222. *
  7223. * @static
  7224. * @memberOf _
  7225. * @since 4.0.0
  7226. * @category Lang
  7227. * @param {*} value The value to process.
  7228. * @returns {number} Returns the number.
  7229. * @example
  7230. *
  7231. * _.toNumber(3.2);
  7232. * // => 3.2
  7233. *
  7234. * _.toNumber(Number.MIN_VALUE);
  7235. * // => 5e-324
  7236. *
  7237. * _.toNumber(Infinity);
  7238. * // => Infinity
  7239. *
  7240. * _.toNumber('3.2');
  7241. * // => 3.2
  7242. */function toNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}if(isObject(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string"){return value===0?value:+value}value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}
  7243. /**
  7244. * Converts `value` to a plain object flattening inherited enumerable string
  7245. * keyed properties of `value` to own properties of the plain object.
  7246. *
  7247. * @static
  7248. * @memberOf _
  7249. * @since 3.0.0
  7250. * @category Lang
  7251. * @param {*} value The value to convert.
  7252. * @returns {Object} Returns the converted plain object.
  7253. * @example
  7254. *
  7255. * function Foo() {
  7256. * this.b = 2;
  7257. * }
  7258. *
  7259. * Foo.prototype.c = 3;
  7260. *
  7261. * _.assign({ 'a': 1 }, new Foo);
  7262. * // => { 'a': 1, 'b': 2 }
  7263. *
  7264. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  7265. * // => { 'a': 1, 'b': 2, 'c': 3 }
  7266. */function toPlainObject(value){return copyObject(value,keysIn(value))}
  7267. /**
  7268. * Converts `value` to a safe integer. A safe integer can be compared and
  7269. * represented correctly.
  7270. *
  7271. * @static
  7272. * @memberOf _
  7273. * @since 4.0.0
  7274. * @category Lang
  7275. * @param {*} value The value to convert.
  7276. * @returns {number} Returns the converted integer.
  7277. * @example
  7278. *
  7279. * _.toSafeInteger(3.2);
  7280. * // => 3
  7281. *
  7282. * _.toSafeInteger(Number.MIN_VALUE);
  7283. * // => 0
  7284. *
  7285. * _.toSafeInteger(Infinity);
  7286. * // => 9007199254740991
  7287. *
  7288. * _.toSafeInteger('3.2');
  7289. * // => 3
  7290. */function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):value===0?value:0}
  7291. /**
  7292. * Converts `value` to a string. An empty string is returned for `null`
  7293. * and `undefined` values. The sign of `-0` is preserved.
  7294. *
  7295. * @static
  7296. * @memberOf _
  7297. * @since 4.0.0
  7298. * @category Lang
  7299. * @param {*} value The value to convert.
  7300. * @returns {string} Returns the converted string.
  7301. * @example
  7302. *
  7303. * _.toString(null);
  7304. * // => ''
  7305. *
  7306. * _.toString(-0);
  7307. * // => '-0'
  7308. *
  7309. * _.toString([1, 2, 3]);
  7310. * // => '1,2,3'
  7311. */function toString(value){return value==null?"":baseToString(value)}
  7312. /*------------------------------------------------------------------------*/
  7313. /**
  7314. * Assigns own enumerable string keyed properties of source objects to the
  7315. * destination object. Source objects are applied from left to right.
  7316. * Subsequent sources overwrite property assignments of previous sources.
  7317. *
  7318. * **Note:** This method mutates `object` and is loosely based on
  7319. * [`Object.assign`](https://mdn.io/Object/assign).
  7320. *
  7321. * @static
  7322. * @memberOf _
  7323. * @since 0.10.0
  7324. * @category Object
  7325. * @param {Object} object The destination object.
  7326. * @param {...Object} [sources] The source objects.
  7327. * @returns {Object} Returns `object`.
  7328. * @see _.assignIn
  7329. * @example
  7330. *
  7331. * function Foo() {
  7332. * this.a = 1;
  7333. * }
  7334. *
  7335. * function Bar() {
  7336. * this.c = 3;
  7337. * }
  7338. *
  7339. * Foo.prototype.b = 2;
  7340. * Bar.prototype.d = 4;
  7341. *
  7342. * _.assign({ 'a': 0 }, new Foo, new Bar);
  7343. * // => { 'a': 1, 'c': 3 }
  7344. */var assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return}for(var key in source){if(hasOwnProperty.call(source,key)){assignValue(object,key,source[key])}}});
  7345. /**
  7346. * This method is like `_.assign` except that it iterates over own and
  7347. * inherited source properties.
  7348. *
  7349. * **Note:** This method mutates `object`.
  7350. *
  7351. * @static
  7352. * @memberOf _
  7353. * @since 4.0.0
  7354. * @alias extend
  7355. * @category Object
  7356. * @param {Object} object The destination object.
  7357. * @param {...Object} [sources] The source objects.
  7358. * @returns {Object} Returns `object`.
  7359. * @see _.assign
  7360. * @example
  7361. *
  7362. * function Foo() {
  7363. * this.a = 1;
  7364. * }
  7365. *
  7366. * function Bar() {
  7367. * this.c = 3;
  7368. * }
  7369. *
  7370. * Foo.prototype.b = 2;
  7371. * Bar.prototype.d = 4;
  7372. *
  7373. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  7374. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  7375. */var assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object)});
  7376. /**
  7377. * This method is like `_.assignIn` except that it accepts `customizer`
  7378. * which is invoked to produce the assigned values. If `customizer` returns
  7379. * `undefined`, assignment is handled by the method instead. The `customizer`
  7380. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  7381. *
  7382. * **Note:** This method mutates `object`.
  7383. *
  7384. * @static
  7385. * @memberOf _
  7386. * @since 4.0.0
  7387. * @alias extendWith
  7388. * @category Object
  7389. * @param {Object} object The destination object.
  7390. * @param {...Object} sources The source objects.
  7391. * @param {Function} [customizer] The function to customize assigned values.
  7392. * @returns {Object} Returns `object`.
  7393. * @see _.assignWith
  7394. * @example
  7395. *
  7396. * function customizer(objValue, srcValue) {
  7397. * return _.isUndefined(objValue) ? srcValue : objValue;
  7398. * }
  7399. *
  7400. * var defaults = _.partialRight(_.assignInWith, customizer);
  7401. *
  7402. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  7403. * // => { 'a': 1, 'b': 2 }
  7404. */var assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)});
  7405. /**
  7406. * This method is like `_.assign` except that it accepts `customizer`
  7407. * which is invoked to produce the assigned values. If `customizer` returns
  7408. * `undefined`, assignment is handled by the method instead. The `customizer`
  7409. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  7410. *
  7411. * **Note:** This method mutates `object`.
  7412. *
  7413. * @static
  7414. * @memberOf _
  7415. * @since 4.0.0
  7416. * @category Object
  7417. * @param {Object} object The destination object.
  7418. * @param {...Object} sources The source objects.
  7419. * @param {Function} [customizer] The function to customize assigned values.
  7420. * @returns {Object} Returns `object`.
  7421. * @see _.assignInWith
  7422. * @example
  7423. *
  7424. * function customizer(objValue, srcValue) {
  7425. * return _.isUndefined(objValue) ? srcValue : objValue;
  7426. * }
  7427. *
  7428. * var defaults = _.partialRight(_.assignWith, customizer);
  7429. *
  7430. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  7431. * // => { 'a': 1, 'b': 2 }
  7432. */var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)});
  7433. /**
  7434. * Creates an array of values corresponding to `paths` of `object`.
  7435. *
  7436. * @static
  7437. * @memberOf _
  7438. * @since 1.0.0
  7439. * @category Object
  7440. * @param {Object} object The object to iterate over.
  7441. * @param {...(string|string[])} [paths] The property paths to pick.
  7442. * @returns {Array} Returns the picked values.
  7443. * @example
  7444. *
  7445. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  7446. *
  7447. * _.at(object, ['a[0].b.c', 'a[1]']);
  7448. * // => [3, 4]
  7449. */var at=flatRest(baseAt);
  7450. /**
  7451. * Creates an object that inherits from the `prototype` object. If a
  7452. * `properties` object is given, its own enumerable string keyed properties
  7453. * are assigned to the created object.
  7454. *
  7455. * @static
  7456. * @memberOf _
  7457. * @since 2.3.0
  7458. * @category Object
  7459. * @param {Object} prototype The object to inherit from.
  7460. * @param {Object} [properties] The properties to assign to the object.
  7461. * @returns {Object} Returns the new object.
  7462. * @example
  7463. *
  7464. * function Shape() {
  7465. * this.x = 0;
  7466. * this.y = 0;
  7467. * }
  7468. *
  7469. * function Circle() {
  7470. * Shape.call(this);
  7471. * }
  7472. *
  7473. * Circle.prototype = _.create(Shape.prototype, {
  7474. * 'constructor': Circle
  7475. * });
  7476. *
  7477. * var circle = new Circle;
  7478. * circle instanceof Circle;
  7479. * // => true
  7480. *
  7481. * circle instanceof Shape;
  7482. * // => true
  7483. */function create(prototype,properties){var result=baseCreate(prototype);return properties==null?result:baseAssign(result,properties)}
  7484. /**
  7485. * Assigns own and inherited enumerable string keyed properties of source
  7486. * objects to the destination object for all destination properties that
  7487. * resolve to `undefined`. Source objects are applied from left to right.
  7488. * Once a property is set, additional values of the same property are ignored.
  7489. *
  7490. * **Note:** This method mutates `object`.
  7491. *
  7492. * @static
  7493. * @since 0.1.0
  7494. * @memberOf _
  7495. * @category Object
  7496. * @param {Object} object The destination object.
  7497. * @param {...Object} [sources] The source objects.
  7498. * @returns {Object} Returns `object`.
  7499. * @see _.defaultsDeep
  7500. * @example
  7501. *
  7502. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  7503. * // => { 'a': 1, 'b': 2 }
  7504. */var defaults=baseRest(function(object,sources){object=Object(object);var index=-1;var length=sources.length;var guard=length>2?sources[2]:undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){length=1}while(++index<length){var source=sources[index];var props=keysIn(source);var propsIndex=-1;var propsLength=props.length;while(++propsIndex<propsLength){var key=props[propsIndex];var value=object[key];if(value===undefined||eq(value,objectProto[key])&&!hasOwnProperty.call(object,key)){object[key]=source[key]}}}return object});
  7505. /**
  7506. * This method is like `_.defaults` except that it recursively assigns
  7507. * default properties.
  7508. *
  7509. * **Note:** This method mutates `object`.
  7510. *
  7511. * @static
  7512. * @memberOf _
  7513. * @since 3.10.0
  7514. * @category Object
  7515. * @param {Object} object The destination object.
  7516. * @param {...Object} [sources] The source objects.
  7517. * @returns {Object} Returns `object`.
  7518. * @see _.defaults
  7519. * @example
  7520. *
  7521. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  7522. * // => { 'a': { 'b': 2, 'c': 3 } }
  7523. */var defaultsDeep=baseRest(function(args){args.push(undefined,customDefaultsMerge);return apply(mergeWith,undefined,args)});
  7524. /**
  7525. * This method is like `_.find` except that it returns the key of the first
  7526. * element `predicate` returns truthy for instead of the element itself.
  7527. *
  7528. * @static
  7529. * @memberOf _
  7530. * @since 1.1.0
  7531. * @category Object
  7532. * @param {Object} object The object to inspect.
  7533. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7534. * @returns {string|undefined} Returns the key of the matched element,
  7535. * else `undefined`.
  7536. * @example
  7537. *
  7538. * var users = {
  7539. * 'barney': { 'age': 36, 'active': true },
  7540. * 'fred': { 'age': 40, 'active': false },
  7541. * 'pebbles': { 'age': 1, 'active': true }
  7542. * };
  7543. *
  7544. * _.findKey(users, function(o) { return o.age < 40; });
  7545. * // => 'barney' (iteration order is not guaranteed)
  7546. *
  7547. * // The `_.matches` iteratee shorthand.
  7548. * _.findKey(users, { 'age': 1, 'active': true });
  7549. * // => 'pebbles'
  7550. *
  7551. * // The `_.matchesProperty` iteratee shorthand.
  7552. * _.findKey(users, ['active', false]);
  7553. * // => 'fred'
  7554. *
  7555. * // The `_.property` iteratee shorthand.
  7556. * _.findKey(users, 'active');
  7557. * // => 'barney'
  7558. */function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}
  7559. /**
  7560. * This method is like `_.findKey` except that it iterates over elements of
  7561. * a collection in the opposite order.
  7562. *
  7563. * @static
  7564. * @memberOf _
  7565. * @since 2.0.0
  7566. * @category Object
  7567. * @param {Object} object The object to inspect.
  7568. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7569. * @returns {string|undefined} Returns the key of the matched element,
  7570. * else `undefined`.
  7571. * @example
  7572. *
  7573. * var users = {
  7574. * 'barney': { 'age': 36, 'active': true },
  7575. * 'fred': { 'age': 40, 'active': false },
  7576. * 'pebbles': { 'age': 1, 'active': true }
  7577. * };
  7578. *
  7579. * _.findLastKey(users, function(o) { return o.age < 40; });
  7580. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  7581. *
  7582. * // The `_.matches` iteratee shorthand.
  7583. * _.findLastKey(users, { 'age': 36, 'active': true });
  7584. * // => 'barney'
  7585. *
  7586. * // The `_.matchesProperty` iteratee shorthand.
  7587. * _.findLastKey(users, ['active', false]);
  7588. * // => 'fred'
  7589. *
  7590. * // The `_.property` iteratee shorthand.
  7591. * _.findLastKey(users, 'active');
  7592. * // => 'pebbles'
  7593. */function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}
  7594. /**
  7595. * Iterates over own and inherited enumerable string keyed properties of an
  7596. * object and invokes `iteratee` for each property. The iteratee is invoked
  7597. * with three arguments: (value, key, object). Iteratee functions may exit
  7598. * iteration early by explicitly returning `false`.
  7599. *
  7600. * @static
  7601. * @memberOf _
  7602. * @since 0.3.0
  7603. * @category Object
  7604. * @param {Object} object The object to iterate over.
  7605. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7606. * @returns {Object} Returns `object`.
  7607. * @see _.forInRight
  7608. * @example
  7609. *
  7610. * function Foo() {
  7611. * this.a = 1;
  7612. * this.b = 2;
  7613. * }
  7614. *
  7615. * Foo.prototype.c = 3;
  7616. *
  7617. * _.forIn(new Foo, function(value, key) {
  7618. * console.log(key);
  7619. * });
  7620. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  7621. */function forIn(object,iteratee){return object==null?object:baseFor(object,getIteratee(iteratee,3),keysIn)}
  7622. /**
  7623. * This method is like `_.forIn` except that it iterates over properties of
  7624. * `object` in the opposite order.
  7625. *
  7626. * @static
  7627. * @memberOf _
  7628. * @since 2.0.0
  7629. * @category Object
  7630. * @param {Object} object The object to iterate over.
  7631. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7632. * @returns {Object} Returns `object`.
  7633. * @see _.forIn
  7634. * @example
  7635. *
  7636. * function Foo() {
  7637. * this.a = 1;
  7638. * this.b = 2;
  7639. * }
  7640. *
  7641. * Foo.prototype.c = 3;
  7642. *
  7643. * _.forInRight(new Foo, function(value, key) {
  7644. * console.log(key);
  7645. * });
  7646. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  7647. */function forInRight(object,iteratee){return object==null?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}
  7648. /**
  7649. * Iterates over own enumerable string keyed properties of an object and
  7650. * invokes `iteratee` for each property. The iteratee is invoked with three
  7651. * arguments: (value, key, object). Iteratee functions may exit iteration
  7652. * early by explicitly returning `false`.
  7653. *
  7654. * @static
  7655. * @memberOf _
  7656. * @since 0.3.0
  7657. * @category Object
  7658. * @param {Object} object The object to iterate over.
  7659. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7660. * @returns {Object} Returns `object`.
  7661. * @see _.forOwnRight
  7662. * @example
  7663. *
  7664. * function Foo() {
  7665. * this.a = 1;
  7666. * this.b = 2;
  7667. * }
  7668. *
  7669. * Foo.prototype.c = 3;
  7670. *
  7671. * _.forOwn(new Foo, function(value, key) {
  7672. * console.log(key);
  7673. * });
  7674. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  7675. */function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3))}
  7676. /**
  7677. * This method is like `_.forOwn` except that it iterates over properties of
  7678. * `object` in the opposite order.
  7679. *
  7680. * @static
  7681. * @memberOf _
  7682. * @since 2.0.0
  7683. * @category Object
  7684. * @param {Object} object The object to iterate over.
  7685. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7686. * @returns {Object} Returns `object`.
  7687. * @see _.forOwn
  7688. * @example
  7689. *
  7690. * function Foo() {
  7691. * this.a = 1;
  7692. * this.b = 2;
  7693. * }
  7694. *
  7695. * Foo.prototype.c = 3;
  7696. *
  7697. * _.forOwnRight(new Foo, function(value, key) {
  7698. * console.log(key);
  7699. * });
  7700. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  7701. */function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}
  7702. /**
  7703. * Creates an array of function property names from own enumerable properties
  7704. * of `object`.
  7705. *
  7706. * @static
  7707. * @since 0.1.0
  7708. * @memberOf _
  7709. * @category Object
  7710. * @param {Object} object The object to inspect.
  7711. * @returns {Array} Returns the function names.
  7712. * @see _.functionsIn
  7713. * @example
  7714. *
  7715. * function Foo() {
  7716. * this.a = _.constant('a');
  7717. * this.b = _.constant('b');
  7718. * }
  7719. *
  7720. * Foo.prototype.c = _.constant('c');
  7721. *
  7722. * _.functions(new Foo);
  7723. * // => ['a', 'b']
  7724. */function functions(object){return object==null?[]:baseFunctions(object,keys(object))}
  7725. /**
  7726. * Creates an array of function property names from own and inherited
  7727. * enumerable properties of `object`.
  7728. *
  7729. * @static
  7730. * @memberOf _
  7731. * @since 4.0.0
  7732. * @category Object
  7733. * @param {Object} object The object to inspect.
  7734. * @returns {Array} Returns the function names.
  7735. * @see _.functions
  7736. * @example
  7737. *
  7738. * function Foo() {
  7739. * this.a = _.constant('a');
  7740. * this.b = _.constant('b');
  7741. * }
  7742. *
  7743. * Foo.prototype.c = _.constant('c');
  7744. *
  7745. * _.functionsIn(new Foo);
  7746. * // => ['a', 'b', 'c']
  7747. */function functionsIn(object){return object==null?[]:baseFunctions(object,keysIn(object))}
  7748. /**
  7749. * Gets the value at `path` of `object`. If the resolved value is
  7750. * `undefined`, the `defaultValue` is returned in its place.
  7751. *
  7752. * @static
  7753. * @memberOf _
  7754. * @since 3.7.0
  7755. * @category Object
  7756. * @param {Object} object The object to query.
  7757. * @param {Array|string} path The path of the property to get.
  7758. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  7759. * @returns {*} Returns the resolved value.
  7760. * @example
  7761. *
  7762. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  7763. *
  7764. * _.get(object, 'a[0].b.c');
  7765. * // => 3
  7766. *
  7767. * _.get(object, ['a', '0', 'b', 'c']);
  7768. * // => 3
  7769. *
  7770. * _.get(object, 'a.b.c', 'default');
  7771. * // => 'default'
  7772. */function get(object,path,defaultValue){var result=object==null?undefined:baseGet(object,path);return result===undefined?defaultValue:result}
  7773. /**
  7774. * Checks if `path` is a direct property of `object`.
  7775. *
  7776. * @static
  7777. * @since 0.1.0
  7778. * @memberOf _
  7779. * @category Object
  7780. * @param {Object} object The object to query.
  7781. * @param {Array|string} path The path to check.
  7782. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7783. * @example
  7784. *
  7785. * var object = { 'a': { 'b': 2 } };
  7786. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  7787. *
  7788. * _.has(object, 'a');
  7789. * // => true
  7790. *
  7791. * _.has(object, 'a.b');
  7792. * // => true
  7793. *
  7794. * _.has(object, ['a', 'b']);
  7795. * // => true
  7796. *
  7797. * _.has(other, 'a');
  7798. * // => false
  7799. */function has(object,path){return object!=null&&hasPath(object,path,baseHas)}
  7800. /**
  7801. * Checks if `path` is a direct or inherited property of `object`.
  7802. *
  7803. * @static
  7804. * @memberOf _
  7805. * @since 4.0.0
  7806. * @category Object
  7807. * @param {Object} object The object to query.
  7808. * @param {Array|string} path The path to check.
  7809. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7810. * @example
  7811. *
  7812. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  7813. *
  7814. * _.hasIn(object, 'a');
  7815. * // => true
  7816. *
  7817. * _.hasIn(object, 'a.b');
  7818. * // => true
  7819. *
  7820. * _.hasIn(object, ['a', 'b']);
  7821. * // => true
  7822. *
  7823. * _.hasIn(object, 'b');
  7824. * // => false
  7825. */function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn)}
  7826. /**
  7827. * Creates an object composed of the inverted keys and values of `object`.
  7828. * If `object` contains duplicate values, subsequent values overwrite
  7829. * property assignments of previous values.
  7830. *
  7831. * @static
  7832. * @memberOf _
  7833. * @since 0.7.0
  7834. * @category Object
  7835. * @param {Object} object The object to invert.
  7836. * @returns {Object} Returns the new inverted object.
  7837. * @example
  7838. *
  7839. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  7840. *
  7841. * _.invert(object);
  7842. * // => { '1': 'c', '2': 'b' }
  7843. */var invert=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!="function"){value=nativeObjectToString.call(value)}result[value]=key},constant(identity));
  7844. /**
  7845. * This method is like `_.invert` except that the inverted object is generated
  7846. * from the results of running each element of `object` thru `iteratee`. The
  7847. * corresponding inverted value of each inverted key is an array of keys
  7848. * responsible for generating the inverted value. The iteratee is invoked
  7849. * with one argument: (value).
  7850. *
  7851. * @static
  7852. * @memberOf _
  7853. * @since 4.1.0
  7854. * @category Object
  7855. * @param {Object} object The object to invert.
  7856. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7857. * @returns {Object} Returns the new inverted object.
  7858. * @example
  7859. *
  7860. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  7861. *
  7862. * _.invertBy(object);
  7863. * // => { '1': ['a', 'c'], '2': ['b'] }
  7864. *
  7865. * _.invertBy(object, function(value) {
  7866. * return 'group' + value;
  7867. * });
  7868. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  7869. */var invertBy=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!="function"){value=nativeObjectToString.call(value)}if(hasOwnProperty.call(result,value)){result[value].push(key)}else{result[value]=[key]}},getIteratee);
  7870. /**
  7871. * Invokes the method at `path` of `object`.
  7872. *
  7873. * @static
  7874. * @memberOf _
  7875. * @since 4.0.0
  7876. * @category Object
  7877. * @param {Object} object The object to query.
  7878. * @param {Array|string} path The path of the method to invoke.
  7879. * @param {...*} [args] The arguments to invoke the method with.
  7880. * @returns {*} Returns the result of the invoked method.
  7881. * @example
  7882. *
  7883. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  7884. *
  7885. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  7886. * // => [2, 3]
  7887. */var invoke=baseRest(baseInvoke);
  7888. /**
  7889. * Creates an array of the own enumerable property names of `object`.
  7890. *
  7891. * **Note:** Non-object values are coerced to objects. See the
  7892. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7893. * for more details.
  7894. *
  7895. * @static
  7896. * @since 0.1.0
  7897. * @memberOf _
  7898. * @category Object
  7899. * @param {Object} object The object to query.
  7900. * @returns {Array} Returns the array of property names.
  7901. * @example
  7902. *
  7903. * function Foo() {
  7904. * this.a = 1;
  7905. * this.b = 2;
  7906. * }
  7907. *
  7908. * Foo.prototype.c = 3;
  7909. *
  7910. * _.keys(new Foo);
  7911. * // => ['a', 'b'] (iteration order is not guaranteed)
  7912. *
  7913. * _.keys('hi');
  7914. * // => ['0', '1']
  7915. */function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}
  7916. /**
  7917. * Creates an array of the own and inherited enumerable property names of `object`.
  7918. *
  7919. * **Note:** Non-object values are coerced to objects.
  7920. *
  7921. * @static
  7922. * @memberOf _
  7923. * @since 3.0.0
  7924. * @category Object
  7925. * @param {Object} object The object to query.
  7926. * @returns {Array} Returns the array of property names.
  7927. * @example
  7928. *
  7929. * function Foo() {
  7930. * this.a = 1;
  7931. * this.b = 2;
  7932. * }
  7933. *
  7934. * Foo.prototype.c = 3;
  7935. *
  7936. * _.keysIn(new Foo);
  7937. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  7938. */function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object)}
  7939. /**
  7940. * The opposite of `_.mapValues`; this method creates an object with the
  7941. * same values as `object` and keys generated by running each own enumerable
  7942. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  7943. * with three arguments: (value, key, object).
  7944. *
  7945. * @static
  7946. * @memberOf _
  7947. * @since 3.8.0
  7948. * @category Object
  7949. * @param {Object} object The object to iterate over.
  7950. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7951. * @returns {Object} Returns the new mapped object.
  7952. * @see _.mapValues
  7953. * @example
  7954. *
  7955. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  7956. * return key + value;
  7957. * });
  7958. * // => { 'a1': 1, 'b2': 2 }
  7959. */function mapKeys(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value)});return result}
  7960. /**
  7961. * Creates an object with the same keys as `object` and values generated
  7962. * by running each own enumerable string keyed property of `object` thru
  7963. * `iteratee`. The iteratee is invoked with three arguments:
  7964. * (value, key, object).
  7965. *
  7966. * @static
  7967. * @memberOf _
  7968. * @since 2.4.0
  7969. * @category Object
  7970. * @param {Object} object The object to iterate over.
  7971. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7972. * @returns {Object} Returns the new mapped object.
  7973. * @see _.mapKeys
  7974. * @example
  7975. *
  7976. * var users = {
  7977. * 'fred': { 'user': 'fred', 'age': 40 },
  7978. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  7979. * };
  7980. *
  7981. * _.mapValues(users, function(o) { return o.age; });
  7982. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  7983. *
  7984. * // The `_.property` iteratee shorthand.
  7985. * _.mapValues(users, 'age');
  7986. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  7987. */function mapValues(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))});return result}
  7988. /**
  7989. * This method is like `_.assign` except that it recursively merges own and
  7990. * inherited enumerable string keyed properties of source objects into the
  7991. * destination object. Source properties that resolve to `undefined` are
  7992. * skipped if a destination value exists. Array and plain object properties
  7993. * are merged recursively. Other objects and value types are overridden by
  7994. * assignment. Source objects are applied from left to right. Subsequent
  7995. * sources overwrite property assignments of previous sources.
  7996. *
  7997. * **Note:** This method mutates `object`.
  7998. *
  7999. * @static
  8000. * @memberOf _
  8001. * @since 0.5.0
  8002. * @category Object
  8003. * @param {Object} object The destination object.
  8004. * @param {...Object} [sources] The source objects.
  8005. * @returns {Object} Returns `object`.
  8006. * @example
  8007. *
  8008. * var object = {
  8009. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  8010. * };
  8011. *
  8012. * var other = {
  8013. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  8014. * };
  8015. *
  8016. * _.merge(object, other);
  8017. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  8018. */var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)});
  8019. /**
  8020. * This method is like `_.merge` except that it accepts `customizer` which
  8021. * is invoked to produce the merged values of the destination and source
  8022. * properties. If `customizer` returns `undefined`, merging is handled by the
  8023. * method instead. The `customizer` is invoked with six arguments:
  8024. * (objValue, srcValue, key, object, source, stack).
  8025. *
  8026. * **Note:** This method mutates `object`.
  8027. *
  8028. * @static
  8029. * @memberOf _
  8030. * @since 4.0.0
  8031. * @category Object
  8032. * @param {Object} object The destination object.
  8033. * @param {...Object} sources The source objects.
  8034. * @param {Function} customizer The function to customize assigned values.
  8035. * @returns {Object} Returns `object`.
  8036. * @example
  8037. *
  8038. * function customizer(objValue, srcValue) {
  8039. * if (_.isArray(objValue)) {
  8040. * return objValue.concat(srcValue);
  8041. * }
  8042. * }
  8043. *
  8044. * var object = { 'a': [1], 'b': [2] };
  8045. * var other = { 'a': [3], 'b': [4] };
  8046. *
  8047. * _.mergeWith(object, other, customizer);
  8048. * // => { 'a': [1, 3], 'b': [2, 4] }
  8049. */var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)});
  8050. /**
  8051. * The opposite of `_.pick`; this method creates an object composed of the
  8052. * own and inherited enumerable property paths of `object` that are not omitted.
  8053. *
  8054. * **Note:** This method is considerably slower than `_.pick`.
  8055. *
  8056. * @static
  8057. * @since 0.1.0
  8058. * @memberOf _
  8059. * @category Object
  8060. * @param {Object} object The source object.
  8061. * @param {...(string|string[])} [paths] The property paths to omit.
  8062. * @returns {Object} Returns the new object.
  8063. * @example
  8064. *
  8065. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  8066. *
  8067. * _.omit(object, ['a', 'c']);
  8068. * // => { 'b': '2' }
  8069. */var omit=flatRest(function(object,paths){var result={};if(object==null){return result}var isDeep=false;paths=arrayMap(paths,function(path){path=castPath(path,object);isDeep||(isDeep=path.length>1);return path});copyObject(object,getAllKeysIn(object),result);if(isDeep){result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone)}var length=paths.length;while(length--){baseUnset(result,paths[length])}return result});
  8070. /**
  8071. * The opposite of `_.pickBy`; this method creates an object composed of
  8072. * the own and inherited enumerable string keyed properties of `object` that
  8073. * `predicate` doesn't return truthy for. The predicate is invoked with two
  8074. * arguments: (value, key).
  8075. *
  8076. * @static
  8077. * @memberOf _
  8078. * @since 4.0.0
  8079. * @category Object
  8080. * @param {Object} object The source object.
  8081. * @param {Function} [predicate=_.identity] The function invoked per property.
  8082. * @returns {Object} Returns the new object.
  8083. * @example
  8084. *
  8085. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  8086. *
  8087. * _.omitBy(object, _.isNumber);
  8088. * // => { 'b': '2' }
  8089. */function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}
  8090. /**
  8091. * Creates an object composed of the picked `object` properties.
  8092. *
  8093. * @static
  8094. * @since 0.1.0
  8095. * @memberOf _
  8096. * @category Object
  8097. * @param {Object} object The source object.
  8098. * @param {...(string|string[])} [paths] The property paths to pick.
  8099. * @returns {Object} Returns the new object.
  8100. * @example
  8101. *
  8102. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  8103. *
  8104. * _.pick(object, ['a', 'c']);
  8105. * // => { 'a': 1, 'c': 3 }
  8106. */var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths)});
  8107. /**
  8108. * Creates an object composed of the `object` properties `predicate` returns
  8109. * truthy for. The predicate is invoked with two arguments: (value, key).
  8110. *
  8111. * @static
  8112. * @memberOf _
  8113. * @since 4.0.0
  8114. * @category Object
  8115. * @param {Object} object The source object.
  8116. * @param {Function} [predicate=_.identity] The function invoked per property.
  8117. * @returns {Object} Returns the new object.
  8118. * @example
  8119. *
  8120. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  8121. *
  8122. * _.pickBy(object, _.isNumber);
  8123. * // => { 'a': 1, 'c': 3 }
  8124. */function pickBy(object,predicate){if(object==null){return{}}var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});predicate=getIteratee(predicate);return basePickBy(object,props,function(value,path){return predicate(value,path[0])})}
  8125. /**
  8126. * This method is like `_.get` except that if the resolved value is a
  8127. * function it's invoked with the `this` binding of its parent object and
  8128. * its result is returned.
  8129. *
  8130. * @static
  8131. * @since 0.1.0
  8132. * @memberOf _
  8133. * @category Object
  8134. * @param {Object} object The object to query.
  8135. * @param {Array|string} path The path of the property to resolve.
  8136. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  8137. * @returns {*} Returns the resolved value.
  8138. * @example
  8139. *
  8140. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  8141. *
  8142. * _.result(object, 'a[0].b.c1');
  8143. * // => 3
  8144. *
  8145. * _.result(object, 'a[0].b.c2');
  8146. * // => 4
  8147. *
  8148. * _.result(object, 'a[0].b.c3', 'default');
  8149. * // => 'default'
  8150. *
  8151. * _.result(object, 'a[0].b.c3', _.constant('default'));
  8152. * // => 'default'
  8153. */function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;
  8154. // Ensure the loop is entered when path is empty.
  8155. if(!length){length=1;object=undefined}while(++index<length){var value=object==null?undefined:object[toKey(path[index])];if(value===undefined){index=length;value=defaultValue}object=isFunction(value)?value.call(object):value}return object}
  8156. /**
  8157. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  8158. * it's created. Arrays are created for missing index properties while objects
  8159. * are created for all other missing properties. Use `_.setWith` to customize
  8160. * `path` creation.
  8161. *
  8162. * **Note:** This method mutates `object`.
  8163. *
  8164. * @static
  8165. * @memberOf _
  8166. * @since 3.7.0
  8167. * @category Object
  8168. * @param {Object} object The object to modify.
  8169. * @param {Array|string} path The path of the property to set.
  8170. * @param {*} value The value to set.
  8171. * @returns {Object} Returns `object`.
  8172. * @example
  8173. *
  8174. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  8175. *
  8176. * _.set(object, 'a[0].b.c', 4);
  8177. * console.log(object.a[0].b.c);
  8178. * // => 4
  8179. *
  8180. * _.set(object, ['x', '0', 'y', 'z'], 5);
  8181. * console.log(object.x[0].y.z);
  8182. * // => 5
  8183. */function set(object,path,value){return object==null?object:baseSet(object,path,value)}
  8184. /**
  8185. * This method is like `_.set` except that it accepts `customizer` which is
  8186. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  8187. * path creation is handled by the method instead. The `customizer` is invoked
  8188. * with three arguments: (nsValue, key, nsObject).
  8189. *
  8190. * **Note:** This method mutates `object`.
  8191. *
  8192. * @static
  8193. * @memberOf _
  8194. * @since 4.0.0
  8195. * @category Object
  8196. * @param {Object} object The object to modify.
  8197. * @param {Array|string} path The path of the property to set.
  8198. * @param {*} value The value to set.
  8199. * @param {Function} [customizer] The function to customize assigned values.
  8200. * @returns {Object} Returns `object`.
  8201. * @example
  8202. *
  8203. * var object = {};
  8204. *
  8205. * _.setWith(object, '[0][1]', 'a', Object);
  8206. * // => { '0': { '1': 'a' } }
  8207. */function setWith(object,path,value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseSet(object,path,value,customizer)}
  8208. /**
  8209. * Creates an array of own enumerable string keyed-value pairs for `object`
  8210. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  8211. * entries are returned.
  8212. *
  8213. * @static
  8214. * @memberOf _
  8215. * @since 4.0.0
  8216. * @alias entries
  8217. * @category Object
  8218. * @param {Object} object The object to query.
  8219. * @returns {Array} Returns the key-value pairs.
  8220. * @example
  8221. *
  8222. * function Foo() {
  8223. * this.a = 1;
  8224. * this.b = 2;
  8225. * }
  8226. *
  8227. * Foo.prototype.c = 3;
  8228. *
  8229. * _.toPairs(new Foo);
  8230. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  8231. */var toPairs=createToPairs(keys);
  8232. /**
  8233. * Creates an array of own and inherited enumerable string keyed-value pairs
  8234. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  8235. * or set, its entries are returned.
  8236. *
  8237. * @static
  8238. * @memberOf _
  8239. * @since 4.0.0
  8240. * @alias entriesIn
  8241. * @category Object
  8242. * @param {Object} object The object to query.
  8243. * @returns {Array} Returns the key-value pairs.
  8244. * @example
  8245. *
  8246. * function Foo() {
  8247. * this.a = 1;
  8248. * this.b = 2;
  8249. * }
  8250. *
  8251. * Foo.prototype.c = 3;
  8252. *
  8253. * _.toPairsIn(new Foo);
  8254. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  8255. */var toPairsIn=createToPairs(keysIn);
  8256. /**
  8257. * An alternative to `_.reduce`; this method transforms `object` to a new
  8258. * `accumulator` object which is the result of running each of its own
  8259. * enumerable string keyed properties thru `iteratee`, with each invocation
  8260. * potentially mutating the `accumulator` object. If `accumulator` is not
  8261. * provided, a new object with the same `[[Prototype]]` will be used. The
  8262. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  8263. * Iteratee functions may exit iteration early by explicitly returning `false`.
  8264. *
  8265. * @static
  8266. * @memberOf _
  8267. * @since 1.3.0
  8268. * @category Object
  8269. * @param {Object} object The object to iterate over.
  8270. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  8271. * @param {*} [accumulator] The custom accumulator value.
  8272. * @returns {*} Returns the accumulated value.
  8273. * @example
  8274. *
  8275. * _.transform([2, 3, 4], function(result, n) {
  8276. * result.push(n *= n);
  8277. * return n % 2 == 0;
  8278. * }, []);
  8279. * // => [4, 9]
  8280. *
  8281. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  8282. * (result[value] || (result[value] = [])).push(key);
  8283. * }, {});
  8284. * // => { '1': ['a', 'c'], '2': ['b'] }
  8285. */function transform(object,iteratee,accumulator){var isArr=isArray(object),isArrLike=isArr||isBuffer(object)||isTypedArray(object);iteratee=getIteratee(iteratee,4);if(accumulator==null){var Ctor=object&&object.constructor;if(isArrLike){accumulator=isArr?new Ctor:[]}else if(isObject(object)){accumulator=isFunction(Ctor)?baseCreate(getPrototype(object)):{}}else{accumulator={}}}(isArrLike?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)});return accumulator}
  8286. /**
  8287. * Removes the property at `path` of `object`.
  8288. *
  8289. * **Note:** This method mutates `object`.
  8290. *
  8291. * @static
  8292. * @memberOf _
  8293. * @since 4.0.0
  8294. * @category Object
  8295. * @param {Object} object The object to modify.
  8296. * @param {Array|string} path The path of the property to unset.
  8297. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  8298. * @example
  8299. *
  8300. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  8301. * _.unset(object, 'a[0].b.c');
  8302. * // => true
  8303. *
  8304. * console.log(object);
  8305. * // => { 'a': [{ 'b': {} }] };
  8306. *
  8307. * _.unset(object, ['a', '0', 'b', 'c']);
  8308. * // => true
  8309. *
  8310. * console.log(object);
  8311. * // => { 'a': [{ 'b': {} }] };
  8312. */function unset(object,path){return object==null?true:baseUnset(object,path)}
  8313. /**
  8314. * This method is like `_.set` except that accepts `updater` to produce the
  8315. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  8316. * is invoked with one argument: (value).
  8317. *
  8318. * **Note:** This method mutates `object`.
  8319. *
  8320. * @static
  8321. * @memberOf _
  8322. * @since 4.6.0
  8323. * @category Object
  8324. * @param {Object} object The object to modify.
  8325. * @param {Array|string} path The path of the property to set.
  8326. * @param {Function} updater The function to produce the updated value.
  8327. * @returns {Object} Returns `object`.
  8328. * @example
  8329. *
  8330. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  8331. *
  8332. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  8333. * console.log(object.a[0].b.c);
  8334. * // => 9
  8335. *
  8336. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  8337. * console.log(object.x[0].y.z);
  8338. * // => 0
  8339. */function update(object,path,updater){return object==null?object:baseUpdate(object,path,castFunction(updater))}
  8340. /**
  8341. * This method is like `_.update` except that it accepts `customizer` which is
  8342. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  8343. * path creation is handled by the method instead. The `customizer` is invoked
  8344. * with three arguments: (nsValue, key, nsObject).
  8345. *
  8346. * **Note:** This method mutates `object`.
  8347. *
  8348. * @static
  8349. * @memberOf _
  8350. * @since 4.6.0
  8351. * @category Object
  8352. * @param {Object} object The object to modify.
  8353. * @param {Array|string} path The path of the property to set.
  8354. * @param {Function} updater The function to produce the updated value.
  8355. * @param {Function} [customizer] The function to customize assigned values.
  8356. * @returns {Object} Returns `object`.
  8357. * @example
  8358. *
  8359. * var object = {};
  8360. *
  8361. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  8362. * // => { '0': { '1': 'a' } }
  8363. */function updateWith(object,path,updater,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseUpdate(object,path,castFunction(updater),customizer)}
  8364. /**
  8365. * Creates an array of the own enumerable string keyed property values of `object`.
  8366. *
  8367. * **Note:** Non-object values are coerced to objects.
  8368. *
  8369. * @static
  8370. * @since 0.1.0
  8371. * @memberOf _
  8372. * @category Object
  8373. * @param {Object} object The object to query.
  8374. * @returns {Array} Returns the array of property values.
  8375. * @example
  8376. *
  8377. * function Foo() {
  8378. * this.a = 1;
  8379. * this.b = 2;
  8380. * }
  8381. *
  8382. * Foo.prototype.c = 3;
  8383. *
  8384. * _.values(new Foo);
  8385. * // => [1, 2] (iteration order is not guaranteed)
  8386. *
  8387. * _.values('hi');
  8388. * // => ['h', 'i']
  8389. */function values(object){return object==null?[]:baseValues(object,keys(object))}
  8390. /**
  8391. * Creates an array of the own and inherited enumerable string keyed property
  8392. * values of `object`.
  8393. *
  8394. * **Note:** Non-object values are coerced to objects.
  8395. *
  8396. * @static
  8397. * @memberOf _
  8398. * @since 3.0.0
  8399. * @category Object
  8400. * @param {Object} object The object to query.
  8401. * @returns {Array} Returns the array of property values.
  8402. * @example
  8403. *
  8404. * function Foo() {
  8405. * this.a = 1;
  8406. * this.b = 2;
  8407. * }
  8408. *
  8409. * Foo.prototype.c = 3;
  8410. *
  8411. * _.valuesIn(new Foo);
  8412. * // => [1, 2, 3] (iteration order is not guaranteed)
  8413. */function valuesIn(object){return object==null?[]:baseValues(object,keysIn(object))}
  8414. /*------------------------------------------------------------------------*/
  8415. /**
  8416. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  8417. *
  8418. * @static
  8419. * @memberOf _
  8420. * @since 4.0.0
  8421. * @category Number
  8422. * @param {number} number The number to clamp.
  8423. * @param {number} [lower] The lower bound.
  8424. * @param {number} upper The upper bound.
  8425. * @returns {number} Returns the clamped number.
  8426. * @example
  8427. *
  8428. * _.clamp(-10, -5, 5);
  8429. * // => -5
  8430. *
  8431. * _.clamp(10, -5, 5);
  8432. * // => 5
  8433. */function clamp(number,lower,upper){if(upper===undefined){upper=lower;lower=undefined}if(upper!==undefined){upper=toNumber(upper);upper=upper===upper?upper:0}if(lower!==undefined){lower=toNumber(lower);lower=lower===lower?lower:0}return baseClamp(toNumber(number),lower,upper)}
  8434. /**
  8435. * Checks if `n` is between `start` and up to, but not including, `end`. If
  8436. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  8437. * If `start` is greater than `end` the params are swapped to support
  8438. * negative ranges.
  8439. *
  8440. * @static
  8441. * @memberOf _
  8442. * @since 3.3.0
  8443. * @category Number
  8444. * @param {number} number The number to check.
  8445. * @param {number} [start=0] The start of the range.
  8446. * @param {number} end The end of the range.
  8447. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  8448. * @see _.range, _.rangeRight
  8449. * @example
  8450. *
  8451. * _.inRange(3, 2, 4);
  8452. * // => true
  8453. *
  8454. * _.inRange(4, 8);
  8455. * // => true
  8456. *
  8457. * _.inRange(4, 2);
  8458. * // => false
  8459. *
  8460. * _.inRange(2, 2);
  8461. * // => false
  8462. *
  8463. * _.inRange(1.2, 2);
  8464. * // => true
  8465. *
  8466. * _.inRange(5.2, 4);
  8467. * // => false
  8468. *
  8469. * _.inRange(-3, -2, -6);
  8470. * // => true
  8471. */function inRange(number,start,end){start=toFinite(start);if(end===undefined){end=start;start=0}else{end=toFinite(end)}number=toNumber(number);return baseInRange(number,start,end)}
  8472. /**
  8473. * Produces a random number between the inclusive `lower` and `upper` bounds.
  8474. * If only one argument is provided a number between `0` and the given number
  8475. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  8476. * floats, a floating-point number is returned instead of an integer.
  8477. *
  8478. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  8479. * floating-point values which can produce unexpected results.
  8480. *
  8481. * @static
  8482. * @memberOf _
  8483. * @since 0.7.0
  8484. * @category Number
  8485. * @param {number} [lower=0] The lower bound.
  8486. * @param {number} [upper=1] The upper bound.
  8487. * @param {boolean} [floating] Specify returning a floating-point number.
  8488. * @returns {number} Returns the random number.
  8489. * @example
  8490. *
  8491. * _.random(0, 5);
  8492. * // => an integer between 0 and 5
  8493. *
  8494. * _.random(5);
  8495. * // => also an integer between 0 and 5
  8496. *
  8497. * _.random(5, true);
  8498. * // => a floating-point number between 0 and 5
  8499. *
  8500. * _.random(1.2, 5.2);
  8501. * // => a floating-point number between 1.2 and 5.2
  8502. */function random(lower,upper,floating){if(floating&&typeof floating!="boolean"&&isIterateeCall(lower,upper,floating)){upper=floating=undefined}if(floating===undefined){if(typeof upper=="boolean"){floating=upper;upper=undefined}else if(typeof lower=="boolean"){floating=lower;lower=undefined}}if(lower===undefined&&upper===undefined){lower=0;upper=1}else{lower=toFinite(lower);if(upper===undefined){upper=lower;lower=0}else{upper=toFinite(upper)}}if(lower>upper){var temp=lower;lower=upper;upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}
  8503. /*------------------------------------------------------------------------*/
  8504. /**
  8505. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  8506. *
  8507. * @static
  8508. * @memberOf _
  8509. * @since 3.0.0
  8510. * @category String
  8511. * @param {string} [string=''] The string to convert.
  8512. * @returns {string} Returns the camel cased string.
  8513. * @example
  8514. *
  8515. * _.camelCase('Foo Bar');
  8516. * // => 'fooBar'
  8517. *
  8518. * _.camelCase('--foo-bar--');
  8519. * // => 'fooBar'
  8520. *
  8521. * _.camelCase('__FOO_BAR__');
  8522. * // => 'fooBar'
  8523. */var camelCase=createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word)});
  8524. /**
  8525. * Converts the first character of `string` to upper case and the remaining
  8526. * to lower case.
  8527. *
  8528. * @static
  8529. * @memberOf _
  8530. * @since 3.0.0
  8531. * @category String
  8532. * @param {string} [string=''] The string to capitalize.
  8533. * @returns {string} Returns the capitalized string.
  8534. * @example
  8535. *
  8536. * _.capitalize('FRED');
  8537. * // => 'Fred'
  8538. */function capitalize(string){return upperFirst(toString(string).toLowerCase())}
  8539. /**
  8540. * Deburrs `string` by converting
  8541. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  8542. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  8543. * letters to basic Latin letters and removing
  8544. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  8545. *
  8546. * @static
  8547. * @memberOf _
  8548. * @since 3.0.0
  8549. * @category String
  8550. * @param {string} [string=''] The string to deburr.
  8551. * @returns {string} Returns the deburred string.
  8552. * @example
  8553. *
  8554. * _.deburr('déjà vu');
  8555. * // => 'deja vu'
  8556. */function deburr(string){string=toString(string);return string&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}
  8557. /**
  8558. * Checks if `string` ends with the given target string.
  8559. *
  8560. * @static
  8561. * @memberOf _
  8562. * @since 3.0.0
  8563. * @category String
  8564. * @param {string} [string=''] The string to inspect.
  8565. * @param {string} [target] The string to search for.
  8566. * @param {number} [position=string.length] The position to search up to.
  8567. * @returns {boolean} Returns `true` if `string` ends with `target`,
  8568. * else `false`.
  8569. * @example
  8570. *
  8571. * _.endsWith('abc', 'c');
  8572. * // => true
  8573. *
  8574. * _.endsWith('abc', 'b');
  8575. * // => false
  8576. *
  8577. * _.endsWith('abc', 'b', 2);
  8578. * // => true
  8579. */function endsWith(string,target,position){string=toString(string);target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position),0,length);var end=position;position-=target.length;return position>=0&&string.slice(position,end)==target}
  8580. /**
  8581. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  8582. * corresponding HTML entities.
  8583. *
  8584. * **Note:** No other characters are escaped. To escape additional
  8585. * characters use a third-party library like [_he_](https://mths.be/he).
  8586. *
  8587. * Though the ">" character is escaped for symmetry, characters like
  8588. * ">" and "/" don't need escaping in HTML and have no special meaning
  8589. * unless they're part of a tag or unquoted attribute value. See
  8590. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  8591. * (under "semi-related fun fact") for more details.
  8592. *
  8593. * When working with HTML you should always
  8594. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  8595. * XSS vectors.
  8596. *
  8597. * @static
  8598. * @since 0.1.0
  8599. * @memberOf _
  8600. * @category String
  8601. * @param {string} [string=''] The string to escape.
  8602. * @returns {string} Returns the escaped string.
  8603. * @example
  8604. *
  8605. * _.escape('fred, barney, & pebbles');
  8606. * // => 'fred, barney, &amp; pebbles'
  8607. */function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}
  8608. /**
  8609. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  8610. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  8611. *
  8612. * @static
  8613. * @memberOf _
  8614. * @since 3.0.0
  8615. * @category String
  8616. * @param {string} [string=''] The string to escape.
  8617. * @returns {string} Returns the escaped string.
  8618. * @example
  8619. *
  8620. * _.escapeRegExp('[lodash](https://lodash.com/)');
  8621. * // => '\[lodash\]\(https://lodash\.com/\)'
  8622. */function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$&"):string}
  8623. /**
  8624. * Converts `string` to
  8625. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  8626. *
  8627. * @static
  8628. * @memberOf _
  8629. * @since 3.0.0
  8630. * @category String
  8631. * @param {string} [string=''] The string to convert.
  8632. * @returns {string} Returns the kebab cased string.
  8633. * @example
  8634. *
  8635. * _.kebabCase('Foo Bar');
  8636. * // => 'foo-bar'
  8637. *
  8638. * _.kebabCase('fooBar');
  8639. * // => 'foo-bar'
  8640. *
  8641. * _.kebabCase('__FOO_BAR__');
  8642. * // => 'foo-bar'
  8643. */var kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()});
  8644. /**
  8645. * Converts `string`, as space separated words, to lower case.
  8646. *
  8647. * @static
  8648. * @memberOf _
  8649. * @since 4.0.0
  8650. * @category String
  8651. * @param {string} [string=''] The string to convert.
  8652. * @returns {string} Returns the lower cased string.
  8653. * @example
  8654. *
  8655. * _.lowerCase('--Foo-Bar--');
  8656. * // => 'foo bar'
  8657. *
  8658. * _.lowerCase('fooBar');
  8659. * // => 'foo bar'
  8660. *
  8661. * _.lowerCase('__FOO_BAR__');
  8662. * // => 'foo bar'
  8663. */var lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()});
  8664. /**
  8665. * Converts the first character of `string` to lower case.
  8666. *
  8667. * @static
  8668. * @memberOf _
  8669. * @since 4.0.0
  8670. * @category String
  8671. * @param {string} [string=''] The string to convert.
  8672. * @returns {string} Returns the converted string.
  8673. * @example
  8674. *
  8675. * _.lowerFirst('Fred');
  8676. * // => 'fred'
  8677. *
  8678. * _.lowerFirst('FRED');
  8679. * // => 'fRED'
  8680. */var lowerFirst=createCaseFirst("toLowerCase");
  8681. /**
  8682. * Pads `string` on the left and right sides if it's shorter than `length`.
  8683. * Padding characters are truncated if they can't be evenly divided by `length`.
  8684. *
  8685. * @static
  8686. * @memberOf _
  8687. * @since 3.0.0
  8688. * @category String
  8689. * @param {string} [string=''] The string to pad.
  8690. * @param {number} [length=0] The padding length.
  8691. * @param {string} [chars=' '] The string used as padding.
  8692. * @returns {string} Returns the padded string.
  8693. * @example
  8694. *
  8695. * _.pad('abc', 8);
  8696. * // => ' abc '
  8697. *
  8698. * _.pad('abc', 8, '_-');
  8699. * // => '_-abc_-_'
  8700. *
  8701. * _.pad('abc', 3);
  8702. * // => 'abc'
  8703. */function pad(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length){return string}var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}
  8704. /**
  8705. * Pads `string` on the right side if it's shorter than `length`. Padding
  8706. * characters are truncated if they exceed `length`.
  8707. *
  8708. * @static
  8709. * @memberOf _
  8710. * @since 4.0.0
  8711. * @category String
  8712. * @param {string} [string=''] The string to pad.
  8713. * @param {number} [length=0] The padding length.
  8714. * @param {string} [chars=' '] The string used as padding.
  8715. * @returns {string} Returns the padded string.
  8716. * @example
  8717. *
  8718. * _.padEnd('abc', 6);
  8719. * // => 'abc '
  8720. *
  8721. * _.padEnd('abc', 6, '_-');
  8722. * // => 'abc_-_'
  8723. *
  8724. * _.padEnd('abc', 3);
  8725. * // => 'abc'
  8726. */function padEnd(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?string+createPadding(length-strLength,chars):string}
  8727. /**
  8728. * Pads `string` on the left side if it's shorter than `length`. Padding
  8729. * characters are truncated if they exceed `length`.
  8730. *
  8731. * @static
  8732. * @memberOf _
  8733. * @since 4.0.0
  8734. * @category String
  8735. * @param {string} [string=''] The string to pad.
  8736. * @param {number} [length=0] The padding length.
  8737. * @param {string} [chars=' '] The string used as padding.
  8738. * @returns {string} Returns the padded string.
  8739. * @example
  8740. *
  8741. * _.padStart('abc', 6);
  8742. * // => ' abc'
  8743. *
  8744. * _.padStart('abc', 6, '_-');
  8745. * // => '_-_abc'
  8746. *
  8747. * _.padStart('abc', 3);
  8748. * // => 'abc'
  8749. */function padStart(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?createPadding(length-strLength,chars)+string:string}
  8750. /**
  8751. * Converts `string` to an integer of the specified radix. If `radix` is
  8752. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  8753. * hexadecimal, in which case a `radix` of `16` is used.
  8754. *
  8755. * **Note:** This method aligns with the
  8756. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  8757. *
  8758. * @static
  8759. * @memberOf _
  8760. * @since 1.1.0
  8761. * @category String
  8762. * @param {string} string The string to convert.
  8763. * @param {number} [radix=10] The radix to interpret `value` by.
  8764. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8765. * @returns {number} Returns the converted integer.
  8766. * @example
  8767. *
  8768. * _.parseInt('08');
  8769. * // => 8
  8770. *
  8771. * _.map(['6', '08', '10'], _.parseInt);
  8772. * // => [6, 8, 10]
  8773. */function parseInt(string,radix,guard){if(guard||radix==null){radix=0}else if(radix){radix=+radix}return nativeParseInt(toString(string).replace(reTrimStart,""),radix||0)}
  8774. /**
  8775. * Repeats the given string `n` times.
  8776. *
  8777. * @static
  8778. * @memberOf _
  8779. * @since 3.0.0
  8780. * @category String
  8781. * @param {string} [string=''] The string to repeat.
  8782. * @param {number} [n=1] The number of times to repeat the string.
  8783. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8784. * @returns {string} Returns the repeated string.
  8785. * @example
  8786. *
  8787. * _.repeat('*', 3);
  8788. * // => '***'
  8789. *
  8790. * _.repeat('abc', 2);
  8791. * // => 'abcabc'
  8792. *
  8793. * _.repeat('abc', 0);
  8794. * // => ''
  8795. */function repeat(string,n,guard){if(guard?isIterateeCall(string,n,guard):n===undefined){n=1}else{n=toInteger(n)}return baseRepeat(toString(string),n)}
  8796. /**
  8797. * Replaces matches for `pattern` in `string` with `replacement`.
  8798. *
  8799. * **Note:** This method is based on
  8800. * [`String#replace`](https://mdn.io/String/replace).
  8801. *
  8802. * @static
  8803. * @memberOf _
  8804. * @since 4.0.0
  8805. * @category String
  8806. * @param {string} [string=''] The string to modify.
  8807. * @param {RegExp|string} pattern The pattern to replace.
  8808. * @param {Function|string} replacement The match replacement.
  8809. * @returns {string} Returns the modified string.
  8810. * @example
  8811. *
  8812. * _.replace('Hi Fred', 'Fred', 'Barney');
  8813. * // => 'Hi Barney'
  8814. */function replace(){var args=arguments,string=toString(args[0]);return args.length<3?string:string.replace(args[1],args[2])}
  8815. /**
  8816. * Converts `string` to
  8817. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  8818. *
  8819. * @static
  8820. * @memberOf _
  8821. * @since 3.0.0
  8822. * @category String
  8823. * @param {string} [string=''] The string to convert.
  8824. * @returns {string} Returns the snake cased string.
  8825. * @example
  8826. *
  8827. * _.snakeCase('Foo Bar');
  8828. * // => 'foo_bar'
  8829. *
  8830. * _.snakeCase('fooBar');
  8831. * // => 'foo_bar'
  8832. *
  8833. * _.snakeCase('--FOO-BAR--');
  8834. * // => 'foo_bar'
  8835. */var snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()});
  8836. /**
  8837. * Splits `string` by `separator`.
  8838. *
  8839. * **Note:** This method is based on
  8840. * [`String#split`](https://mdn.io/String/split).
  8841. *
  8842. * @static
  8843. * @memberOf _
  8844. * @since 4.0.0
  8845. * @category String
  8846. * @param {string} [string=''] The string to split.
  8847. * @param {RegExp|string} separator The separator pattern to split by.
  8848. * @param {number} [limit] The length to truncate results to.
  8849. * @returns {Array} Returns the string segments.
  8850. * @example
  8851. *
  8852. * _.split('a-b-c', '-', 2);
  8853. * // => ['a', 'b']
  8854. */function split(string,separator,limit){if(limit&&typeof limit!="number"&&isIterateeCall(string,separator,limit)){separator=limit=undefined}limit=limit===undefined?MAX_ARRAY_LENGTH:limit>>>0;if(!limit){return[]}string=toString(string);if(string&&(typeof separator=="string"||separator!=null&&!isRegExp(separator))){separator=baseToString(separator);if(!separator&&hasUnicode(string)){return castSlice(stringToArray(string),0,limit)}}return string.split(separator,limit)}
  8855. /**
  8856. * Converts `string` to
  8857. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  8858. *
  8859. * @static
  8860. * @memberOf _
  8861. * @since 3.1.0
  8862. * @category String
  8863. * @param {string} [string=''] The string to convert.
  8864. * @returns {string} Returns the start cased string.
  8865. * @example
  8866. *
  8867. * _.startCase('--foo-bar--');
  8868. * // => 'Foo Bar'
  8869. *
  8870. * _.startCase('fooBar');
  8871. * // => 'Foo Bar'
  8872. *
  8873. * _.startCase('__FOO_BAR__');
  8874. * // => 'FOO BAR'
  8875. */var startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word)});
  8876. /**
  8877. * Checks if `string` starts with the given target string.
  8878. *
  8879. * @static
  8880. * @memberOf _
  8881. * @since 3.0.0
  8882. * @category String
  8883. * @param {string} [string=''] The string to inspect.
  8884. * @param {string} [target] The string to search for.
  8885. * @param {number} [position=0] The position to search from.
  8886. * @returns {boolean} Returns `true` if `string` starts with `target`,
  8887. * else `false`.
  8888. * @example
  8889. *
  8890. * _.startsWith('abc', 'a');
  8891. * // => true
  8892. *
  8893. * _.startsWith('abc', 'b');
  8894. * // => false
  8895. *
  8896. * _.startsWith('abc', 'b', 1);
  8897. * // => true
  8898. */function startsWith(string,target,position){string=toString(string);position=position==null?0:baseClamp(toInteger(position),0,string.length);target=baseToString(target);return string.slice(position,position+target.length)==target}
  8899. /**
  8900. * Creates a compiled template function that can interpolate data properties
  8901. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  8902. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  8903. * properties may be accessed as free variables in the template. If a setting
  8904. * object is given, it takes precedence over `_.templateSettings` values.
  8905. *
  8906. * **Note:** In the development build `_.template` utilizes
  8907. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  8908. * for easier debugging.
  8909. *
  8910. * For more information on precompiling templates see
  8911. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  8912. *
  8913. * For more information on Chrome extension sandboxes see
  8914. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  8915. *
  8916. * @static
  8917. * @since 0.1.0
  8918. * @memberOf _
  8919. * @category String
  8920. * @param {string} [string=''] The template string.
  8921. * @param {Object} [options={}] The options object.
  8922. * @param {RegExp} [options.escape=_.templateSettings.escape]
  8923. * The HTML "escape" delimiter.
  8924. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  8925. * The "evaluate" delimiter.
  8926. * @param {Object} [options.imports=_.templateSettings.imports]
  8927. * An object to import into the template as free variables.
  8928. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  8929. * The "interpolate" delimiter.
  8930. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  8931. * The sourceURL of the compiled template.
  8932. * @param {string} [options.variable='obj']
  8933. * The data object variable name.
  8934. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8935. * @returns {Function} Returns the compiled template function.
  8936. * @example
  8937. *
  8938. * // Use the "interpolate" delimiter to create a compiled template.
  8939. * var compiled = _.template('hello <%= user %>!');
  8940. * compiled({ 'user': 'fred' });
  8941. * // => 'hello fred!'
  8942. *
  8943. * // Use the HTML "escape" delimiter to escape data property values.
  8944. * var compiled = _.template('<b><%- value %></b>');
  8945. * compiled({ 'value': '<script>' });
  8946. * // => '<b>&lt;script&gt;</b>'
  8947. *
  8948. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  8949. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  8950. * compiled({ 'users': ['fred', 'barney'] });
  8951. * // => '<li>fred</li><li>barney</li>'
  8952. *
  8953. * // Use the internal `print` function in "evaluate" delimiters.
  8954. * var compiled = _.template('<% print("hello " + user); %>!');
  8955. * compiled({ 'user': 'barney' });
  8956. * // => 'hello barney!'
  8957. *
  8958. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  8959. * // Disable support by replacing the "interpolate" delimiter.
  8960. * var compiled = _.template('hello ${ user }!');
  8961. * compiled({ 'user': 'pebbles' });
  8962. * // => 'hello pebbles!'
  8963. *
  8964. * // Use backslashes to treat delimiters as plain text.
  8965. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  8966. * compiled({ 'value': 'ignored' });
  8967. * // => '<%- value %>'
  8968. *
  8969. * // Use the `imports` option to import `jQuery` as `jq`.
  8970. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  8971. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  8972. * compiled({ 'users': ['fred', 'barney'] });
  8973. * // => '<li>fred</li><li>barney</li>'
  8974. *
  8975. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  8976. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  8977. * compiled(data);
  8978. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  8979. *
  8980. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  8981. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  8982. * compiled.source;
  8983. * // => function(data) {
  8984. * // var __t, __p = '';
  8985. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  8986. * // return __p;
  8987. * // }
  8988. *
  8989. * // Use custom template delimiters.
  8990. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  8991. * var compiled = _.template('hello {{ user }}!');
  8992. * compiled({ 'user': 'mustache' });
  8993. * // => 'hello mustache!'
  8994. *
  8995. * // Use the `source` property to inline compiled templates for meaningful
  8996. * // line numbers in error messages and stack traces.
  8997. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  8998. * var JST = {\
  8999. * "main": ' + _.template(mainText).source + '\
  9000. * };\
  9001. * ');
  9002. */function template(string,options,guard){
  9003. // Based on John Resig's `tmpl` implementation
  9004. // (http://ejohn.org/blog/javascript-micro-templating/)
  9005. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  9006. var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard)){options=undefined}string=toString(string);options=assignInWith({},options,settings,customDefaultsAssignIn);var imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";
  9007. // Compile the regexp to match each delimiter.
  9008. var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");
  9009. // Use a sourceURL for easier debugging.
  9010. var sourceURL="//# sourceURL="+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);
  9011. // Escape characters that can't be included in string literals.
  9012. source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);
  9013. // Replace delimiters with snippets.
  9014. if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;
  9015. // The JS engine embedded in Adobe products needs `match` returned in
  9016. // order to produce the correct `offset` value.
  9017. return match});source+="';\n";
  9018. // If `variable` is not specified wrap a with-statement around the generated
  9019. // code to add the data object to the top of the scope chain.
  9020. var variable=options.variable;if(!variable){source="with (obj) {\n"+source+"\n}\n"}
  9021. // Cleanup code by stripping empty strings.
  9022. source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");
  9023. // Frame code as the function body.
  9024. source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(isEscaping?", __e = _.escape":"")+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});
  9025. // Provide the compiled function's source by its `toString` method or
  9026. // the `source` property as a convenience for inlining compiled templates.
  9027. result.source=source;if(isError(result)){throw result}return result}
  9028. /**
  9029. * Converts `string`, as a whole, to lower case just like
  9030. * [String#toLowerCase](https://mdn.io/toLowerCase).
  9031. *
  9032. * @static
  9033. * @memberOf _
  9034. * @since 4.0.0
  9035. * @category String
  9036. * @param {string} [string=''] The string to convert.
  9037. * @returns {string} Returns the lower cased string.
  9038. * @example
  9039. *
  9040. * _.toLower('--Foo-Bar--');
  9041. * // => '--foo-bar--'
  9042. *
  9043. * _.toLower('fooBar');
  9044. * // => 'foobar'
  9045. *
  9046. * _.toLower('__FOO_BAR__');
  9047. * // => '__foo_bar__'
  9048. */function toLower(value){return toString(value).toLowerCase()}
  9049. /**
  9050. * Converts `string`, as a whole, to upper case just like
  9051. * [String#toUpperCase](https://mdn.io/toUpperCase).
  9052. *
  9053. * @static
  9054. * @memberOf _
  9055. * @since 4.0.0
  9056. * @category String
  9057. * @param {string} [string=''] The string to convert.
  9058. * @returns {string} Returns the upper cased string.
  9059. * @example
  9060. *
  9061. * _.toUpper('--foo-bar--');
  9062. * // => '--FOO-BAR--'
  9063. *
  9064. * _.toUpper('fooBar');
  9065. * // => 'FOOBAR'
  9066. *
  9067. * _.toUpper('__foo_bar__');
  9068. * // => '__FOO_BAR__'
  9069. */function toUpper(value){return toString(value).toUpperCase()}
  9070. /**
  9071. * Removes leading and trailing whitespace or specified characters from `string`.
  9072. *
  9073. * @static
  9074. * @memberOf _
  9075. * @since 3.0.0
  9076. * @category String
  9077. * @param {string} [string=''] The string to trim.
  9078. * @param {string} [chars=whitespace] The characters to trim.
  9079. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9080. * @returns {string} Returns the trimmed string.
  9081. * @example
  9082. *
  9083. * _.trim(' abc ');
  9084. * // => 'abc'
  9085. *
  9086. * _.trim('-_-abc-_-', '_-');
  9087. * // => 'abc'
  9088. *
  9089. * _.map([' foo ', ' bar '], _.trim);
  9090. * // => ['foo', 'bar']
  9091. */function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrim,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join("")}
  9092. /**
  9093. * Removes trailing whitespace or specified characters from `string`.
  9094. *
  9095. * @static
  9096. * @memberOf _
  9097. * @since 4.0.0
  9098. * @category String
  9099. * @param {string} [string=''] The string to trim.
  9100. * @param {string} [chars=whitespace] The characters to trim.
  9101. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9102. * @returns {string} Returns the trimmed string.
  9103. * @example
  9104. *
  9105. * _.trimEnd(' abc ');
  9106. * // => ' abc'
  9107. *
  9108. * _.trimEnd('-_-abc-_-', '_-');
  9109. * // => '-_-abc'
  9110. */function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrimEnd,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols,0,end).join("")}
  9111. /**
  9112. * Removes leading whitespace or specified characters from `string`.
  9113. *
  9114. * @static
  9115. * @memberOf _
  9116. * @since 4.0.0
  9117. * @category String
  9118. * @param {string} [string=''] The string to trim.
  9119. * @param {string} [chars=whitespace] The characters to trim.
  9120. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9121. * @returns {string} Returns the trimmed string.
  9122. * @example
  9123. *
  9124. * _.trimStart(' abc ');
  9125. * // => 'abc '
  9126. *
  9127. * _.trimStart('-_-abc-_-', '_-');
  9128. * // => 'abc-_-'
  9129. */function trimStart(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrimStart,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),start=charsStartIndex(strSymbols,stringToArray(chars));return castSlice(strSymbols,start).join("")}
  9130. /**
  9131. * Truncates `string` if it's longer than the given maximum string length.
  9132. * The last characters of the truncated string are replaced with the omission
  9133. * string which defaults to "...".
  9134. *
  9135. * @static
  9136. * @memberOf _
  9137. * @since 4.0.0
  9138. * @category String
  9139. * @param {string} [string=''] The string to truncate.
  9140. * @param {Object} [options={}] The options object.
  9141. * @param {number} [options.length=30] The maximum string length.
  9142. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  9143. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  9144. * @returns {string} Returns the truncated string.
  9145. * @example
  9146. *
  9147. * _.truncate('hi-diddly-ho there, neighborino');
  9148. * // => 'hi-diddly-ho there, neighbo...'
  9149. *
  9150. * _.truncate('hi-diddly-ho there, neighborino', {
  9151. * 'length': 24,
  9152. * 'separator': ' '
  9153. * });
  9154. * // => 'hi-diddly-ho there,...'
  9155. *
  9156. * _.truncate('hi-diddly-ho there, neighborino', {
  9157. * 'length': 24,
  9158. * 'separator': /,? +/
  9159. * });
  9160. * // => 'hi-diddly-ho there...'
  9161. *
  9162. * _.truncate('hi-diddly-ho there, neighborino', {
  9163. * 'omission': ' [...]'
  9164. * });
  9165. * // => 'hi-diddly-ho there, neig [...]'
  9166. */function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options?options.separator:separator;length="length"in options?toInteger(options.length):length;omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength){return string}var end=length-stringSize(omission);if(end<1){return omission}var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined){return result+omission}if(strSymbols){end+=result.length-end}if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;if(!separator.global){separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g")}separator.lastIndex=0;while(match=separator.exec(substring)){var newEnd=match.index}result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);if(index>-1){result=result.slice(0,index)}}return result+omission}
  9167. /**
  9168. * The inverse of `_.escape`; this method converts the HTML entities
  9169. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  9170. * their corresponding characters.
  9171. *
  9172. * **Note:** No other HTML entities are unescaped. To unescape additional
  9173. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  9174. *
  9175. * @static
  9176. * @memberOf _
  9177. * @since 0.6.0
  9178. * @category String
  9179. * @param {string} [string=''] The string to unescape.
  9180. * @returns {string} Returns the unescaped string.
  9181. * @example
  9182. *
  9183. * _.unescape('fred, barney, &amp; pebbles');
  9184. * // => 'fred, barney, & pebbles'
  9185. */function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}
  9186. /**
  9187. * Converts `string`, as space separated words, to upper case.
  9188. *
  9189. * @static
  9190. * @memberOf _
  9191. * @since 4.0.0
  9192. * @category String
  9193. * @param {string} [string=''] The string to convert.
  9194. * @returns {string} Returns the upper cased string.
  9195. * @example
  9196. *
  9197. * _.upperCase('--foo-bar');
  9198. * // => 'FOO BAR'
  9199. *
  9200. * _.upperCase('fooBar');
  9201. * // => 'FOO BAR'
  9202. *
  9203. * _.upperCase('__foo_bar__');
  9204. * // => 'FOO BAR'
  9205. */var upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()});
  9206. /**
  9207. * Converts the first character of `string` to upper case.
  9208. *
  9209. * @static
  9210. * @memberOf _
  9211. * @since 4.0.0
  9212. * @category String
  9213. * @param {string} [string=''] The string to convert.
  9214. * @returns {string} Returns the converted string.
  9215. * @example
  9216. *
  9217. * _.upperFirst('fred');
  9218. * // => 'Fred'
  9219. *
  9220. * _.upperFirst('FRED');
  9221. * // => 'FRED'
  9222. */var upperFirst=createCaseFirst("toUpperCase");
  9223. /**
  9224. * Splits `string` into an array of its words.
  9225. *
  9226. * @static
  9227. * @memberOf _
  9228. * @since 3.0.0
  9229. * @category String
  9230. * @param {string} [string=''] The string to inspect.
  9231. * @param {RegExp|string} [pattern] The pattern to match words.
  9232. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9233. * @returns {Array} Returns the words of `string`.
  9234. * @example
  9235. *
  9236. * _.words('fred, barney, & pebbles');
  9237. * // => ['fred', 'barney', 'pebbles']
  9238. *
  9239. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  9240. * // => ['fred', 'barney', '&', 'pebbles']
  9241. */function words(string,pattern,guard){string=toString(string);pattern=guard?undefined:pattern;if(pattern===undefined){return hasUnicodeWord(string)?unicodeWords(string):asciiWords(string)}return string.match(pattern)||[]}
  9242. /*------------------------------------------------------------------------*/
  9243. /**
  9244. * Attempts to invoke `func`, returning either the result or the caught error
  9245. * object. Any additional arguments are provided to `func` when it's invoked.
  9246. *
  9247. * @static
  9248. * @memberOf _
  9249. * @since 3.0.0
  9250. * @category Util
  9251. * @param {Function} func The function to attempt.
  9252. * @param {...*} [args] The arguments to invoke `func` with.
  9253. * @returns {*} Returns the `func` result or error object.
  9254. * @example
  9255. *
  9256. * // Avoid throwing errors for invalid selectors.
  9257. * var elements = _.attempt(function(selector) {
  9258. * return document.querySelectorAll(selector);
  9259. * }, '>_>');
  9260. *
  9261. * if (_.isError(elements)) {
  9262. * elements = [];
  9263. * }
  9264. */var attempt=baseRest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}});
  9265. /**
  9266. * Binds methods of an object to the object itself, overwriting the existing
  9267. * method.
  9268. *
  9269. * **Note:** This method doesn't set the "length" property of bound functions.
  9270. *
  9271. * @static
  9272. * @since 0.1.0
  9273. * @memberOf _
  9274. * @category Util
  9275. * @param {Object} object The object to bind and assign the bound methods to.
  9276. * @param {...(string|string[])} methodNames The object method names to bind.
  9277. * @returns {Object} Returns `object`.
  9278. * @example
  9279. *
  9280. * var view = {
  9281. * 'label': 'docs',
  9282. * 'click': function() {
  9283. * console.log('clicked ' + this.label);
  9284. * }
  9285. * };
  9286. *
  9287. * _.bindAll(view, ['click']);
  9288. * jQuery(element).on('click', view.click);
  9289. * // => Logs 'clicked docs' when clicked.
  9290. */var bindAll=flatRest(function(object,methodNames){arrayEach(methodNames,function(key){key=toKey(key);baseAssignValue(object,key,bind(object[key],object))});return object});
  9291. /**
  9292. * Creates a function that iterates over `pairs` and invokes the corresponding
  9293. * function of the first predicate to return truthy. The predicate-function
  9294. * pairs are invoked with the `this` binding and arguments of the created
  9295. * function.
  9296. *
  9297. * @static
  9298. * @memberOf _
  9299. * @since 4.0.0
  9300. * @category Util
  9301. * @param {Array} pairs The predicate-function pairs.
  9302. * @returns {Function} Returns the new composite function.
  9303. * @example
  9304. *
  9305. * var func = _.cond([
  9306. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  9307. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  9308. * [_.stubTrue, _.constant('no match')]
  9309. * ]);
  9310. *
  9311. * func({ 'a': 1, 'b': 2 });
  9312. * // => 'matches A'
  9313. *
  9314. * func({ 'a': 0, 'b': 1 });
  9315. * // => 'matches B'
  9316. *
  9317. * func({ 'a': '1', 'b': '2' });
  9318. * // => 'no match'
  9319. */function cond(pairs){var length=pairs==null?0:pairs.length,toIteratee=getIteratee();pairs=!length?[]:arrayMap(pairs,function(pair){if(typeof pair[1]!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return[toIteratee(pair[0]),pair[1]]});return baseRest(function(args){var index=-1;while(++index<length){var pair=pairs[index];if(apply(pair[0],this,args)){return apply(pair[1],this,args)}}})}
  9320. /**
  9321. * Creates a function that invokes the predicate properties of `source` with
  9322. * the corresponding property values of a given object, returning `true` if
  9323. * all predicates return truthy, else `false`.
  9324. *
  9325. * **Note:** The created function is equivalent to `_.conformsTo` with
  9326. * `source` partially applied.
  9327. *
  9328. * @static
  9329. * @memberOf _
  9330. * @since 4.0.0
  9331. * @category Util
  9332. * @param {Object} source The object of property predicates to conform to.
  9333. * @returns {Function} Returns the new spec function.
  9334. * @example
  9335. *
  9336. * var objects = [
  9337. * { 'a': 2, 'b': 1 },
  9338. * { 'a': 1, 'b': 2 }
  9339. * ];
  9340. *
  9341. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  9342. * // => [{ 'a': 1, 'b': 2 }]
  9343. */function conforms(source){return baseConforms(baseClone(source,CLONE_DEEP_FLAG))}
  9344. /**
  9345. * Creates a function that returns `value`.
  9346. *
  9347. * @static
  9348. * @memberOf _
  9349. * @since 2.4.0
  9350. * @category Util
  9351. * @param {*} value The value to return from the new function.
  9352. * @returns {Function} Returns the new constant function.
  9353. * @example
  9354. *
  9355. * var objects = _.times(2, _.constant({ 'a': 1 }));
  9356. *
  9357. * console.log(objects);
  9358. * // => [{ 'a': 1 }, { 'a': 1 }]
  9359. *
  9360. * console.log(objects[0] === objects[1]);
  9361. * // => true
  9362. */function constant(value){return function(){return value}}
  9363. /**
  9364. * Checks `value` to determine whether a default value should be returned in
  9365. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  9366. * or `undefined`.
  9367. *
  9368. * @static
  9369. * @memberOf _
  9370. * @since 4.14.0
  9371. * @category Util
  9372. * @param {*} value The value to check.
  9373. * @param {*} defaultValue The default value.
  9374. * @returns {*} Returns the resolved value.
  9375. * @example
  9376. *
  9377. * _.defaultTo(1, 10);
  9378. * // => 1
  9379. *
  9380. * _.defaultTo(undefined, 10);
  9381. * // => 10
  9382. */function defaultTo(value,defaultValue){return value==null||value!==value?defaultValue:value}
  9383. /**
  9384. * Creates a function that returns the result of invoking the given functions
  9385. * with the `this` binding of the created function, where each successive
  9386. * invocation is supplied the return value of the previous.
  9387. *
  9388. * @static
  9389. * @memberOf _
  9390. * @since 3.0.0
  9391. * @category Util
  9392. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  9393. * @returns {Function} Returns the new composite function.
  9394. * @see _.flowRight
  9395. * @example
  9396. *
  9397. * function square(n) {
  9398. * return n * n;
  9399. * }
  9400. *
  9401. * var addSquare = _.flow([_.add, square]);
  9402. * addSquare(1, 2);
  9403. * // => 9
  9404. */var flow=createFlow();
  9405. /**
  9406. * This method is like `_.flow` except that it creates a function that
  9407. * invokes the given functions from right to left.
  9408. *
  9409. * @static
  9410. * @since 3.0.0
  9411. * @memberOf _
  9412. * @category Util
  9413. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  9414. * @returns {Function} Returns the new composite function.
  9415. * @see _.flow
  9416. * @example
  9417. *
  9418. * function square(n) {
  9419. * return n * n;
  9420. * }
  9421. *
  9422. * var addSquare = _.flowRight([square, _.add]);
  9423. * addSquare(1, 2);
  9424. * // => 9
  9425. */var flowRight=createFlow(true);
  9426. /**
  9427. * This method returns the first argument it receives.
  9428. *
  9429. * @static
  9430. * @since 0.1.0
  9431. * @memberOf _
  9432. * @category Util
  9433. * @param {*} value Any value.
  9434. * @returns {*} Returns `value`.
  9435. * @example
  9436. *
  9437. * var object = { 'a': 1 };
  9438. *
  9439. * console.log(_.identity(object) === object);
  9440. * // => true
  9441. */function identity(value){return value}
  9442. /**
  9443. * Creates a function that invokes `func` with the arguments of the created
  9444. * function. If `func` is a property name, the created function returns the
  9445. * property value for a given element. If `func` is an array or object, the
  9446. * created function returns `true` for elements that contain the equivalent
  9447. * source properties, otherwise it returns `false`.
  9448. *
  9449. * @static
  9450. * @since 4.0.0
  9451. * @memberOf _
  9452. * @category Util
  9453. * @param {*} [func=_.identity] The value to convert to a callback.
  9454. * @returns {Function} Returns the callback.
  9455. * @example
  9456. *
  9457. * var users = [
  9458. * { 'user': 'barney', 'age': 36, 'active': true },
  9459. * { 'user': 'fred', 'age': 40, 'active': false }
  9460. * ];
  9461. *
  9462. * // The `_.matches` iteratee shorthand.
  9463. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  9464. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  9465. *
  9466. * // The `_.matchesProperty` iteratee shorthand.
  9467. * _.filter(users, _.iteratee(['user', 'fred']));
  9468. * // => [{ 'user': 'fred', 'age': 40 }]
  9469. *
  9470. * // The `_.property` iteratee shorthand.
  9471. * _.map(users, _.iteratee('user'));
  9472. * // => ['barney', 'fred']
  9473. *
  9474. * // Create custom iteratee shorthands.
  9475. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  9476. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  9477. * return func.test(string);
  9478. * };
  9479. * });
  9480. *
  9481. * _.filter(['abc', 'def'], /ef/);
  9482. * // => ['def']
  9483. */function iteratee(func){return baseIteratee(typeof func=="function"?func:baseClone(func,CLONE_DEEP_FLAG))}
  9484. /**
  9485. * Creates a function that performs a partial deep comparison between a given
  9486. * object and `source`, returning `true` if the given object has equivalent
  9487. * property values, else `false`.
  9488. *
  9489. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  9490. * partially applied.
  9491. *
  9492. * Partial comparisons will match empty array and empty object `source`
  9493. * values against any array or object value, respectively. See `_.isEqual`
  9494. * for a list of supported value comparisons.
  9495. *
  9496. * @static
  9497. * @memberOf _
  9498. * @since 3.0.0
  9499. * @category Util
  9500. * @param {Object} source The object of property values to match.
  9501. * @returns {Function} Returns the new spec function.
  9502. * @example
  9503. *
  9504. * var objects = [
  9505. * { 'a': 1, 'b': 2, 'c': 3 },
  9506. * { 'a': 4, 'b': 5, 'c': 6 }
  9507. * ];
  9508. *
  9509. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  9510. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  9511. */function matches(source){return baseMatches(baseClone(source,CLONE_DEEP_FLAG))}
  9512. /**
  9513. * Creates a function that performs a partial deep comparison between the
  9514. * value at `path` of a given object to `srcValue`, returning `true` if the
  9515. * object value is equivalent, else `false`.
  9516. *
  9517. * **Note:** Partial comparisons will match empty array and empty object
  9518. * `srcValue` values against any array or object value, respectively. See
  9519. * `_.isEqual` for a list of supported value comparisons.
  9520. *
  9521. * @static
  9522. * @memberOf _
  9523. * @since 3.2.0
  9524. * @category Util
  9525. * @param {Array|string} path The path of the property to get.
  9526. * @param {*} srcValue The value to match.
  9527. * @returns {Function} Returns the new spec function.
  9528. * @example
  9529. *
  9530. * var objects = [
  9531. * { 'a': 1, 'b': 2, 'c': 3 },
  9532. * { 'a': 4, 'b': 5, 'c': 6 }
  9533. * ];
  9534. *
  9535. * _.find(objects, _.matchesProperty('a', 4));
  9536. * // => { 'a': 4, 'b': 5, 'c': 6 }
  9537. */function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,CLONE_DEEP_FLAG))}
  9538. /**
  9539. * Creates a function that invokes the method at `path` of a given object.
  9540. * Any additional arguments are provided to the invoked method.
  9541. *
  9542. * @static
  9543. * @memberOf _
  9544. * @since 3.7.0
  9545. * @category Util
  9546. * @param {Array|string} path The path of the method to invoke.
  9547. * @param {...*} [args] The arguments to invoke the method with.
  9548. * @returns {Function} Returns the new invoker function.
  9549. * @example
  9550. *
  9551. * var objects = [
  9552. * { 'a': { 'b': _.constant(2) } },
  9553. * { 'a': { 'b': _.constant(1) } }
  9554. * ];
  9555. *
  9556. * _.map(objects, _.method('a.b'));
  9557. * // => [2, 1]
  9558. *
  9559. * _.map(objects, _.method(['a', 'b']));
  9560. * // => [2, 1]
  9561. */var method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args)}});
  9562. /**
  9563. * The opposite of `_.method`; this method creates a function that invokes
  9564. * the method at a given path of `object`. Any additional arguments are
  9565. * provided to the invoked method.
  9566. *
  9567. * @static
  9568. * @memberOf _
  9569. * @since 3.7.0
  9570. * @category Util
  9571. * @param {Object} object The object to query.
  9572. * @param {...*} [args] The arguments to invoke the method with.
  9573. * @returns {Function} Returns the new invoker function.
  9574. * @example
  9575. *
  9576. * var array = _.times(3, _.constant),
  9577. * object = { 'a': array, 'b': array, 'c': array };
  9578. *
  9579. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  9580. * // => [2, 0]
  9581. *
  9582. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  9583. * // => [2, 0]
  9584. */var methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args)}});
  9585. /**
  9586. * Adds all own enumerable string keyed function properties of a source
  9587. * object to the destination object. If `object` is a function, then methods
  9588. * are added to its prototype as well.
  9589. *
  9590. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  9591. * avoid conflicts caused by modifying the original.
  9592. *
  9593. * @static
  9594. * @since 0.1.0
  9595. * @memberOf _
  9596. * @category Util
  9597. * @param {Function|Object} [object=lodash] The destination object.
  9598. * @param {Object} source The object of functions to add.
  9599. * @param {Object} [options={}] The options object.
  9600. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  9601. * @returns {Function|Object} Returns `object`.
  9602. * @example
  9603. *
  9604. * function vowels(string) {
  9605. * return _.filter(string, function(v) {
  9606. * return /[aeiou]/i.test(v);
  9607. * });
  9608. * }
  9609. *
  9610. * _.mixin({ 'vowels': vowels });
  9611. * _.vowels('fred');
  9612. * // => ['e']
  9613. *
  9614. * _('fred').vowels().value();
  9615. * // => ['e']
  9616. *
  9617. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  9618. * _('fred').vowels();
  9619. * // => ['e']
  9620. */function mixin(object,source,options){var props=keys(source),methodNames=baseFunctions(source,props);if(options==null&&!(isObject(source)&&(methodNames.length||!props.length))){options=source;source=object;object=this;methodNames=baseFunctions(source,keys(source))}var chain=!(isObject(options)&&"chain"in options)||!!options.chain,isFunc=isFunction(object);arrayEach(methodNames,function(methodName){var func=source[methodName];object[methodName]=func;if(isFunc){object.prototype[methodName]=function(){var chainAll=this.__chain__;if(chain||chainAll){var result=object(this.__wrapped__),actions=result.__actions__=copyArray(this.__actions__);actions.push({func,args:arguments,thisArg:object});result.__chain__=chainAll;return result}return func.apply(object,arrayPush([this.value()],arguments))}}});return object}
  9621. /**
  9622. * Reverts the `_` variable to its previous value and returns a reference to
  9623. * the `lodash` function.
  9624. *
  9625. * @static
  9626. * @since 0.1.0
  9627. * @memberOf _
  9628. * @category Util
  9629. * @returns {Function} Returns the `lodash` function.
  9630. * @example
  9631. *
  9632. * var lodash = _.noConflict();
  9633. */function noConflict(){if(root._===this){root._=oldDash}return this}
  9634. /**
  9635. * This method returns `undefined`.
  9636. *
  9637. * @static
  9638. * @memberOf _
  9639. * @since 2.3.0
  9640. * @category Util
  9641. * @example
  9642. *
  9643. * _.times(2, _.noop);
  9644. * // => [undefined, undefined]
  9645. */function noop(){
  9646. // No operation performed.
  9647. }
  9648. /**
  9649. * Creates a function that gets the argument at index `n`. If `n` is negative,
  9650. * the nth argument from the end is returned.
  9651. *
  9652. * @static
  9653. * @memberOf _
  9654. * @since 4.0.0
  9655. * @category Util
  9656. * @param {number} [n=0] The index of the argument to return.
  9657. * @returns {Function} Returns the new pass-thru function.
  9658. * @example
  9659. *
  9660. * var func = _.nthArg(1);
  9661. * func('a', 'b', 'c', 'd');
  9662. * // => 'b'
  9663. *
  9664. * var func = _.nthArg(-2);
  9665. * func('a', 'b', 'c', 'd');
  9666. * // => 'c'
  9667. */function nthArg(n){n=toInteger(n);return baseRest(function(args){return baseNth(args,n)})}
  9668. /**
  9669. * Creates a function that invokes `iteratees` with the arguments it receives
  9670. * and returns their results.
  9671. *
  9672. * @static
  9673. * @memberOf _
  9674. * @since 4.0.0
  9675. * @category Util
  9676. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  9677. * The iteratees to invoke.
  9678. * @returns {Function} Returns the new function.
  9679. * @example
  9680. *
  9681. * var func = _.over([Math.max, Math.min]);
  9682. *
  9683. * func(1, 2, 3, 4);
  9684. * // => [4, 1]
  9685. */var over=createOver(arrayMap);
  9686. /**
  9687. * Creates a function that checks if **all** of the `predicates` return
  9688. * truthy when invoked with the arguments it receives.
  9689. *
  9690. * @static
  9691. * @memberOf _
  9692. * @since 4.0.0
  9693. * @category Util
  9694. * @param {...(Function|Function[])} [predicates=[_.identity]]
  9695. * The predicates to check.
  9696. * @returns {Function} Returns the new function.
  9697. * @example
  9698. *
  9699. * var func = _.overEvery([Boolean, isFinite]);
  9700. *
  9701. * func('1');
  9702. * // => true
  9703. *
  9704. * func(null);
  9705. * // => false
  9706. *
  9707. * func(NaN);
  9708. * // => false
  9709. */var overEvery=createOver(arrayEvery);
  9710. /**
  9711. * Creates a function that checks if **any** of the `predicates` return
  9712. * truthy when invoked with the arguments it receives.
  9713. *
  9714. * @static
  9715. * @memberOf _
  9716. * @since 4.0.0
  9717. * @category Util
  9718. * @param {...(Function|Function[])} [predicates=[_.identity]]
  9719. * The predicates to check.
  9720. * @returns {Function} Returns the new function.
  9721. * @example
  9722. *
  9723. * var func = _.overSome([Boolean, isFinite]);
  9724. *
  9725. * func('1');
  9726. * // => true
  9727. *
  9728. * func(null);
  9729. * // => true
  9730. *
  9731. * func(NaN);
  9732. * // => false
  9733. */var overSome=createOver(arraySome);
  9734. /**
  9735. * Creates a function that returns the value at `path` of a given object.
  9736. *
  9737. * @static
  9738. * @memberOf _
  9739. * @since 2.4.0
  9740. * @category Util
  9741. * @param {Array|string} path The path of the property to get.
  9742. * @returns {Function} Returns the new accessor function.
  9743. * @example
  9744. *
  9745. * var objects = [
  9746. * { 'a': { 'b': 2 } },
  9747. * { 'a': { 'b': 1 } }
  9748. * ];
  9749. *
  9750. * _.map(objects, _.property('a.b'));
  9751. * // => [2, 1]
  9752. *
  9753. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  9754. * // => [1, 2]
  9755. */function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}
  9756. /**
  9757. * The opposite of `_.property`; this method creates a function that returns
  9758. * the value at a given path of `object`.
  9759. *
  9760. * @static
  9761. * @memberOf _
  9762. * @since 3.0.0
  9763. * @category Util
  9764. * @param {Object} object The object to query.
  9765. * @returns {Function} Returns the new accessor function.
  9766. * @example
  9767. *
  9768. * var array = [0, 1, 2],
  9769. * object = { 'a': array, 'b': array, 'c': array };
  9770. *
  9771. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  9772. * // => [2, 0]
  9773. *
  9774. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  9775. * // => [2, 0]
  9776. */function propertyOf(object){return function(path){return object==null?undefined:baseGet(object,path)}}
  9777. /**
  9778. * Creates an array of numbers (positive and/or negative) progressing from
  9779. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  9780. * `start` is specified without an `end` or `step`. If `end` is not specified,
  9781. * it's set to `start` with `start` then set to `0`.
  9782. *
  9783. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  9784. * floating-point values which can produce unexpected results.
  9785. *
  9786. * @static
  9787. * @since 0.1.0
  9788. * @memberOf _
  9789. * @category Util
  9790. * @param {number} [start=0] The start of the range.
  9791. * @param {number} end The end of the range.
  9792. * @param {number} [step=1] The value to increment or decrement by.
  9793. * @returns {Array} Returns the range of numbers.
  9794. * @see _.inRange, _.rangeRight
  9795. * @example
  9796. *
  9797. * _.range(4);
  9798. * // => [0, 1, 2, 3]
  9799. *
  9800. * _.range(-4);
  9801. * // => [0, -1, -2, -3]
  9802. *
  9803. * _.range(1, 5);
  9804. * // => [1, 2, 3, 4]
  9805. *
  9806. * _.range(0, 20, 5);
  9807. * // => [0, 5, 10, 15]
  9808. *
  9809. * _.range(0, -4, -1);
  9810. * // => [0, -1, -2, -3]
  9811. *
  9812. * _.range(1, 4, 0);
  9813. * // => [1, 1, 1]
  9814. *
  9815. * _.range(0);
  9816. * // => []
  9817. */var range=createRange();
  9818. /**
  9819. * This method is like `_.range` except that it populates values in
  9820. * descending order.
  9821. *
  9822. * @static
  9823. * @memberOf _
  9824. * @since 4.0.0
  9825. * @category Util
  9826. * @param {number} [start=0] The start of the range.
  9827. * @param {number} end The end of the range.
  9828. * @param {number} [step=1] The value to increment or decrement by.
  9829. * @returns {Array} Returns the range of numbers.
  9830. * @see _.inRange, _.range
  9831. * @example
  9832. *
  9833. * _.rangeRight(4);
  9834. * // => [3, 2, 1, 0]
  9835. *
  9836. * _.rangeRight(-4);
  9837. * // => [-3, -2, -1, 0]
  9838. *
  9839. * _.rangeRight(1, 5);
  9840. * // => [4, 3, 2, 1]
  9841. *
  9842. * _.rangeRight(0, 20, 5);
  9843. * // => [15, 10, 5, 0]
  9844. *
  9845. * _.rangeRight(0, -4, -1);
  9846. * // => [-3, -2, -1, 0]
  9847. *
  9848. * _.rangeRight(1, 4, 0);
  9849. * // => [1, 1, 1]
  9850. *
  9851. * _.rangeRight(0);
  9852. * // => []
  9853. */var rangeRight=createRange(true);
  9854. /**
  9855. * This method returns a new empty array.
  9856. *
  9857. * @static
  9858. * @memberOf _
  9859. * @since 4.13.0
  9860. * @category Util
  9861. * @returns {Array} Returns the new empty array.
  9862. * @example
  9863. *
  9864. * var arrays = _.times(2, _.stubArray);
  9865. *
  9866. * console.log(arrays);
  9867. * // => [[], []]
  9868. *
  9869. * console.log(arrays[0] === arrays[1]);
  9870. * // => false
  9871. */function stubArray(){return[]}
  9872. /**
  9873. * This method returns `false`.
  9874. *
  9875. * @static
  9876. * @memberOf _
  9877. * @since 4.13.0
  9878. * @category Util
  9879. * @returns {boolean} Returns `false`.
  9880. * @example
  9881. *
  9882. * _.times(2, _.stubFalse);
  9883. * // => [false, false]
  9884. */function stubFalse(){return false}
  9885. /**
  9886. * This method returns a new empty object.
  9887. *
  9888. * @static
  9889. * @memberOf _
  9890. * @since 4.13.0
  9891. * @category Util
  9892. * @returns {Object} Returns the new empty object.
  9893. * @example
  9894. *
  9895. * var objects = _.times(2, _.stubObject);
  9896. *
  9897. * console.log(objects);
  9898. * // => [{}, {}]
  9899. *
  9900. * console.log(objects[0] === objects[1]);
  9901. * // => false
  9902. */function stubObject(){return{}}
  9903. /**
  9904. * This method returns an empty string.
  9905. *
  9906. * @static
  9907. * @memberOf _
  9908. * @since 4.13.0
  9909. * @category Util
  9910. * @returns {string} Returns the empty string.
  9911. * @example
  9912. *
  9913. * _.times(2, _.stubString);
  9914. * // => ['', '']
  9915. */function stubString(){return""}
  9916. /**
  9917. * This method returns `true`.
  9918. *
  9919. * @static
  9920. * @memberOf _
  9921. * @since 4.13.0
  9922. * @category Util
  9923. * @returns {boolean} Returns `true`.
  9924. * @example
  9925. *
  9926. * _.times(2, _.stubTrue);
  9927. * // => [true, true]
  9928. */function stubTrue(){return true}
  9929. /**
  9930. * Invokes the iteratee `n` times, returning an array of the results of
  9931. * each invocation. The iteratee is invoked with one argument; (index).
  9932. *
  9933. * @static
  9934. * @since 0.1.0
  9935. * @memberOf _
  9936. * @category Util
  9937. * @param {number} n The number of times to invoke `iteratee`.
  9938. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9939. * @returns {Array} Returns the array of results.
  9940. * @example
  9941. *
  9942. * _.times(3, String);
  9943. * // => ['0', '1', '2']
  9944. *
  9945. * _.times(4, _.constant(0));
  9946. * // => [0, 0, 0, 0]
  9947. */function times(n,iteratee){n=toInteger(n);if(n<1||n>MAX_SAFE_INTEGER){return[]}var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee);n-=MAX_ARRAY_LENGTH;var result=baseTimes(length,iteratee);while(++index<n){iteratee(index)}return result}
  9948. /**
  9949. * Converts `value` to a property path array.
  9950. *
  9951. * @static
  9952. * @memberOf _
  9953. * @since 4.0.0
  9954. * @category Util
  9955. * @param {*} value The value to convert.
  9956. * @returns {Array} Returns the new property path array.
  9957. * @example
  9958. *
  9959. * _.toPath('a.b.c');
  9960. * // => ['a', 'b', 'c']
  9961. *
  9962. * _.toPath('a[0].b.c');
  9963. * // => ['a', '0', 'b', 'c']
  9964. */function toPath(value){if(isArray(value)){return arrayMap(value,toKey)}return isSymbol(value)?[value]:copyArray(stringToPath(toString(value)))}
  9965. /**
  9966. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  9967. *
  9968. * @static
  9969. * @since 0.1.0
  9970. * @memberOf _
  9971. * @category Util
  9972. * @param {string} [prefix=''] The value to prefix the ID with.
  9973. * @returns {string} Returns the unique ID.
  9974. * @example
  9975. *
  9976. * _.uniqueId('contact_');
  9977. * // => 'contact_104'
  9978. *
  9979. * _.uniqueId();
  9980. * // => '105'
  9981. */function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}
  9982. /*------------------------------------------------------------------------*/
  9983. /**
  9984. * Adds two numbers.
  9985. *
  9986. * @static
  9987. * @memberOf _
  9988. * @since 3.4.0
  9989. * @category Math
  9990. * @param {number} augend The first number in an addition.
  9991. * @param {number} addend The second number in an addition.
  9992. * @returns {number} Returns the total.
  9993. * @example
  9994. *
  9995. * _.add(6, 4);
  9996. * // => 10
  9997. */var add=createMathOperation(function(augend,addend){return augend+addend},0);
  9998. /**
  9999. * Computes `number` rounded up to `precision`.
  10000. *
  10001. * @static
  10002. * @memberOf _
  10003. * @since 3.10.0
  10004. * @category Math
  10005. * @param {number} number The number to round up.
  10006. * @param {number} [precision=0] The precision to round up to.
  10007. * @returns {number} Returns the rounded up number.
  10008. * @example
  10009. *
  10010. * _.ceil(4.006);
  10011. * // => 5
  10012. *
  10013. * _.ceil(6.004, 2);
  10014. * // => 6.01
  10015. *
  10016. * _.ceil(6040, -2);
  10017. * // => 6100
  10018. */var ceil=createRound("ceil");
  10019. /**
  10020. * Divide two numbers.
  10021. *
  10022. * @static
  10023. * @memberOf _
  10024. * @since 4.7.0
  10025. * @category Math
  10026. * @param {number} dividend The first number in a division.
  10027. * @param {number} divisor The second number in a division.
  10028. * @returns {number} Returns the quotient.
  10029. * @example
  10030. *
  10031. * _.divide(6, 4);
  10032. * // => 1.5
  10033. */var divide=createMathOperation(function(dividend,divisor){return dividend/divisor},1);
  10034. /**
  10035. * Computes `number` rounded down to `precision`.
  10036. *
  10037. * @static
  10038. * @memberOf _
  10039. * @since 3.10.0
  10040. * @category Math
  10041. * @param {number} number The number to round down.
  10042. * @param {number} [precision=0] The precision to round down to.
  10043. * @returns {number} Returns the rounded down number.
  10044. * @example
  10045. *
  10046. * _.floor(4.006);
  10047. * // => 4
  10048. *
  10049. * _.floor(0.046, 2);
  10050. * // => 0.04
  10051. *
  10052. * _.floor(4060, -2);
  10053. * // => 4000
  10054. */var floor=createRound("floor");
  10055. /**
  10056. * Computes the maximum value of `array`. If `array` is empty or falsey,
  10057. * `undefined` is returned.
  10058. *
  10059. * @static
  10060. * @since 0.1.0
  10061. * @memberOf _
  10062. * @category Math
  10063. * @param {Array} array The array to iterate over.
  10064. * @returns {*} Returns the maximum value.
  10065. * @example
  10066. *
  10067. * _.max([4, 2, 8, 6]);
  10068. * // => 8
  10069. *
  10070. * _.max([]);
  10071. * // => undefined
  10072. */function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined}
  10073. /**
  10074. * This method is like `_.max` except that it accepts `iteratee` which is
  10075. * invoked for each element in `array` to generate the criterion by which
  10076. * the value is ranked. The iteratee is invoked with one argument: (value).
  10077. *
  10078. * @static
  10079. * @memberOf _
  10080. * @since 4.0.0
  10081. * @category Math
  10082. * @param {Array} array The array to iterate over.
  10083. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  10084. * @returns {*} Returns the maximum value.
  10085. * @example
  10086. *
  10087. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  10088. *
  10089. * _.maxBy(objects, function(o) { return o.n; });
  10090. * // => { 'n': 2 }
  10091. *
  10092. * // The `_.property` iteratee shorthand.
  10093. * _.maxBy(objects, 'n');
  10094. * // => { 'n': 2 }
  10095. */function maxBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseGt):undefined}
  10096. /**
  10097. * Computes the mean of the values in `array`.
  10098. *
  10099. * @static
  10100. * @memberOf _
  10101. * @since 4.0.0
  10102. * @category Math
  10103. * @param {Array} array The array to iterate over.
  10104. * @returns {number} Returns the mean.
  10105. * @example
  10106. *
  10107. * _.mean([4, 2, 8, 6]);
  10108. * // => 5
  10109. */function mean(array){return baseMean(array,identity)}
  10110. /**
  10111. * This method is like `_.mean` except that it accepts `iteratee` which is
  10112. * invoked for each element in `array` to generate the value to be averaged.
  10113. * The iteratee is invoked with one argument: (value).
  10114. *
  10115. * @static
  10116. * @memberOf _
  10117. * @since 4.7.0
  10118. * @category Math
  10119. * @param {Array} array The array to iterate over.
  10120. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  10121. * @returns {number} Returns the mean.
  10122. * @example
  10123. *
  10124. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  10125. *
  10126. * _.meanBy(objects, function(o) { return o.n; });
  10127. * // => 5
  10128. *
  10129. * // The `_.property` iteratee shorthand.
  10130. * _.meanBy(objects, 'n');
  10131. * // => 5
  10132. */function meanBy(array,iteratee){return baseMean(array,getIteratee(iteratee,2))}
  10133. /**
  10134. * Computes the minimum value of `array`. If `array` is empty or falsey,
  10135. * `undefined` is returned.
  10136. *
  10137. * @static
  10138. * @since 0.1.0
  10139. * @memberOf _
  10140. * @category Math
  10141. * @param {Array} array The array to iterate over.
  10142. * @returns {*} Returns the minimum value.
  10143. * @example
  10144. *
  10145. * _.min([4, 2, 8, 6]);
  10146. * // => 2
  10147. *
  10148. * _.min([]);
  10149. * // => undefined
  10150. */function min(array){return array&&array.length?baseExtremum(array,identity,baseLt):undefined}
  10151. /**
  10152. * This method is like `_.min` except that it accepts `iteratee` which is
  10153. * invoked for each element in `array` to generate the criterion by which
  10154. * the value is ranked. The iteratee is invoked with one argument: (value).
  10155. *
  10156. * @static
  10157. * @memberOf _
  10158. * @since 4.0.0
  10159. * @category Math
  10160. * @param {Array} array The array to iterate over.
  10161. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  10162. * @returns {*} Returns the minimum value.
  10163. * @example
  10164. *
  10165. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  10166. *
  10167. * _.minBy(objects, function(o) { return o.n; });
  10168. * // => { 'n': 1 }
  10169. *
  10170. * // The `_.property` iteratee shorthand.
  10171. * _.minBy(objects, 'n');
  10172. * // => { 'n': 1 }
  10173. */function minBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseLt):undefined}
  10174. /**
  10175. * Multiply two numbers.
  10176. *
  10177. * @static
  10178. * @memberOf _
  10179. * @since 4.7.0
  10180. * @category Math
  10181. * @param {number} multiplier The first number in a multiplication.
  10182. * @param {number} multiplicand The second number in a multiplication.
  10183. * @returns {number} Returns the product.
  10184. * @example
  10185. *
  10186. * _.multiply(6, 4);
  10187. * // => 24
  10188. */var multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand},1);
  10189. /**
  10190. * Computes `number` rounded to `precision`.
  10191. *
  10192. * @static
  10193. * @memberOf _
  10194. * @since 3.10.0
  10195. * @category Math
  10196. * @param {number} number The number to round.
  10197. * @param {number} [precision=0] The precision to round to.
  10198. * @returns {number} Returns the rounded number.
  10199. * @example
  10200. *
  10201. * _.round(4.006);
  10202. * // => 4
  10203. *
  10204. * _.round(4.006, 2);
  10205. * // => 4.01
  10206. *
  10207. * _.round(4060, -2);
  10208. * // => 4100
  10209. */var round=createRound("round");
  10210. /**
  10211. * Subtract two numbers.
  10212. *
  10213. * @static
  10214. * @memberOf _
  10215. * @since 4.0.0
  10216. * @category Math
  10217. * @param {number} minuend The first number in a subtraction.
  10218. * @param {number} subtrahend The second number in a subtraction.
  10219. * @returns {number} Returns the difference.
  10220. * @example
  10221. *
  10222. * _.subtract(6, 4);
  10223. * // => 2
  10224. */var subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend},0);
  10225. /**
  10226. * Computes the sum of the values in `array`.
  10227. *
  10228. * @static
  10229. * @memberOf _
  10230. * @since 3.4.0
  10231. * @category Math
  10232. * @param {Array} array The array to iterate over.
  10233. * @returns {number} Returns the sum.
  10234. * @example
  10235. *
  10236. * _.sum([4, 2, 8, 6]);
  10237. * // => 20
  10238. */function sum(array){return array&&array.length?baseSum(array,identity):0}
  10239. /**
  10240. * This method is like `_.sum` except that it accepts `iteratee` which is
  10241. * invoked for each element in `array` to generate the value to be summed.
  10242. * The iteratee is invoked with one argument: (value).
  10243. *
  10244. * @static
  10245. * @memberOf _
  10246. * @since 4.0.0
  10247. * @category Math
  10248. * @param {Array} array The array to iterate over.
  10249. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  10250. * @returns {number} Returns the sum.
  10251. * @example
  10252. *
  10253. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  10254. *
  10255. * _.sumBy(objects, function(o) { return o.n; });
  10256. * // => 20
  10257. *
  10258. * // The `_.property` iteratee shorthand.
  10259. * _.sumBy(objects, 'n');
  10260. * // => 20
  10261. */function sumBy(array,iteratee){return array&&array.length?baseSum(array,getIteratee(iteratee,2)):0}
  10262. /*------------------------------------------------------------------------*/
  10263. // Add methods that return wrapped values in chain sequences.
  10264. lodash.after=after;lodash.ary=ary;lodash.assign=assign;lodash.assignIn=assignIn;lodash.assignInWith=assignInWith;lodash.assignWith=assignWith;lodash.at=at;lodash.before=before;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.castArray=castArray;lodash.chain=chain;lodash.chunk=chunk;lodash.compact=compact;lodash.concat=concat;lodash.cond=cond;lodash.conforms=conforms;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.curry=curry;lodash.curryRight=curryRight;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defaultsDeep=defaultsDeep;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.differenceBy=differenceBy;lodash.differenceWith=differenceWith;lodash.drop=drop;lodash.dropRight=dropRight;lodash.dropRightWhile=dropRightWhile;lodash.dropWhile=dropWhile;lodash.fill=fill;lodash.filter=filter;lodash.flatMap=flatMap;lodash.flatMapDeep=flatMapDeep;lodash.flatMapDepth=flatMapDepth;lodash.flatten=flatten;lodash.flattenDeep=flattenDeep;lodash.flattenDepth=flattenDepth;lodash.flip=flip;lodash.flow=flow;lodash.flowRight=flowRight;lodash.fromPairs=fromPairs;lodash.functions=functions;lodash.functionsIn=functionsIn;lodash.groupBy=groupBy;lodash.initial=initial;lodash.intersection=intersection;lodash.intersectionBy=intersectionBy;lodash.intersectionWith=intersectionWith;lodash.invert=invert;lodash.invertBy=invertBy;lodash.invokeMap=invokeMap;lodash.iteratee=iteratee;lodash.keyBy=keyBy;lodash.keys=keys;lodash.keysIn=keysIn;lodash.map=map;lodash.mapKeys=mapKeys;lodash.mapValues=mapValues;lodash.matches=matches;lodash.matchesProperty=matchesProperty;lodash.memoize=memoize;lodash.merge=merge;lodash.mergeWith=mergeWith;lodash.method=method;lodash.methodOf=methodOf;lodash.mixin=mixin;lodash.negate=negate;lodash.nthArg=nthArg;lodash.omit=omit;lodash.omitBy=omitBy;lodash.once=once;lodash.orderBy=orderBy;lodash.over=over;lodash.overArgs=overArgs;lodash.overEvery=overEvery;lodash.overSome=overSome;lodash.partial=partial;lodash.partialRight=partialRight;lodash.partition=partition;lodash.pick=pick;lodash.pickBy=pickBy;lodash.property=property;lodash.propertyOf=propertyOf;lodash.pull=pull;lodash.pullAll=pullAll;lodash.pullAllBy=pullAllBy;lodash.pullAllWith=pullAllWith;lodash.pullAt=pullAt;lodash.range=range;lodash.rangeRight=rangeRight;lodash.rearg=rearg;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.reverse=reverse;lodash.sampleSize=sampleSize;lodash.set=set;lodash.setWith=setWith;lodash.shuffle=shuffle;lodash.slice=slice;lodash.sortBy=sortBy;lodash.sortedUniq=sortedUniq;lodash.sortedUniqBy=sortedUniqBy;lodash.split=split;lodash.spread=spread;lodash.tail=tail;lodash.take=take;lodash.takeRight=takeRight;lodash.takeRightWhile=takeRightWhile;lodash.takeWhile=takeWhile;lodash.tap=tap;lodash.throttle=throttle;lodash.thru=thru;lodash.toArray=toArray;lodash.toPairs=toPairs;lodash.toPairsIn=toPairsIn;lodash.toPath=toPath;lodash.toPlainObject=toPlainObject;lodash.transform=transform;lodash.unary=unary;lodash.union=union;lodash.unionBy=unionBy;lodash.unionWith=unionWith;lodash.uniq=uniq;lodash.uniqBy=uniqBy;lodash.uniqWith=uniqWith;lodash.unset=unset;lodash.unzip=unzip;lodash.unzipWith=unzipWith;lodash.update=update;lodash.updateWith=updateWith;lodash.values=values;lodash.valuesIn=valuesIn;lodash.without=without;lodash.words=words;lodash.wrap=wrap;lodash.xor=xor;lodash.xorBy=xorBy;lodash.xorWith=xorWith;lodash.zip=zip;lodash.zipObject=zipObject;lodash.zipObjectDeep=zipObjectDeep;lodash.zipWith=zipWith;
  10265. // Add aliases.
  10266. lodash.entries=toPairs;lodash.entriesIn=toPairsIn;lodash.extend=assignIn;lodash.extendWith=assignInWith;
  10267. // Add methods to `lodash.prototype`.
  10268. mixin(lodash,lodash);
  10269. /*------------------------------------------------------------------------*/
  10270. // Add methods that return unwrapped values in chain sequences.
  10271. lodash.add=add;lodash.attempt=attempt;lodash.camelCase=camelCase;lodash.capitalize=capitalize;lodash.ceil=ceil;lodash.clamp=clamp;lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.cloneDeepWith=cloneDeepWith;lodash.cloneWith=cloneWith;lodash.conformsTo=conformsTo;lodash.deburr=deburr;lodash.defaultTo=defaultTo;lodash.divide=divide;lodash.endsWith=endsWith;lodash.eq=eq;lodash.escape=escape;lodash.escapeRegExp=escapeRegExp;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.floor=floor;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.get=get;lodash.gt=gt;lodash.gte=gte;lodash.has=has;lodash.hasIn=hasIn;lodash.head=head;lodash.identity=identity;lodash.includes=includes;lodash.indexOf=indexOf;lodash.inRange=inRange;lodash.invoke=invoke;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isArrayBuffer=isArrayBuffer;lodash.isArrayLike=isArrayLike;lodash.isArrayLikeObject=isArrayLikeObject;lodash.isBoolean=isBoolean;lodash.isBuffer=isBuffer;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isEqualWith=isEqualWith;lodash.isError=isError;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isInteger=isInteger;lodash.isLength=isLength;lodash.isMap=isMap;lodash.isMatch=isMatch;lodash.isMatchWith=isMatchWith;lodash.isNaN=isNaN;lodash.isNative=isNative;lodash.isNil=isNil;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isObjectLike=isObjectLike;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isSafeInteger=isSafeInteger;lodash.isSet=isSet;lodash.isString=isString;lodash.isSymbol=isSymbol;lodash.isTypedArray=isTypedArray;lodash.isUndefined=isUndefined;lodash.isWeakMap=isWeakMap;lodash.isWeakSet=isWeakSet;lodash.join=join;lodash.kebabCase=kebabCase;lodash.last=last;lodash.lastIndexOf=lastIndexOf;lodash.lowerCase=lowerCase;lodash.lowerFirst=lowerFirst;lodash.lt=lt;lodash.lte=lte;lodash.max=max;lodash.maxBy=maxBy;lodash.mean=mean;lodash.meanBy=meanBy;lodash.min=min;lodash.minBy=minBy;lodash.stubArray=stubArray;lodash.stubFalse=stubFalse;lodash.stubObject=stubObject;lodash.stubString=stubString;lodash.stubTrue=stubTrue;lodash.multiply=multiply;lodash.nth=nth;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.pad=pad;lodash.padEnd=padEnd;lodash.padStart=padStart;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.repeat=repeat;lodash.replace=replace;lodash.result=result;lodash.round=round;lodash.runInContext=runInContext;lodash.sample=sample;lodash.size=size;lodash.snakeCase=snakeCase;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.sortedIndexBy=sortedIndexBy;lodash.sortedIndexOf=sortedIndexOf;lodash.sortedLastIndex=sortedLastIndex;lodash.sortedLastIndexBy=sortedLastIndexBy;lodash.sortedLastIndexOf=sortedLastIndexOf;lodash.startCase=startCase;lodash.startsWith=startsWith;lodash.subtract=subtract;lodash.sum=sum;lodash.sumBy=sumBy;lodash.template=template;lodash.times=times;lodash.toFinite=toFinite;lodash.toInteger=toInteger;lodash.toLength=toLength;lodash.toLower=toLower;lodash.toNumber=toNumber;lodash.toSafeInteger=toSafeInteger;lodash.toString=toString;lodash.toUpper=toUpper;lodash.trim=trim;lodash.trimEnd=trimEnd;lodash.trimStart=trimStart;lodash.truncate=truncate;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.upperCase=upperCase;lodash.upperFirst=upperFirst;
  10272. // Add aliases.
  10273. lodash.each=forEach;lodash.eachRight=forEachRight;lodash.first=head;mixin(lodash,function(){var source={};baseForOwn(lodash,function(func,methodName){if(!hasOwnProperty.call(lodash.prototype,methodName)){source[methodName]=func}});return source}(),{chain:false});
  10274. /*------------------------------------------------------------------------*/
  10275. /**
  10276. * The semantic version number.
  10277. *
  10278. * @static
  10279. * @memberOf _
  10280. * @type {string}
  10281. */lodash.VERSION=VERSION;
  10282. // Assign default placeholders.
  10283. arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash});
  10284. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  10285. arrayEach(["drop","take"],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){n=n===undefined?1:nativeMax(toInteger(n),0);var result=this.__filtered__&&!index?new LazyWrapper(this):this.clone();if(result.__filtered__){result.__takeCount__=nativeMin(n,result.__takeCount__)}else{result.__views__.push({size:nativeMin(n,MAX_ARRAY_LENGTH),type:methodName+(result.__dir__<0?"Right":"")})}return result};LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()}});
  10286. // Add `LazyWrapper` methods that accept an `iteratee` value.
  10287. arrayEach(["filter","map","takeWhile"],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||type==LAZY_WHILE_FLAG;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();result.__iteratees__.push({iteratee:getIteratee(iteratee,3),type});result.__filtered__=result.__filtered__||isFilter;return result}});
  10288. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  10289. arrayEach(["head","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}});
  10290. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  10291. arrayEach(["initial","tail"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1)}});LazyWrapper.prototype.compact=function(){return this.filter(identity)};LazyWrapper.prototype.find=function(predicate){return this.filter(predicate).head()};LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate)};LazyWrapper.prototype.invokeMap=baseRest(function(path,args){if(typeof path=="function"){return new LazyWrapper(this)}return this.map(function(value){return baseInvoke(value,path,args)})});LazyWrapper.prototype.reject=function(predicate){return this.filter(negate(getIteratee(predicate)))};LazyWrapper.prototype.slice=function(start,end){start=toInteger(start);var result=this;if(result.__filtered__&&(start>0||end<0)){return new LazyWrapper(result)}if(start<0){result=result.takeRight(-start)}else if(start){result=result.drop(start)}if(end!==undefined){end=toInteger(end);result=end<0?result.dropRight(-end):result.take(end-start)}return result};LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)};
  10292. // Add `LazyWrapper` methods to `lodash.prototype`.
  10293. baseForOwn(LazyWrapper.prototype,function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+(methodName=="last"?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);if(!lodashFunc){return}lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value);var interceptor=function(value){var result=lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};if(useLazy&&checkIteratee&&typeof iteratee=="function"&&iteratee.length!=1){
  10294. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  10295. isLazy=useLazy=false}var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);result.__actions__.push({func:thru,args:[interceptor],thisArg:undefined});return new LodashWrapper(result,chainAll)}if(isUnwrapped&&onlyLazy){return func.apply(this,args)}result=this.thru(interceptor);return isUnwrapped?isTaker?result.value()[0]:result.value():result}});
  10296. // Add `Array` methods to `lodash.prototype`.
  10297. arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}});
  10298. // Map minified method names to their real names.
  10299. baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"",names=realNames[key]||(realNames[key]=[]);names.push({name:methodName,func:lodashFunc})}});realNames[createHybrid(undefined,WRAP_BIND_KEY_FLAG).name]=[{name:"wrapper",func:undefined}];
  10300. // Add methods to `LazyWrapper`.
  10301. LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;
  10302. // Add chain sequence methods to the `lodash` wrapper.
  10303. lodash.prototype.at=wrapperAt;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;
  10304. // Add lazy aliases.
  10305. lodash.prototype.first=lodash.prototype.head;if(symIterator){lodash.prototype[symIterator]=wrapperToIterator}return lodash};
  10306. /*--------------------------------------------------------------------------*/
  10307. // Export lodash.
  10308. var _=runInContext();
  10309. // Some AMD build optimizers, like r.js, check for condition patterns like:
  10310. if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){
  10311. // Expose Lodash on the global object to prevent errors when Lodash is
  10312. // loaded by a script tag in the presence of an AMD loader.
  10313. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  10314. // Use `_.noConflict` to remove Lodash from the global object.
  10315. root._=_;
  10316. // Define as an anonymous module so, through path mapping, it can be
  10317. // referenced as the "underscore" module.
  10318. define(function(){return _})}
  10319. // Check for `exports` after `define` in case a build optimizer adds it.
  10320. else if(freeModule){
  10321. // Export for Node.js.
  10322. (freeModule.exports=_)._=_;
  10323. // Export for CommonJS support.
  10324. freeExports._=_}else{
  10325. // Export to the global object.
  10326. root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1])(1)});