resources_js_pages_mutation_Report_vue.js 653KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236
  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["resources_js_pages_mutation_Report_vue"],{
  2. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js":
  3. /*!**************************************************************************************************************************************************************************************************************!*\
  4. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js ***!
  5. \**************************************************************************************************************************************************************************************************************/
  6. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  7. "use strict";
  8. __webpack_require__.r(__webpack_exports__);
  9. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  11. /* harmony export */ });
  12. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  13. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  14. props: {
  15. inertiaLink: {
  16. type: Boolean,
  17. "default": true
  18. },
  19. icon: String,
  20. label: String,
  21. classButton: String
  22. },
  23. setup: function setup(__props, _ref) {
  24. var expose = _ref.expose;
  25. expose();
  26. var __returned__ = {
  27. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  28. };
  29. Object.defineProperty(__returned__, '__isScriptSetup', {
  30. enumerable: false,
  31. value: true
  32. });
  33. return __returned__;
  34. }
  35. });
  36. /***/ }),
  37. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  38. /*!***************************************************************************************************************************************************************************************************************!*\
  39. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  40. \***************************************************************************************************************************************************************************************************************/
  41. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  42. "use strict";
  43. __webpack_require__.r(__webpack_exports__);
  44. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  45. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  46. /* harmony export */ });
  47. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  48. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  49. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  50. setup: function setup(__props, _ref) {
  51. var expose = _ref.expose;
  52. expose();
  53. var flashMessage = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  54. return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash;
  55. });
  56. var messageDisplay = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)({});
  57. var onClose = function onClose() {
  58. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.errors = {};
  59. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.success = null;
  60. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.error = null;
  61. messageDisplay.value = {
  62. display: 'none'
  63. };
  64. };
  65. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(flashMessage, function () {
  66. messageDisplay.value = {
  67. display: ''
  68. };
  69. }, {
  70. deep: true
  71. });
  72. var __returned__ = {
  73. flashMessage: flashMessage,
  74. messageDisplay: messageDisplay,
  75. onClose: onClose,
  76. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  77. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  78. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  79. usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage
  80. };
  81. Object.defineProperty(__returned__, '__isScriptSetup', {
  82. enumerable: false,
  83. value: true
  84. });
  85. return __returned__;
  86. }
  87. });
  88. /***/ }),
  89. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js":
  90. /*!******************************************************************************************************************************************************************************************************************!*\
  91. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js ***!
  92. \******************************************************************************************************************************************************************************************************************/
  93. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  94. "use strict";
  95. __webpack_require__.r(__webpack_exports__);
  96. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  97. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  98. /* harmony export */ });
  99. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  100. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  101. props: {
  102. links: Array
  103. },
  104. setup: function setup(__props, _ref) {
  105. var expose = _ref.expose;
  106. expose();
  107. var __returned__ = {
  108. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  109. };
  110. Object.defineProperty(__returned__, '__isScriptSetup', {
  111. enumerable: false,
  112. value: true
  113. });
  114. return __returned__;
  115. }
  116. });
  117. /***/ }),
  118. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  119. /*!***************************************************************************************************************************************************************************************************************!*\
  120. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  121. \***************************************************************************************************************************************************************************************************************/
  122. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  123. "use strict";
  124. __webpack_require__.r(__webpack_exports__);
  125. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  126. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  127. /* harmony export */ });
  128. /* harmony import */ var _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/AppSubSidebar.vue */ "./resources/js/components/AppSubSidebar.vue");
  129. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  130. props: {
  131. model: Array
  132. },
  133. emits: ['menuitem-click'],
  134. setup: function setup(__props, _ref) {
  135. var expose = _ref.expose,
  136. emits = _ref.emit;
  137. expose();
  138. var onKeyDown = function onKeyDown(event) {
  139. var nodeElement = event.target;
  140. if (event.code === 'Enter' || event.code === 'Space') {
  141. nodeElement.click();
  142. event.preventDefault();
  143. }
  144. };
  145. var onMenuItemClick = function onMenuItemClick(event) {
  146. emits('menuitem-click', event);
  147. };
  148. var __returned__ = {
  149. emits: emits,
  150. onKeyDown: onKeyDown,
  151. onMenuItemClick: onMenuItemClick,
  152. AppSubSidebar: _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  153. };
  154. Object.defineProperty(__returned__, '__isScriptSetup', {
  155. enumerable: false,
  156. value: true
  157. });
  158. return __returned__;
  159. }
  160. });
  161. /***/ }),
  162. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  163. /*!******************************************************************************************************************************************************************************************************************!*\
  164. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  165. \******************************************************************************************************************************************************************************************************************/
  166. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  167. "use strict";
  168. __webpack_require__.r(__webpack_exports__);
  169. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  170. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  171. /* harmony export */ });
  172. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  173. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  174. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  175. props: {
  176. items: Array,
  177. root: {
  178. type: Boolean,
  179. "default": false
  180. }
  181. },
  182. emits: ['menuitem-click'],
  183. setup: function setup(__props, _ref) {
  184. var expose = _ref.expose,
  185. emits = _ref.emit;
  186. expose();
  187. var activeIndex = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(null);
  188. var onMenuItemClick = function onMenuItemClick(event, item, index) {
  189. if (item.disabled) {
  190. event.preventDefault();
  191. return;
  192. }
  193. if (!item.to && !item.url) {
  194. event.preventDefault();
  195. }
  196. if (item.command) {
  197. item.command({
  198. originalEvent: event,
  199. item: item
  200. });
  201. }
  202. activeIndex.value = index === activeIndex.value ? null : index;
  203. emits('menuitem-click', {
  204. originalEvent: event,
  205. item: item
  206. });
  207. };
  208. var visible = function visible(item) {
  209. return typeof item.visible === 'function' ? item.visible() : item.visible !== false;
  210. };
  211. var __returned__ = {
  212. emits: emits,
  213. activeIndex: activeIndex,
  214. onMenuItemClick: onMenuItemClick,
  215. visible: visible,
  216. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  217. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.Link
  218. };
  219. Object.defineProperty(__returned__, '__isScriptSetup', {
  220. enumerable: false,
  221. value: true
  222. });
  223. return __returned__;
  224. }
  225. });
  226. /***/ }),
  227. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  228. /*!**************************************************************************************************************************************************************************************************************!*\
  229. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  230. \**************************************************************************************************************************************************************************************************************/
  231. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  232. "use strict";
  233. __webpack_require__.r(__webpack_exports__);
  234. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  235. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  236. /* harmony export */ });
  237. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  238. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  239. emits: ['menu-toggle'],
  240. setup: function setup(__props, _ref) {
  241. var expose = _ref.expose;
  242. expose();
  243. var __returned__ = {
  244. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  245. };
  246. Object.defineProperty(__returned__, '__isScriptSetup', {
  247. enumerable: false,
  248. value: true
  249. });
  250. return __returned__;
  251. }
  252. });
  253. /***/ }),
  254. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  255. /*!***********************************************************************************************************************************************************************************************************!*\
  256. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  257. \***********************************************************************************************************************************************************************************************************/
  258. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  259. "use strict";
  260. __webpack_require__.r(__webpack_exports__);
  261. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  262. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  263. /* harmony export */ });
  264. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  265. /* harmony import */ var _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppTopBar.vue */ "./resources/js/components/AppTopBar.vue");
  266. /* harmony import */ var _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppSidebar.vue */ "./resources/js/components/AppSidebar.vue");
  267. /* harmony import */ var _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppFooter.vue */ "./resources/js/components/AppFooter.vue");
  268. /* harmony import */ var _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppMessage.vue */ "./resources/js/components/AppMessage.vue");
  269. /* harmony import */ var _utils_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/menu */ "./resources/js/utils/menu.js");
  270. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  271. setup: function setup(__props, _ref) {
  272. var expose = _ref.expose;
  273. expose();
  274. var mobileMenuActive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  275. var staticMenuInactive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  276. var menuClick = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  277. var isDesktop = function isDesktop() {
  278. return window.innerWidth >= 992;
  279. };
  280. var addClass = function addClass(element, className) {
  281. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  282. };
  283. var removeClass = function removeClass(element, className) {
  284. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  285. };
  286. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate)(function () {
  287. if (mobileMenuActive.value) {
  288. addClass(document.body, 'body-overflow-hidden');
  289. } else {
  290. removeClass(document.body, 'body-overflow-hidden');
  291. }
  292. });
  293. var containerClass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  294. return ['layout-wrapper', 'layout-static', {
  295. 'layout-static-sidebar-inactive': staticMenuInactive.value,
  296. 'layout-mobile-sidebar-active': mobileMenuActive.value
  297. }];
  298. });
  299. var onWrapperClick = function onWrapperClick() {
  300. if (!menuClick.value) {
  301. mobileMenuActive.value = false;
  302. }
  303. menuClick.value = false;
  304. };
  305. var onMenuToggle = function onMenuToggle(event) {
  306. menuClick.value = true;
  307. if (isDesktop()) {
  308. staticMenuInactive.value = !staticMenuInactive.value;
  309. } else {
  310. mobileMenuActive.value = !mobileMenuActive.value;
  311. }
  312. event.preventDefault();
  313. };
  314. var onSidebarClick = function onSidebarClick() {
  315. menuClick.value = true;
  316. };
  317. var onMenuItemClick = function onMenuItemClick(event) {
  318. if (event.item && !event.item.items) {
  319. mobileMenuActive.value = false;
  320. }
  321. };
  322. var __returned__ = {
  323. mobileMenuActive: mobileMenuActive,
  324. staticMenuInactive: staticMenuInactive,
  325. menuClick: menuClick,
  326. isDesktop: isDesktop,
  327. addClass: addClass,
  328. removeClass: removeClass,
  329. containerClass: containerClass,
  330. onWrapperClick: onWrapperClick,
  331. onMenuToggle: onMenuToggle,
  332. onSidebarClick: onSidebarClick,
  333. onMenuItemClick: onMenuItemClick,
  334. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  335. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  336. onBeforeUpdate: vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate,
  337. AppTopBar: _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  338. AppSidebar: _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  339. AppFooter: _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  340. AppMessage: _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
  341. menu: _utils_menu__WEBPACK_IMPORTED_MODULE_5__["default"]
  342. };
  343. Object.defineProperty(__returned__, '__isScriptSetup', {
  344. enumerable: false,
  345. value: true
  346. });
  347. return __returned__;
  348. }
  349. });
  350. /***/ }),
  351. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js":
  352. /*!***************************************************************************************************************************************************************************************************************!*\
  353. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js ***!
  354. \***************************************************************************************************************************************************************************************************************/
  355. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  356. "use strict";
  357. __webpack_require__.r(__webpack_exports__);
  358. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  359. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  360. /* harmony export */ });
  361. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  362. /* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
  363. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  364. /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
  365. /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);
  366. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  367. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);
  368. /* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
  369. /* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
  370. /* harmony import */ var _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppButton.vue */ "./resources/js/components/AppButton.vue");
  371. /* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/mutation/TableHeader.js");
  372. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  373. props: {
  374. mutations: {
  375. type: Object,
  376. "default": {
  377. details: {
  378. data: [],
  379. links: [],
  380. total: 0
  381. }
  382. }
  383. },
  384. filters: Object
  385. },
  386. setup: function setup(__props, _ref) {
  387. var expose = _ref.expose;
  388. expose();
  389. var props = __props;
  390. var filterForm = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm)({
  391. dates: null,
  392. startDate: props.filters.startDate,
  393. endDate: props.filters.endDate
  394. });
  395. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
  396. if (props.filters.startDate || props.filters.endDate) {
  397. if (props.filters.endDate) {
  398. filterForm.dates = [new Date(props.filters.startDate), new Date(props.filters.endDate)];
  399. } else {
  400. filterForm.dates = [new Date(props.filters.startDate), null];
  401. }
  402. }
  403. });
  404. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(filterForm, function () {
  405. if (filterForm.dates) {
  406. if (filterForm.dates[1]) {
  407. filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
  408. filterForm.endDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[1]).format('YYYY-MM-DD');
  409. } else {
  410. filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
  411. filterForm.endDate = null;
  412. }
  413. } else {
  414. filterForm.endDate = null;
  415. filterForm.startDate = null;
  416. }
  417. _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.reload({
  418. data: (0,lodash__WEBPACK_IMPORTED_MODULE_4__.pickBy)({
  419. startDate: filterForm.startDate,
  420. endDate: filterForm.endDate
  421. }),
  422. only: ['mutations']
  423. });
  424. var params = window.location.search;
  425. exportExcelLink.value = "/reports/mutations/export/excel".concat(params);
  426. });
  427. var filterReset = function filterReset() {
  428. _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.get('/reports/mutations');
  429. };
  430. var linkReference = function linkReference(data) {
  431. if (data.topupId) {
  432. return route('top-ups.show', data.topupId);
  433. } else if (data.expenseId) {
  434. return route('expenses.show', data.expenseId);
  435. } else {
  436. console.info('under construction'); // return route('expenses.show', data.expenseId)
  437. }
  438. };
  439. var exportExcelLink = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)('/reports/mutations/export/excel');
  440. var __returned__ = {
  441. props: props,
  442. filterForm: filterForm,
  443. filterReset: filterReset,
  444. linkReference: linkReference,
  445. exportExcelLink: exportExcelLink,
  446. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  447. onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
  448. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  449. Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
  450. Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
  451. useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
  452. dayjs: (dayjs__WEBPACK_IMPORTED_MODULE_3___default()),
  453. pickBy: lodash__WEBPACK_IMPORTED_MODULE_4__.pickBy,
  454. AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
  455. AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
  456. AppButton: _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
  457. TableHeader: _TableHeader__WEBPACK_IMPORTED_MODULE_8__["default"]
  458. };
  459. Object.defineProperty(__returned__, '__isScriptSetup', {
  460. enumerable: false,
  461. value: true
  462. });
  463. return __returned__;
  464. }
  465. });
  466. /***/ }),
  467. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50":
  468. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  469. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50 ***!
  470. \*******************************************************************************************************************************************************************************************************************************************************************************/
  471. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  472. "use strict";
  473. __webpack_require__.r(__webpack_exports__);
  474. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  475. /* harmony export */ "render": () => (/* binding */ render)
  476. /* harmony export */ });
  477. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  478. var _hoisted_1 = {
  479. key: 1,
  480. "class": "p-button-label"
  481. };
  482. var _hoisted_2 = {
  483. key: 1,
  484. "class": "p-button-label"
  485. };
  486. function render(_ctx, _cache, $props, $setup, $data, $options) {
  487. return $props.inertiaLink ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["Link"], {
  488. key: 0,
  489. "class": "p-button p-component",
  490. as: "button",
  491. type: "button"
  492. }, {
  493. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  494. return [$props.icon ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", {
  495. key: 0,
  496. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-button-icon p-button-icon-left", $props.icon])
  497. }, null, 2
  498. /* CLASS */
  499. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.label ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", _hoisted_1, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 1
  500. /* TEXT */
  501. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  502. }),
  503. _: 1
  504. /* STABLE */
  505. })) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("a", {
  506. key: 1,
  507. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([$props.classButton, "p-button p-component"])
  508. }, [$props.icon ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", {
  509. key: 0,
  510. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-button-icon p-button-icon-left", $props.icon])
  511. }, null, 2
  512. /* CLASS */
  513. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.label ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", _hoisted_2, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 1
  514. /* TEXT */
  515. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 2
  516. /* CLASS */
  517. ));
  518. }
  519. /***/ }),
  520. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  521. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  522. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  523. \*******************************************************************************************************************************************************************************************************************************************************************************/
  524. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  525. "use strict";
  526. __webpack_require__.r(__webpack_exports__);
  527. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  528. /* harmony export */ "render": () => (/* binding */ render)
  529. /* harmony export */ });
  530. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  531. var _hoisted_1 = {
  532. "class": "layout-footer"
  533. };
  534. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Developed by ");
  535. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("a", {
  536. href: "https://dijitalcode.com",
  537. target: "_blank",
  538. "class": "font-medium ml-2"
  539. }, "DijitalCODE", -1
  540. /* HOISTED */
  541. );
  542. var _hoisted_4 = [_hoisted_2, _hoisted_3];
  543. function render(_ctx, _cache) {
  544. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, _hoisted_4);
  545. }
  546. /***/ }),
  547. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  548. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  549. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  550. \********************************************************************************************************************************************************************************************************************************************************************************/
  551. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  552. "use strict";
  553. __webpack_require__.r(__webpack_exports__);
  554. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  555. /* harmony export */ "render": () => (/* binding */ render)
  556. /* harmony export */ });
  557. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  558. var _hoisted_1 = {
  559. "class": "grid"
  560. };
  561. var _hoisted_2 = {
  562. "class": "col-12"
  563. };
  564. var _hoisted_3 = {
  565. key: 0
  566. };
  567. var _hoisted_4 = {
  568. key: 1
  569. };
  570. function render(_ctx, _cache, $props, $setup, $data, $options) {
  571. var _component_Message = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Message");
  572. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [_ctx.$page.props.flash.success ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  573. key: 0,
  574. severity: "success",
  575. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  576. onClose: $setup.onClose
  577. }, {
  578. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  579. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.success), 1
  580. /* TEXT */
  581. )];
  582. }),
  583. _: 1
  584. /* STABLE */
  585. }, 8
  586. /* PROPS */
  587. , ["style"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), _ctx.$page.props.flash.error || Object.keys(_ctx.$page.props.errors).length > 0 ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  588. key: 1
  589. }, [_ctx.$page.props.flash.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  590. key: 0,
  591. severity: "error",
  592. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  593. onClose: $setup.onClose
  594. }, {
  595. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  596. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.error), 1
  597. /* TEXT */
  598. )];
  599. }),
  600. _: 1
  601. /* STABLE */
  602. }, 8
  603. /* PROPS */
  604. , ["style"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  605. key: 1,
  606. severity: "error",
  607. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  608. onClose: $setup.onClose
  609. }, {
  610. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  611. return [Object.keys(_ctx.$page.props.errors).length === 1 ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_3, "Ditemukan satu error pada form")) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_4, "Ditemukan " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(Object.keys(_ctx.$page.props.errors).length) + " error pada form", 1
  612. /* TEXT */
  613. ))];
  614. }),
  615. _: 1
  616. /* STABLE */
  617. }, 8
  618. /* PROPS */
  619. , ["style"]))], 2112
  620. /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
  621. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]);
  622. }
  623. /***/ }),
  624. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0":
  625. /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\
  626. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0 ***!
  627. \***********************************************************************************************************************************************************************************************************************************************************************************/
  628. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  629. "use strict";
  630. __webpack_require__.r(__webpack_exports__);
  631. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  632. /* harmony export */ "render": () => (/* binding */ render)
  633. /* harmony export */ });
  634. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  635. var _hoisted_1 = {
  636. key: 0,
  637. "class": "p-paginator p-component flex justify-content-start"
  638. };
  639. var _hoisted_2 = {
  640. "class": "p-paginator-pages"
  641. };
  642. var _hoisted_3 = ["innerHTML"];
  643. function render(_ctx, _cache, $props, $setup, $data, $options) {
  644. return $props.links.length > 3 ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("nav", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.links, function (link, key) {
  645. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [link.url === null ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", {
  646. key: "link-".concat(key),
  647. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-paginator-page p-paginator-element p-link", {
  648. 'p-disabled': link
  649. }]),
  650. innerHTML: link.label
  651. }, null, 10
  652. /* CLASS, PROPS */
  653. , _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), link.url !== null ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["Link"], {
  654. key: "link-".concat(key),
  655. href: link.url,
  656. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([{
  657. 'p-highlight': link.active
  658. }, "p-paginator-page p-paginator-element p-link"]),
  659. innerHTML: link.label
  660. }, null, 8
  661. /* PROPS */
  662. , ["href", "class", "innerHTML"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 64
  663. /* STABLE_FRAGMENT */
  664. );
  665. }), 256
  666. /* UNKEYED_FRAGMENT */
  667. ))])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true);
  668. }
  669. /***/ }),
  670. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  671. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  672. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  673. \********************************************************************************************************************************************************************************************************************************************************************************/
  674. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  675. "use strict";
  676. __webpack_require__.r(__webpack_exports__);
  677. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  678. /* harmony export */ "render": () => (/* binding */ render)
  679. /* harmony export */ });
  680. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  681. var _hoisted_1 = {
  682. "class": "layout-menu-container"
  683. };
  684. function render(_ctx, _cache, $props, $setup, $data, $options) {
  685. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppSubSidebar"], {
  686. "class": "layout-menu",
  687. items: $props.model,
  688. root: true,
  689. onKeydown: $setup.onKeyDown,
  690. onMenuitemClick: $setup.onMenuItemClick
  691. }, null, 8
  692. /* PROPS */
  693. , ["items"])]);
  694. }
  695. /***/ }),
  696. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  697. /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\
  698. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  699. \***********************************************************************************************************************************************************************************************************************************************************************************/
  700. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  701. "use strict";
  702. __webpack_require__.r(__webpack_exports__);
  703. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  704. /* harmony export */ "render": () => (/* binding */ render)
  705. /* harmony export */ });
  706. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  707. var _hoisted_1 = {
  708. key: 0
  709. };
  710. var _hoisted_2 = ["aria-label"];
  711. var _hoisted_3 = {
  712. key: 0,
  713. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  714. };
  715. var _hoisted_4 = ["href", "target", "aria-label", "onClick"];
  716. var _hoisted_5 = {
  717. key: 0,
  718. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  719. };
  720. function render(_ctx, _cache, $props, $setup, $data, $options) {
  721. var _component_AppSubSidebar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("AppSubSidebar", true);
  722. var _component_Badge = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Badge");
  723. var _directive_ripple = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("ripple");
  724. return $props.items ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("ul", _hoisted_1, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.items, function (item, i) {
  725. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [$setup.visible(item) && !item.separator ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("li", {
  726. key: item.label || i,
  727. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([{
  728. 'layout-menuitem-category': $props.root,
  729. 'active-menuitem': $setup.activeIndex === i && !item.to && !item.disabled
  730. }]),
  731. role: "none"
  732. }, [$props.root ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  733. key: 0
  734. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  735. "class": "layout-menuitem-root-text",
  736. "aria-label": item.label
  737. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 9
  738. /* TEXT, PROPS */
  739. , _hoisted_2), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  740. items: $setup.visible(item) && item.items,
  741. onMenuitemClick: _cache[0] || (_cache[0] = function ($event) {
  742. return _ctx.$emit('menuitem-click', $event);
  743. })
  744. }, null, 8
  745. /* PROPS */
  746. , ["items"])], 64
  747. /* STABLE_FRAGMENT */
  748. )) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  749. key: 1
  750. }, [item.to ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["Link"], {
  751. key: 0,
  752. role: "menuitem",
  753. href: item.to,
  754. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  755. 'p-disabled': item.disabled,
  756. 'router-link-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to),
  757. 'router-link-exact-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to)
  758. }]),
  759. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  760. target: item.target,
  761. "aria-label": item.label,
  762. onClick: function onClick($event) {
  763. return $setup.onMenuItemClick($event, item, i);
  764. }
  765. }, {
  766. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  767. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  768. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  769. }, null, 2
  770. /* CLASS */
  771. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  772. /* TEXT */
  773. ), item.items ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("i", _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), item.badge ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Badge, {
  774. key: 1,
  775. value: item.badge
  776. }, null, 8
  777. /* PROPS */
  778. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  779. }),
  780. _: 2
  781. /* DYNAMIC */
  782. }, 1032
  783. /* PROPS, DYNAMIC_SLOTS */
  784. , ["href", "class", "style", "target", "aria-label", "onClick"])), [[_directive_ripple]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), !item.to ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("a", {
  785. key: 1,
  786. role: "menuitem",
  787. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  788. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  789. 'p-disabled': item.disabled
  790. }]),
  791. href: item.url || '#',
  792. target: item.target,
  793. "aria-label": item.label,
  794. onClick: function onClick($event) {
  795. return $setup.onMenuItemClick($event, item, i);
  796. }
  797. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  798. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  799. }, null, 2
  800. /* CLASS */
  801. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  802. /* TEXT */
  803. ), item.items ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("i", _hoisted_5)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), item.badge ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Badge, {
  804. key: 1,
  805. value: item.badge
  806. }, null, 8
  807. /* PROPS */
  808. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 14
  809. /* CLASS, STYLE, PROPS */
  810. , _hoisted_4)), [[_directive_ripple]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vue__WEBPACK_IMPORTED_MODULE_0__.Transition, {
  811. name: "layout-submenu-wrapper"
  812. }, {
  813. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  814. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  815. items: $setup.visible(item) && item.items,
  816. onMenuitemClick: _cache[1] || (_cache[1] = function ($event) {
  817. return _ctx.$emit('menuitem-click', $event);
  818. })
  819. }, null, 8
  820. /* PROPS */
  821. , ["items"]), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.activeIndex === i]])];
  822. }),
  823. _: 2
  824. /* DYNAMIC */
  825. }, 1024
  826. /* DYNAMIC_SLOTS */
  827. )], 64
  828. /* STABLE_FRAGMENT */
  829. ))], 2
  830. /* CLASS */
  831. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $setup.visible(item) && item.separator ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("li", {
  832. "class": "p-menu-separator",
  833. role: "separator",
  834. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  835. key: 'separator' + i
  836. }, null, 4
  837. /* STYLE */
  838. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 64
  839. /* STABLE_FRAGMENT */
  840. );
  841. }), 256
  842. /* UNKEYED_FRAGMENT */
  843. ))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true);
  844. }
  845. /***/ }),
  846. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  847. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  848. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  849. \*******************************************************************************************************************************************************************************************************************************************************************************/
  850. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  851. "use strict";
  852. __webpack_require__.r(__webpack_exports__);
  853. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  854. /* harmony export */ "render": () => (/* binding */ render)
  855. /* harmony export */ });
  856. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  857. var _hoisted_1 = {
  858. "class": "layout-topbar"
  859. };
  860. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("img", {
  861. alt: "Logo",
  862. src: "/images/logo.svg",
  863. "class": "md:mr-3"
  864. }, null, -1
  865. /* HOISTED */
  866. );
  867. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Parkirin", -1
  868. /* HOISTED */
  869. );
  870. var _hoisted_4 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  871. "class": "pi pi-bars"
  872. }, null, -1
  873. /* HOISTED */
  874. );
  875. var _hoisted_5 = [_hoisted_4];
  876. var _hoisted_6 = {
  877. "class": "p-link layout-topbar-menu-button layout-topbar-button"
  878. };
  879. var _hoisted_7 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  880. "class": "pi pi-ellipsis-v"
  881. }, null, -1
  882. /* HOISTED */
  883. );
  884. var _hoisted_8 = [_hoisted_7];
  885. var _hoisted_9 = {
  886. "class": "layout-topbar-menu hidden lg:flex origin-top"
  887. };
  888. var _hoisted_10 = {
  889. "class": "align-self-center"
  890. };
  891. var _hoisted_11 = {
  892. "class": "hidden lg:inline"
  893. };
  894. var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  895. "class": "pi pi-user"
  896. }, null, -1
  897. /* HOISTED */
  898. );
  899. var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Profil Saya", -1
  900. /* HOISTED */
  901. );
  902. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  903. "class": "pi pi-sign-out"
  904. }, null, -1
  905. /* HOISTED */
  906. );
  907. var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Sign Out", -1
  908. /* HOISTED */
  909. );
  910. function render(_ctx, _cache, $props, $setup, $data, $options) {
  911. var _directive_styleclass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("styleclass");
  912. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  913. href: "/",
  914. "class": "layout-topbar-logo"
  915. }, {
  916. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  917. return [_hoisted_2, _hoisted_3];
  918. }),
  919. _: 1
  920. /* STABLE */
  921. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("button", {
  922. "class": "p-link layout-menu-button layout-topbar-button",
  923. onClick: _cache[0] || (_cache[0] = function ($event) {
  924. return _ctx.$emit('menu-toggle', $event);
  925. })
  926. }, _hoisted_5), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("button", _hoisted_6, _hoisted_8)), [[_directive_styleclass, {
  927. selector: '@next',
  928. enterClass: 'hidden',
  929. enterActiveClass: 'scalein',
  930. leaveToClass: 'hidden',
  931. leaveActiveClass: 'fadeout',
  932. hideOnOutsideClick: true
  933. }]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("ul", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.auth.user.name), 1
  934. /* TEXT */
  935. )]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  936. href: _ctx.route('users.show', _ctx.$page.props.auth.user.id),
  937. "class": "p-link layout-topbar-button"
  938. }, {
  939. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  940. return [_hoisted_12, _hoisted_13];
  941. }),
  942. _: 1
  943. /* STABLE */
  944. }, 8
  945. /* PROPS */
  946. , ["href"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  947. href: _ctx.route('logout'),
  948. as: "button",
  949. method: "post",
  950. "class": "p-link layout-topbar-button"
  951. }, {
  952. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  953. return [_hoisted_14, _hoisted_15];
  954. }),
  955. _: 1
  956. /* STABLE */
  957. }, 8
  958. /* PROPS */
  959. , ["href"])])])]);
  960. }
  961. /***/ }),
  962. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  963. /*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  964. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  965. \****************************************************************************************************************************************************************************************************************************************************************************/
  966. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  967. "use strict";
  968. __webpack_require__.r(__webpack_exports__);
  969. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  970. /* harmony export */ "render": () => (/* binding */ render)
  971. /* harmony export */ });
  972. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  973. var _hoisted_1 = {
  974. "class": "layout-main-container"
  975. };
  976. var _hoisted_2 = {
  977. "class": "layout-main"
  978. };
  979. var _hoisted_3 = {
  980. key: 0,
  981. "class": "layout-mask p-component-overlay"
  982. };
  983. function render(_ctx, _cache, $props, $setup, $data, $options) {
  984. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", {
  985. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)($setup.containerClass),
  986. onClick: $setup.onWrapperClick
  987. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppTopBar"], {
  988. onMenuToggle: $setup.onMenuToggle
  989. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  990. "class": "layout-sidebar",
  991. onClick: $setup.onSidebarClick
  992. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppSidebar"], {
  993. model: $setup.menu[_ctx.$page.props.auth.user.role_id],
  994. onMenuitemClick: $setup.onMenuItemClick
  995. }, null, 8
  996. /* PROPS */
  997. , ["model"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppMessage"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, "default")]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppFooter"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vue__WEBPACK_IMPORTED_MODULE_0__.Transition, {
  998. name: "layout-mask"
  999. }, {
  1000. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1001. return [$setup.mobileMenuActive ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  1002. }),
  1003. _: 1
  1004. /* STABLE */
  1005. })], 2
  1006. /* CLASS */
  1007. );
  1008. }
  1009. /***/ }),
  1010. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421":
  1011. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  1012. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421 ***!
  1013. \********************************************************************************************************************************************************************************************************************************************************************************/
  1014. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1015. "use strict";
  1016. __webpack_require__.r(__webpack_exports__);
  1017. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1018. /* harmony export */ "render": () => (/* binding */ render)
  1019. /* harmony export */ });
  1020. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1021. var _hoisted_1 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h1", null, "Laporan Mutasi", -1
  1022. /* HOISTED */
  1023. );
  1024. var _hoisted_2 = {
  1025. "class": "grid"
  1026. };
  1027. var _hoisted_3 = {
  1028. "class": "col-12 md:col-8"
  1029. };
  1030. var _hoisted_4 = {
  1031. "class": "grid"
  1032. };
  1033. var _hoisted_5 = {
  1034. "class": "col-12 md:col-4"
  1035. };
  1036. var _hoisted_6 = {
  1037. "class": "col-auto mt-2 ml-2"
  1038. };
  1039. var _hoisted_7 = {
  1040. "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
  1041. };
  1042. var _hoisted_8 = {
  1043. key: 0,
  1044. "class": "grid mt-5 ml-1"
  1045. };
  1046. var _hoisted_9 = {
  1047. "class": "col-auto mr-7"
  1048. };
  1049. var _hoisted_10 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
  1050. "class": "text-base"
  1051. }, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1052. "class": "pi pi-wallet"
  1053. }), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Pendapatan")], -1
  1054. /* HOISTED */
  1055. );
  1056. var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
  1057. /* HOISTED */
  1058. );
  1059. var _hoisted_12 = {
  1060. "class": "text-xl font-bold"
  1061. };
  1062. var _hoisted_13 = {
  1063. "class": "col-auto mr-7"
  1064. };
  1065. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
  1066. "class": "text-base"
  1067. }, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1068. "class": "pi pi-wallet"
  1069. }), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Pengeluaran")], -1
  1070. /* HOISTED */
  1071. );
  1072. var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
  1073. /* HOISTED */
  1074. );
  1075. var _hoisted_16 = {
  1076. "class": "text-xl font-bold"
  1077. };
  1078. var _hoisted_17 = {
  1079. "class": "col-auto"
  1080. };
  1081. var _hoisted_18 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
  1082. "class": "text-base"
  1083. }, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1084. "class": "pi pi-wallet"
  1085. }), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Total Pendapatan ")], -1
  1086. /* HOISTED */
  1087. );
  1088. var _hoisted_19 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
  1089. /* HOISTED */
  1090. );
  1091. var _hoisted_20 = {
  1092. "class": "text-xl font-bold"
  1093. };
  1094. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1095. var _component_Calendar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Calendar");
  1096. var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
  1097. var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
  1098. var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
  1099. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppLayout"], null, {
  1100. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1101. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Head"], {
  1102. title: "Laporan Mutasi"
  1103. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
  1104. "responsive-layout": "scroll",
  1105. "column-resize-mode": "expand",
  1106. value: $props.mutations.details.data,
  1107. "row-hover": true,
  1108. "striped-rows": true
  1109. }, {
  1110. header: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1111. return [_hoisted_1, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_4, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_5, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Calendar, {
  1112. "class": "w-full",
  1113. modelValue: $setup.filterForm.dates,
  1114. "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
  1115. return $setup.filterForm.dates = $event;
  1116. }),
  1117. "selection-mode": "range",
  1118. placeholder: "filter waktu...",
  1119. "date-format": "dd/mm/yy",
  1120. "manual-input": false
  1121. }, null, 8
  1122. /* PROPS */
  1123. , ["modelValue"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1124. label: "reset",
  1125. "class": "p-button-link",
  1126. onClick: $setup.filterReset
  1127. })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [$props.mutations.details.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
  1128. key: 0,
  1129. label: "Export excel",
  1130. "class-button": "p-button-outlined md:w-16rem",
  1131. icon: "pi pi-file-excel",
  1132. "inertia-link": false,
  1133. href: $setup.exportExcelLink
  1134. }, null, 8
  1135. /* PROPS */
  1136. , ["href"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), $props.mutations.totalAmount ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_10, _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_12, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalIncome), 1
  1137. /* TEXT */
  1138. )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_13, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_14, _hoisted_15, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_16, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalExpense), 1
  1139. /* TEXT */
  1140. )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_17, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_18, _hoisted_19, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_20, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalAmount), 1
  1141. /* TEXT */
  1142. )])])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  1143. }),
  1144. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1145. return [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($setup.TableHeader, function (tableHeader) {
  1146. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Column, {
  1147. field: tableHeader.field,
  1148. header: tableHeader.header,
  1149. key: tableHeader.field
  1150. }, null, 8
  1151. /* PROPS */
  1152. , ["field", "header"]);
  1153. }), 128
  1154. /* KEYED_FRAGMENT */
  1155. )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
  1156. body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
  1157. var data = _ref.data;
  1158. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButton"], {
  1159. icon: "pi pi-link",
  1160. "class": "p-button-text p-button-icon-only p-button-rounded p-button-text",
  1161. href: $setup.linkReference(data)
  1162. }, null, 8
  1163. /* PROPS */
  1164. , ["href"])];
  1165. }),
  1166. _: 1
  1167. /* STABLE */
  1168. })];
  1169. }),
  1170. _: 1
  1171. /* STABLE */
  1172. }, 8
  1173. /* PROPS */
  1174. , ["value"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppPagination"], {
  1175. links: $props.mutations.details.links
  1176. }, null, 8
  1177. /* PROPS */
  1178. , ["links"])];
  1179. }),
  1180. _: 1
  1181. /* STABLE */
  1182. });
  1183. }
  1184. /***/ }),
  1185. /***/ "./resources/js/pages/mutation/TableHeader.js":
  1186. /*!****************************************************!*\
  1187. !*** ./resources/js/pages/mutation/TableHeader.js ***!
  1188. \****************************************************/
  1189. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1190. "use strict";
  1191. __webpack_require__.r(__webpack_exports__);
  1192. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1193. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  1194. /* harmony export */ });
  1195. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([{
  1196. field: 'createdAt',
  1197. header: 'Tanggal'
  1198. }, {
  1199. field: 'type',
  1200. header: 'Tipe'
  1201. }, {
  1202. field: 'amount',
  1203. header: 'Nilai'
  1204. }]);
  1205. /***/ }),
  1206. /***/ "./resources/js/utils/menu.js":
  1207. /*!************************************!*\
  1208. !*** ./resources/js/utils/menu.js ***!
  1209. \************************************/
  1210. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1211. "use strict";
  1212. __webpack_require__.r(__webpack_exports__);
  1213. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1214. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  1215. /* harmony export */ });
  1216. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  1217. // Admin
  1218. 1: [{
  1219. label: 'Home',
  1220. items: [{
  1221. label: 'Dashboard',
  1222. icon: 'pi pi-home',
  1223. to: '/dashboards',
  1224. component: 'home/Index'
  1225. }]
  1226. }, {
  1227. label: 'Master',
  1228. items: [{
  1229. label: 'User',
  1230. icon: 'pi pi-user',
  1231. to: '/users',
  1232. component: 'user/Index'
  1233. }]
  1234. }],
  1235. // Supervisor
  1236. 2: [{
  1237. label: 'Home',
  1238. items: [{
  1239. label: 'Dashboard',
  1240. icon: 'pi pi-home',
  1241. to: '/dashboards',
  1242. component: 'home/Index'
  1243. }]
  1244. }, {
  1245. label: 'Menu',
  1246. items: [{
  1247. label: 'Pengeluaran',
  1248. icon: 'pi pi-wallet',
  1249. to: '/expenses',
  1250. component: 'expense/Index'
  1251. }, {
  1252. label: 'Laporan',
  1253. icon: 'pi pi-book',
  1254. items: [{
  1255. label: 'Mutasi',
  1256. icon: 'pi pi-circle',
  1257. to: '/reports/mutations',
  1258. component: 'mutation/Report'
  1259. }]
  1260. }]
  1261. }, {
  1262. label: 'Master',
  1263. items: [{
  1264. label: 'Jenis Kendaraan',
  1265. icon: 'pi pi-car',
  1266. to: '/type-vehicles',
  1267. component: 'typevehicle/Index'
  1268. }, {
  1269. label: 'Jenis Member',
  1270. icon: 'pi pi-id-card',
  1271. to: '/type-members',
  1272. component: 'typemember/Index'
  1273. }]
  1274. }],
  1275. // Operator
  1276. 3: [{
  1277. label: 'Home',
  1278. items: [{
  1279. label: 'Dashboard',
  1280. icon: 'pi pi-home',
  1281. to: '/dashboards',
  1282. component: 'home/Index'
  1283. }]
  1284. }, {
  1285. label: 'Menu',
  1286. items: [{
  1287. label: 'Pengeluaran',
  1288. icon: 'pi pi-wallet',
  1289. to: '/expenses',
  1290. component: 'expense/Index'
  1291. }, {
  1292. label: 'Member',
  1293. icon: 'pi pi-id-card',
  1294. to: '/members',
  1295. component: 'member/Index'
  1296. }, {
  1297. label: 'Top Up',
  1298. icon: 'pi pi-wallet',
  1299. to: '/top-ups',
  1300. component: 'topup/Index'
  1301. }]
  1302. }]
  1303. });
  1304. /***/ }),
  1305. /***/ "./node_modules/dayjs/dayjs.min.js":
  1306. /*!*****************************************!*\
  1307. !*** ./node_modules/dayjs/dayjs.min.js ***!
  1308. \*****************************************/
  1309. /***/ (function(module) {
  1310. !function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},v="en",D={};D[v]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return v;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(v=i),i||!r&&v},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var v=this.$locale().weekStart||0,D=(y<v?y+7:y)-v;return $(r?m-D:m+(6-D),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,v=O.m(this,M);return v=(l={},l[c]=v/12,l[f]=v,l[h]=v/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?v:O.a(v)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[v],w.Ls=D,w.p={},w}));
  1311. /***/ }),
  1312. /***/ "./node_modules/lodash/lodash.js":
  1313. /*!***************************************!*\
  1314. !*** ./node_modules/lodash/lodash.js ***!
  1315. \***************************************/
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. /* module decorator */ module = __webpack_require__.nmd(module);
  1318. var __WEBPACK_AMD_DEFINE_RESULT__;/**
  1319. * @license
  1320. * Lodash <https://lodash.com/>
  1321. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  1322. * Released under MIT license <https://lodash.com/license>
  1323. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1324. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1325. */
  1326. ;(function() {
  1327. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  1328. var undefined;
  1329. /** Used as the semantic version number. */
  1330. var VERSION = '4.17.21';
  1331. /** Used as the size to enable large array optimizations. */
  1332. var LARGE_ARRAY_SIZE = 200;
  1333. /** Error message constants. */
  1334. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  1335. FUNC_ERROR_TEXT = 'Expected a function',
  1336. INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
  1337. /** Used to stand-in for `undefined` hash values. */
  1338. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1339. /** Used as the maximum memoize cache size. */
  1340. var MAX_MEMOIZE_SIZE = 500;
  1341. /** Used as the internal argument placeholder. */
  1342. var PLACEHOLDER = '__lodash_placeholder__';
  1343. /** Used to compose bitmasks for cloning. */
  1344. var CLONE_DEEP_FLAG = 1,
  1345. CLONE_FLAT_FLAG = 2,
  1346. CLONE_SYMBOLS_FLAG = 4;
  1347. /** Used to compose bitmasks for value comparisons. */
  1348. var COMPARE_PARTIAL_FLAG = 1,
  1349. COMPARE_UNORDERED_FLAG = 2;
  1350. /** Used to compose bitmasks for function metadata. */
  1351. var WRAP_BIND_FLAG = 1,
  1352. WRAP_BIND_KEY_FLAG = 2,
  1353. WRAP_CURRY_BOUND_FLAG = 4,
  1354. WRAP_CURRY_FLAG = 8,
  1355. WRAP_CURRY_RIGHT_FLAG = 16,
  1356. WRAP_PARTIAL_FLAG = 32,
  1357. WRAP_PARTIAL_RIGHT_FLAG = 64,
  1358. WRAP_ARY_FLAG = 128,
  1359. WRAP_REARG_FLAG = 256,
  1360. WRAP_FLIP_FLAG = 512;
  1361. /** Used as default options for `_.truncate`. */
  1362. var DEFAULT_TRUNC_LENGTH = 30,
  1363. DEFAULT_TRUNC_OMISSION = '...';
  1364. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  1365. var HOT_COUNT = 800,
  1366. HOT_SPAN = 16;
  1367. /** Used to indicate the type of lazy iteratees. */
  1368. var LAZY_FILTER_FLAG = 1,
  1369. LAZY_MAP_FLAG = 2,
  1370. LAZY_WHILE_FLAG = 3;
  1371. /** Used as references for various `Number` constants. */
  1372. var INFINITY = 1 / 0,
  1373. MAX_SAFE_INTEGER = 9007199254740991,
  1374. MAX_INTEGER = 1.7976931348623157e+308,
  1375. NAN = 0 / 0;
  1376. /** Used as references for the maximum length and index of an array. */
  1377. var MAX_ARRAY_LENGTH = 4294967295,
  1378. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  1379. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  1380. /** Used to associate wrap methods with their bit flags. */
  1381. var wrapFlags = [
  1382. ['ary', WRAP_ARY_FLAG],
  1383. ['bind', WRAP_BIND_FLAG],
  1384. ['bindKey', WRAP_BIND_KEY_FLAG],
  1385. ['curry', WRAP_CURRY_FLAG],
  1386. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  1387. ['flip', WRAP_FLIP_FLAG],
  1388. ['partial', WRAP_PARTIAL_FLAG],
  1389. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  1390. ['rearg', WRAP_REARG_FLAG]
  1391. ];
  1392. /** `Object#toString` result references. */
  1393. var argsTag = '[object Arguments]',
  1394. arrayTag = '[object Array]',
  1395. asyncTag = '[object AsyncFunction]',
  1396. boolTag = '[object Boolean]',
  1397. dateTag = '[object Date]',
  1398. domExcTag = '[object DOMException]',
  1399. errorTag = '[object Error]',
  1400. funcTag = '[object Function]',
  1401. genTag = '[object GeneratorFunction]',
  1402. mapTag = '[object Map]',
  1403. numberTag = '[object Number]',
  1404. nullTag = '[object Null]',
  1405. objectTag = '[object Object]',
  1406. promiseTag = '[object Promise]',
  1407. proxyTag = '[object Proxy]',
  1408. regexpTag = '[object RegExp]',
  1409. setTag = '[object Set]',
  1410. stringTag = '[object String]',
  1411. symbolTag = '[object Symbol]',
  1412. undefinedTag = '[object Undefined]',
  1413. weakMapTag = '[object WeakMap]',
  1414. weakSetTag = '[object WeakSet]';
  1415. var arrayBufferTag = '[object ArrayBuffer]',
  1416. dataViewTag = '[object DataView]',
  1417. float32Tag = '[object Float32Array]',
  1418. float64Tag = '[object Float64Array]',
  1419. int8Tag = '[object Int8Array]',
  1420. int16Tag = '[object Int16Array]',
  1421. int32Tag = '[object Int32Array]',
  1422. uint8Tag = '[object Uint8Array]',
  1423. uint8ClampedTag = '[object Uint8ClampedArray]',
  1424. uint16Tag = '[object Uint16Array]',
  1425. uint32Tag = '[object Uint32Array]';
  1426. /** Used to match empty string literals in compiled template source. */
  1427. var reEmptyStringLeading = /\b__p \+= '';/g,
  1428. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1429. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1430. /** Used to match HTML entities and HTML characters. */
  1431. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1432. reUnescapedHtml = /[&<>"']/g,
  1433. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1434. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1435. /** Used to match template delimiters. */
  1436. var reEscape = /<%-([\s\S]+?)%>/g,
  1437. reEvaluate = /<%([\s\S]+?)%>/g,
  1438. reInterpolate = /<%=([\s\S]+?)%>/g;
  1439. /** Used to match property names within property paths. */
  1440. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1441. reIsPlainProp = /^\w*$/,
  1442. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1443. /**
  1444. * Used to match `RegExp`
  1445. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1446. */
  1447. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1448. reHasRegExpChar = RegExp(reRegExpChar.source);
  1449. /** Used to match leading whitespace. */
  1450. var reTrimStart = /^\s+/;
  1451. /** Used to match a single whitespace character. */
  1452. var reWhitespace = /\s/;
  1453. /** Used to match wrap detail comments. */
  1454. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1455. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1456. reSplitDetails = /,? & /;
  1457. /** Used to match words composed of alphanumeric characters. */
  1458. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1459. /**
  1460. * Used to validate the `validate` option in `_.template` variable.
  1461. *
  1462. * Forbids characters which could potentially change the meaning of the function argument definition:
  1463. * - "()," (modification of function parameters)
  1464. * - "=" (default value)
  1465. * - "[]{}" (destructuring of function parameters)
  1466. * - "/" (beginning of a comment)
  1467. * - whitespace
  1468. */
  1469. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  1470. /** Used to match backslashes in property paths. */
  1471. var reEscapeChar = /\\(\\)?/g;
  1472. /**
  1473. * Used to match
  1474. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1475. */
  1476. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1477. /** Used to match `RegExp` flags from their coerced string values. */
  1478. var reFlags = /\w*$/;
  1479. /** Used to detect bad signed hexadecimal string values. */
  1480. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1481. /** Used to detect binary string values. */
  1482. var reIsBinary = /^0b[01]+$/i;
  1483. /** Used to detect host constructors (Safari). */
  1484. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1485. /** Used to detect octal string values. */
  1486. var reIsOctal = /^0o[0-7]+$/i;
  1487. /** Used to detect unsigned integer values. */
  1488. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1489. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1490. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1491. /** Used to ensure capturing order of template delimiters. */
  1492. var reNoMatch = /($^)/;
  1493. /** Used to match unescaped characters in compiled string literals. */
  1494. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1495. /** Used to compose unicode character classes. */
  1496. var rsAstralRange = '\\ud800-\\udfff',
  1497. rsComboMarksRange = '\\u0300-\\u036f',
  1498. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1499. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1500. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1501. rsDingbatRange = '\\u2700-\\u27bf',
  1502. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1503. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1504. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1505. rsPunctuationRange = '\\u2000-\\u206f',
  1506. 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',
  1507. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1508. rsVarRange = '\\ufe0e\\ufe0f',
  1509. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1510. /** Used to compose unicode capture groups. */
  1511. var rsApos = "['\u2019]",
  1512. rsAstral = '[' + rsAstralRange + ']',
  1513. rsBreak = '[' + rsBreakRange + ']',
  1514. rsCombo = '[' + rsComboRange + ']',
  1515. rsDigits = '\\d+',
  1516. rsDingbat = '[' + rsDingbatRange + ']',
  1517. rsLower = '[' + rsLowerRange + ']',
  1518. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1519. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1520. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1521. rsNonAstral = '[^' + rsAstralRange + ']',
  1522. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1523. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1524. rsUpper = '[' + rsUpperRange + ']',
  1525. rsZWJ = '\\u200d';
  1526. /** Used to compose unicode regexes. */
  1527. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1528. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1529. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1530. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1531. reOptMod = rsModifier + '?',
  1532. rsOptVar = '[' + rsVarRange + ']?',
  1533. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1534. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1535. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1536. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1537. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1538. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1539. /** Used to match apostrophes. */
  1540. var reApos = RegExp(rsApos, 'g');
  1541. /**
  1542. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1543. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1544. */
  1545. var reComboMark = RegExp(rsCombo, 'g');
  1546. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1547. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1548. /** Used to match complex or compound words. */
  1549. var reUnicodeWord = RegExp([
  1550. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1551. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1552. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1553. rsUpper + '+' + rsOptContrUpper,
  1554. rsOrdUpper,
  1555. rsOrdLower,
  1556. rsDigits,
  1557. rsEmoji
  1558. ].join('|'), 'g');
  1559. /** 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/). */
  1560. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1561. /** Used to detect strings that need a more robust regexp to match words. */
  1562. 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 ]/;
  1563. /** Used to assign default `context` object properties. */
  1564. var contextProps = [
  1565. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1566. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1567. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1568. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1569. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1570. ];
  1571. /** Used to make template sourceURLs easier to identify. */
  1572. var templateCounter = -1;
  1573. /** Used to identify `toStringTag` values of typed arrays. */
  1574. var typedArrayTags = {};
  1575. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1576. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1577. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1578. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1579. typedArrayTags[uint32Tag] = true;
  1580. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1581. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1582. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1583. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1584. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1585. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1586. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1587. typedArrayTags[weakMapTag] = false;
  1588. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1589. var cloneableTags = {};
  1590. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1591. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1592. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1593. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1594. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1595. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1596. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1597. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1598. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1599. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1600. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1601. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1602. cloneableTags[weakMapTag] = false;
  1603. /** Used to map Latin Unicode letters to basic Latin letters. */
  1604. var deburredLetters = {
  1605. // Latin-1 Supplement block.
  1606. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1607. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1608. '\xc7': 'C', '\xe7': 'c',
  1609. '\xd0': 'D', '\xf0': 'd',
  1610. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1611. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1612. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1613. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1614. '\xd1': 'N', '\xf1': 'n',
  1615. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1616. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1617. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1618. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1619. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1620. '\xc6': 'Ae', '\xe6': 'ae',
  1621. '\xde': 'Th', '\xfe': 'th',
  1622. '\xdf': 'ss',
  1623. // Latin Extended-A block.
  1624. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1625. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1626. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1627. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1628. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1629. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1630. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1631. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1632. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1633. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1634. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1635. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1636. '\u0134': 'J', '\u0135': 'j',
  1637. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1638. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1639. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1640. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1641. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1642. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1643. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1644. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1645. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1646. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1647. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1648. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1649. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1650. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1651. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1652. '\u0174': 'W', '\u0175': 'w',
  1653. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1654. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1655. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1656. '\u0132': 'IJ', '\u0133': 'ij',
  1657. '\u0152': 'Oe', '\u0153': 'oe',
  1658. '\u0149': "'n", '\u017f': 's'
  1659. };
  1660. /** Used to map characters to HTML entities. */
  1661. var htmlEscapes = {
  1662. '&': '&amp;',
  1663. '<': '&lt;',
  1664. '>': '&gt;',
  1665. '"': '&quot;',
  1666. "'": '&#39;'
  1667. };
  1668. /** Used to map HTML entities to characters. */
  1669. var htmlUnescapes = {
  1670. '&amp;': '&',
  1671. '&lt;': '<',
  1672. '&gt;': '>',
  1673. '&quot;': '"',
  1674. '&#39;': "'"
  1675. };
  1676. /** Used to escape characters for inclusion in compiled string literals. */
  1677. var stringEscapes = {
  1678. '\\': '\\',
  1679. "'": "'",
  1680. '\n': 'n',
  1681. '\r': 'r',
  1682. '\u2028': 'u2028',
  1683. '\u2029': 'u2029'
  1684. };
  1685. /** Built-in method references without a dependency on `root`. */
  1686. var freeParseFloat = parseFloat,
  1687. freeParseInt = parseInt;
  1688. /** Detect free variable `global` from Node.js. */
  1689. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  1690. /** Detect free variable `self`. */
  1691. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1692. /** Used as a reference to the global object. */
  1693. var root = freeGlobal || freeSelf || Function('return this')();
  1694. /** Detect free variable `exports`. */
  1695. var freeExports = true && exports && !exports.nodeType && exports;
  1696. /** Detect free variable `module`. */
  1697. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  1698. /** Detect the popular CommonJS extension `module.exports`. */
  1699. var moduleExports = freeModule && freeModule.exports === freeExports;
  1700. /** Detect free variable `process` from Node.js. */
  1701. var freeProcess = moduleExports && freeGlobal.process;
  1702. /** Used to access faster Node.js helpers. */
  1703. var nodeUtil = (function() {
  1704. try {
  1705. // Use `util.types` for Node.js 10+.
  1706. var types = freeModule && freeModule.require && freeModule.require('util').types;
  1707. if (types) {
  1708. return types;
  1709. }
  1710. // Legacy `process.binding('util')` for Node.js < 10.
  1711. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1712. } catch (e) {}
  1713. }());
  1714. /* Node.js helper references. */
  1715. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1716. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1717. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1718. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1719. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1720. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1721. /*--------------------------------------------------------------------------*/
  1722. /**
  1723. * A faster alternative to `Function#apply`, this function invokes `func`
  1724. * with the `this` binding of `thisArg` and the arguments of `args`.
  1725. *
  1726. * @private
  1727. * @param {Function} func The function to invoke.
  1728. * @param {*} thisArg The `this` binding of `func`.
  1729. * @param {Array} args The arguments to invoke `func` with.
  1730. * @returns {*} Returns the result of `func`.
  1731. */
  1732. function apply(func, thisArg, args) {
  1733. switch (args.length) {
  1734. case 0: return func.call(thisArg);
  1735. case 1: return func.call(thisArg, args[0]);
  1736. case 2: return func.call(thisArg, args[0], args[1]);
  1737. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1738. }
  1739. return func.apply(thisArg, args);
  1740. }
  1741. /**
  1742. * A specialized version of `baseAggregator` for arrays.
  1743. *
  1744. * @private
  1745. * @param {Array} [array] The array to iterate over.
  1746. * @param {Function} setter The function to set `accumulator` values.
  1747. * @param {Function} iteratee The iteratee to transform keys.
  1748. * @param {Object} accumulator The initial aggregated object.
  1749. * @returns {Function} Returns `accumulator`.
  1750. */
  1751. function arrayAggregator(array, setter, iteratee, accumulator) {
  1752. var index = -1,
  1753. length = array == null ? 0 : array.length;
  1754. while (++index < length) {
  1755. var value = array[index];
  1756. setter(accumulator, value, iteratee(value), array);
  1757. }
  1758. return accumulator;
  1759. }
  1760. /**
  1761. * A specialized version of `_.forEach` for arrays without support for
  1762. * iteratee shorthands.
  1763. *
  1764. * @private
  1765. * @param {Array} [array] The array to iterate over.
  1766. * @param {Function} iteratee The function invoked per iteration.
  1767. * @returns {Array} Returns `array`.
  1768. */
  1769. function arrayEach(array, iteratee) {
  1770. var index = -1,
  1771. length = array == null ? 0 : array.length;
  1772. while (++index < length) {
  1773. if (iteratee(array[index], index, array) === false) {
  1774. break;
  1775. }
  1776. }
  1777. return array;
  1778. }
  1779. /**
  1780. * A specialized version of `_.forEachRight` for arrays without support for
  1781. * iteratee shorthands.
  1782. *
  1783. * @private
  1784. * @param {Array} [array] The array to iterate over.
  1785. * @param {Function} iteratee The function invoked per iteration.
  1786. * @returns {Array} Returns `array`.
  1787. */
  1788. function arrayEachRight(array, iteratee) {
  1789. var length = array == null ? 0 : array.length;
  1790. while (length--) {
  1791. if (iteratee(array[length], length, array) === false) {
  1792. break;
  1793. }
  1794. }
  1795. return array;
  1796. }
  1797. /**
  1798. * A specialized version of `_.every` for arrays without support for
  1799. * iteratee shorthands.
  1800. *
  1801. * @private
  1802. * @param {Array} [array] The array to iterate over.
  1803. * @param {Function} predicate The function invoked per iteration.
  1804. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1805. * else `false`.
  1806. */
  1807. function arrayEvery(array, predicate) {
  1808. var index = -1,
  1809. length = array == null ? 0 : array.length;
  1810. while (++index < length) {
  1811. if (!predicate(array[index], index, array)) {
  1812. return false;
  1813. }
  1814. }
  1815. return true;
  1816. }
  1817. /**
  1818. * A specialized version of `_.filter` for arrays without support for
  1819. * iteratee shorthands.
  1820. *
  1821. * @private
  1822. * @param {Array} [array] The array to iterate over.
  1823. * @param {Function} predicate The function invoked per iteration.
  1824. * @returns {Array} Returns the new filtered array.
  1825. */
  1826. function arrayFilter(array, predicate) {
  1827. var index = -1,
  1828. length = array == null ? 0 : array.length,
  1829. resIndex = 0,
  1830. result = [];
  1831. while (++index < length) {
  1832. var value = array[index];
  1833. if (predicate(value, index, array)) {
  1834. result[resIndex++] = value;
  1835. }
  1836. }
  1837. return result;
  1838. }
  1839. /**
  1840. * A specialized version of `_.includes` for arrays without support for
  1841. * specifying an index to search from.
  1842. *
  1843. * @private
  1844. * @param {Array} [array] The array to inspect.
  1845. * @param {*} target The value to search for.
  1846. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1847. */
  1848. function arrayIncludes(array, value) {
  1849. var length = array == null ? 0 : array.length;
  1850. return !!length && baseIndexOf(array, value, 0) > -1;
  1851. }
  1852. /**
  1853. * This function is like `arrayIncludes` except that it accepts a comparator.
  1854. *
  1855. * @private
  1856. * @param {Array} [array] The array to inspect.
  1857. * @param {*} target The value to search for.
  1858. * @param {Function} comparator The comparator invoked per element.
  1859. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1860. */
  1861. function arrayIncludesWith(array, value, comparator) {
  1862. var index = -1,
  1863. length = array == null ? 0 : array.length;
  1864. while (++index < length) {
  1865. if (comparator(value, array[index])) {
  1866. return true;
  1867. }
  1868. }
  1869. return false;
  1870. }
  1871. /**
  1872. * A specialized version of `_.map` for arrays without support for iteratee
  1873. * shorthands.
  1874. *
  1875. * @private
  1876. * @param {Array} [array] The array to iterate over.
  1877. * @param {Function} iteratee The function invoked per iteration.
  1878. * @returns {Array} Returns the new mapped array.
  1879. */
  1880. function arrayMap(array, iteratee) {
  1881. var index = -1,
  1882. length = array == null ? 0 : array.length,
  1883. result = Array(length);
  1884. while (++index < length) {
  1885. result[index] = iteratee(array[index], index, array);
  1886. }
  1887. return result;
  1888. }
  1889. /**
  1890. * Appends the elements of `values` to `array`.
  1891. *
  1892. * @private
  1893. * @param {Array} array The array to modify.
  1894. * @param {Array} values The values to append.
  1895. * @returns {Array} Returns `array`.
  1896. */
  1897. function arrayPush(array, values) {
  1898. var index = -1,
  1899. length = values.length,
  1900. offset = array.length;
  1901. while (++index < length) {
  1902. array[offset + index] = values[index];
  1903. }
  1904. return array;
  1905. }
  1906. /**
  1907. * A specialized version of `_.reduce` for arrays without support for
  1908. * iteratee shorthands.
  1909. *
  1910. * @private
  1911. * @param {Array} [array] The array to iterate over.
  1912. * @param {Function} iteratee The function invoked per iteration.
  1913. * @param {*} [accumulator] The initial value.
  1914. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1915. * the initial value.
  1916. * @returns {*} Returns the accumulated value.
  1917. */
  1918. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1919. var index = -1,
  1920. length = array == null ? 0 : array.length;
  1921. if (initAccum && length) {
  1922. accumulator = array[++index];
  1923. }
  1924. while (++index < length) {
  1925. accumulator = iteratee(accumulator, array[index], index, array);
  1926. }
  1927. return accumulator;
  1928. }
  1929. /**
  1930. * A specialized version of `_.reduceRight` for arrays without support for
  1931. * iteratee shorthands.
  1932. *
  1933. * @private
  1934. * @param {Array} [array] The array to iterate over.
  1935. * @param {Function} iteratee The function invoked per iteration.
  1936. * @param {*} [accumulator] The initial value.
  1937. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1938. * the initial value.
  1939. * @returns {*} Returns the accumulated value.
  1940. */
  1941. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1942. var length = array == null ? 0 : array.length;
  1943. if (initAccum && length) {
  1944. accumulator = array[--length];
  1945. }
  1946. while (length--) {
  1947. accumulator = iteratee(accumulator, array[length], length, array);
  1948. }
  1949. return accumulator;
  1950. }
  1951. /**
  1952. * A specialized version of `_.some` for arrays without support for iteratee
  1953. * shorthands.
  1954. *
  1955. * @private
  1956. * @param {Array} [array] The array to iterate over.
  1957. * @param {Function} predicate The function invoked per iteration.
  1958. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1959. * else `false`.
  1960. */
  1961. function arraySome(array, predicate) {
  1962. var index = -1,
  1963. length = array == null ? 0 : array.length;
  1964. while (++index < length) {
  1965. if (predicate(array[index], index, array)) {
  1966. return true;
  1967. }
  1968. }
  1969. return false;
  1970. }
  1971. /**
  1972. * Gets the size of an ASCII `string`.
  1973. *
  1974. * @private
  1975. * @param {string} string The string inspect.
  1976. * @returns {number} Returns the string size.
  1977. */
  1978. var asciiSize = baseProperty('length');
  1979. /**
  1980. * Converts an ASCII `string` to an array.
  1981. *
  1982. * @private
  1983. * @param {string} string The string to convert.
  1984. * @returns {Array} Returns the converted array.
  1985. */
  1986. function asciiToArray(string) {
  1987. return string.split('');
  1988. }
  1989. /**
  1990. * Splits an ASCII `string` into an array of its words.
  1991. *
  1992. * @private
  1993. * @param {string} The string to inspect.
  1994. * @returns {Array} Returns the words of `string`.
  1995. */
  1996. function asciiWords(string) {
  1997. return string.match(reAsciiWord) || [];
  1998. }
  1999. /**
  2000. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  2001. * without support for iteratee shorthands, which iterates over `collection`
  2002. * using `eachFunc`.
  2003. *
  2004. * @private
  2005. * @param {Array|Object} collection The collection to inspect.
  2006. * @param {Function} predicate The function invoked per iteration.
  2007. * @param {Function} eachFunc The function to iterate over `collection`.
  2008. * @returns {*} Returns the found element or its key, else `undefined`.
  2009. */
  2010. function baseFindKey(collection, predicate, eachFunc) {
  2011. var result;
  2012. eachFunc(collection, function(value, key, collection) {
  2013. if (predicate(value, key, collection)) {
  2014. result = key;
  2015. return false;
  2016. }
  2017. });
  2018. return result;
  2019. }
  2020. /**
  2021. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  2022. * support for iteratee shorthands.
  2023. *
  2024. * @private
  2025. * @param {Array} array The array to inspect.
  2026. * @param {Function} predicate The function invoked per iteration.
  2027. * @param {number} fromIndex The index to search from.
  2028. * @param {boolean} [fromRight] Specify iterating from right to left.
  2029. * @returns {number} Returns the index of the matched value, else `-1`.
  2030. */
  2031. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  2032. var length = array.length,
  2033. index = fromIndex + (fromRight ? 1 : -1);
  2034. while ((fromRight ? index-- : ++index < length)) {
  2035. if (predicate(array[index], index, array)) {
  2036. return index;
  2037. }
  2038. }
  2039. return -1;
  2040. }
  2041. /**
  2042. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  2043. *
  2044. * @private
  2045. * @param {Array} array The array to inspect.
  2046. * @param {*} value The value to search for.
  2047. * @param {number} fromIndex The index to search from.
  2048. * @returns {number} Returns the index of the matched value, else `-1`.
  2049. */
  2050. function baseIndexOf(array, value, fromIndex) {
  2051. return value === value
  2052. ? strictIndexOf(array, value, fromIndex)
  2053. : baseFindIndex(array, baseIsNaN, fromIndex);
  2054. }
  2055. /**
  2056. * This function is like `baseIndexOf` except that it accepts a comparator.
  2057. *
  2058. * @private
  2059. * @param {Array} array The array to inspect.
  2060. * @param {*} value The value to search for.
  2061. * @param {number} fromIndex The index to search from.
  2062. * @param {Function} comparator The comparator invoked per element.
  2063. * @returns {number} Returns the index of the matched value, else `-1`.
  2064. */
  2065. function baseIndexOfWith(array, value, fromIndex, comparator) {
  2066. var index = fromIndex - 1,
  2067. length = array.length;
  2068. while (++index < length) {
  2069. if (comparator(array[index], value)) {
  2070. return index;
  2071. }
  2072. }
  2073. return -1;
  2074. }
  2075. /**
  2076. * The base implementation of `_.isNaN` without support for number objects.
  2077. *
  2078. * @private
  2079. * @param {*} value The value to check.
  2080. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  2081. */
  2082. function baseIsNaN(value) {
  2083. return value !== value;
  2084. }
  2085. /**
  2086. * The base implementation of `_.mean` and `_.meanBy` without support for
  2087. * iteratee shorthands.
  2088. *
  2089. * @private
  2090. * @param {Array} array The array to iterate over.
  2091. * @param {Function} iteratee The function invoked per iteration.
  2092. * @returns {number} Returns the mean.
  2093. */
  2094. function baseMean(array, iteratee) {
  2095. var length = array == null ? 0 : array.length;
  2096. return length ? (baseSum(array, iteratee) / length) : NAN;
  2097. }
  2098. /**
  2099. * The base implementation of `_.property` without support for deep paths.
  2100. *
  2101. * @private
  2102. * @param {string} key The key of the property to get.
  2103. * @returns {Function} Returns the new accessor function.
  2104. */
  2105. function baseProperty(key) {
  2106. return function(object) {
  2107. return object == null ? undefined : object[key];
  2108. };
  2109. }
  2110. /**
  2111. * The base implementation of `_.propertyOf` without support for deep paths.
  2112. *
  2113. * @private
  2114. * @param {Object} object The object to query.
  2115. * @returns {Function} Returns the new accessor function.
  2116. */
  2117. function basePropertyOf(object) {
  2118. return function(key) {
  2119. return object == null ? undefined : object[key];
  2120. };
  2121. }
  2122. /**
  2123. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  2124. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  2125. *
  2126. * @private
  2127. * @param {Array|Object} collection The collection to iterate over.
  2128. * @param {Function} iteratee The function invoked per iteration.
  2129. * @param {*} accumulator The initial value.
  2130. * @param {boolean} initAccum Specify using the first or last element of
  2131. * `collection` as the initial value.
  2132. * @param {Function} eachFunc The function to iterate over `collection`.
  2133. * @returns {*} Returns the accumulated value.
  2134. */
  2135. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  2136. eachFunc(collection, function(value, index, collection) {
  2137. accumulator = initAccum
  2138. ? (initAccum = false, value)
  2139. : iteratee(accumulator, value, index, collection);
  2140. });
  2141. return accumulator;
  2142. }
  2143. /**
  2144. * The base implementation of `_.sortBy` which uses `comparer` to define the
  2145. * sort order of `array` and replaces criteria objects with their corresponding
  2146. * values.
  2147. *
  2148. * @private
  2149. * @param {Array} array The array to sort.
  2150. * @param {Function} comparer The function to define sort order.
  2151. * @returns {Array} Returns `array`.
  2152. */
  2153. function baseSortBy(array, comparer) {
  2154. var length = array.length;
  2155. array.sort(comparer);
  2156. while (length--) {
  2157. array[length] = array[length].value;
  2158. }
  2159. return array;
  2160. }
  2161. /**
  2162. * The base implementation of `_.sum` and `_.sumBy` without support for
  2163. * iteratee shorthands.
  2164. *
  2165. * @private
  2166. * @param {Array} array The array to iterate over.
  2167. * @param {Function} iteratee The function invoked per iteration.
  2168. * @returns {number} Returns the sum.
  2169. */
  2170. function baseSum(array, iteratee) {
  2171. var result,
  2172. index = -1,
  2173. length = array.length;
  2174. while (++index < length) {
  2175. var current = iteratee(array[index]);
  2176. if (current !== undefined) {
  2177. result = result === undefined ? current : (result + current);
  2178. }
  2179. }
  2180. return result;
  2181. }
  2182. /**
  2183. * The base implementation of `_.times` without support for iteratee shorthands
  2184. * or max array length checks.
  2185. *
  2186. * @private
  2187. * @param {number} n The number of times to invoke `iteratee`.
  2188. * @param {Function} iteratee The function invoked per iteration.
  2189. * @returns {Array} Returns the array of results.
  2190. */
  2191. function baseTimes(n, iteratee) {
  2192. var index = -1,
  2193. result = Array(n);
  2194. while (++index < n) {
  2195. result[index] = iteratee(index);
  2196. }
  2197. return result;
  2198. }
  2199. /**
  2200. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  2201. * of key-value pairs for `object` corresponding to the property names of `props`.
  2202. *
  2203. * @private
  2204. * @param {Object} object The object to query.
  2205. * @param {Array} props The property names to get values for.
  2206. * @returns {Object} Returns the key-value pairs.
  2207. */
  2208. function baseToPairs(object, props) {
  2209. return arrayMap(props, function(key) {
  2210. return [key, object[key]];
  2211. });
  2212. }
  2213. /**
  2214. * The base implementation of `_.trim`.
  2215. *
  2216. * @private
  2217. * @param {string} string The string to trim.
  2218. * @returns {string} Returns the trimmed string.
  2219. */
  2220. function baseTrim(string) {
  2221. return string
  2222. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  2223. : string;
  2224. }
  2225. /**
  2226. * The base implementation of `_.unary` without support for storing metadata.
  2227. *
  2228. * @private
  2229. * @param {Function} func The function to cap arguments for.
  2230. * @returns {Function} Returns the new capped function.
  2231. */
  2232. function baseUnary(func) {
  2233. return function(value) {
  2234. return func(value);
  2235. };
  2236. }
  2237. /**
  2238. * The base implementation of `_.values` and `_.valuesIn` which creates an
  2239. * array of `object` property values corresponding to the property names
  2240. * of `props`.
  2241. *
  2242. * @private
  2243. * @param {Object} object The object to query.
  2244. * @param {Array} props The property names to get values for.
  2245. * @returns {Object} Returns the array of property values.
  2246. */
  2247. function baseValues(object, props) {
  2248. return arrayMap(props, function(key) {
  2249. return object[key];
  2250. });
  2251. }
  2252. /**
  2253. * Checks if a `cache` value for `key` exists.
  2254. *
  2255. * @private
  2256. * @param {Object} cache The cache to query.
  2257. * @param {string} key The key of the entry to check.
  2258. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2259. */
  2260. function cacheHas(cache, key) {
  2261. return cache.has(key);
  2262. }
  2263. /**
  2264. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  2265. * that is not found in the character symbols.
  2266. *
  2267. * @private
  2268. * @param {Array} strSymbols The string symbols to inspect.
  2269. * @param {Array} chrSymbols The character symbols to find.
  2270. * @returns {number} Returns the index of the first unmatched string symbol.
  2271. */
  2272. function charsStartIndex(strSymbols, chrSymbols) {
  2273. var index = -1,
  2274. length = strSymbols.length;
  2275. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2276. return index;
  2277. }
  2278. /**
  2279. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  2280. * that is not found in the character symbols.
  2281. *
  2282. * @private
  2283. * @param {Array} strSymbols The string symbols to inspect.
  2284. * @param {Array} chrSymbols The character symbols to find.
  2285. * @returns {number} Returns the index of the last unmatched string symbol.
  2286. */
  2287. function charsEndIndex(strSymbols, chrSymbols) {
  2288. var index = strSymbols.length;
  2289. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2290. return index;
  2291. }
  2292. /**
  2293. * Gets the number of `placeholder` occurrences in `array`.
  2294. *
  2295. * @private
  2296. * @param {Array} array The array to inspect.
  2297. * @param {*} placeholder The placeholder to search for.
  2298. * @returns {number} Returns the placeholder count.
  2299. */
  2300. function countHolders(array, placeholder) {
  2301. var length = array.length,
  2302. result = 0;
  2303. while (length--) {
  2304. if (array[length] === placeholder) {
  2305. ++result;
  2306. }
  2307. }
  2308. return result;
  2309. }
  2310. /**
  2311. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  2312. * letters to basic Latin letters.
  2313. *
  2314. * @private
  2315. * @param {string} letter The matched letter to deburr.
  2316. * @returns {string} Returns the deburred letter.
  2317. */
  2318. var deburrLetter = basePropertyOf(deburredLetters);
  2319. /**
  2320. * Used by `_.escape` to convert characters to HTML entities.
  2321. *
  2322. * @private
  2323. * @param {string} chr The matched character to escape.
  2324. * @returns {string} Returns the escaped character.
  2325. */
  2326. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  2327. /**
  2328. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  2329. *
  2330. * @private
  2331. * @param {string} chr The matched character to escape.
  2332. * @returns {string} Returns the escaped character.
  2333. */
  2334. function escapeStringChar(chr) {
  2335. return '\\' + stringEscapes[chr];
  2336. }
  2337. /**
  2338. * Gets the value at `key` of `object`.
  2339. *
  2340. * @private
  2341. * @param {Object} [object] The object to query.
  2342. * @param {string} key The key of the property to get.
  2343. * @returns {*} Returns the property value.
  2344. */
  2345. function getValue(object, key) {
  2346. return object == null ? undefined : object[key];
  2347. }
  2348. /**
  2349. * Checks if `string` contains Unicode symbols.
  2350. *
  2351. * @private
  2352. * @param {string} string The string to inspect.
  2353. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  2354. */
  2355. function hasUnicode(string) {
  2356. return reHasUnicode.test(string);
  2357. }
  2358. /**
  2359. * Checks if `string` contains a word composed of Unicode symbols.
  2360. *
  2361. * @private
  2362. * @param {string} string The string to inspect.
  2363. * @returns {boolean} Returns `true` if a word is found, else `false`.
  2364. */
  2365. function hasUnicodeWord(string) {
  2366. return reHasUnicodeWord.test(string);
  2367. }
  2368. /**
  2369. * Converts `iterator` to an array.
  2370. *
  2371. * @private
  2372. * @param {Object} iterator The iterator to convert.
  2373. * @returns {Array} Returns the converted array.
  2374. */
  2375. function iteratorToArray(iterator) {
  2376. var data,
  2377. result = [];
  2378. while (!(data = iterator.next()).done) {
  2379. result.push(data.value);
  2380. }
  2381. return result;
  2382. }
  2383. /**
  2384. * Converts `map` to its key-value pairs.
  2385. *
  2386. * @private
  2387. * @param {Object} map The map to convert.
  2388. * @returns {Array} Returns the key-value pairs.
  2389. */
  2390. function mapToArray(map) {
  2391. var index = -1,
  2392. result = Array(map.size);
  2393. map.forEach(function(value, key) {
  2394. result[++index] = [key, value];
  2395. });
  2396. return result;
  2397. }
  2398. /**
  2399. * Creates a unary function that invokes `func` with its argument transformed.
  2400. *
  2401. * @private
  2402. * @param {Function} func The function to wrap.
  2403. * @param {Function} transform The argument transform.
  2404. * @returns {Function} Returns the new function.
  2405. */
  2406. function overArg(func, transform) {
  2407. return function(arg) {
  2408. return func(transform(arg));
  2409. };
  2410. }
  2411. /**
  2412. * Replaces all `placeholder` elements in `array` with an internal placeholder
  2413. * and returns an array of their indexes.
  2414. *
  2415. * @private
  2416. * @param {Array} array The array to modify.
  2417. * @param {*} placeholder The placeholder to replace.
  2418. * @returns {Array} Returns the new array of placeholder indexes.
  2419. */
  2420. function replaceHolders(array, placeholder) {
  2421. var index = -1,
  2422. length = array.length,
  2423. resIndex = 0,
  2424. result = [];
  2425. while (++index < length) {
  2426. var value = array[index];
  2427. if (value === placeholder || value === PLACEHOLDER) {
  2428. array[index] = PLACEHOLDER;
  2429. result[resIndex++] = index;
  2430. }
  2431. }
  2432. return result;
  2433. }
  2434. /**
  2435. * Converts `set` to an array of its values.
  2436. *
  2437. * @private
  2438. * @param {Object} set The set to convert.
  2439. * @returns {Array} Returns the values.
  2440. */
  2441. function setToArray(set) {
  2442. var index = -1,
  2443. result = Array(set.size);
  2444. set.forEach(function(value) {
  2445. result[++index] = value;
  2446. });
  2447. return result;
  2448. }
  2449. /**
  2450. * Converts `set` to its value-value pairs.
  2451. *
  2452. * @private
  2453. * @param {Object} set The set to convert.
  2454. * @returns {Array} Returns the value-value pairs.
  2455. */
  2456. function setToPairs(set) {
  2457. var index = -1,
  2458. result = Array(set.size);
  2459. set.forEach(function(value) {
  2460. result[++index] = [value, value];
  2461. });
  2462. return result;
  2463. }
  2464. /**
  2465. * A specialized version of `_.indexOf` which performs strict equality
  2466. * comparisons of values, i.e. `===`.
  2467. *
  2468. * @private
  2469. * @param {Array} array The array to inspect.
  2470. * @param {*} value The value to search for.
  2471. * @param {number} fromIndex The index to search from.
  2472. * @returns {number} Returns the index of the matched value, else `-1`.
  2473. */
  2474. function strictIndexOf(array, value, fromIndex) {
  2475. var index = fromIndex - 1,
  2476. length = array.length;
  2477. while (++index < length) {
  2478. if (array[index] === value) {
  2479. return index;
  2480. }
  2481. }
  2482. return -1;
  2483. }
  2484. /**
  2485. * A specialized version of `_.lastIndexOf` which performs strict equality
  2486. * comparisons of values, i.e. `===`.
  2487. *
  2488. * @private
  2489. * @param {Array} array The array to inspect.
  2490. * @param {*} value The value to search for.
  2491. * @param {number} fromIndex The index to search from.
  2492. * @returns {number} Returns the index of the matched value, else `-1`.
  2493. */
  2494. function strictLastIndexOf(array, value, fromIndex) {
  2495. var index = fromIndex + 1;
  2496. while (index--) {
  2497. if (array[index] === value) {
  2498. return index;
  2499. }
  2500. }
  2501. return index;
  2502. }
  2503. /**
  2504. * Gets the number of symbols in `string`.
  2505. *
  2506. * @private
  2507. * @param {string} string The string to inspect.
  2508. * @returns {number} Returns the string size.
  2509. */
  2510. function stringSize(string) {
  2511. return hasUnicode(string)
  2512. ? unicodeSize(string)
  2513. : asciiSize(string);
  2514. }
  2515. /**
  2516. * Converts `string` to an array.
  2517. *
  2518. * @private
  2519. * @param {string} string The string to convert.
  2520. * @returns {Array} Returns the converted array.
  2521. */
  2522. function stringToArray(string) {
  2523. return hasUnicode(string)
  2524. ? unicodeToArray(string)
  2525. : asciiToArray(string);
  2526. }
  2527. /**
  2528. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  2529. * character of `string`.
  2530. *
  2531. * @private
  2532. * @param {string} string The string to inspect.
  2533. * @returns {number} Returns the index of the last non-whitespace character.
  2534. */
  2535. function trimmedEndIndex(string) {
  2536. var index = string.length;
  2537. while (index-- && reWhitespace.test(string.charAt(index))) {}
  2538. return index;
  2539. }
  2540. /**
  2541. * Used by `_.unescape` to convert HTML entities to characters.
  2542. *
  2543. * @private
  2544. * @param {string} chr The matched character to unescape.
  2545. * @returns {string} Returns the unescaped character.
  2546. */
  2547. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2548. /**
  2549. * Gets the size of a Unicode `string`.
  2550. *
  2551. * @private
  2552. * @param {string} string The string inspect.
  2553. * @returns {number} Returns the string size.
  2554. */
  2555. function unicodeSize(string) {
  2556. var result = reUnicode.lastIndex = 0;
  2557. while (reUnicode.test(string)) {
  2558. ++result;
  2559. }
  2560. return result;
  2561. }
  2562. /**
  2563. * Converts a Unicode `string` to an array.
  2564. *
  2565. * @private
  2566. * @param {string} string The string to convert.
  2567. * @returns {Array} Returns the converted array.
  2568. */
  2569. function unicodeToArray(string) {
  2570. return string.match(reUnicode) || [];
  2571. }
  2572. /**
  2573. * Splits a Unicode `string` into an array of its words.
  2574. *
  2575. * @private
  2576. * @param {string} The string to inspect.
  2577. * @returns {Array} Returns the words of `string`.
  2578. */
  2579. function unicodeWords(string) {
  2580. return string.match(reUnicodeWord) || [];
  2581. }
  2582. /*--------------------------------------------------------------------------*/
  2583. /**
  2584. * Create a new pristine `lodash` function using the `context` object.
  2585. *
  2586. * @static
  2587. * @memberOf _
  2588. * @since 1.1.0
  2589. * @category Util
  2590. * @param {Object} [context=root] The context object.
  2591. * @returns {Function} Returns a new `lodash` function.
  2592. * @example
  2593. *
  2594. * _.mixin({ 'foo': _.constant('foo') });
  2595. *
  2596. * var lodash = _.runInContext();
  2597. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2598. *
  2599. * _.isFunction(_.foo);
  2600. * // => true
  2601. * _.isFunction(_.bar);
  2602. * // => false
  2603. *
  2604. * lodash.isFunction(lodash.foo);
  2605. * // => false
  2606. * lodash.isFunction(lodash.bar);
  2607. * // => true
  2608. *
  2609. * // Create a suped-up `defer` in Node.js.
  2610. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2611. */
  2612. var runInContext = (function runInContext(context) {
  2613. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2614. /** Built-in constructor references. */
  2615. var Array = context.Array,
  2616. Date = context.Date,
  2617. Error = context.Error,
  2618. Function = context.Function,
  2619. Math = context.Math,
  2620. Object = context.Object,
  2621. RegExp = context.RegExp,
  2622. String = context.String,
  2623. TypeError = context.TypeError;
  2624. /** Used for built-in method references. */
  2625. var arrayProto = Array.prototype,
  2626. funcProto = Function.prototype,
  2627. objectProto = Object.prototype;
  2628. /** Used to detect overreaching core-js shims. */
  2629. var coreJsData = context['__core-js_shared__'];
  2630. /** Used to resolve the decompiled source of functions. */
  2631. var funcToString = funcProto.toString;
  2632. /** Used to check objects for own properties. */
  2633. var hasOwnProperty = objectProto.hasOwnProperty;
  2634. /** Used to generate unique IDs. */
  2635. var idCounter = 0;
  2636. /** Used to detect methods masquerading as native. */
  2637. var maskSrcKey = (function() {
  2638. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2639. return uid ? ('Symbol(src)_1.' + uid) : '';
  2640. }());
  2641. /**
  2642. * Used to resolve the
  2643. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2644. * of values.
  2645. */
  2646. var nativeObjectToString = objectProto.toString;
  2647. /** Used to infer the `Object` constructor. */
  2648. var objectCtorString = funcToString.call(Object);
  2649. /** Used to restore the original `_` reference in `_.noConflict`. */
  2650. var oldDash = root._;
  2651. /** Used to detect if a method is native. */
  2652. var reIsNative = RegExp('^' +
  2653. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2654. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2655. );
  2656. /** Built-in value references. */
  2657. var Buffer = moduleExports ? context.Buffer : undefined,
  2658. Symbol = context.Symbol,
  2659. Uint8Array = context.Uint8Array,
  2660. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2661. getPrototype = overArg(Object.getPrototypeOf, Object),
  2662. objectCreate = Object.create,
  2663. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2664. splice = arrayProto.splice,
  2665. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2666. symIterator = Symbol ? Symbol.iterator : undefined,
  2667. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2668. var defineProperty = (function() {
  2669. try {
  2670. var func = getNative(Object, 'defineProperty');
  2671. func({}, '', {});
  2672. return func;
  2673. } catch (e) {}
  2674. }());
  2675. /** Mocked built-ins. */
  2676. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2677. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2678. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2679. /* Built-in method references for those with the same name as other `lodash` methods. */
  2680. var nativeCeil = Math.ceil,
  2681. nativeFloor = Math.floor,
  2682. nativeGetSymbols = Object.getOwnPropertySymbols,
  2683. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2684. nativeIsFinite = context.isFinite,
  2685. nativeJoin = arrayProto.join,
  2686. nativeKeys = overArg(Object.keys, Object),
  2687. nativeMax = Math.max,
  2688. nativeMin = Math.min,
  2689. nativeNow = Date.now,
  2690. nativeParseInt = context.parseInt,
  2691. nativeRandom = Math.random,
  2692. nativeReverse = arrayProto.reverse;
  2693. /* Built-in method references that are verified to be native. */
  2694. var DataView = getNative(context, 'DataView'),
  2695. Map = getNative(context, 'Map'),
  2696. Promise = getNative(context, 'Promise'),
  2697. Set = getNative(context, 'Set'),
  2698. WeakMap = getNative(context, 'WeakMap'),
  2699. nativeCreate = getNative(Object, 'create');
  2700. /** Used to store function metadata. */
  2701. var metaMap = WeakMap && new WeakMap;
  2702. /** Used to lookup unminified function names. */
  2703. var realNames = {};
  2704. /** Used to detect maps, sets, and weakmaps. */
  2705. var dataViewCtorString = toSource(DataView),
  2706. mapCtorString = toSource(Map),
  2707. promiseCtorString = toSource(Promise),
  2708. setCtorString = toSource(Set),
  2709. weakMapCtorString = toSource(WeakMap);
  2710. /** Used to convert symbols to primitives and strings. */
  2711. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2712. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2713. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2714. /*------------------------------------------------------------------------*/
  2715. /**
  2716. * Creates a `lodash` object which wraps `value` to enable implicit method
  2717. * chain sequences. Methods that operate on and return arrays, collections,
  2718. * and functions can be chained together. Methods that retrieve a single value
  2719. * or may return a primitive value will automatically end the chain sequence
  2720. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2721. * with `_#value`.
  2722. *
  2723. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2724. * enabled using `_.chain`.
  2725. *
  2726. * The execution of chained methods is lazy, that is, it's deferred until
  2727. * `_#value` is implicitly or explicitly called.
  2728. *
  2729. * Lazy evaluation allows several methods to support shortcut fusion.
  2730. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2731. * the creation of intermediate arrays and can greatly reduce the number of
  2732. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2733. * fusion if the section is applied to an array and iteratees accept only
  2734. * one argument. The heuristic for whether a section qualifies for shortcut
  2735. * fusion is subject to change.
  2736. *
  2737. * Chaining is supported in custom builds as long as the `_#value` method is
  2738. * directly or indirectly included in the build.
  2739. *
  2740. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2741. *
  2742. * The wrapper `Array` methods are:
  2743. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2744. *
  2745. * The wrapper `String` methods are:
  2746. * `replace` and `split`
  2747. *
  2748. * The wrapper methods that support shortcut fusion are:
  2749. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2750. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2751. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2752. *
  2753. * The chainable wrapper methods are:
  2754. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2755. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2756. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2757. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2758. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2759. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2760. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2761. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2762. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2763. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2764. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2765. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2766. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2767. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2768. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2769. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2770. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2771. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2772. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2773. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2774. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2775. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2776. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2777. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2778. *
  2779. * The wrapper methods that are **not** chainable by default are:
  2780. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2781. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2782. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2783. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2784. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2785. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2786. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2787. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2788. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2789. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2790. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2791. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2792. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2793. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2794. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2795. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2796. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2797. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2798. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2799. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2800. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2801. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2802. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2803. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2804. * `upperFirst`, `value`, and `words`
  2805. *
  2806. * @name _
  2807. * @constructor
  2808. * @category Seq
  2809. * @param {*} value The value to wrap in a `lodash` instance.
  2810. * @returns {Object} Returns the new `lodash` wrapper instance.
  2811. * @example
  2812. *
  2813. * function square(n) {
  2814. * return n * n;
  2815. * }
  2816. *
  2817. * var wrapped = _([1, 2, 3]);
  2818. *
  2819. * // Returns an unwrapped value.
  2820. * wrapped.reduce(_.add);
  2821. * // => 6
  2822. *
  2823. * // Returns a wrapped value.
  2824. * var squares = wrapped.map(square);
  2825. *
  2826. * _.isArray(squares);
  2827. * // => false
  2828. *
  2829. * _.isArray(squares.value());
  2830. * // => true
  2831. */
  2832. function lodash(value) {
  2833. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2834. if (value instanceof LodashWrapper) {
  2835. return value;
  2836. }
  2837. if (hasOwnProperty.call(value, '__wrapped__')) {
  2838. return wrapperClone(value);
  2839. }
  2840. }
  2841. return new LodashWrapper(value);
  2842. }
  2843. /**
  2844. * The base implementation of `_.create` without support for assigning
  2845. * properties to the created object.
  2846. *
  2847. * @private
  2848. * @param {Object} proto The object to inherit from.
  2849. * @returns {Object} Returns the new object.
  2850. */
  2851. var baseCreate = (function() {
  2852. function object() {}
  2853. return function(proto) {
  2854. if (!isObject(proto)) {
  2855. return {};
  2856. }
  2857. if (objectCreate) {
  2858. return objectCreate(proto);
  2859. }
  2860. object.prototype = proto;
  2861. var result = new object;
  2862. object.prototype = undefined;
  2863. return result;
  2864. };
  2865. }());
  2866. /**
  2867. * The function whose prototype chain sequence wrappers inherit from.
  2868. *
  2869. * @private
  2870. */
  2871. function baseLodash() {
  2872. // No operation performed.
  2873. }
  2874. /**
  2875. * The base constructor for creating `lodash` wrapper objects.
  2876. *
  2877. * @private
  2878. * @param {*} value The value to wrap.
  2879. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2880. */
  2881. function LodashWrapper(value, chainAll) {
  2882. this.__wrapped__ = value;
  2883. this.__actions__ = [];
  2884. this.__chain__ = !!chainAll;
  2885. this.__index__ = 0;
  2886. this.__values__ = undefined;
  2887. }
  2888. /**
  2889. * By default, the template delimiters used by lodash are like those in
  2890. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2891. * following template settings to use alternative delimiters.
  2892. *
  2893. * @static
  2894. * @memberOf _
  2895. * @type {Object}
  2896. */
  2897. lodash.templateSettings = {
  2898. /**
  2899. * Used to detect `data` property values to be HTML-escaped.
  2900. *
  2901. * @memberOf _.templateSettings
  2902. * @type {RegExp}
  2903. */
  2904. 'escape': reEscape,
  2905. /**
  2906. * Used to detect code to be evaluated.
  2907. *
  2908. * @memberOf _.templateSettings
  2909. * @type {RegExp}
  2910. */
  2911. 'evaluate': reEvaluate,
  2912. /**
  2913. * Used to detect `data` property values to inject.
  2914. *
  2915. * @memberOf _.templateSettings
  2916. * @type {RegExp}
  2917. */
  2918. 'interpolate': reInterpolate,
  2919. /**
  2920. * Used to reference the data object in the template text.
  2921. *
  2922. * @memberOf _.templateSettings
  2923. * @type {string}
  2924. */
  2925. 'variable': '',
  2926. /**
  2927. * Used to import variables into the compiled template.
  2928. *
  2929. * @memberOf _.templateSettings
  2930. * @type {Object}
  2931. */
  2932. 'imports': {
  2933. /**
  2934. * A reference to the `lodash` function.
  2935. *
  2936. * @memberOf _.templateSettings.imports
  2937. * @type {Function}
  2938. */
  2939. '_': lodash
  2940. }
  2941. };
  2942. // Ensure wrappers are instances of `baseLodash`.
  2943. lodash.prototype = baseLodash.prototype;
  2944. lodash.prototype.constructor = lodash;
  2945. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2946. LodashWrapper.prototype.constructor = LodashWrapper;
  2947. /*------------------------------------------------------------------------*/
  2948. /**
  2949. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2950. *
  2951. * @private
  2952. * @constructor
  2953. * @param {*} value The value to wrap.
  2954. */
  2955. function LazyWrapper(value) {
  2956. this.__wrapped__ = value;
  2957. this.__actions__ = [];
  2958. this.__dir__ = 1;
  2959. this.__filtered__ = false;
  2960. this.__iteratees__ = [];
  2961. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2962. this.__views__ = [];
  2963. }
  2964. /**
  2965. * Creates a clone of the lazy wrapper object.
  2966. *
  2967. * @private
  2968. * @name clone
  2969. * @memberOf LazyWrapper
  2970. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2971. */
  2972. function lazyClone() {
  2973. var result = new LazyWrapper(this.__wrapped__);
  2974. result.__actions__ = copyArray(this.__actions__);
  2975. result.__dir__ = this.__dir__;
  2976. result.__filtered__ = this.__filtered__;
  2977. result.__iteratees__ = copyArray(this.__iteratees__);
  2978. result.__takeCount__ = this.__takeCount__;
  2979. result.__views__ = copyArray(this.__views__);
  2980. return result;
  2981. }
  2982. /**
  2983. * Reverses the direction of lazy iteration.
  2984. *
  2985. * @private
  2986. * @name reverse
  2987. * @memberOf LazyWrapper
  2988. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2989. */
  2990. function lazyReverse() {
  2991. if (this.__filtered__) {
  2992. var result = new LazyWrapper(this);
  2993. result.__dir__ = -1;
  2994. result.__filtered__ = true;
  2995. } else {
  2996. result = this.clone();
  2997. result.__dir__ *= -1;
  2998. }
  2999. return result;
  3000. }
  3001. /**
  3002. * Extracts the unwrapped value from its lazy wrapper.
  3003. *
  3004. * @private
  3005. * @name value
  3006. * @memberOf LazyWrapper
  3007. * @returns {*} Returns the unwrapped value.
  3008. */
  3009. function lazyValue() {
  3010. var array = this.__wrapped__.value(),
  3011. dir = this.__dir__,
  3012. isArr = isArray(array),
  3013. isRight = dir < 0,
  3014. arrLength = isArr ? array.length : 0,
  3015. view = getView(0, arrLength, this.__views__),
  3016. start = view.start,
  3017. end = view.end,
  3018. length = end - start,
  3019. index = isRight ? end : (start - 1),
  3020. iteratees = this.__iteratees__,
  3021. iterLength = iteratees.length,
  3022. resIndex = 0,
  3023. takeCount = nativeMin(length, this.__takeCount__);
  3024. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  3025. return baseWrapperValue(array, this.__actions__);
  3026. }
  3027. var result = [];
  3028. outer:
  3029. while (length-- && resIndex < takeCount) {
  3030. index += dir;
  3031. var iterIndex = -1,
  3032. value = array[index];
  3033. while (++iterIndex < iterLength) {
  3034. var data = iteratees[iterIndex],
  3035. iteratee = data.iteratee,
  3036. type = data.type,
  3037. computed = iteratee(value);
  3038. if (type == LAZY_MAP_FLAG) {
  3039. value = computed;
  3040. } else if (!computed) {
  3041. if (type == LAZY_FILTER_FLAG) {
  3042. continue outer;
  3043. } else {
  3044. break outer;
  3045. }
  3046. }
  3047. }
  3048. result[resIndex++] = value;
  3049. }
  3050. return result;
  3051. }
  3052. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  3053. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  3054. LazyWrapper.prototype.constructor = LazyWrapper;
  3055. /*------------------------------------------------------------------------*/
  3056. /**
  3057. * Creates a hash object.
  3058. *
  3059. * @private
  3060. * @constructor
  3061. * @param {Array} [entries] The key-value pairs to cache.
  3062. */
  3063. function Hash(entries) {
  3064. var index = -1,
  3065. length = entries == null ? 0 : entries.length;
  3066. this.clear();
  3067. while (++index < length) {
  3068. var entry = entries[index];
  3069. this.set(entry[0], entry[1]);
  3070. }
  3071. }
  3072. /**
  3073. * Removes all key-value entries from the hash.
  3074. *
  3075. * @private
  3076. * @name clear
  3077. * @memberOf Hash
  3078. */
  3079. function hashClear() {
  3080. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3081. this.size = 0;
  3082. }
  3083. /**
  3084. * Removes `key` and its value from the hash.
  3085. *
  3086. * @private
  3087. * @name delete
  3088. * @memberOf Hash
  3089. * @param {Object} hash The hash to modify.
  3090. * @param {string} key The key of the value to remove.
  3091. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3092. */
  3093. function hashDelete(key) {
  3094. var result = this.has(key) && delete this.__data__[key];
  3095. this.size -= result ? 1 : 0;
  3096. return result;
  3097. }
  3098. /**
  3099. * Gets the hash value for `key`.
  3100. *
  3101. * @private
  3102. * @name get
  3103. * @memberOf Hash
  3104. * @param {string} key The key of the value to get.
  3105. * @returns {*} Returns the entry value.
  3106. */
  3107. function hashGet(key) {
  3108. var data = this.__data__;
  3109. if (nativeCreate) {
  3110. var result = data[key];
  3111. return result === HASH_UNDEFINED ? undefined : result;
  3112. }
  3113. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3114. }
  3115. /**
  3116. * Checks if a hash value for `key` exists.
  3117. *
  3118. * @private
  3119. * @name has
  3120. * @memberOf Hash
  3121. * @param {string} key The key of the entry to check.
  3122. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3123. */
  3124. function hashHas(key) {
  3125. var data = this.__data__;
  3126. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  3127. }
  3128. /**
  3129. * Sets the hash `key` to `value`.
  3130. *
  3131. * @private
  3132. * @name set
  3133. * @memberOf Hash
  3134. * @param {string} key The key of the value to set.
  3135. * @param {*} value The value to set.
  3136. * @returns {Object} Returns the hash instance.
  3137. */
  3138. function hashSet(key, value) {
  3139. var data = this.__data__;
  3140. this.size += this.has(key) ? 0 : 1;
  3141. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3142. return this;
  3143. }
  3144. // Add methods to `Hash`.
  3145. Hash.prototype.clear = hashClear;
  3146. Hash.prototype['delete'] = hashDelete;
  3147. Hash.prototype.get = hashGet;
  3148. Hash.prototype.has = hashHas;
  3149. Hash.prototype.set = hashSet;
  3150. /*------------------------------------------------------------------------*/
  3151. /**
  3152. * Creates an list cache object.
  3153. *
  3154. * @private
  3155. * @constructor
  3156. * @param {Array} [entries] The key-value pairs to cache.
  3157. */
  3158. function ListCache(entries) {
  3159. var index = -1,
  3160. length = entries == null ? 0 : entries.length;
  3161. this.clear();
  3162. while (++index < length) {
  3163. var entry = entries[index];
  3164. this.set(entry[0], entry[1]);
  3165. }
  3166. }
  3167. /**
  3168. * Removes all key-value entries from the list cache.
  3169. *
  3170. * @private
  3171. * @name clear
  3172. * @memberOf ListCache
  3173. */
  3174. function listCacheClear() {
  3175. this.__data__ = [];
  3176. this.size = 0;
  3177. }
  3178. /**
  3179. * Removes `key` and its value from the list cache.
  3180. *
  3181. * @private
  3182. * @name delete
  3183. * @memberOf ListCache
  3184. * @param {string} key The key of the value to remove.
  3185. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3186. */
  3187. function listCacheDelete(key) {
  3188. var data = this.__data__,
  3189. index = assocIndexOf(data, key);
  3190. if (index < 0) {
  3191. return false;
  3192. }
  3193. var lastIndex = data.length - 1;
  3194. if (index == lastIndex) {
  3195. data.pop();
  3196. } else {
  3197. splice.call(data, index, 1);
  3198. }
  3199. --this.size;
  3200. return true;
  3201. }
  3202. /**
  3203. * Gets the list cache value for `key`.
  3204. *
  3205. * @private
  3206. * @name get
  3207. * @memberOf ListCache
  3208. * @param {string} key The key of the value to get.
  3209. * @returns {*} Returns the entry value.
  3210. */
  3211. function listCacheGet(key) {
  3212. var data = this.__data__,
  3213. index = assocIndexOf(data, key);
  3214. return index < 0 ? undefined : data[index][1];
  3215. }
  3216. /**
  3217. * Checks if a list cache value for `key` exists.
  3218. *
  3219. * @private
  3220. * @name has
  3221. * @memberOf ListCache
  3222. * @param {string} key The key of the entry to check.
  3223. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3224. */
  3225. function listCacheHas(key) {
  3226. return assocIndexOf(this.__data__, key) > -1;
  3227. }
  3228. /**
  3229. * Sets the list cache `key` to `value`.
  3230. *
  3231. * @private
  3232. * @name set
  3233. * @memberOf ListCache
  3234. * @param {string} key The key of the value to set.
  3235. * @param {*} value The value to set.
  3236. * @returns {Object} Returns the list cache instance.
  3237. */
  3238. function listCacheSet(key, value) {
  3239. var data = this.__data__,
  3240. index = assocIndexOf(data, key);
  3241. if (index < 0) {
  3242. ++this.size;
  3243. data.push([key, value]);
  3244. } else {
  3245. data[index][1] = value;
  3246. }
  3247. return this;
  3248. }
  3249. // Add methods to `ListCache`.
  3250. ListCache.prototype.clear = listCacheClear;
  3251. ListCache.prototype['delete'] = listCacheDelete;
  3252. ListCache.prototype.get = listCacheGet;
  3253. ListCache.prototype.has = listCacheHas;
  3254. ListCache.prototype.set = listCacheSet;
  3255. /*------------------------------------------------------------------------*/
  3256. /**
  3257. * Creates a map cache object to store key-value pairs.
  3258. *
  3259. * @private
  3260. * @constructor
  3261. * @param {Array} [entries] The key-value pairs to cache.
  3262. */
  3263. function MapCache(entries) {
  3264. var index = -1,
  3265. length = entries == null ? 0 : entries.length;
  3266. this.clear();
  3267. while (++index < length) {
  3268. var entry = entries[index];
  3269. this.set(entry[0], entry[1]);
  3270. }
  3271. }
  3272. /**
  3273. * Removes all key-value entries from the map.
  3274. *
  3275. * @private
  3276. * @name clear
  3277. * @memberOf MapCache
  3278. */
  3279. function mapCacheClear() {
  3280. this.size = 0;
  3281. this.__data__ = {
  3282. 'hash': new Hash,
  3283. 'map': new (Map || ListCache),
  3284. 'string': new Hash
  3285. };
  3286. }
  3287. /**
  3288. * Removes `key` and its value from the map.
  3289. *
  3290. * @private
  3291. * @name delete
  3292. * @memberOf MapCache
  3293. * @param {string} key The key of the value to remove.
  3294. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3295. */
  3296. function mapCacheDelete(key) {
  3297. var result = getMapData(this, key)['delete'](key);
  3298. this.size -= result ? 1 : 0;
  3299. return result;
  3300. }
  3301. /**
  3302. * Gets the map value for `key`.
  3303. *
  3304. * @private
  3305. * @name get
  3306. * @memberOf MapCache
  3307. * @param {string} key The key of the value to get.
  3308. * @returns {*} Returns the entry value.
  3309. */
  3310. function mapCacheGet(key) {
  3311. return getMapData(this, key).get(key);
  3312. }
  3313. /**
  3314. * Checks if a map value for `key` exists.
  3315. *
  3316. * @private
  3317. * @name has
  3318. * @memberOf MapCache
  3319. * @param {string} key The key of the entry to check.
  3320. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3321. */
  3322. function mapCacheHas(key) {
  3323. return getMapData(this, key).has(key);
  3324. }
  3325. /**
  3326. * Sets the map `key` to `value`.
  3327. *
  3328. * @private
  3329. * @name set
  3330. * @memberOf MapCache
  3331. * @param {string} key The key of the value to set.
  3332. * @param {*} value The value to set.
  3333. * @returns {Object} Returns the map cache instance.
  3334. */
  3335. function mapCacheSet(key, value) {
  3336. var data = getMapData(this, key),
  3337. size = data.size;
  3338. data.set(key, value);
  3339. this.size += data.size == size ? 0 : 1;
  3340. return this;
  3341. }
  3342. // Add methods to `MapCache`.
  3343. MapCache.prototype.clear = mapCacheClear;
  3344. MapCache.prototype['delete'] = mapCacheDelete;
  3345. MapCache.prototype.get = mapCacheGet;
  3346. MapCache.prototype.has = mapCacheHas;
  3347. MapCache.prototype.set = mapCacheSet;
  3348. /*------------------------------------------------------------------------*/
  3349. /**
  3350. *
  3351. * Creates an array cache object to store unique values.
  3352. *
  3353. * @private
  3354. * @constructor
  3355. * @param {Array} [values] The values to cache.
  3356. */
  3357. function SetCache(values) {
  3358. var index = -1,
  3359. length = values == null ? 0 : values.length;
  3360. this.__data__ = new MapCache;
  3361. while (++index < length) {
  3362. this.add(values[index]);
  3363. }
  3364. }
  3365. /**
  3366. * Adds `value` to the array cache.
  3367. *
  3368. * @private
  3369. * @name add
  3370. * @memberOf SetCache
  3371. * @alias push
  3372. * @param {*} value The value to cache.
  3373. * @returns {Object} Returns the cache instance.
  3374. */
  3375. function setCacheAdd(value) {
  3376. this.__data__.set(value, HASH_UNDEFINED);
  3377. return this;
  3378. }
  3379. /**
  3380. * Checks if `value` is in the array cache.
  3381. *
  3382. * @private
  3383. * @name has
  3384. * @memberOf SetCache
  3385. * @param {*} value The value to search for.
  3386. * @returns {number} Returns `true` if `value` is found, else `false`.
  3387. */
  3388. function setCacheHas(value) {
  3389. return this.__data__.has(value);
  3390. }
  3391. // Add methods to `SetCache`.
  3392. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3393. SetCache.prototype.has = setCacheHas;
  3394. /*------------------------------------------------------------------------*/
  3395. /**
  3396. * Creates a stack cache object to store key-value pairs.
  3397. *
  3398. * @private
  3399. * @constructor
  3400. * @param {Array} [entries] The key-value pairs to cache.
  3401. */
  3402. function Stack(entries) {
  3403. var data = this.__data__ = new ListCache(entries);
  3404. this.size = data.size;
  3405. }
  3406. /**
  3407. * Removes all key-value entries from the stack.
  3408. *
  3409. * @private
  3410. * @name clear
  3411. * @memberOf Stack
  3412. */
  3413. function stackClear() {
  3414. this.__data__ = new ListCache;
  3415. this.size = 0;
  3416. }
  3417. /**
  3418. * Removes `key` and its value from the stack.
  3419. *
  3420. * @private
  3421. * @name delete
  3422. * @memberOf Stack
  3423. * @param {string} key The key of the value to remove.
  3424. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3425. */
  3426. function stackDelete(key) {
  3427. var data = this.__data__,
  3428. result = data['delete'](key);
  3429. this.size = data.size;
  3430. return result;
  3431. }
  3432. /**
  3433. * Gets the stack value for `key`.
  3434. *
  3435. * @private
  3436. * @name get
  3437. * @memberOf Stack
  3438. * @param {string} key The key of the value to get.
  3439. * @returns {*} Returns the entry value.
  3440. */
  3441. function stackGet(key) {
  3442. return this.__data__.get(key);
  3443. }
  3444. /**
  3445. * Checks if a stack value for `key` exists.
  3446. *
  3447. * @private
  3448. * @name has
  3449. * @memberOf Stack
  3450. * @param {string} key The key of the entry to check.
  3451. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3452. */
  3453. function stackHas(key) {
  3454. return this.__data__.has(key);
  3455. }
  3456. /**
  3457. * Sets the stack `key` to `value`.
  3458. *
  3459. * @private
  3460. * @name set
  3461. * @memberOf Stack
  3462. * @param {string} key The key of the value to set.
  3463. * @param {*} value The value to set.
  3464. * @returns {Object} Returns the stack cache instance.
  3465. */
  3466. function stackSet(key, value) {
  3467. var data = this.__data__;
  3468. if (data instanceof ListCache) {
  3469. var pairs = data.__data__;
  3470. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3471. pairs.push([key, value]);
  3472. this.size = ++data.size;
  3473. return this;
  3474. }
  3475. data = this.__data__ = new MapCache(pairs);
  3476. }
  3477. data.set(key, value);
  3478. this.size = data.size;
  3479. return this;
  3480. }
  3481. // Add methods to `Stack`.
  3482. Stack.prototype.clear = stackClear;
  3483. Stack.prototype['delete'] = stackDelete;
  3484. Stack.prototype.get = stackGet;
  3485. Stack.prototype.has = stackHas;
  3486. Stack.prototype.set = stackSet;
  3487. /*------------------------------------------------------------------------*/
  3488. /**
  3489. * Creates an array of the enumerable property names of the array-like `value`.
  3490. *
  3491. * @private
  3492. * @param {*} value The value to query.
  3493. * @param {boolean} inherited Specify returning inherited property names.
  3494. * @returns {Array} Returns the array of property names.
  3495. */
  3496. function arrayLikeKeys(value, inherited) {
  3497. var isArr = isArray(value),
  3498. isArg = !isArr && isArguments(value),
  3499. isBuff = !isArr && !isArg && isBuffer(value),
  3500. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3501. skipIndexes = isArr || isArg || isBuff || isType,
  3502. result = skipIndexes ? baseTimes(value.length, String) : [],
  3503. length = result.length;
  3504. for (var key in value) {
  3505. if ((inherited || hasOwnProperty.call(value, key)) &&
  3506. !(skipIndexes && (
  3507. // Safari 9 has enumerable `arguments.length` in strict mode.
  3508. key == 'length' ||
  3509. // Node.js 0.10 has enumerable non-index properties on buffers.
  3510. (isBuff && (key == 'offset' || key == 'parent')) ||
  3511. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3512. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3513. // Skip index properties.
  3514. isIndex(key, length)
  3515. ))) {
  3516. result.push(key);
  3517. }
  3518. }
  3519. return result;
  3520. }
  3521. /**
  3522. * A specialized version of `_.sample` for arrays.
  3523. *
  3524. * @private
  3525. * @param {Array} array The array to sample.
  3526. * @returns {*} Returns the random element.
  3527. */
  3528. function arraySample(array) {
  3529. var length = array.length;
  3530. return length ? array[baseRandom(0, length - 1)] : undefined;
  3531. }
  3532. /**
  3533. * A specialized version of `_.sampleSize` for arrays.
  3534. *
  3535. * @private
  3536. * @param {Array} array The array to sample.
  3537. * @param {number} n The number of elements to sample.
  3538. * @returns {Array} Returns the random elements.
  3539. */
  3540. function arraySampleSize(array, n) {
  3541. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3542. }
  3543. /**
  3544. * A specialized version of `_.shuffle` for arrays.
  3545. *
  3546. * @private
  3547. * @param {Array} array The array to shuffle.
  3548. * @returns {Array} Returns the new shuffled array.
  3549. */
  3550. function arrayShuffle(array) {
  3551. return shuffleSelf(copyArray(array));
  3552. }
  3553. /**
  3554. * This function is like `assignValue` except that it doesn't assign
  3555. * `undefined` values.
  3556. *
  3557. * @private
  3558. * @param {Object} object The object to modify.
  3559. * @param {string} key The key of the property to assign.
  3560. * @param {*} value The value to assign.
  3561. */
  3562. function assignMergeValue(object, key, value) {
  3563. if ((value !== undefined && !eq(object[key], value)) ||
  3564. (value === undefined && !(key in object))) {
  3565. baseAssignValue(object, key, value);
  3566. }
  3567. }
  3568. /**
  3569. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3570. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3571. * for equality comparisons.
  3572. *
  3573. * @private
  3574. * @param {Object} object The object to modify.
  3575. * @param {string} key The key of the property to assign.
  3576. * @param {*} value The value to assign.
  3577. */
  3578. function assignValue(object, key, value) {
  3579. var objValue = object[key];
  3580. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3581. (value === undefined && !(key in object))) {
  3582. baseAssignValue(object, key, value);
  3583. }
  3584. }
  3585. /**
  3586. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3587. *
  3588. * @private
  3589. * @param {Array} array The array to inspect.
  3590. * @param {*} key The key to search for.
  3591. * @returns {number} Returns the index of the matched value, else `-1`.
  3592. */
  3593. function assocIndexOf(array, key) {
  3594. var length = array.length;
  3595. while (length--) {
  3596. if (eq(array[length][0], key)) {
  3597. return length;
  3598. }
  3599. }
  3600. return -1;
  3601. }
  3602. /**
  3603. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3604. * by `iteratee` and values set by `setter`.
  3605. *
  3606. * @private
  3607. * @param {Array|Object} collection The collection to iterate over.
  3608. * @param {Function} setter The function to set `accumulator` values.
  3609. * @param {Function} iteratee The iteratee to transform keys.
  3610. * @param {Object} accumulator The initial aggregated object.
  3611. * @returns {Function} Returns `accumulator`.
  3612. */
  3613. function baseAggregator(collection, setter, iteratee, accumulator) {
  3614. baseEach(collection, function(value, key, collection) {
  3615. setter(accumulator, value, iteratee(value), collection);
  3616. });
  3617. return accumulator;
  3618. }
  3619. /**
  3620. * The base implementation of `_.assign` without support for multiple sources
  3621. * or `customizer` functions.
  3622. *
  3623. * @private
  3624. * @param {Object} object The destination object.
  3625. * @param {Object} source The source object.
  3626. * @returns {Object} Returns `object`.
  3627. */
  3628. function baseAssign(object, source) {
  3629. return object && copyObject(source, keys(source), object);
  3630. }
  3631. /**
  3632. * The base implementation of `_.assignIn` without support for multiple sources
  3633. * or `customizer` functions.
  3634. *
  3635. * @private
  3636. * @param {Object} object The destination object.
  3637. * @param {Object} source The source object.
  3638. * @returns {Object} Returns `object`.
  3639. */
  3640. function baseAssignIn(object, source) {
  3641. return object && copyObject(source, keysIn(source), object);
  3642. }
  3643. /**
  3644. * The base implementation of `assignValue` and `assignMergeValue` without
  3645. * value checks.
  3646. *
  3647. * @private
  3648. * @param {Object} object The object to modify.
  3649. * @param {string} key The key of the property to assign.
  3650. * @param {*} value The value to assign.
  3651. */
  3652. function baseAssignValue(object, key, value) {
  3653. if (key == '__proto__' && defineProperty) {
  3654. defineProperty(object, key, {
  3655. 'configurable': true,
  3656. 'enumerable': true,
  3657. 'value': value,
  3658. 'writable': true
  3659. });
  3660. } else {
  3661. object[key] = value;
  3662. }
  3663. }
  3664. /**
  3665. * The base implementation of `_.at` without support for individual paths.
  3666. *
  3667. * @private
  3668. * @param {Object} object The object to iterate over.
  3669. * @param {string[]} paths The property paths to pick.
  3670. * @returns {Array} Returns the picked elements.
  3671. */
  3672. function baseAt(object, paths) {
  3673. var index = -1,
  3674. length = paths.length,
  3675. result = Array(length),
  3676. skip = object == null;
  3677. while (++index < length) {
  3678. result[index] = skip ? undefined : get(object, paths[index]);
  3679. }
  3680. return result;
  3681. }
  3682. /**
  3683. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3684. *
  3685. * @private
  3686. * @param {number} number The number to clamp.
  3687. * @param {number} [lower] The lower bound.
  3688. * @param {number} upper The upper bound.
  3689. * @returns {number} Returns the clamped number.
  3690. */
  3691. function baseClamp(number, lower, upper) {
  3692. if (number === number) {
  3693. if (upper !== undefined) {
  3694. number = number <= upper ? number : upper;
  3695. }
  3696. if (lower !== undefined) {
  3697. number = number >= lower ? number : lower;
  3698. }
  3699. }
  3700. return number;
  3701. }
  3702. /**
  3703. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3704. * traversed objects.
  3705. *
  3706. * @private
  3707. * @param {*} value The value to clone.
  3708. * @param {boolean} bitmask The bitmask flags.
  3709. * 1 - Deep clone
  3710. * 2 - Flatten inherited properties
  3711. * 4 - Clone symbols
  3712. * @param {Function} [customizer] The function to customize cloning.
  3713. * @param {string} [key] The key of `value`.
  3714. * @param {Object} [object] The parent object of `value`.
  3715. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3716. * @returns {*} Returns the cloned value.
  3717. */
  3718. function baseClone(value, bitmask, customizer, key, object, stack) {
  3719. var result,
  3720. isDeep = bitmask & CLONE_DEEP_FLAG,
  3721. isFlat = bitmask & CLONE_FLAT_FLAG,
  3722. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3723. if (customizer) {
  3724. result = object ? customizer(value, key, object, stack) : customizer(value);
  3725. }
  3726. if (result !== undefined) {
  3727. return result;
  3728. }
  3729. if (!isObject(value)) {
  3730. return value;
  3731. }
  3732. var isArr = isArray(value);
  3733. if (isArr) {
  3734. result = initCloneArray(value);
  3735. if (!isDeep) {
  3736. return copyArray(value, result);
  3737. }
  3738. } else {
  3739. var tag = getTag(value),
  3740. isFunc = tag == funcTag || tag == genTag;
  3741. if (isBuffer(value)) {
  3742. return cloneBuffer(value, isDeep);
  3743. }
  3744. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3745. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3746. if (!isDeep) {
  3747. return isFlat
  3748. ? copySymbolsIn(value, baseAssignIn(result, value))
  3749. : copySymbols(value, baseAssign(result, value));
  3750. }
  3751. } else {
  3752. if (!cloneableTags[tag]) {
  3753. return object ? value : {};
  3754. }
  3755. result = initCloneByTag(value, tag, isDeep);
  3756. }
  3757. }
  3758. // Check for circular references and return its corresponding clone.
  3759. stack || (stack = new Stack);
  3760. var stacked = stack.get(value);
  3761. if (stacked) {
  3762. return stacked;
  3763. }
  3764. stack.set(value, result);
  3765. if (isSet(value)) {
  3766. value.forEach(function(subValue) {
  3767. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3768. });
  3769. } else if (isMap(value)) {
  3770. value.forEach(function(subValue, key) {
  3771. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3772. });
  3773. }
  3774. var keysFunc = isFull
  3775. ? (isFlat ? getAllKeysIn : getAllKeys)
  3776. : (isFlat ? keysIn : keys);
  3777. var props = isArr ? undefined : keysFunc(value);
  3778. arrayEach(props || value, function(subValue, key) {
  3779. if (props) {
  3780. key = subValue;
  3781. subValue = value[key];
  3782. }
  3783. // Recursively populate clone (susceptible to call stack limits).
  3784. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3785. });
  3786. return result;
  3787. }
  3788. /**
  3789. * The base implementation of `_.conforms` which doesn't clone `source`.
  3790. *
  3791. * @private
  3792. * @param {Object} source The object of property predicates to conform to.
  3793. * @returns {Function} Returns the new spec function.
  3794. */
  3795. function baseConforms(source) {
  3796. var props = keys(source);
  3797. return function(object) {
  3798. return baseConformsTo(object, source, props);
  3799. };
  3800. }
  3801. /**
  3802. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3803. *
  3804. * @private
  3805. * @param {Object} object The object to inspect.
  3806. * @param {Object} source The object of property predicates to conform to.
  3807. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3808. */
  3809. function baseConformsTo(object, source, props) {
  3810. var length = props.length;
  3811. if (object == null) {
  3812. return !length;
  3813. }
  3814. object = Object(object);
  3815. while (length--) {
  3816. var key = props[length],
  3817. predicate = source[key],
  3818. value = object[key];
  3819. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3820. return false;
  3821. }
  3822. }
  3823. return true;
  3824. }
  3825. /**
  3826. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3827. * to provide to `func`.
  3828. *
  3829. * @private
  3830. * @param {Function} func The function to delay.
  3831. * @param {number} wait The number of milliseconds to delay invocation.
  3832. * @param {Array} args The arguments to provide to `func`.
  3833. * @returns {number|Object} Returns the timer id or timeout object.
  3834. */
  3835. function baseDelay(func, wait, args) {
  3836. if (typeof func != 'function') {
  3837. throw new TypeError(FUNC_ERROR_TEXT);
  3838. }
  3839. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3840. }
  3841. /**
  3842. * The base implementation of methods like `_.difference` without support
  3843. * for excluding multiple arrays or iteratee shorthands.
  3844. *
  3845. * @private
  3846. * @param {Array} array The array to inspect.
  3847. * @param {Array} values The values to exclude.
  3848. * @param {Function} [iteratee] The iteratee invoked per element.
  3849. * @param {Function} [comparator] The comparator invoked per element.
  3850. * @returns {Array} Returns the new array of filtered values.
  3851. */
  3852. function baseDifference(array, values, iteratee, comparator) {
  3853. var index = -1,
  3854. includes = arrayIncludes,
  3855. isCommon = true,
  3856. length = array.length,
  3857. result = [],
  3858. valuesLength = values.length;
  3859. if (!length) {
  3860. return result;
  3861. }
  3862. if (iteratee) {
  3863. values = arrayMap(values, baseUnary(iteratee));
  3864. }
  3865. if (comparator) {
  3866. includes = arrayIncludesWith;
  3867. isCommon = false;
  3868. }
  3869. else if (values.length >= LARGE_ARRAY_SIZE) {
  3870. includes = cacheHas;
  3871. isCommon = false;
  3872. values = new SetCache(values);
  3873. }
  3874. outer:
  3875. while (++index < length) {
  3876. var value = array[index],
  3877. computed = iteratee == null ? value : iteratee(value);
  3878. value = (comparator || value !== 0) ? value : 0;
  3879. if (isCommon && computed === computed) {
  3880. var valuesIndex = valuesLength;
  3881. while (valuesIndex--) {
  3882. if (values[valuesIndex] === computed) {
  3883. continue outer;
  3884. }
  3885. }
  3886. result.push(value);
  3887. }
  3888. else if (!includes(values, computed, comparator)) {
  3889. result.push(value);
  3890. }
  3891. }
  3892. return result;
  3893. }
  3894. /**
  3895. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3896. *
  3897. * @private
  3898. * @param {Array|Object} collection The collection to iterate over.
  3899. * @param {Function} iteratee The function invoked per iteration.
  3900. * @returns {Array|Object} Returns `collection`.
  3901. */
  3902. var baseEach = createBaseEach(baseForOwn);
  3903. /**
  3904. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3905. *
  3906. * @private
  3907. * @param {Array|Object} collection The collection to iterate over.
  3908. * @param {Function} iteratee The function invoked per iteration.
  3909. * @returns {Array|Object} Returns `collection`.
  3910. */
  3911. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3912. /**
  3913. * The base implementation of `_.every` without support for iteratee shorthands.
  3914. *
  3915. * @private
  3916. * @param {Array|Object} collection The collection to iterate over.
  3917. * @param {Function} predicate The function invoked per iteration.
  3918. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3919. * else `false`
  3920. */
  3921. function baseEvery(collection, predicate) {
  3922. var result = true;
  3923. baseEach(collection, function(value, index, collection) {
  3924. result = !!predicate(value, index, collection);
  3925. return result;
  3926. });
  3927. return result;
  3928. }
  3929. /**
  3930. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3931. * `comparator` to determine the extremum value.
  3932. *
  3933. * @private
  3934. * @param {Array} array The array to iterate over.
  3935. * @param {Function} iteratee The iteratee invoked per iteration.
  3936. * @param {Function} comparator The comparator used to compare values.
  3937. * @returns {*} Returns the extremum value.
  3938. */
  3939. function baseExtremum(array, iteratee, comparator) {
  3940. var index = -1,
  3941. length = array.length;
  3942. while (++index < length) {
  3943. var value = array[index],
  3944. current = iteratee(value);
  3945. if (current != null && (computed === undefined
  3946. ? (current === current && !isSymbol(current))
  3947. : comparator(current, computed)
  3948. )) {
  3949. var computed = current,
  3950. result = value;
  3951. }
  3952. }
  3953. return result;
  3954. }
  3955. /**
  3956. * The base implementation of `_.fill` without an iteratee call guard.
  3957. *
  3958. * @private
  3959. * @param {Array} array The array to fill.
  3960. * @param {*} value The value to fill `array` with.
  3961. * @param {number} [start=0] The start position.
  3962. * @param {number} [end=array.length] The end position.
  3963. * @returns {Array} Returns `array`.
  3964. */
  3965. function baseFill(array, value, start, end) {
  3966. var length = array.length;
  3967. start = toInteger(start);
  3968. if (start < 0) {
  3969. start = -start > length ? 0 : (length + start);
  3970. }
  3971. end = (end === undefined || end > length) ? length : toInteger(end);
  3972. if (end < 0) {
  3973. end += length;
  3974. }
  3975. end = start > end ? 0 : toLength(end);
  3976. while (start < end) {
  3977. array[start++] = value;
  3978. }
  3979. return array;
  3980. }
  3981. /**
  3982. * The base implementation of `_.filter` without support for iteratee shorthands.
  3983. *
  3984. * @private
  3985. * @param {Array|Object} collection The collection to iterate over.
  3986. * @param {Function} predicate The function invoked per iteration.
  3987. * @returns {Array} Returns the new filtered array.
  3988. */
  3989. function baseFilter(collection, predicate) {
  3990. var result = [];
  3991. baseEach(collection, function(value, index, collection) {
  3992. if (predicate(value, index, collection)) {
  3993. result.push(value);
  3994. }
  3995. });
  3996. return result;
  3997. }
  3998. /**
  3999. * The base implementation of `_.flatten` with support for restricting flattening.
  4000. *
  4001. * @private
  4002. * @param {Array} array The array to flatten.
  4003. * @param {number} depth The maximum recursion depth.
  4004. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  4005. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  4006. * @param {Array} [result=[]] The initial result value.
  4007. * @returns {Array} Returns the new flattened array.
  4008. */
  4009. function baseFlatten(array, depth, predicate, isStrict, result) {
  4010. var index = -1,
  4011. length = array.length;
  4012. predicate || (predicate = isFlattenable);
  4013. result || (result = []);
  4014. while (++index < length) {
  4015. var value = array[index];
  4016. if (depth > 0 && predicate(value)) {
  4017. if (depth > 1) {
  4018. // Recursively flatten arrays (susceptible to call stack limits).
  4019. baseFlatten(value, depth - 1, predicate, isStrict, result);
  4020. } else {
  4021. arrayPush(result, value);
  4022. }
  4023. } else if (!isStrict) {
  4024. result[result.length] = value;
  4025. }
  4026. }
  4027. return result;
  4028. }
  4029. /**
  4030. * The base implementation of `baseForOwn` which iterates over `object`
  4031. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  4032. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4033. *
  4034. * @private
  4035. * @param {Object} object The object to iterate over.
  4036. * @param {Function} iteratee The function invoked per iteration.
  4037. * @param {Function} keysFunc The function to get the keys of `object`.
  4038. * @returns {Object} Returns `object`.
  4039. */
  4040. var baseFor = createBaseFor();
  4041. /**
  4042. * This function is like `baseFor` except that it iterates over properties
  4043. * in the opposite order.
  4044. *
  4045. * @private
  4046. * @param {Object} object The object to iterate over.
  4047. * @param {Function} iteratee The function invoked per iteration.
  4048. * @param {Function} keysFunc The function to get the keys of `object`.
  4049. * @returns {Object} Returns `object`.
  4050. */
  4051. var baseForRight = createBaseFor(true);
  4052. /**
  4053. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  4054. *
  4055. * @private
  4056. * @param {Object} object The object to iterate over.
  4057. * @param {Function} iteratee The function invoked per iteration.
  4058. * @returns {Object} Returns `object`.
  4059. */
  4060. function baseForOwn(object, iteratee) {
  4061. return object && baseFor(object, iteratee, keys);
  4062. }
  4063. /**
  4064. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  4065. *
  4066. * @private
  4067. * @param {Object} object The object to iterate over.
  4068. * @param {Function} iteratee The function invoked per iteration.
  4069. * @returns {Object} Returns `object`.
  4070. */
  4071. function baseForOwnRight(object, iteratee) {
  4072. return object && baseForRight(object, iteratee, keys);
  4073. }
  4074. /**
  4075. * The base implementation of `_.functions` which creates an array of
  4076. * `object` function property names filtered from `props`.
  4077. *
  4078. * @private
  4079. * @param {Object} object The object to inspect.
  4080. * @param {Array} props The property names to filter.
  4081. * @returns {Array} Returns the function names.
  4082. */
  4083. function baseFunctions(object, props) {
  4084. return arrayFilter(props, function(key) {
  4085. return isFunction(object[key]);
  4086. });
  4087. }
  4088. /**
  4089. * The base implementation of `_.get` without support for default values.
  4090. *
  4091. * @private
  4092. * @param {Object} object The object to query.
  4093. * @param {Array|string} path The path of the property to get.
  4094. * @returns {*} Returns the resolved value.
  4095. */
  4096. function baseGet(object, path) {
  4097. path = castPath(path, object);
  4098. var index = 0,
  4099. length = path.length;
  4100. while (object != null && index < length) {
  4101. object = object[toKey(path[index++])];
  4102. }
  4103. return (index && index == length) ? object : undefined;
  4104. }
  4105. /**
  4106. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  4107. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  4108. * symbols of `object`.
  4109. *
  4110. * @private
  4111. * @param {Object} object The object to query.
  4112. * @param {Function} keysFunc The function to get the keys of `object`.
  4113. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  4114. * @returns {Array} Returns the array of property names and symbols.
  4115. */
  4116. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  4117. var result = keysFunc(object);
  4118. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  4119. }
  4120. /**
  4121. * The base implementation of `getTag` without fallbacks for buggy environments.
  4122. *
  4123. * @private
  4124. * @param {*} value The value to query.
  4125. * @returns {string} Returns the `toStringTag`.
  4126. */
  4127. function baseGetTag(value) {
  4128. if (value == null) {
  4129. return value === undefined ? undefinedTag : nullTag;
  4130. }
  4131. return (symToStringTag && symToStringTag in Object(value))
  4132. ? getRawTag(value)
  4133. : objectToString(value);
  4134. }
  4135. /**
  4136. * The base implementation of `_.gt` which doesn't coerce arguments.
  4137. *
  4138. * @private
  4139. * @param {*} value The value to compare.
  4140. * @param {*} other The other value to compare.
  4141. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  4142. * else `false`.
  4143. */
  4144. function baseGt(value, other) {
  4145. return value > other;
  4146. }
  4147. /**
  4148. * The base implementation of `_.has` without support for deep paths.
  4149. *
  4150. * @private
  4151. * @param {Object} [object] The object to query.
  4152. * @param {Array|string} key The key to check.
  4153. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4154. */
  4155. function baseHas(object, key) {
  4156. return object != null && hasOwnProperty.call(object, key);
  4157. }
  4158. /**
  4159. * The base implementation of `_.hasIn` without support for deep paths.
  4160. *
  4161. * @private
  4162. * @param {Object} [object] The object to query.
  4163. * @param {Array|string} key The key to check.
  4164. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4165. */
  4166. function baseHasIn(object, key) {
  4167. return object != null && key in Object(object);
  4168. }
  4169. /**
  4170. * The base implementation of `_.inRange` which doesn't coerce arguments.
  4171. *
  4172. * @private
  4173. * @param {number} number The number to check.
  4174. * @param {number} start The start of the range.
  4175. * @param {number} end The end of the range.
  4176. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  4177. */
  4178. function baseInRange(number, start, end) {
  4179. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  4180. }
  4181. /**
  4182. * The base implementation of methods like `_.intersection`, without support
  4183. * for iteratee shorthands, that accepts an array of arrays to inspect.
  4184. *
  4185. * @private
  4186. * @param {Array} arrays The arrays to inspect.
  4187. * @param {Function} [iteratee] The iteratee invoked per element.
  4188. * @param {Function} [comparator] The comparator invoked per element.
  4189. * @returns {Array} Returns the new array of shared values.
  4190. */
  4191. function baseIntersection(arrays, iteratee, comparator) {
  4192. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  4193. length = arrays[0].length,
  4194. othLength = arrays.length,
  4195. othIndex = othLength,
  4196. caches = Array(othLength),
  4197. maxLength = Infinity,
  4198. result = [];
  4199. while (othIndex--) {
  4200. var array = arrays[othIndex];
  4201. if (othIndex && iteratee) {
  4202. array = arrayMap(array, baseUnary(iteratee));
  4203. }
  4204. maxLength = nativeMin(array.length, maxLength);
  4205. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  4206. ? new SetCache(othIndex && array)
  4207. : undefined;
  4208. }
  4209. array = arrays[0];
  4210. var index = -1,
  4211. seen = caches[0];
  4212. outer:
  4213. while (++index < length && result.length < maxLength) {
  4214. var value = array[index],
  4215. computed = iteratee ? iteratee(value) : value;
  4216. value = (comparator || value !== 0) ? value : 0;
  4217. if (!(seen
  4218. ? cacheHas(seen, computed)
  4219. : includes(result, computed, comparator)
  4220. )) {
  4221. othIndex = othLength;
  4222. while (--othIndex) {
  4223. var cache = caches[othIndex];
  4224. if (!(cache
  4225. ? cacheHas(cache, computed)
  4226. : includes(arrays[othIndex], computed, comparator))
  4227. ) {
  4228. continue outer;
  4229. }
  4230. }
  4231. if (seen) {
  4232. seen.push(computed);
  4233. }
  4234. result.push(value);
  4235. }
  4236. }
  4237. return result;
  4238. }
  4239. /**
  4240. * The base implementation of `_.invert` and `_.invertBy` which inverts
  4241. * `object` with values transformed by `iteratee` and set by `setter`.
  4242. *
  4243. * @private
  4244. * @param {Object} object The object to iterate over.
  4245. * @param {Function} setter The function to set `accumulator` values.
  4246. * @param {Function} iteratee The iteratee to transform values.
  4247. * @param {Object} accumulator The initial inverted object.
  4248. * @returns {Function} Returns `accumulator`.
  4249. */
  4250. function baseInverter(object, setter, iteratee, accumulator) {
  4251. baseForOwn(object, function(value, key, object) {
  4252. setter(accumulator, iteratee(value), key, object);
  4253. });
  4254. return accumulator;
  4255. }
  4256. /**
  4257. * The base implementation of `_.invoke` without support for individual
  4258. * method arguments.
  4259. *
  4260. * @private
  4261. * @param {Object} object The object to query.
  4262. * @param {Array|string} path The path of the method to invoke.
  4263. * @param {Array} args The arguments to invoke the method with.
  4264. * @returns {*} Returns the result of the invoked method.
  4265. */
  4266. function baseInvoke(object, path, args) {
  4267. path = castPath(path, object);
  4268. object = parent(object, path);
  4269. var func = object == null ? object : object[toKey(last(path))];
  4270. return func == null ? undefined : apply(func, object, args);
  4271. }
  4272. /**
  4273. * The base implementation of `_.isArguments`.
  4274. *
  4275. * @private
  4276. * @param {*} value The value to check.
  4277. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4278. */
  4279. function baseIsArguments(value) {
  4280. return isObjectLike(value) && baseGetTag(value) == argsTag;
  4281. }
  4282. /**
  4283. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  4284. *
  4285. * @private
  4286. * @param {*} value The value to check.
  4287. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  4288. */
  4289. function baseIsArrayBuffer(value) {
  4290. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4291. }
  4292. /**
  4293. * The base implementation of `_.isDate` without Node.js optimizations.
  4294. *
  4295. * @private
  4296. * @param {*} value The value to check.
  4297. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  4298. */
  4299. function baseIsDate(value) {
  4300. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4301. }
  4302. /**
  4303. * The base implementation of `_.isEqual` which supports partial comparisons
  4304. * and tracks traversed objects.
  4305. *
  4306. * @private
  4307. * @param {*} value The value to compare.
  4308. * @param {*} other The other value to compare.
  4309. * @param {boolean} bitmask The bitmask flags.
  4310. * 1 - Unordered comparison
  4311. * 2 - Partial comparison
  4312. * @param {Function} [customizer] The function to customize comparisons.
  4313. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4314. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4315. */
  4316. function baseIsEqual(value, other, bitmask, customizer, stack) {
  4317. if (value === other) {
  4318. return true;
  4319. }
  4320. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  4321. return value !== value && other !== other;
  4322. }
  4323. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  4324. }
  4325. /**
  4326. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4327. * deep comparisons and tracks traversed objects enabling objects with circular
  4328. * references to be compared.
  4329. *
  4330. * @private
  4331. * @param {Object} object The object to compare.
  4332. * @param {Object} other The other object to compare.
  4333. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4334. * @param {Function} customizer The function to customize comparisons.
  4335. * @param {Function} equalFunc The function to determine equivalents of values.
  4336. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4337. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4338. */
  4339. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  4340. var objIsArr = isArray(object),
  4341. othIsArr = isArray(other),
  4342. objTag = objIsArr ? arrayTag : getTag(object),
  4343. othTag = othIsArr ? arrayTag : getTag(other);
  4344. objTag = objTag == argsTag ? objectTag : objTag;
  4345. othTag = othTag == argsTag ? objectTag : othTag;
  4346. var objIsObj = objTag == objectTag,
  4347. othIsObj = othTag == objectTag,
  4348. isSameTag = objTag == othTag;
  4349. if (isSameTag && isBuffer(object)) {
  4350. if (!isBuffer(other)) {
  4351. return false;
  4352. }
  4353. objIsArr = true;
  4354. objIsObj = false;
  4355. }
  4356. if (isSameTag && !objIsObj) {
  4357. stack || (stack = new Stack);
  4358. return (objIsArr || isTypedArray(object))
  4359. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  4360. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  4361. }
  4362. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  4363. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4364. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4365. if (objIsWrapped || othIsWrapped) {
  4366. var objUnwrapped = objIsWrapped ? object.value() : object,
  4367. othUnwrapped = othIsWrapped ? other.value() : other;
  4368. stack || (stack = new Stack);
  4369. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  4370. }
  4371. }
  4372. if (!isSameTag) {
  4373. return false;
  4374. }
  4375. stack || (stack = new Stack);
  4376. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  4377. }
  4378. /**
  4379. * The base implementation of `_.isMap` without Node.js optimizations.
  4380. *
  4381. * @private
  4382. * @param {*} value The value to check.
  4383. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  4384. */
  4385. function baseIsMap(value) {
  4386. return isObjectLike(value) && getTag(value) == mapTag;
  4387. }
  4388. /**
  4389. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4390. *
  4391. * @private
  4392. * @param {Object} object The object to inspect.
  4393. * @param {Object} source The object of property values to match.
  4394. * @param {Array} matchData The property names, values, and compare flags to match.
  4395. * @param {Function} [customizer] The function to customize comparisons.
  4396. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4397. */
  4398. function baseIsMatch(object, source, matchData, customizer) {
  4399. var index = matchData.length,
  4400. length = index,
  4401. noCustomizer = !customizer;
  4402. if (object == null) {
  4403. return !length;
  4404. }
  4405. object = Object(object);
  4406. while (index--) {
  4407. var data = matchData[index];
  4408. if ((noCustomizer && data[2])
  4409. ? data[1] !== object[data[0]]
  4410. : !(data[0] in object)
  4411. ) {
  4412. return false;
  4413. }
  4414. }
  4415. while (++index < length) {
  4416. data = matchData[index];
  4417. var key = data[0],
  4418. objValue = object[key],
  4419. srcValue = data[1];
  4420. if (noCustomizer && data[2]) {
  4421. if (objValue === undefined && !(key in object)) {
  4422. return false;
  4423. }
  4424. } else {
  4425. var stack = new Stack;
  4426. if (customizer) {
  4427. var result = customizer(objValue, srcValue, key, object, source, stack);
  4428. }
  4429. if (!(result === undefined
  4430. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  4431. : result
  4432. )) {
  4433. return false;
  4434. }
  4435. }
  4436. }
  4437. return true;
  4438. }
  4439. /**
  4440. * The base implementation of `_.isNative` without bad shim checks.
  4441. *
  4442. * @private
  4443. * @param {*} value The value to check.
  4444. * @returns {boolean} Returns `true` if `value` is a native function,
  4445. * else `false`.
  4446. */
  4447. function baseIsNative(value) {
  4448. if (!isObject(value) || isMasked(value)) {
  4449. return false;
  4450. }
  4451. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4452. return pattern.test(toSource(value));
  4453. }
  4454. /**
  4455. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4456. *
  4457. * @private
  4458. * @param {*} value The value to check.
  4459. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4460. */
  4461. function baseIsRegExp(value) {
  4462. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4463. }
  4464. /**
  4465. * The base implementation of `_.isSet` without Node.js optimizations.
  4466. *
  4467. * @private
  4468. * @param {*} value The value to check.
  4469. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4470. */
  4471. function baseIsSet(value) {
  4472. return isObjectLike(value) && getTag(value) == setTag;
  4473. }
  4474. /**
  4475. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4476. *
  4477. * @private
  4478. * @param {*} value The value to check.
  4479. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4480. */
  4481. function baseIsTypedArray(value) {
  4482. return isObjectLike(value) &&
  4483. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4484. }
  4485. /**
  4486. * The base implementation of `_.iteratee`.
  4487. *
  4488. * @private
  4489. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4490. * @returns {Function} Returns the iteratee.
  4491. */
  4492. function baseIteratee(value) {
  4493. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4494. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4495. if (typeof value == 'function') {
  4496. return value;
  4497. }
  4498. if (value == null) {
  4499. return identity;
  4500. }
  4501. if (typeof value == 'object') {
  4502. return isArray(value)
  4503. ? baseMatchesProperty(value[0], value[1])
  4504. : baseMatches(value);
  4505. }
  4506. return property(value);
  4507. }
  4508. /**
  4509. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4510. *
  4511. * @private
  4512. * @param {Object} object The object to query.
  4513. * @returns {Array} Returns the array of property names.
  4514. */
  4515. function baseKeys(object) {
  4516. if (!isPrototype(object)) {
  4517. return nativeKeys(object);
  4518. }
  4519. var result = [];
  4520. for (var key in Object(object)) {
  4521. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4522. result.push(key);
  4523. }
  4524. }
  4525. return result;
  4526. }
  4527. /**
  4528. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4529. *
  4530. * @private
  4531. * @param {Object} object The object to query.
  4532. * @returns {Array} Returns the array of property names.
  4533. */
  4534. function baseKeysIn(object) {
  4535. if (!isObject(object)) {
  4536. return nativeKeysIn(object);
  4537. }
  4538. var isProto = isPrototype(object),
  4539. result = [];
  4540. for (var key in object) {
  4541. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4542. result.push(key);
  4543. }
  4544. }
  4545. return result;
  4546. }
  4547. /**
  4548. * The base implementation of `_.lt` which doesn't coerce arguments.
  4549. *
  4550. * @private
  4551. * @param {*} value The value to compare.
  4552. * @param {*} other The other value to compare.
  4553. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4554. * else `false`.
  4555. */
  4556. function baseLt(value, other) {
  4557. return value < other;
  4558. }
  4559. /**
  4560. * The base implementation of `_.map` without support for iteratee shorthands.
  4561. *
  4562. * @private
  4563. * @param {Array|Object} collection The collection to iterate over.
  4564. * @param {Function} iteratee The function invoked per iteration.
  4565. * @returns {Array} Returns the new mapped array.
  4566. */
  4567. function baseMap(collection, iteratee) {
  4568. var index = -1,
  4569. result = isArrayLike(collection) ? Array(collection.length) : [];
  4570. baseEach(collection, function(value, key, collection) {
  4571. result[++index] = iteratee(value, key, collection);
  4572. });
  4573. return result;
  4574. }
  4575. /**
  4576. * The base implementation of `_.matches` which doesn't clone `source`.
  4577. *
  4578. * @private
  4579. * @param {Object} source The object of property values to match.
  4580. * @returns {Function} Returns the new spec function.
  4581. */
  4582. function baseMatches(source) {
  4583. var matchData = getMatchData(source);
  4584. if (matchData.length == 1 && matchData[0][2]) {
  4585. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4586. }
  4587. return function(object) {
  4588. return object === source || baseIsMatch(object, source, matchData);
  4589. };
  4590. }
  4591. /**
  4592. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4593. *
  4594. * @private
  4595. * @param {string} path The path of the property to get.
  4596. * @param {*} srcValue The value to match.
  4597. * @returns {Function} Returns the new spec function.
  4598. */
  4599. function baseMatchesProperty(path, srcValue) {
  4600. if (isKey(path) && isStrictComparable(srcValue)) {
  4601. return matchesStrictComparable(toKey(path), srcValue);
  4602. }
  4603. return function(object) {
  4604. var objValue = get(object, path);
  4605. return (objValue === undefined && objValue === srcValue)
  4606. ? hasIn(object, path)
  4607. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4608. };
  4609. }
  4610. /**
  4611. * The base implementation of `_.merge` without support for multiple sources.
  4612. *
  4613. * @private
  4614. * @param {Object} object The destination object.
  4615. * @param {Object} source The source object.
  4616. * @param {number} srcIndex The index of `source`.
  4617. * @param {Function} [customizer] The function to customize merged values.
  4618. * @param {Object} [stack] Tracks traversed source values and their merged
  4619. * counterparts.
  4620. */
  4621. function baseMerge(object, source, srcIndex, customizer, stack) {
  4622. if (object === source) {
  4623. return;
  4624. }
  4625. baseFor(source, function(srcValue, key) {
  4626. stack || (stack = new Stack);
  4627. if (isObject(srcValue)) {
  4628. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4629. }
  4630. else {
  4631. var newValue = customizer
  4632. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4633. : undefined;
  4634. if (newValue === undefined) {
  4635. newValue = srcValue;
  4636. }
  4637. assignMergeValue(object, key, newValue);
  4638. }
  4639. }, keysIn);
  4640. }
  4641. /**
  4642. * A specialized version of `baseMerge` for arrays and objects which performs
  4643. * deep merges and tracks traversed objects enabling objects with circular
  4644. * references to be merged.
  4645. *
  4646. * @private
  4647. * @param {Object} object The destination object.
  4648. * @param {Object} source The source object.
  4649. * @param {string} key The key of the value to merge.
  4650. * @param {number} srcIndex The index of `source`.
  4651. * @param {Function} mergeFunc The function to merge values.
  4652. * @param {Function} [customizer] The function to customize assigned values.
  4653. * @param {Object} [stack] Tracks traversed source values and their merged
  4654. * counterparts.
  4655. */
  4656. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4657. var objValue = safeGet(object, key),
  4658. srcValue = safeGet(source, key),
  4659. stacked = stack.get(srcValue);
  4660. if (stacked) {
  4661. assignMergeValue(object, key, stacked);
  4662. return;
  4663. }
  4664. var newValue = customizer
  4665. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4666. : undefined;
  4667. var isCommon = newValue === undefined;
  4668. if (isCommon) {
  4669. var isArr = isArray(srcValue),
  4670. isBuff = !isArr && isBuffer(srcValue),
  4671. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4672. newValue = srcValue;
  4673. if (isArr || isBuff || isTyped) {
  4674. if (isArray(objValue)) {
  4675. newValue = objValue;
  4676. }
  4677. else if (isArrayLikeObject(objValue)) {
  4678. newValue = copyArray(objValue);
  4679. }
  4680. else if (isBuff) {
  4681. isCommon = false;
  4682. newValue = cloneBuffer(srcValue, true);
  4683. }
  4684. else if (isTyped) {
  4685. isCommon = false;
  4686. newValue = cloneTypedArray(srcValue, true);
  4687. }
  4688. else {
  4689. newValue = [];
  4690. }
  4691. }
  4692. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4693. newValue = objValue;
  4694. if (isArguments(objValue)) {
  4695. newValue = toPlainObject(objValue);
  4696. }
  4697. else if (!isObject(objValue) || isFunction(objValue)) {
  4698. newValue = initCloneObject(srcValue);
  4699. }
  4700. }
  4701. else {
  4702. isCommon = false;
  4703. }
  4704. }
  4705. if (isCommon) {
  4706. // Recursively merge objects and arrays (susceptible to call stack limits).
  4707. stack.set(srcValue, newValue);
  4708. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4709. stack['delete'](srcValue);
  4710. }
  4711. assignMergeValue(object, key, newValue);
  4712. }
  4713. /**
  4714. * The base implementation of `_.nth` which doesn't coerce arguments.
  4715. *
  4716. * @private
  4717. * @param {Array} array The array to query.
  4718. * @param {number} n The index of the element to return.
  4719. * @returns {*} Returns the nth element of `array`.
  4720. */
  4721. function baseNth(array, n) {
  4722. var length = array.length;
  4723. if (!length) {
  4724. return;
  4725. }
  4726. n += n < 0 ? length : 0;
  4727. return isIndex(n, length) ? array[n] : undefined;
  4728. }
  4729. /**
  4730. * The base implementation of `_.orderBy` without param guards.
  4731. *
  4732. * @private
  4733. * @param {Array|Object} collection The collection to iterate over.
  4734. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4735. * @param {string[]} orders The sort orders of `iteratees`.
  4736. * @returns {Array} Returns the new sorted array.
  4737. */
  4738. function baseOrderBy(collection, iteratees, orders) {
  4739. if (iteratees.length) {
  4740. iteratees = arrayMap(iteratees, function(iteratee) {
  4741. if (isArray(iteratee)) {
  4742. return function(value) {
  4743. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4744. }
  4745. }
  4746. return iteratee;
  4747. });
  4748. } else {
  4749. iteratees = [identity];
  4750. }
  4751. var index = -1;
  4752. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  4753. var result = baseMap(collection, function(value, key, collection) {
  4754. var criteria = arrayMap(iteratees, function(iteratee) {
  4755. return iteratee(value);
  4756. });
  4757. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4758. });
  4759. return baseSortBy(result, function(object, other) {
  4760. return compareMultiple(object, other, orders);
  4761. });
  4762. }
  4763. /**
  4764. * The base implementation of `_.pick` without support for individual
  4765. * property identifiers.
  4766. *
  4767. * @private
  4768. * @param {Object} object The source object.
  4769. * @param {string[]} paths The property paths to pick.
  4770. * @returns {Object} Returns the new object.
  4771. */
  4772. function basePick(object, paths) {
  4773. return basePickBy(object, paths, function(value, path) {
  4774. return hasIn(object, path);
  4775. });
  4776. }
  4777. /**
  4778. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4779. *
  4780. * @private
  4781. * @param {Object} object The source object.
  4782. * @param {string[]} paths The property paths to pick.
  4783. * @param {Function} predicate The function invoked per property.
  4784. * @returns {Object} Returns the new object.
  4785. */
  4786. function basePickBy(object, paths, predicate) {
  4787. var index = -1,
  4788. length = paths.length,
  4789. result = {};
  4790. while (++index < length) {
  4791. var path = paths[index],
  4792. value = baseGet(object, path);
  4793. if (predicate(value, path)) {
  4794. baseSet(result, castPath(path, object), value);
  4795. }
  4796. }
  4797. return result;
  4798. }
  4799. /**
  4800. * A specialized version of `baseProperty` which supports deep paths.
  4801. *
  4802. * @private
  4803. * @param {Array|string} path The path of the property to get.
  4804. * @returns {Function} Returns the new accessor function.
  4805. */
  4806. function basePropertyDeep(path) {
  4807. return function(object) {
  4808. return baseGet(object, path);
  4809. };
  4810. }
  4811. /**
  4812. * The base implementation of `_.pullAllBy` without support for iteratee
  4813. * shorthands.
  4814. *
  4815. * @private
  4816. * @param {Array} array The array to modify.
  4817. * @param {Array} values The values to remove.
  4818. * @param {Function} [iteratee] The iteratee invoked per element.
  4819. * @param {Function} [comparator] The comparator invoked per element.
  4820. * @returns {Array} Returns `array`.
  4821. */
  4822. function basePullAll(array, values, iteratee, comparator) {
  4823. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4824. index = -1,
  4825. length = values.length,
  4826. seen = array;
  4827. if (array === values) {
  4828. values = copyArray(values);
  4829. }
  4830. if (iteratee) {
  4831. seen = arrayMap(array, baseUnary(iteratee));
  4832. }
  4833. while (++index < length) {
  4834. var fromIndex = 0,
  4835. value = values[index],
  4836. computed = iteratee ? iteratee(value) : value;
  4837. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4838. if (seen !== array) {
  4839. splice.call(seen, fromIndex, 1);
  4840. }
  4841. splice.call(array, fromIndex, 1);
  4842. }
  4843. }
  4844. return array;
  4845. }
  4846. /**
  4847. * The base implementation of `_.pullAt` without support for individual
  4848. * indexes or capturing the removed elements.
  4849. *
  4850. * @private
  4851. * @param {Array} array The array to modify.
  4852. * @param {number[]} indexes The indexes of elements to remove.
  4853. * @returns {Array} Returns `array`.
  4854. */
  4855. function basePullAt(array, indexes) {
  4856. var length = array ? indexes.length : 0,
  4857. lastIndex = length - 1;
  4858. while (length--) {
  4859. var index = indexes[length];
  4860. if (length == lastIndex || index !== previous) {
  4861. var previous = index;
  4862. if (isIndex(index)) {
  4863. splice.call(array, index, 1);
  4864. } else {
  4865. baseUnset(array, index);
  4866. }
  4867. }
  4868. }
  4869. return array;
  4870. }
  4871. /**
  4872. * The base implementation of `_.random` without support for returning
  4873. * floating-point numbers.
  4874. *
  4875. * @private
  4876. * @param {number} lower The lower bound.
  4877. * @param {number} upper The upper bound.
  4878. * @returns {number} Returns the random number.
  4879. */
  4880. function baseRandom(lower, upper) {
  4881. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4882. }
  4883. /**
  4884. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4885. * coerce arguments.
  4886. *
  4887. * @private
  4888. * @param {number} start The start of the range.
  4889. * @param {number} end The end of the range.
  4890. * @param {number} step The value to increment or decrement by.
  4891. * @param {boolean} [fromRight] Specify iterating from right to left.
  4892. * @returns {Array} Returns the range of numbers.
  4893. */
  4894. function baseRange(start, end, step, fromRight) {
  4895. var index = -1,
  4896. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4897. result = Array(length);
  4898. while (length--) {
  4899. result[fromRight ? length : ++index] = start;
  4900. start += step;
  4901. }
  4902. return result;
  4903. }
  4904. /**
  4905. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4906. *
  4907. * @private
  4908. * @param {string} string The string to repeat.
  4909. * @param {number} n The number of times to repeat the string.
  4910. * @returns {string} Returns the repeated string.
  4911. */
  4912. function baseRepeat(string, n) {
  4913. var result = '';
  4914. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4915. return result;
  4916. }
  4917. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4918. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4919. do {
  4920. if (n % 2) {
  4921. result += string;
  4922. }
  4923. n = nativeFloor(n / 2);
  4924. if (n) {
  4925. string += string;
  4926. }
  4927. } while (n);
  4928. return result;
  4929. }
  4930. /**
  4931. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4932. *
  4933. * @private
  4934. * @param {Function} func The function to apply a rest parameter to.
  4935. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4936. * @returns {Function} Returns the new function.
  4937. */
  4938. function baseRest(func, start) {
  4939. return setToString(overRest(func, start, identity), func + '');
  4940. }
  4941. /**
  4942. * The base implementation of `_.sample`.
  4943. *
  4944. * @private
  4945. * @param {Array|Object} collection The collection to sample.
  4946. * @returns {*} Returns the random element.
  4947. */
  4948. function baseSample(collection) {
  4949. return arraySample(values(collection));
  4950. }
  4951. /**
  4952. * The base implementation of `_.sampleSize` without param guards.
  4953. *
  4954. * @private
  4955. * @param {Array|Object} collection The collection to sample.
  4956. * @param {number} n The number of elements to sample.
  4957. * @returns {Array} Returns the random elements.
  4958. */
  4959. function baseSampleSize(collection, n) {
  4960. var array = values(collection);
  4961. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4962. }
  4963. /**
  4964. * The base implementation of `_.set`.
  4965. *
  4966. * @private
  4967. * @param {Object} object The object to modify.
  4968. * @param {Array|string} path The path of the property to set.
  4969. * @param {*} value The value to set.
  4970. * @param {Function} [customizer] The function to customize path creation.
  4971. * @returns {Object} Returns `object`.
  4972. */
  4973. function baseSet(object, path, value, customizer) {
  4974. if (!isObject(object)) {
  4975. return object;
  4976. }
  4977. path = castPath(path, object);
  4978. var index = -1,
  4979. length = path.length,
  4980. lastIndex = length - 1,
  4981. nested = object;
  4982. while (nested != null && ++index < length) {
  4983. var key = toKey(path[index]),
  4984. newValue = value;
  4985. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  4986. return object;
  4987. }
  4988. if (index != lastIndex) {
  4989. var objValue = nested[key];
  4990. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4991. if (newValue === undefined) {
  4992. newValue = isObject(objValue)
  4993. ? objValue
  4994. : (isIndex(path[index + 1]) ? [] : {});
  4995. }
  4996. }
  4997. assignValue(nested, key, newValue);
  4998. nested = nested[key];
  4999. }
  5000. return object;
  5001. }
  5002. /**
  5003. * The base implementation of `setData` without support for hot loop shorting.
  5004. *
  5005. * @private
  5006. * @param {Function} func The function to associate metadata with.
  5007. * @param {*} data The metadata.
  5008. * @returns {Function} Returns `func`.
  5009. */
  5010. var baseSetData = !metaMap ? identity : function(func, data) {
  5011. metaMap.set(func, data);
  5012. return func;
  5013. };
  5014. /**
  5015. * The base implementation of `setToString` without support for hot loop shorting.
  5016. *
  5017. * @private
  5018. * @param {Function} func The function to modify.
  5019. * @param {Function} string The `toString` result.
  5020. * @returns {Function} Returns `func`.
  5021. */
  5022. var baseSetToString = !defineProperty ? identity : function(func, string) {
  5023. return defineProperty(func, 'toString', {
  5024. 'configurable': true,
  5025. 'enumerable': false,
  5026. 'value': constant(string),
  5027. 'writable': true
  5028. });
  5029. };
  5030. /**
  5031. * The base implementation of `_.shuffle`.
  5032. *
  5033. * @private
  5034. * @param {Array|Object} collection The collection to shuffle.
  5035. * @returns {Array} Returns the new shuffled array.
  5036. */
  5037. function baseShuffle(collection) {
  5038. return shuffleSelf(values(collection));
  5039. }
  5040. /**
  5041. * The base implementation of `_.slice` without an iteratee call guard.
  5042. *
  5043. * @private
  5044. * @param {Array} array The array to slice.
  5045. * @param {number} [start=0] The start position.
  5046. * @param {number} [end=array.length] The end position.
  5047. * @returns {Array} Returns the slice of `array`.
  5048. */
  5049. function baseSlice(array, start, end) {
  5050. var index = -1,
  5051. length = array.length;
  5052. if (start < 0) {
  5053. start = -start > length ? 0 : (length + start);
  5054. }
  5055. end = end > length ? length : end;
  5056. if (end < 0) {
  5057. end += length;
  5058. }
  5059. length = start > end ? 0 : ((end - start) >>> 0);
  5060. start >>>= 0;
  5061. var result = Array(length);
  5062. while (++index < length) {
  5063. result[index] = array[index + start];
  5064. }
  5065. return result;
  5066. }
  5067. /**
  5068. * The base implementation of `_.some` without support for iteratee shorthands.
  5069. *
  5070. * @private
  5071. * @param {Array|Object} collection The collection to iterate over.
  5072. * @param {Function} predicate The function invoked per iteration.
  5073. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5074. * else `false`.
  5075. */
  5076. function baseSome(collection, predicate) {
  5077. var result;
  5078. baseEach(collection, function(value, index, collection) {
  5079. result = predicate(value, index, collection);
  5080. return !result;
  5081. });
  5082. return !!result;
  5083. }
  5084. /**
  5085. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  5086. * performs a binary search of `array` to determine the index at which `value`
  5087. * should be inserted into `array` in order to maintain its sort order.
  5088. *
  5089. * @private
  5090. * @param {Array} array The sorted array to inspect.
  5091. * @param {*} value The value to evaluate.
  5092. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5093. * @returns {number} Returns the index at which `value` should be inserted
  5094. * into `array`.
  5095. */
  5096. function baseSortedIndex(array, value, retHighest) {
  5097. var low = 0,
  5098. high = array == null ? low : array.length;
  5099. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5100. while (low < high) {
  5101. var mid = (low + high) >>> 1,
  5102. computed = array[mid];
  5103. if (computed !== null && !isSymbol(computed) &&
  5104. (retHighest ? (computed <= value) : (computed < value))) {
  5105. low = mid + 1;
  5106. } else {
  5107. high = mid;
  5108. }
  5109. }
  5110. return high;
  5111. }
  5112. return baseSortedIndexBy(array, value, identity, retHighest);
  5113. }
  5114. /**
  5115. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  5116. * which invokes `iteratee` for `value` and each element of `array` to compute
  5117. * their sort ranking. The iteratee is invoked with one argument; (value).
  5118. *
  5119. * @private
  5120. * @param {Array} array The sorted array to inspect.
  5121. * @param {*} value The value to evaluate.
  5122. * @param {Function} iteratee The iteratee invoked per element.
  5123. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5124. * @returns {number} Returns the index at which `value` should be inserted
  5125. * into `array`.
  5126. */
  5127. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5128. var low = 0,
  5129. high = array == null ? 0 : array.length;
  5130. if (high === 0) {
  5131. return 0;
  5132. }
  5133. value = iteratee(value);
  5134. var valIsNaN = value !== value,
  5135. valIsNull = value === null,
  5136. valIsSymbol = isSymbol(value),
  5137. valIsUndefined = value === undefined;
  5138. while (low < high) {
  5139. var mid = nativeFloor((low + high) / 2),
  5140. computed = iteratee(array[mid]),
  5141. othIsDefined = computed !== undefined,
  5142. othIsNull = computed === null,
  5143. othIsReflexive = computed === computed,
  5144. othIsSymbol = isSymbol(computed);
  5145. if (valIsNaN) {
  5146. var setLow = retHighest || othIsReflexive;
  5147. } else if (valIsUndefined) {
  5148. setLow = othIsReflexive && (retHighest || othIsDefined);
  5149. } else if (valIsNull) {
  5150. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5151. } else if (valIsSymbol) {
  5152. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5153. } else if (othIsNull || othIsSymbol) {
  5154. setLow = false;
  5155. } else {
  5156. setLow = retHighest ? (computed <= value) : (computed < value);
  5157. }
  5158. if (setLow) {
  5159. low = mid + 1;
  5160. } else {
  5161. high = mid;
  5162. }
  5163. }
  5164. return nativeMin(high, MAX_ARRAY_INDEX);
  5165. }
  5166. /**
  5167. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  5168. * support for iteratee shorthands.
  5169. *
  5170. * @private
  5171. * @param {Array} array The array to inspect.
  5172. * @param {Function} [iteratee] The iteratee invoked per element.
  5173. * @returns {Array} Returns the new duplicate free array.
  5174. */
  5175. function baseSortedUniq(array, iteratee) {
  5176. var index = -1,
  5177. length = array.length,
  5178. resIndex = 0,
  5179. result = [];
  5180. while (++index < length) {
  5181. var value = array[index],
  5182. computed = iteratee ? iteratee(value) : value;
  5183. if (!index || !eq(computed, seen)) {
  5184. var seen = computed;
  5185. result[resIndex++] = value === 0 ? 0 : value;
  5186. }
  5187. }
  5188. return result;
  5189. }
  5190. /**
  5191. * The base implementation of `_.toNumber` which doesn't ensure correct
  5192. * conversions of binary, hexadecimal, or octal string values.
  5193. *
  5194. * @private
  5195. * @param {*} value The value to process.
  5196. * @returns {number} Returns the number.
  5197. */
  5198. function baseToNumber(value) {
  5199. if (typeof value == 'number') {
  5200. return value;
  5201. }
  5202. if (isSymbol(value)) {
  5203. return NAN;
  5204. }
  5205. return +value;
  5206. }
  5207. /**
  5208. * The base implementation of `_.toString` which doesn't convert nullish
  5209. * values to empty strings.
  5210. *
  5211. * @private
  5212. * @param {*} value The value to process.
  5213. * @returns {string} Returns the string.
  5214. */
  5215. function baseToString(value) {
  5216. // Exit early for strings to avoid a performance hit in some environments.
  5217. if (typeof value == 'string') {
  5218. return value;
  5219. }
  5220. if (isArray(value)) {
  5221. // Recursively convert values (susceptible to call stack limits).
  5222. return arrayMap(value, baseToString) + '';
  5223. }
  5224. if (isSymbol(value)) {
  5225. return symbolToString ? symbolToString.call(value) : '';
  5226. }
  5227. var result = (value + '');
  5228. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5229. }
  5230. /**
  5231. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5232. *
  5233. * @private
  5234. * @param {Array} array The array to inspect.
  5235. * @param {Function} [iteratee] The iteratee invoked per element.
  5236. * @param {Function} [comparator] The comparator invoked per element.
  5237. * @returns {Array} Returns the new duplicate free array.
  5238. */
  5239. function baseUniq(array, iteratee, comparator) {
  5240. var index = -1,
  5241. includes = arrayIncludes,
  5242. length = array.length,
  5243. isCommon = true,
  5244. result = [],
  5245. seen = result;
  5246. if (comparator) {
  5247. isCommon = false;
  5248. includes = arrayIncludesWith;
  5249. }
  5250. else if (length >= LARGE_ARRAY_SIZE) {
  5251. var set = iteratee ? null : createSet(array);
  5252. if (set) {
  5253. return setToArray(set);
  5254. }
  5255. isCommon = false;
  5256. includes = cacheHas;
  5257. seen = new SetCache;
  5258. }
  5259. else {
  5260. seen = iteratee ? [] : result;
  5261. }
  5262. outer:
  5263. while (++index < length) {
  5264. var value = array[index],
  5265. computed = iteratee ? iteratee(value) : value;
  5266. value = (comparator || value !== 0) ? value : 0;
  5267. if (isCommon && computed === computed) {
  5268. var seenIndex = seen.length;
  5269. while (seenIndex--) {
  5270. if (seen[seenIndex] === computed) {
  5271. continue outer;
  5272. }
  5273. }
  5274. if (iteratee) {
  5275. seen.push(computed);
  5276. }
  5277. result.push(value);
  5278. }
  5279. else if (!includes(seen, computed, comparator)) {
  5280. if (seen !== result) {
  5281. seen.push(computed);
  5282. }
  5283. result.push(value);
  5284. }
  5285. }
  5286. return result;
  5287. }
  5288. /**
  5289. * The base implementation of `_.unset`.
  5290. *
  5291. * @private
  5292. * @param {Object} object The object to modify.
  5293. * @param {Array|string} path The property path to unset.
  5294. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  5295. */
  5296. function baseUnset(object, path) {
  5297. path = castPath(path, object);
  5298. object = parent(object, path);
  5299. return object == null || delete object[toKey(last(path))];
  5300. }
  5301. /**
  5302. * The base implementation of `_.update`.
  5303. *
  5304. * @private
  5305. * @param {Object} object The object to modify.
  5306. * @param {Array|string} path The path of the property to update.
  5307. * @param {Function} updater The function to produce the updated value.
  5308. * @param {Function} [customizer] The function to customize path creation.
  5309. * @returns {Object} Returns `object`.
  5310. */
  5311. function baseUpdate(object, path, updater, customizer) {
  5312. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5313. }
  5314. /**
  5315. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  5316. * without support for iteratee shorthands.
  5317. *
  5318. * @private
  5319. * @param {Array} array The array to query.
  5320. * @param {Function} predicate The function invoked per iteration.
  5321. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  5322. * @param {boolean} [fromRight] Specify iterating from right to left.
  5323. * @returns {Array} Returns the slice of `array`.
  5324. */
  5325. function baseWhile(array, predicate, isDrop, fromRight) {
  5326. var length = array.length,
  5327. index = fromRight ? length : -1;
  5328. while ((fromRight ? index-- : ++index < length) &&
  5329. predicate(array[index], index, array)) {}
  5330. return isDrop
  5331. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  5332. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  5333. }
  5334. /**
  5335. * The base implementation of `wrapperValue` which returns the result of
  5336. * performing a sequence of actions on the unwrapped `value`, where each
  5337. * successive action is supplied the return value of the previous.
  5338. *
  5339. * @private
  5340. * @param {*} value The unwrapped value.
  5341. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  5342. * @returns {*} Returns the resolved value.
  5343. */
  5344. function baseWrapperValue(value, actions) {
  5345. var result = value;
  5346. if (result instanceof LazyWrapper) {
  5347. result = result.value();
  5348. }
  5349. return arrayReduce(actions, function(result, action) {
  5350. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  5351. }, result);
  5352. }
  5353. /**
  5354. * The base implementation of methods like `_.xor`, without support for
  5355. * iteratee shorthands, that accepts an array of arrays to inspect.
  5356. *
  5357. * @private
  5358. * @param {Array} arrays The arrays to inspect.
  5359. * @param {Function} [iteratee] The iteratee invoked per element.
  5360. * @param {Function} [comparator] The comparator invoked per element.
  5361. * @returns {Array} Returns the new array of values.
  5362. */
  5363. function baseXor(arrays, iteratee, comparator) {
  5364. var length = arrays.length;
  5365. if (length < 2) {
  5366. return length ? baseUniq(arrays[0]) : [];
  5367. }
  5368. var index = -1,
  5369. result = Array(length);
  5370. while (++index < length) {
  5371. var array = arrays[index],
  5372. othIndex = -1;
  5373. while (++othIndex < length) {
  5374. if (othIndex != index) {
  5375. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5376. }
  5377. }
  5378. }
  5379. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5380. }
  5381. /**
  5382. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  5383. *
  5384. * @private
  5385. * @param {Array} props The property identifiers.
  5386. * @param {Array} values The property values.
  5387. * @param {Function} assignFunc The function to assign values.
  5388. * @returns {Object} Returns the new object.
  5389. */
  5390. function baseZipObject(props, values, assignFunc) {
  5391. var index = -1,
  5392. length = props.length,
  5393. valsLength = values.length,
  5394. result = {};
  5395. while (++index < length) {
  5396. var value = index < valsLength ? values[index] : undefined;
  5397. assignFunc(result, props[index], value);
  5398. }
  5399. return result;
  5400. }
  5401. /**
  5402. * Casts `value` to an empty array if it's not an array like object.
  5403. *
  5404. * @private
  5405. * @param {*} value The value to inspect.
  5406. * @returns {Array|Object} Returns the cast array-like object.
  5407. */
  5408. function castArrayLikeObject(value) {
  5409. return isArrayLikeObject(value) ? value : [];
  5410. }
  5411. /**
  5412. * Casts `value` to `identity` if it's not a function.
  5413. *
  5414. * @private
  5415. * @param {*} value The value to inspect.
  5416. * @returns {Function} Returns cast function.
  5417. */
  5418. function castFunction(value) {
  5419. return typeof value == 'function' ? value : identity;
  5420. }
  5421. /**
  5422. * Casts `value` to a path array if it's not one.
  5423. *
  5424. * @private
  5425. * @param {*} value The value to inspect.
  5426. * @param {Object} [object] The object to query keys on.
  5427. * @returns {Array} Returns the cast property path array.
  5428. */
  5429. function castPath(value, object) {
  5430. if (isArray(value)) {
  5431. return value;
  5432. }
  5433. return isKey(value, object) ? [value] : stringToPath(toString(value));
  5434. }
  5435. /**
  5436. * A `baseRest` alias which can be replaced with `identity` by module
  5437. * replacement plugins.
  5438. *
  5439. * @private
  5440. * @type {Function}
  5441. * @param {Function} func The function to apply a rest parameter to.
  5442. * @returns {Function} Returns the new function.
  5443. */
  5444. var castRest = baseRest;
  5445. /**
  5446. * Casts `array` to a slice if it's needed.
  5447. *
  5448. * @private
  5449. * @param {Array} array The array to inspect.
  5450. * @param {number} start The start position.
  5451. * @param {number} [end=array.length] The end position.
  5452. * @returns {Array} Returns the cast slice.
  5453. */
  5454. function castSlice(array, start, end) {
  5455. var length = array.length;
  5456. end = end === undefined ? length : end;
  5457. return (!start && end >= length) ? array : baseSlice(array, start, end);
  5458. }
  5459. /**
  5460. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  5461. *
  5462. * @private
  5463. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  5464. */
  5465. var clearTimeout = ctxClearTimeout || function(id) {
  5466. return root.clearTimeout(id);
  5467. };
  5468. /**
  5469. * Creates a clone of `buffer`.
  5470. *
  5471. * @private
  5472. * @param {Buffer} buffer The buffer to clone.
  5473. * @param {boolean} [isDeep] Specify a deep clone.
  5474. * @returns {Buffer} Returns the cloned buffer.
  5475. */
  5476. function cloneBuffer(buffer, isDeep) {
  5477. if (isDeep) {
  5478. return buffer.slice();
  5479. }
  5480. var length = buffer.length,
  5481. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5482. buffer.copy(result);
  5483. return result;
  5484. }
  5485. /**
  5486. * Creates a clone of `arrayBuffer`.
  5487. *
  5488. * @private
  5489. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5490. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5491. */
  5492. function cloneArrayBuffer(arrayBuffer) {
  5493. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5494. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5495. return result;
  5496. }
  5497. /**
  5498. * Creates a clone of `dataView`.
  5499. *
  5500. * @private
  5501. * @param {Object} dataView The data view to clone.
  5502. * @param {boolean} [isDeep] Specify a deep clone.
  5503. * @returns {Object} Returns the cloned data view.
  5504. */
  5505. function cloneDataView(dataView, isDeep) {
  5506. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5507. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5508. }
  5509. /**
  5510. * Creates a clone of `regexp`.
  5511. *
  5512. * @private
  5513. * @param {Object} regexp The regexp to clone.
  5514. * @returns {Object} Returns the cloned regexp.
  5515. */
  5516. function cloneRegExp(regexp) {
  5517. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5518. result.lastIndex = regexp.lastIndex;
  5519. return result;
  5520. }
  5521. /**
  5522. * Creates a clone of the `symbol` object.
  5523. *
  5524. * @private
  5525. * @param {Object} symbol The symbol object to clone.
  5526. * @returns {Object} Returns the cloned symbol object.
  5527. */
  5528. function cloneSymbol(symbol) {
  5529. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5530. }
  5531. /**
  5532. * Creates a clone of `typedArray`.
  5533. *
  5534. * @private
  5535. * @param {Object} typedArray The typed array to clone.
  5536. * @param {boolean} [isDeep] Specify a deep clone.
  5537. * @returns {Object} Returns the cloned typed array.
  5538. */
  5539. function cloneTypedArray(typedArray, isDeep) {
  5540. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5541. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5542. }
  5543. /**
  5544. * Compares values to sort them in ascending order.
  5545. *
  5546. * @private
  5547. * @param {*} value The value to compare.
  5548. * @param {*} other The other value to compare.
  5549. * @returns {number} Returns the sort order indicator for `value`.
  5550. */
  5551. function compareAscending(value, other) {
  5552. if (value !== other) {
  5553. var valIsDefined = value !== undefined,
  5554. valIsNull = value === null,
  5555. valIsReflexive = value === value,
  5556. valIsSymbol = isSymbol(value);
  5557. var othIsDefined = other !== undefined,
  5558. othIsNull = other === null,
  5559. othIsReflexive = other === other,
  5560. othIsSymbol = isSymbol(other);
  5561. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5562. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5563. (valIsNull && othIsDefined && othIsReflexive) ||
  5564. (!valIsDefined && othIsReflexive) ||
  5565. !valIsReflexive) {
  5566. return 1;
  5567. }
  5568. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5569. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5570. (othIsNull && valIsDefined && valIsReflexive) ||
  5571. (!othIsDefined && valIsReflexive) ||
  5572. !othIsReflexive) {
  5573. return -1;
  5574. }
  5575. }
  5576. return 0;
  5577. }
  5578. /**
  5579. * Used by `_.orderBy` to compare multiple properties of a value to another
  5580. * and stable sort them.
  5581. *
  5582. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5583. * specify an order of "desc" for descending or "asc" for ascending sort order
  5584. * of corresponding values.
  5585. *
  5586. * @private
  5587. * @param {Object} object The object to compare.
  5588. * @param {Object} other The other object to compare.
  5589. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5590. * @returns {number} Returns the sort order indicator for `object`.
  5591. */
  5592. function compareMultiple(object, other, orders) {
  5593. var index = -1,
  5594. objCriteria = object.criteria,
  5595. othCriteria = other.criteria,
  5596. length = objCriteria.length,
  5597. ordersLength = orders.length;
  5598. while (++index < length) {
  5599. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5600. if (result) {
  5601. if (index >= ordersLength) {
  5602. return result;
  5603. }
  5604. var order = orders[index];
  5605. return result * (order == 'desc' ? -1 : 1);
  5606. }
  5607. }
  5608. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5609. // that causes it, under certain circumstances, to provide the same value for
  5610. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5611. // for more details.
  5612. //
  5613. // This also ensures a stable sort in V8 and other engines.
  5614. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5615. return object.index - other.index;
  5616. }
  5617. /**
  5618. * Creates an array that is the composition of partially applied arguments,
  5619. * placeholders, and provided arguments into a single array of arguments.
  5620. *
  5621. * @private
  5622. * @param {Array} args The provided arguments.
  5623. * @param {Array} partials The arguments to prepend to those provided.
  5624. * @param {Array} holders The `partials` placeholder indexes.
  5625. * @params {boolean} [isCurried] Specify composing for a curried function.
  5626. * @returns {Array} Returns the new array of composed arguments.
  5627. */
  5628. function composeArgs(args, partials, holders, isCurried) {
  5629. var argsIndex = -1,
  5630. argsLength = args.length,
  5631. holdersLength = holders.length,
  5632. leftIndex = -1,
  5633. leftLength = partials.length,
  5634. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5635. result = Array(leftLength + rangeLength),
  5636. isUncurried = !isCurried;
  5637. while (++leftIndex < leftLength) {
  5638. result[leftIndex] = partials[leftIndex];
  5639. }
  5640. while (++argsIndex < holdersLength) {
  5641. if (isUncurried || argsIndex < argsLength) {
  5642. result[holders[argsIndex]] = args[argsIndex];
  5643. }
  5644. }
  5645. while (rangeLength--) {
  5646. result[leftIndex++] = args[argsIndex++];
  5647. }
  5648. return result;
  5649. }
  5650. /**
  5651. * This function is like `composeArgs` except that the arguments composition
  5652. * is tailored for `_.partialRight`.
  5653. *
  5654. * @private
  5655. * @param {Array} args The provided arguments.
  5656. * @param {Array} partials The arguments to append to those provided.
  5657. * @param {Array} holders The `partials` placeholder indexes.
  5658. * @params {boolean} [isCurried] Specify composing for a curried function.
  5659. * @returns {Array} Returns the new array of composed arguments.
  5660. */
  5661. function composeArgsRight(args, partials, holders, isCurried) {
  5662. var argsIndex = -1,
  5663. argsLength = args.length,
  5664. holdersIndex = -1,
  5665. holdersLength = holders.length,
  5666. rightIndex = -1,
  5667. rightLength = partials.length,
  5668. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5669. result = Array(rangeLength + rightLength),
  5670. isUncurried = !isCurried;
  5671. while (++argsIndex < rangeLength) {
  5672. result[argsIndex] = args[argsIndex];
  5673. }
  5674. var offset = argsIndex;
  5675. while (++rightIndex < rightLength) {
  5676. result[offset + rightIndex] = partials[rightIndex];
  5677. }
  5678. while (++holdersIndex < holdersLength) {
  5679. if (isUncurried || argsIndex < argsLength) {
  5680. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5681. }
  5682. }
  5683. return result;
  5684. }
  5685. /**
  5686. * Copies the values of `source` to `array`.
  5687. *
  5688. * @private
  5689. * @param {Array} source The array to copy values from.
  5690. * @param {Array} [array=[]] The array to copy values to.
  5691. * @returns {Array} Returns `array`.
  5692. */
  5693. function copyArray(source, array) {
  5694. var index = -1,
  5695. length = source.length;
  5696. array || (array = Array(length));
  5697. while (++index < length) {
  5698. array[index] = source[index];
  5699. }
  5700. return array;
  5701. }
  5702. /**
  5703. * Copies properties of `source` to `object`.
  5704. *
  5705. * @private
  5706. * @param {Object} source The object to copy properties from.
  5707. * @param {Array} props The property identifiers to copy.
  5708. * @param {Object} [object={}] The object to copy properties to.
  5709. * @param {Function} [customizer] The function to customize copied values.
  5710. * @returns {Object} Returns `object`.
  5711. */
  5712. function copyObject(source, props, object, customizer) {
  5713. var isNew = !object;
  5714. object || (object = {});
  5715. var index = -1,
  5716. length = props.length;
  5717. while (++index < length) {
  5718. var key = props[index];
  5719. var newValue = customizer
  5720. ? customizer(object[key], source[key], key, object, source)
  5721. : undefined;
  5722. if (newValue === undefined) {
  5723. newValue = source[key];
  5724. }
  5725. if (isNew) {
  5726. baseAssignValue(object, key, newValue);
  5727. } else {
  5728. assignValue(object, key, newValue);
  5729. }
  5730. }
  5731. return object;
  5732. }
  5733. /**
  5734. * Copies own symbols of `source` to `object`.
  5735. *
  5736. * @private
  5737. * @param {Object} source The object to copy symbols from.
  5738. * @param {Object} [object={}] The object to copy symbols to.
  5739. * @returns {Object} Returns `object`.
  5740. */
  5741. function copySymbols(source, object) {
  5742. return copyObject(source, getSymbols(source), object);
  5743. }
  5744. /**
  5745. * Copies own and inherited symbols of `source` to `object`.
  5746. *
  5747. * @private
  5748. * @param {Object} source The object to copy symbols from.
  5749. * @param {Object} [object={}] The object to copy symbols to.
  5750. * @returns {Object} Returns `object`.
  5751. */
  5752. function copySymbolsIn(source, object) {
  5753. return copyObject(source, getSymbolsIn(source), object);
  5754. }
  5755. /**
  5756. * Creates a function like `_.groupBy`.
  5757. *
  5758. * @private
  5759. * @param {Function} setter The function to set accumulator values.
  5760. * @param {Function} [initializer] The accumulator object initializer.
  5761. * @returns {Function} Returns the new aggregator function.
  5762. */
  5763. function createAggregator(setter, initializer) {
  5764. return function(collection, iteratee) {
  5765. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5766. accumulator = initializer ? initializer() : {};
  5767. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5768. };
  5769. }
  5770. /**
  5771. * Creates a function like `_.assign`.
  5772. *
  5773. * @private
  5774. * @param {Function} assigner The function to assign values.
  5775. * @returns {Function} Returns the new assigner function.
  5776. */
  5777. function createAssigner(assigner) {
  5778. return baseRest(function(object, sources) {
  5779. var index = -1,
  5780. length = sources.length,
  5781. customizer = length > 1 ? sources[length - 1] : undefined,
  5782. guard = length > 2 ? sources[2] : undefined;
  5783. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5784. ? (length--, customizer)
  5785. : undefined;
  5786. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5787. customizer = length < 3 ? undefined : customizer;
  5788. length = 1;
  5789. }
  5790. object = Object(object);
  5791. while (++index < length) {
  5792. var source = sources[index];
  5793. if (source) {
  5794. assigner(object, source, index, customizer);
  5795. }
  5796. }
  5797. return object;
  5798. });
  5799. }
  5800. /**
  5801. * Creates a `baseEach` or `baseEachRight` function.
  5802. *
  5803. * @private
  5804. * @param {Function} eachFunc The function to iterate over a collection.
  5805. * @param {boolean} [fromRight] Specify iterating from right to left.
  5806. * @returns {Function} Returns the new base function.
  5807. */
  5808. function createBaseEach(eachFunc, fromRight) {
  5809. return function(collection, iteratee) {
  5810. if (collection == null) {
  5811. return collection;
  5812. }
  5813. if (!isArrayLike(collection)) {
  5814. return eachFunc(collection, iteratee);
  5815. }
  5816. var length = collection.length,
  5817. index = fromRight ? length : -1,
  5818. iterable = Object(collection);
  5819. while ((fromRight ? index-- : ++index < length)) {
  5820. if (iteratee(iterable[index], index, iterable) === false) {
  5821. break;
  5822. }
  5823. }
  5824. return collection;
  5825. };
  5826. }
  5827. /**
  5828. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5829. *
  5830. * @private
  5831. * @param {boolean} [fromRight] Specify iterating from right to left.
  5832. * @returns {Function} Returns the new base function.
  5833. */
  5834. function createBaseFor(fromRight) {
  5835. return function(object, iteratee, keysFunc) {
  5836. var index = -1,
  5837. iterable = Object(object),
  5838. props = keysFunc(object),
  5839. length = props.length;
  5840. while (length--) {
  5841. var key = props[fromRight ? length : ++index];
  5842. if (iteratee(iterable[key], key, iterable) === false) {
  5843. break;
  5844. }
  5845. }
  5846. return object;
  5847. };
  5848. }
  5849. /**
  5850. * Creates a function that wraps `func` to invoke it with the optional `this`
  5851. * binding of `thisArg`.
  5852. *
  5853. * @private
  5854. * @param {Function} func The function to wrap.
  5855. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5856. * @param {*} [thisArg] The `this` binding of `func`.
  5857. * @returns {Function} Returns the new wrapped function.
  5858. */
  5859. function createBind(func, bitmask, thisArg) {
  5860. var isBind = bitmask & WRAP_BIND_FLAG,
  5861. Ctor = createCtor(func);
  5862. function wrapper() {
  5863. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5864. return fn.apply(isBind ? thisArg : this, arguments);
  5865. }
  5866. return wrapper;
  5867. }
  5868. /**
  5869. * Creates a function like `_.lowerFirst`.
  5870. *
  5871. * @private
  5872. * @param {string} methodName The name of the `String` case method to use.
  5873. * @returns {Function} Returns the new case function.
  5874. */
  5875. function createCaseFirst(methodName) {
  5876. return function(string) {
  5877. string = toString(string);
  5878. var strSymbols = hasUnicode(string)
  5879. ? stringToArray(string)
  5880. : undefined;
  5881. var chr = strSymbols
  5882. ? strSymbols[0]
  5883. : string.charAt(0);
  5884. var trailing = strSymbols
  5885. ? castSlice(strSymbols, 1).join('')
  5886. : string.slice(1);
  5887. return chr[methodName]() + trailing;
  5888. };
  5889. }
  5890. /**
  5891. * Creates a function like `_.camelCase`.
  5892. *
  5893. * @private
  5894. * @param {Function} callback The function to combine each word.
  5895. * @returns {Function} Returns the new compounder function.
  5896. */
  5897. function createCompounder(callback) {
  5898. return function(string) {
  5899. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5900. };
  5901. }
  5902. /**
  5903. * Creates a function that produces an instance of `Ctor` regardless of
  5904. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5905. *
  5906. * @private
  5907. * @param {Function} Ctor The constructor to wrap.
  5908. * @returns {Function} Returns the new wrapped function.
  5909. */
  5910. function createCtor(Ctor) {
  5911. return function() {
  5912. // Use a `switch` statement to work with class constructors. See
  5913. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5914. // for more details.
  5915. var args = arguments;
  5916. switch (args.length) {
  5917. case 0: return new Ctor;
  5918. case 1: return new Ctor(args[0]);
  5919. case 2: return new Ctor(args[0], args[1]);
  5920. case 3: return new Ctor(args[0], args[1], args[2]);
  5921. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5922. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5923. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5924. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5925. }
  5926. var thisBinding = baseCreate(Ctor.prototype),
  5927. result = Ctor.apply(thisBinding, args);
  5928. // Mimic the constructor's `return` behavior.
  5929. // See https://es5.github.io/#x13.2.2 for more details.
  5930. return isObject(result) ? result : thisBinding;
  5931. };
  5932. }
  5933. /**
  5934. * Creates a function that wraps `func` to enable currying.
  5935. *
  5936. * @private
  5937. * @param {Function} func The function to wrap.
  5938. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5939. * @param {number} arity The arity of `func`.
  5940. * @returns {Function} Returns the new wrapped function.
  5941. */
  5942. function createCurry(func, bitmask, arity) {
  5943. var Ctor = createCtor(func);
  5944. function wrapper() {
  5945. var length = arguments.length,
  5946. args = Array(length),
  5947. index = length,
  5948. placeholder = getHolder(wrapper);
  5949. while (index--) {
  5950. args[index] = arguments[index];
  5951. }
  5952. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5953. ? []
  5954. : replaceHolders(args, placeholder);
  5955. length -= holders.length;
  5956. if (length < arity) {
  5957. return createRecurry(
  5958. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5959. args, holders, undefined, undefined, arity - length);
  5960. }
  5961. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5962. return apply(fn, this, args);
  5963. }
  5964. return wrapper;
  5965. }
  5966. /**
  5967. * Creates a `_.find` or `_.findLast` function.
  5968. *
  5969. * @private
  5970. * @param {Function} findIndexFunc The function to find the collection index.
  5971. * @returns {Function} Returns the new find function.
  5972. */
  5973. function createFind(findIndexFunc) {
  5974. return function(collection, predicate, fromIndex) {
  5975. var iterable = Object(collection);
  5976. if (!isArrayLike(collection)) {
  5977. var iteratee = getIteratee(predicate, 3);
  5978. collection = keys(collection);
  5979. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5980. }
  5981. var index = findIndexFunc(collection, predicate, fromIndex);
  5982. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5983. };
  5984. }
  5985. /**
  5986. * Creates a `_.flow` or `_.flowRight` function.
  5987. *
  5988. * @private
  5989. * @param {boolean} [fromRight] Specify iterating from right to left.
  5990. * @returns {Function} Returns the new flow function.
  5991. */
  5992. function createFlow(fromRight) {
  5993. return flatRest(function(funcs) {
  5994. var length = funcs.length,
  5995. index = length,
  5996. prereq = LodashWrapper.prototype.thru;
  5997. if (fromRight) {
  5998. funcs.reverse();
  5999. }
  6000. while (index--) {
  6001. var func = funcs[index];
  6002. if (typeof func != 'function') {
  6003. throw new TypeError(FUNC_ERROR_TEXT);
  6004. }
  6005. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  6006. var wrapper = new LodashWrapper([], true);
  6007. }
  6008. }
  6009. index = wrapper ? index : length;
  6010. while (++index < length) {
  6011. func = funcs[index];
  6012. var funcName = getFuncName(func),
  6013. data = funcName == 'wrapper' ? getData(func) : undefined;
  6014. if (data && isLaziable(data[0]) &&
  6015. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  6016. !data[4].length && data[9] == 1
  6017. ) {
  6018. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  6019. } else {
  6020. wrapper = (func.length == 1 && isLaziable(func))
  6021. ? wrapper[funcName]()
  6022. : wrapper.thru(func);
  6023. }
  6024. }
  6025. return function() {
  6026. var args = arguments,
  6027. value = args[0];
  6028. if (wrapper && args.length == 1 && isArray(value)) {
  6029. return wrapper.plant(value).value();
  6030. }
  6031. var index = 0,
  6032. result = length ? funcs[index].apply(this, args) : value;
  6033. while (++index < length) {
  6034. result = funcs[index].call(this, result);
  6035. }
  6036. return result;
  6037. };
  6038. });
  6039. }
  6040. /**
  6041. * Creates a function that wraps `func` to invoke it with optional `this`
  6042. * binding of `thisArg`, partial application, and currying.
  6043. *
  6044. * @private
  6045. * @param {Function|string} func The function or method name to wrap.
  6046. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6047. * @param {*} [thisArg] The `this` binding of `func`.
  6048. * @param {Array} [partials] The arguments to prepend to those provided to
  6049. * the new function.
  6050. * @param {Array} [holders] The `partials` placeholder indexes.
  6051. * @param {Array} [partialsRight] The arguments to append to those provided
  6052. * to the new function.
  6053. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  6054. * @param {Array} [argPos] The argument positions of the new function.
  6055. * @param {number} [ary] The arity cap of `func`.
  6056. * @param {number} [arity] The arity of `func`.
  6057. * @returns {Function} Returns the new wrapped function.
  6058. */
  6059. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  6060. var isAry = bitmask & WRAP_ARY_FLAG,
  6061. isBind = bitmask & WRAP_BIND_FLAG,
  6062. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  6063. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  6064. isFlip = bitmask & WRAP_FLIP_FLAG,
  6065. Ctor = isBindKey ? undefined : createCtor(func);
  6066. function wrapper() {
  6067. var length = arguments.length,
  6068. args = Array(length),
  6069. index = length;
  6070. while (index--) {
  6071. args[index] = arguments[index];
  6072. }
  6073. if (isCurried) {
  6074. var placeholder = getHolder(wrapper),
  6075. holdersCount = countHolders(args, placeholder);
  6076. }
  6077. if (partials) {
  6078. args = composeArgs(args, partials, holders, isCurried);
  6079. }
  6080. if (partialsRight) {
  6081. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  6082. }
  6083. length -= holdersCount;
  6084. if (isCurried && length < arity) {
  6085. var newHolders = replaceHolders(args, placeholder);
  6086. return createRecurry(
  6087. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  6088. args, newHolders, argPos, ary, arity - length
  6089. );
  6090. }
  6091. var thisBinding = isBind ? thisArg : this,
  6092. fn = isBindKey ? thisBinding[func] : func;
  6093. length = args.length;
  6094. if (argPos) {
  6095. args = reorder(args, argPos);
  6096. } else if (isFlip && length > 1) {
  6097. args.reverse();
  6098. }
  6099. if (isAry && ary < length) {
  6100. args.length = ary;
  6101. }
  6102. if (this && this !== root && this instanceof wrapper) {
  6103. fn = Ctor || createCtor(fn);
  6104. }
  6105. return fn.apply(thisBinding, args);
  6106. }
  6107. return wrapper;
  6108. }
  6109. /**
  6110. * Creates a function like `_.invertBy`.
  6111. *
  6112. * @private
  6113. * @param {Function} setter The function to set accumulator values.
  6114. * @param {Function} toIteratee The function to resolve iteratees.
  6115. * @returns {Function} Returns the new inverter function.
  6116. */
  6117. function createInverter(setter, toIteratee) {
  6118. return function(object, iteratee) {
  6119. return baseInverter(object, setter, toIteratee(iteratee), {});
  6120. };
  6121. }
  6122. /**
  6123. * Creates a function that performs a mathematical operation on two values.
  6124. *
  6125. * @private
  6126. * @param {Function} operator The function to perform the operation.
  6127. * @param {number} [defaultValue] The value used for `undefined` arguments.
  6128. * @returns {Function} Returns the new mathematical operation function.
  6129. */
  6130. function createMathOperation(operator, defaultValue) {
  6131. return function(value, other) {
  6132. var result;
  6133. if (value === undefined && other === undefined) {
  6134. return defaultValue;
  6135. }
  6136. if (value !== undefined) {
  6137. result = value;
  6138. }
  6139. if (other !== undefined) {
  6140. if (result === undefined) {
  6141. return other;
  6142. }
  6143. if (typeof value == 'string' || typeof other == 'string') {
  6144. value = baseToString(value);
  6145. other = baseToString(other);
  6146. } else {
  6147. value = baseToNumber(value);
  6148. other = baseToNumber(other);
  6149. }
  6150. result = operator(value, other);
  6151. }
  6152. return result;
  6153. };
  6154. }
  6155. /**
  6156. * Creates a function like `_.over`.
  6157. *
  6158. * @private
  6159. * @param {Function} arrayFunc The function to iterate over iteratees.
  6160. * @returns {Function} Returns the new over function.
  6161. */
  6162. function createOver(arrayFunc) {
  6163. return flatRest(function(iteratees) {
  6164. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  6165. return baseRest(function(args) {
  6166. var thisArg = this;
  6167. return arrayFunc(iteratees, function(iteratee) {
  6168. return apply(iteratee, thisArg, args);
  6169. });
  6170. });
  6171. });
  6172. }
  6173. /**
  6174. * Creates the padding for `string` based on `length`. The `chars` string
  6175. * is truncated if the number of characters exceeds `length`.
  6176. *
  6177. * @private
  6178. * @param {number} length The padding length.
  6179. * @param {string} [chars=' '] The string used as padding.
  6180. * @returns {string} Returns the padding for `string`.
  6181. */
  6182. function createPadding(length, chars) {
  6183. chars = chars === undefined ? ' ' : baseToString(chars);
  6184. var charsLength = chars.length;
  6185. if (charsLength < 2) {
  6186. return charsLength ? baseRepeat(chars, length) : chars;
  6187. }
  6188. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  6189. return hasUnicode(chars)
  6190. ? castSlice(stringToArray(result), 0, length).join('')
  6191. : result.slice(0, length);
  6192. }
  6193. /**
  6194. * Creates a function that wraps `func` to invoke it with the `this` binding
  6195. * of `thisArg` and `partials` prepended to the arguments it receives.
  6196. *
  6197. * @private
  6198. * @param {Function} func The function to wrap.
  6199. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6200. * @param {*} thisArg The `this` binding of `func`.
  6201. * @param {Array} partials The arguments to prepend to those provided to
  6202. * the new function.
  6203. * @returns {Function} Returns the new wrapped function.
  6204. */
  6205. function createPartial(func, bitmask, thisArg, partials) {
  6206. var isBind = bitmask & WRAP_BIND_FLAG,
  6207. Ctor = createCtor(func);
  6208. function wrapper() {
  6209. var argsIndex = -1,
  6210. argsLength = arguments.length,
  6211. leftIndex = -1,
  6212. leftLength = partials.length,
  6213. args = Array(leftLength + argsLength),
  6214. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6215. while (++leftIndex < leftLength) {
  6216. args[leftIndex] = partials[leftIndex];
  6217. }
  6218. while (argsLength--) {
  6219. args[leftIndex++] = arguments[++argsIndex];
  6220. }
  6221. return apply(fn, isBind ? thisArg : this, args);
  6222. }
  6223. return wrapper;
  6224. }
  6225. /**
  6226. * Creates a `_.range` or `_.rangeRight` function.
  6227. *
  6228. * @private
  6229. * @param {boolean} [fromRight] Specify iterating from right to left.
  6230. * @returns {Function} Returns the new range function.
  6231. */
  6232. function createRange(fromRight) {
  6233. return function(start, end, step) {
  6234. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  6235. end = step = undefined;
  6236. }
  6237. // Ensure the sign of `-0` is preserved.
  6238. start = toFinite(start);
  6239. if (end === undefined) {
  6240. end = start;
  6241. start = 0;
  6242. } else {
  6243. end = toFinite(end);
  6244. }
  6245. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  6246. return baseRange(start, end, step, fromRight);
  6247. };
  6248. }
  6249. /**
  6250. * Creates a function that performs a relational operation on two values.
  6251. *
  6252. * @private
  6253. * @param {Function} operator The function to perform the operation.
  6254. * @returns {Function} Returns the new relational operation function.
  6255. */
  6256. function createRelationalOperation(operator) {
  6257. return function(value, other) {
  6258. if (!(typeof value == 'string' && typeof other == 'string')) {
  6259. value = toNumber(value);
  6260. other = toNumber(other);
  6261. }
  6262. return operator(value, other);
  6263. };
  6264. }
  6265. /**
  6266. * Creates a function that wraps `func` to continue currying.
  6267. *
  6268. * @private
  6269. * @param {Function} func The function to wrap.
  6270. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6271. * @param {Function} wrapFunc The function to create the `func` wrapper.
  6272. * @param {*} placeholder The placeholder value.
  6273. * @param {*} [thisArg] The `this` binding of `func`.
  6274. * @param {Array} [partials] The arguments to prepend to those provided to
  6275. * the new function.
  6276. * @param {Array} [holders] The `partials` placeholder indexes.
  6277. * @param {Array} [argPos] The argument positions of the new function.
  6278. * @param {number} [ary] The arity cap of `func`.
  6279. * @param {number} [arity] The arity of `func`.
  6280. * @returns {Function} Returns the new wrapped function.
  6281. */
  6282. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  6283. var isCurry = bitmask & WRAP_CURRY_FLAG,
  6284. newHolders = isCurry ? holders : undefined,
  6285. newHoldersRight = isCurry ? undefined : holders,
  6286. newPartials = isCurry ? partials : undefined,
  6287. newPartialsRight = isCurry ? undefined : partials;
  6288. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  6289. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  6290. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  6291. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  6292. }
  6293. var newData = [
  6294. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  6295. newHoldersRight, argPos, ary, arity
  6296. ];
  6297. var result = wrapFunc.apply(undefined, newData);
  6298. if (isLaziable(func)) {
  6299. setData(result, newData);
  6300. }
  6301. result.placeholder = placeholder;
  6302. return setWrapToString(result, func, bitmask);
  6303. }
  6304. /**
  6305. * Creates a function like `_.round`.
  6306. *
  6307. * @private
  6308. * @param {string} methodName The name of the `Math` method to use when rounding.
  6309. * @returns {Function} Returns the new round function.
  6310. */
  6311. function createRound(methodName) {
  6312. var func = Math[methodName];
  6313. return function(number, precision) {
  6314. number = toNumber(number);
  6315. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  6316. if (precision && nativeIsFinite(number)) {
  6317. // Shift with exponential notation to avoid floating-point issues.
  6318. // See [MDN](https://mdn.io/round#Examples) for more details.
  6319. var pair = (toString(number) + 'e').split('e'),
  6320. value = func(pair[0] + 'e' + (+pair[1] + precision));
  6321. pair = (toString(value) + 'e').split('e');
  6322. return +(pair[0] + 'e' + (+pair[1] - precision));
  6323. }
  6324. return func(number);
  6325. };
  6326. }
  6327. /**
  6328. * Creates a set object of `values`.
  6329. *
  6330. * @private
  6331. * @param {Array} values The values to add to the set.
  6332. * @returns {Object} Returns the new set.
  6333. */
  6334. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  6335. return new Set(values);
  6336. };
  6337. /**
  6338. * Creates a `_.toPairs` or `_.toPairsIn` function.
  6339. *
  6340. * @private
  6341. * @param {Function} keysFunc The function to get the keys of a given object.
  6342. * @returns {Function} Returns the new pairs function.
  6343. */
  6344. function createToPairs(keysFunc) {
  6345. return function(object) {
  6346. var tag = getTag(object);
  6347. if (tag == mapTag) {
  6348. return mapToArray(object);
  6349. }
  6350. if (tag == setTag) {
  6351. return setToPairs(object);
  6352. }
  6353. return baseToPairs(object, keysFunc(object));
  6354. };
  6355. }
  6356. /**
  6357. * Creates a function that either curries or invokes `func` with optional
  6358. * `this` binding and partially applied arguments.
  6359. *
  6360. * @private
  6361. * @param {Function|string} func The function or method name to wrap.
  6362. * @param {number} bitmask The bitmask flags.
  6363. * 1 - `_.bind`
  6364. * 2 - `_.bindKey`
  6365. * 4 - `_.curry` or `_.curryRight` of a bound function
  6366. * 8 - `_.curry`
  6367. * 16 - `_.curryRight`
  6368. * 32 - `_.partial`
  6369. * 64 - `_.partialRight`
  6370. * 128 - `_.rearg`
  6371. * 256 - `_.ary`
  6372. * 512 - `_.flip`
  6373. * @param {*} [thisArg] The `this` binding of `func`.
  6374. * @param {Array} [partials] The arguments to be partially applied.
  6375. * @param {Array} [holders] The `partials` placeholder indexes.
  6376. * @param {Array} [argPos] The argument positions of the new function.
  6377. * @param {number} [ary] The arity cap of `func`.
  6378. * @param {number} [arity] The arity of `func`.
  6379. * @returns {Function} Returns the new wrapped function.
  6380. */
  6381. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  6382. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  6383. if (!isBindKey && typeof func != 'function') {
  6384. throw new TypeError(FUNC_ERROR_TEXT);
  6385. }
  6386. var length = partials ? partials.length : 0;
  6387. if (!length) {
  6388. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  6389. partials = holders = undefined;
  6390. }
  6391. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  6392. arity = arity === undefined ? arity : toInteger(arity);
  6393. length -= holders ? holders.length : 0;
  6394. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  6395. var partialsRight = partials,
  6396. holdersRight = holders;
  6397. partials = holders = undefined;
  6398. }
  6399. var data = isBindKey ? undefined : getData(func);
  6400. var newData = [
  6401. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  6402. argPos, ary, arity
  6403. ];
  6404. if (data) {
  6405. mergeData(newData, data);
  6406. }
  6407. func = newData[0];
  6408. bitmask = newData[1];
  6409. thisArg = newData[2];
  6410. partials = newData[3];
  6411. holders = newData[4];
  6412. arity = newData[9] = newData[9] === undefined
  6413. ? (isBindKey ? 0 : func.length)
  6414. : nativeMax(newData[9] - length, 0);
  6415. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  6416. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  6417. }
  6418. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  6419. var result = createBind(func, bitmask, thisArg);
  6420. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  6421. result = createCurry(func, bitmask, arity);
  6422. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  6423. result = createPartial(func, bitmask, thisArg, partials);
  6424. } else {
  6425. result = createHybrid.apply(undefined, newData);
  6426. }
  6427. var setter = data ? baseSetData : setData;
  6428. return setWrapToString(setter(result, newData), func, bitmask);
  6429. }
  6430. /**
  6431. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  6432. * of source objects to the destination object for all destination properties
  6433. * that resolve to `undefined`.
  6434. *
  6435. * @private
  6436. * @param {*} objValue The destination value.
  6437. * @param {*} srcValue The source value.
  6438. * @param {string} key The key of the property to assign.
  6439. * @param {Object} object The parent object of `objValue`.
  6440. * @returns {*} Returns the value to assign.
  6441. */
  6442. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  6443. if (objValue === undefined ||
  6444. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  6445. return srcValue;
  6446. }
  6447. return objValue;
  6448. }
  6449. /**
  6450. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  6451. * objects into destination objects that are passed thru.
  6452. *
  6453. * @private
  6454. * @param {*} objValue The destination value.
  6455. * @param {*} srcValue The source value.
  6456. * @param {string} key The key of the property to merge.
  6457. * @param {Object} object The parent object of `objValue`.
  6458. * @param {Object} source The parent object of `srcValue`.
  6459. * @param {Object} [stack] Tracks traversed source values and their merged
  6460. * counterparts.
  6461. * @returns {*} Returns the value to assign.
  6462. */
  6463. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  6464. if (isObject(objValue) && isObject(srcValue)) {
  6465. // Recursively merge objects and arrays (susceptible to call stack limits).
  6466. stack.set(srcValue, objValue);
  6467. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6468. stack['delete'](srcValue);
  6469. }
  6470. return objValue;
  6471. }
  6472. /**
  6473. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6474. * objects.
  6475. *
  6476. * @private
  6477. * @param {*} value The value to inspect.
  6478. * @param {string} key The key of the property to inspect.
  6479. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6480. */
  6481. function customOmitClone(value) {
  6482. return isPlainObject(value) ? undefined : value;
  6483. }
  6484. /**
  6485. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6486. * partial deep comparisons.
  6487. *
  6488. * @private
  6489. * @param {Array} array The array to compare.
  6490. * @param {Array} other The other array to compare.
  6491. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6492. * @param {Function} customizer The function to customize comparisons.
  6493. * @param {Function} equalFunc The function to determine equivalents of values.
  6494. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6495. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6496. */
  6497. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6498. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6499. arrLength = array.length,
  6500. othLength = other.length;
  6501. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6502. return false;
  6503. }
  6504. // Check that cyclic values are equal.
  6505. var arrStacked = stack.get(array);
  6506. var othStacked = stack.get(other);
  6507. if (arrStacked && othStacked) {
  6508. return arrStacked == other && othStacked == array;
  6509. }
  6510. var index = -1,
  6511. result = true,
  6512. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6513. stack.set(array, other);
  6514. stack.set(other, array);
  6515. // Ignore non-index properties.
  6516. while (++index < arrLength) {
  6517. var arrValue = array[index],
  6518. othValue = other[index];
  6519. if (customizer) {
  6520. var compared = isPartial
  6521. ? customizer(othValue, arrValue, index, other, array, stack)
  6522. : customizer(arrValue, othValue, index, array, other, stack);
  6523. }
  6524. if (compared !== undefined) {
  6525. if (compared) {
  6526. continue;
  6527. }
  6528. result = false;
  6529. break;
  6530. }
  6531. // Recursively compare arrays (susceptible to call stack limits).
  6532. if (seen) {
  6533. if (!arraySome(other, function(othValue, othIndex) {
  6534. if (!cacheHas(seen, othIndex) &&
  6535. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6536. return seen.push(othIndex);
  6537. }
  6538. })) {
  6539. result = false;
  6540. break;
  6541. }
  6542. } else if (!(
  6543. arrValue === othValue ||
  6544. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6545. )) {
  6546. result = false;
  6547. break;
  6548. }
  6549. }
  6550. stack['delete'](array);
  6551. stack['delete'](other);
  6552. return result;
  6553. }
  6554. /**
  6555. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6556. * the same `toStringTag`.
  6557. *
  6558. * **Note:** This function only supports comparing values with tags of
  6559. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6560. *
  6561. * @private
  6562. * @param {Object} object The object to compare.
  6563. * @param {Object} other The other object to compare.
  6564. * @param {string} tag The `toStringTag` of the objects to compare.
  6565. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6566. * @param {Function} customizer The function to customize comparisons.
  6567. * @param {Function} equalFunc The function to determine equivalents of values.
  6568. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6569. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6570. */
  6571. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6572. switch (tag) {
  6573. case dataViewTag:
  6574. if ((object.byteLength != other.byteLength) ||
  6575. (object.byteOffset != other.byteOffset)) {
  6576. return false;
  6577. }
  6578. object = object.buffer;
  6579. other = other.buffer;
  6580. case arrayBufferTag:
  6581. if ((object.byteLength != other.byteLength) ||
  6582. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6583. return false;
  6584. }
  6585. return true;
  6586. case boolTag:
  6587. case dateTag:
  6588. case numberTag:
  6589. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6590. // Invalid dates are coerced to `NaN`.
  6591. return eq(+object, +other);
  6592. case errorTag:
  6593. return object.name == other.name && object.message == other.message;
  6594. case regexpTag:
  6595. case stringTag:
  6596. // Coerce regexes to strings and treat strings, primitives and objects,
  6597. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6598. // for more details.
  6599. return object == (other + '');
  6600. case mapTag:
  6601. var convert = mapToArray;
  6602. case setTag:
  6603. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6604. convert || (convert = setToArray);
  6605. if (object.size != other.size && !isPartial) {
  6606. return false;
  6607. }
  6608. // Assume cyclic values are equal.
  6609. var stacked = stack.get(object);
  6610. if (stacked) {
  6611. return stacked == other;
  6612. }
  6613. bitmask |= COMPARE_UNORDERED_FLAG;
  6614. // Recursively compare objects (susceptible to call stack limits).
  6615. stack.set(object, other);
  6616. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6617. stack['delete'](object);
  6618. return result;
  6619. case symbolTag:
  6620. if (symbolValueOf) {
  6621. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6622. }
  6623. }
  6624. return false;
  6625. }
  6626. /**
  6627. * A specialized version of `baseIsEqualDeep` for objects with support for
  6628. * partial deep comparisons.
  6629. *
  6630. * @private
  6631. * @param {Object} object The object to compare.
  6632. * @param {Object} other The other object to compare.
  6633. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6634. * @param {Function} customizer The function to customize comparisons.
  6635. * @param {Function} equalFunc The function to determine equivalents of values.
  6636. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6637. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6638. */
  6639. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6640. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6641. objProps = getAllKeys(object),
  6642. objLength = objProps.length,
  6643. othProps = getAllKeys(other),
  6644. othLength = othProps.length;
  6645. if (objLength != othLength && !isPartial) {
  6646. return false;
  6647. }
  6648. var index = objLength;
  6649. while (index--) {
  6650. var key = objProps[index];
  6651. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6652. return false;
  6653. }
  6654. }
  6655. // Check that cyclic values are equal.
  6656. var objStacked = stack.get(object);
  6657. var othStacked = stack.get(other);
  6658. if (objStacked && othStacked) {
  6659. return objStacked == other && othStacked == object;
  6660. }
  6661. var result = true;
  6662. stack.set(object, other);
  6663. stack.set(other, object);
  6664. var skipCtor = isPartial;
  6665. while (++index < objLength) {
  6666. key = objProps[index];
  6667. var objValue = object[key],
  6668. othValue = other[key];
  6669. if (customizer) {
  6670. var compared = isPartial
  6671. ? customizer(othValue, objValue, key, other, object, stack)
  6672. : customizer(objValue, othValue, key, object, other, stack);
  6673. }
  6674. // Recursively compare objects (susceptible to call stack limits).
  6675. if (!(compared === undefined
  6676. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6677. : compared
  6678. )) {
  6679. result = false;
  6680. break;
  6681. }
  6682. skipCtor || (skipCtor = key == 'constructor');
  6683. }
  6684. if (result && !skipCtor) {
  6685. var objCtor = object.constructor,
  6686. othCtor = other.constructor;
  6687. // Non `Object` object instances with different constructors are not equal.
  6688. if (objCtor != othCtor &&
  6689. ('constructor' in object && 'constructor' in other) &&
  6690. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6691. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6692. result = false;
  6693. }
  6694. }
  6695. stack['delete'](object);
  6696. stack['delete'](other);
  6697. return result;
  6698. }
  6699. /**
  6700. * A specialized version of `baseRest` which flattens the rest array.
  6701. *
  6702. * @private
  6703. * @param {Function} func The function to apply a rest parameter to.
  6704. * @returns {Function} Returns the new function.
  6705. */
  6706. function flatRest(func) {
  6707. return setToString(overRest(func, undefined, flatten), func + '');
  6708. }
  6709. /**
  6710. * Creates an array of own enumerable property names and symbols of `object`.
  6711. *
  6712. * @private
  6713. * @param {Object} object The object to query.
  6714. * @returns {Array} Returns the array of property names and symbols.
  6715. */
  6716. function getAllKeys(object) {
  6717. return baseGetAllKeys(object, keys, getSymbols);
  6718. }
  6719. /**
  6720. * Creates an array of own and inherited enumerable property names and
  6721. * symbols of `object`.
  6722. *
  6723. * @private
  6724. * @param {Object} object The object to query.
  6725. * @returns {Array} Returns the array of property names and symbols.
  6726. */
  6727. function getAllKeysIn(object) {
  6728. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6729. }
  6730. /**
  6731. * Gets metadata for `func`.
  6732. *
  6733. * @private
  6734. * @param {Function} func The function to query.
  6735. * @returns {*} Returns the metadata for `func`.
  6736. */
  6737. var getData = !metaMap ? noop : function(func) {
  6738. return metaMap.get(func);
  6739. };
  6740. /**
  6741. * Gets the name of `func`.
  6742. *
  6743. * @private
  6744. * @param {Function} func The function to query.
  6745. * @returns {string} Returns the function name.
  6746. */
  6747. function getFuncName(func) {
  6748. var result = (func.name + ''),
  6749. array = realNames[result],
  6750. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6751. while (length--) {
  6752. var data = array[length],
  6753. otherFunc = data.func;
  6754. if (otherFunc == null || otherFunc == func) {
  6755. return data.name;
  6756. }
  6757. }
  6758. return result;
  6759. }
  6760. /**
  6761. * Gets the argument placeholder value for `func`.
  6762. *
  6763. * @private
  6764. * @param {Function} func The function to inspect.
  6765. * @returns {*} Returns the placeholder value.
  6766. */
  6767. function getHolder(func) {
  6768. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6769. return object.placeholder;
  6770. }
  6771. /**
  6772. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6773. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6774. * If arguments are provided, the chosen function is invoked with them and
  6775. * its result is returned.
  6776. *
  6777. * @private
  6778. * @param {*} [value] The value to convert to an iteratee.
  6779. * @param {number} [arity] The arity of the created iteratee.
  6780. * @returns {Function} Returns the chosen function or its result.
  6781. */
  6782. function getIteratee() {
  6783. var result = lodash.iteratee || iteratee;
  6784. result = result === iteratee ? baseIteratee : result;
  6785. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6786. }
  6787. /**
  6788. * Gets the data for `map`.
  6789. *
  6790. * @private
  6791. * @param {Object} map The map to query.
  6792. * @param {string} key The reference key.
  6793. * @returns {*} Returns the map data.
  6794. */
  6795. function getMapData(map, key) {
  6796. var data = map.__data__;
  6797. return isKeyable(key)
  6798. ? data[typeof key == 'string' ? 'string' : 'hash']
  6799. : data.map;
  6800. }
  6801. /**
  6802. * Gets the property names, values, and compare flags of `object`.
  6803. *
  6804. * @private
  6805. * @param {Object} object The object to query.
  6806. * @returns {Array} Returns the match data of `object`.
  6807. */
  6808. function getMatchData(object) {
  6809. var result = keys(object),
  6810. length = result.length;
  6811. while (length--) {
  6812. var key = result[length],
  6813. value = object[key];
  6814. result[length] = [key, value, isStrictComparable(value)];
  6815. }
  6816. return result;
  6817. }
  6818. /**
  6819. * Gets the native function at `key` of `object`.
  6820. *
  6821. * @private
  6822. * @param {Object} object The object to query.
  6823. * @param {string} key The key of the method to get.
  6824. * @returns {*} Returns the function if it's native, else `undefined`.
  6825. */
  6826. function getNative(object, key) {
  6827. var value = getValue(object, key);
  6828. return baseIsNative(value) ? value : undefined;
  6829. }
  6830. /**
  6831. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6832. *
  6833. * @private
  6834. * @param {*} value The value to query.
  6835. * @returns {string} Returns the raw `toStringTag`.
  6836. */
  6837. function getRawTag(value) {
  6838. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6839. tag = value[symToStringTag];
  6840. try {
  6841. value[symToStringTag] = undefined;
  6842. var unmasked = true;
  6843. } catch (e) {}
  6844. var result = nativeObjectToString.call(value);
  6845. if (unmasked) {
  6846. if (isOwn) {
  6847. value[symToStringTag] = tag;
  6848. } else {
  6849. delete value[symToStringTag];
  6850. }
  6851. }
  6852. return result;
  6853. }
  6854. /**
  6855. * Creates an array of the own enumerable symbols of `object`.
  6856. *
  6857. * @private
  6858. * @param {Object} object The object to query.
  6859. * @returns {Array} Returns the array of symbols.
  6860. */
  6861. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6862. if (object == null) {
  6863. return [];
  6864. }
  6865. object = Object(object);
  6866. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6867. return propertyIsEnumerable.call(object, symbol);
  6868. });
  6869. };
  6870. /**
  6871. * Creates an array of the own and inherited enumerable symbols of `object`.
  6872. *
  6873. * @private
  6874. * @param {Object} object The object to query.
  6875. * @returns {Array} Returns the array of symbols.
  6876. */
  6877. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6878. var result = [];
  6879. while (object) {
  6880. arrayPush(result, getSymbols(object));
  6881. object = getPrototype(object);
  6882. }
  6883. return result;
  6884. };
  6885. /**
  6886. * Gets the `toStringTag` of `value`.
  6887. *
  6888. * @private
  6889. * @param {*} value The value to query.
  6890. * @returns {string} Returns the `toStringTag`.
  6891. */
  6892. var getTag = baseGetTag;
  6893. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6894. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6895. (Map && getTag(new Map) != mapTag) ||
  6896. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6897. (Set && getTag(new Set) != setTag) ||
  6898. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6899. getTag = function(value) {
  6900. var result = baseGetTag(value),
  6901. Ctor = result == objectTag ? value.constructor : undefined,
  6902. ctorString = Ctor ? toSource(Ctor) : '';
  6903. if (ctorString) {
  6904. switch (ctorString) {
  6905. case dataViewCtorString: return dataViewTag;
  6906. case mapCtorString: return mapTag;
  6907. case promiseCtorString: return promiseTag;
  6908. case setCtorString: return setTag;
  6909. case weakMapCtorString: return weakMapTag;
  6910. }
  6911. }
  6912. return result;
  6913. };
  6914. }
  6915. /**
  6916. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6917. *
  6918. * @private
  6919. * @param {number} start The start of the view.
  6920. * @param {number} end The end of the view.
  6921. * @param {Array} transforms The transformations to apply to the view.
  6922. * @returns {Object} Returns an object containing the `start` and `end`
  6923. * positions of the view.
  6924. */
  6925. function getView(start, end, transforms) {
  6926. var index = -1,
  6927. length = transforms.length;
  6928. while (++index < length) {
  6929. var data = transforms[index],
  6930. size = data.size;
  6931. switch (data.type) {
  6932. case 'drop': start += size; break;
  6933. case 'dropRight': end -= size; break;
  6934. case 'take': end = nativeMin(end, start + size); break;
  6935. case 'takeRight': start = nativeMax(start, end - size); break;
  6936. }
  6937. }
  6938. return { 'start': start, 'end': end };
  6939. }
  6940. /**
  6941. * Extracts wrapper details from the `source` body comment.
  6942. *
  6943. * @private
  6944. * @param {string} source The source to inspect.
  6945. * @returns {Array} Returns the wrapper details.
  6946. */
  6947. function getWrapDetails(source) {
  6948. var match = source.match(reWrapDetails);
  6949. return match ? match[1].split(reSplitDetails) : [];
  6950. }
  6951. /**
  6952. * Checks if `path` exists on `object`.
  6953. *
  6954. * @private
  6955. * @param {Object} object The object to query.
  6956. * @param {Array|string} path The path to check.
  6957. * @param {Function} hasFunc The function to check properties.
  6958. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6959. */
  6960. function hasPath(object, path, hasFunc) {
  6961. path = castPath(path, object);
  6962. var index = -1,
  6963. length = path.length,
  6964. result = false;
  6965. while (++index < length) {
  6966. var key = toKey(path[index]);
  6967. if (!(result = object != null && hasFunc(object, key))) {
  6968. break;
  6969. }
  6970. object = object[key];
  6971. }
  6972. if (result || ++index != length) {
  6973. return result;
  6974. }
  6975. length = object == null ? 0 : object.length;
  6976. return !!length && isLength(length) && isIndex(key, length) &&
  6977. (isArray(object) || isArguments(object));
  6978. }
  6979. /**
  6980. * Initializes an array clone.
  6981. *
  6982. * @private
  6983. * @param {Array} array The array to clone.
  6984. * @returns {Array} Returns the initialized clone.
  6985. */
  6986. function initCloneArray(array) {
  6987. var length = array.length,
  6988. result = new array.constructor(length);
  6989. // Add properties assigned by `RegExp#exec`.
  6990. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6991. result.index = array.index;
  6992. result.input = array.input;
  6993. }
  6994. return result;
  6995. }
  6996. /**
  6997. * Initializes an object clone.
  6998. *
  6999. * @private
  7000. * @param {Object} object The object to clone.
  7001. * @returns {Object} Returns the initialized clone.
  7002. */
  7003. function initCloneObject(object) {
  7004. return (typeof object.constructor == 'function' && !isPrototype(object))
  7005. ? baseCreate(getPrototype(object))
  7006. : {};
  7007. }
  7008. /**
  7009. * Initializes an object clone based on its `toStringTag`.
  7010. *
  7011. * **Note:** This function only supports cloning values with tags of
  7012. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  7013. *
  7014. * @private
  7015. * @param {Object} object The object to clone.
  7016. * @param {string} tag The `toStringTag` of the object to clone.
  7017. * @param {boolean} [isDeep] Specify a deep clone.
  7018. * @returns {Object} Returns the initialized clone.
  7019. */
  7020. function initCloneByTag(object, tag, isDeep) {
  7021. var Ctor = object.constructor;
  7022. switch (tag) {
  7023. case arrayBufferTag:
  7024. return cloneArrayBuffer(object);
  7025. case boolTag:
  7026. case dateTag:
  7027. return new Ctor(+object);
  7028. case dataViewTag:
  7029. return cloneDataView(object, isDeep);
  7030. case float32Tag: case float64Tag:
  7031. case int8Tag: case int16Tag: case int32Tag:
  7032. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  7033. return cloneTypedArray(object, isDeep);
  7034. case mapTag:
  7035. return new Ctor;
  7036. case numberTag:
  7037. case stringTag:
  7038. return new Ctor(object);
  7039. case regexpTag:
  7040. return cloneRegExp(object);
  7041. case setTag:
  7042. return new Ctor;
  7043. case symbolTag:
  7044. return cloneSymbol(object);
  7045. }
  7046. }
  7047. /**
  7048. * Inserts wrapper `details` in a comment at the top of the `source` body.
  7049. *
  7050. * @private
  7051. * @param {string} source The source to modify.
  7052. * @returns {Array} details The details to insert.
  7053. * @returns {string} Returns the modified source.
  7054. */
  7055. function insertWrapDetails(source, details) {
  7056. var length = details.length;
  7057. if (!length) {
  7058. return source;
  7059. }
  7060. var lastIndex = length - 1;
  7061. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  7062. details = details.join(length > 2 ? ', ' : ' ');
  7063. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  7064. }
  7065. /**
  7066. * Checks if `value` is a flattenable `arguments` object or array.
  7067. *
  7068. * @private
  7069. * @param {*} value The value to check.
  7070. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  7071. */
  7072. function isFlattenable(value) {
  7073. return isArray(value) || isArguments(value) ||
  7074. !!(spreadableSymbol && value && value[spreadableSymbol]);
  7075. }
  7076. /**
  7077. * Checks if `value` is a valid array-like index.
  7078. *
  7079. * @private
  7080. * @param {*} value The value to check.
  7081. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7082. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7083. */
  7084. function isIndex(value, length) {
  7085. var type = typeof value;
  7086. length = length == null ? MAX_SAFE_INTEGER : length;
  7087. return !!length &&
  7088. (type == 'number' ||
  7089. (type != 'symbol' && reIsUint.test(value))) &&
  7090. (value > -1 && value % 1 == 0 && value < length);
  7091. }
  7092. /**
  7093. * Checks if the given arguments are from an iteratee call.
  7094. *
  7095. * @private
  7096. * @param {*} value The potential iteratee value argument.
  7097. * @param {*} index The potential iteratee index or key argument.
  7098. * @param {*} object The potential iteratee object argument.
  7099. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  7100. * else `false`.
  7101. */
  7102. function isIterateeCall(value, index, object) {
  7103. if (!isObject(object)) {
  7104. return false;
  7105. }
  7106. var type = typeof index;
  7107. if (type == 'number'
  7108. ? (isArrayLike(object) && isIndex(index, object.length))
  7109. : (type == 'string' && index in object)
  7110. ) {
  7111. return eq(object[index], value);
  7112. }
  7113. return false;
  7114. }
  7115. /**
  7116. * Checks if `value` is a property name and not a property path.
  7117. *
  7118. * @private
  7119. * @param {*} value The value to check.
  7120. * @param {Object} [object] The object to query keys on.
  7121. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  7122. */
  7123. function isKey(value, object) {
  7124. if (isArray(value)) {
  7125. return false;
  7126. }
  7127. var type = typeof value;
  7128. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  7129. value == null || isSymbol(value)) {
  7130. return true;
  7131. }
  7132. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  7133. (object != null && value in Object(object));
  7134. }
  7135. /**
  7136. * Checks if `value` is suitable for use as unique object key.
  7137. *
  7138. * @private
  7139. * @param {*} value The value to check.
  7140. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  7141. */
  7142. function isKeyable(value) {
  7143. var type = typeof value;
  7144. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  7145. ? (value !== '__proto__')
  7146. : (value === null);
  7147. }
  7148. /**
  7149. * Checks if `func` has a lazy counterpart.
  7150. *
  7151. * @private
  7152. * @param {Function} func The function to check.
  7153. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  7154. * else `false`.
  7155. */
  7156. function isLaziable(func) {
  7157. var funcName = getFuncName(func),
  7158. other = lodash[funcName];
  7159. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  7160. return false;
  7161. }
  7162. if (func === other) {
  7163. return true;
  7164. }
  7165. var data = getData(other);
  7166. return !!data && func === data[0];
  7167. }
  7168. /**
  7169. * Checks if `func` has its source masked.
  7170. *
  7171. * @private
  7172. * @param {Function} func The function to check.
  7173. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  7174. */
  7175. function isMasked(func) {
  7176. return !!maskSrcKey && (maskSrcKey in func);
  7177. }
  7178. /**
  7179. * Checks if `func` is capable of being masked.
  7180. *
  7181. * @private
  7182. * @param {*} value The value to check.
  7183. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  7184. */
  7185. var isMaskable = coreJsData ? isFunction : stubFalse;
  7186. /**
  7187. * Checks if `value` is likely a prototype object.
  7188. *
  7189. * @private
  7190. * @param {*} value The value to check.
  7191. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7192. */
  7193. function isPrototype(value) {
  7194. var Ctor = value && value.constructor,
  7195. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  7196. return value === proto;
  7197. }
  7198. /**
  7199. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  7200. *
  7201. * @private
  7202. * @param {*} value The value to check.
  7203. * @returns {boolean} Returns `true` if `value` if suitable for strict
  7204. * equality comparisons, else `false`.
  7205. */
  7206. function isStrictComparable(value) {
  7207. return value === value && !isObject(value);
  7208. }
  7209. /**
  7210. * A specialized version of `matchesProperty` for source values suitable
  7211. * for strict equality comparisons, i.e. `===`.
  7212. *
  7213. * @private
  7214. * @param {string} key The key of the property to get.
  7215. * @param {*} srcValue The value to match.
  7216. * @returns {Function} Returns the new spec function.
  7217. */
  7218. function matchesStrictComparable(key, srcValue) {
  7219. return function(object) {
  7220. if (object == null) {
  7221. return false;
  7222. }
  7223. return object[key] === srcValue &&
  7224. (srcValue !== undefined || (key in Object(object)));
  7225. };
  7226. }
  7227. /**
  7228. * A specialized version of `_.memoize` which clears the memoized function's
  7229. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  7230. *
  7231. * @private
  7232. * @param {Function} func The function to have its output memoized.
  7233. * @returns {Function} Returns the new memoized function.
  7234. */
  7235. function memoizeCapped(func) {
  7236. var result = memoize(func, function(key) {
  7237. if (cache.size === MAX_MEMOIZE_SIZE) {
  7238. cache.clear();
  7239. }
  7240. return key;
  7241. });
  7242. var cache = result.cache;
  7243. return result;
  7244. }
  7245. /**
  7246. * Merges the function metadata of `source` into `data`.
  7247. *
  7248. * Merging metadata reduces the number of wrappers used to invoke a function.
  7249. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  7250. * may be applied regardless of execution order. Methods like `_.ary` and
  7251. * `_.rearg` modify function arguments, making the order in which they are
  7252. * executed important, preventing the merging of metadata. However, we make
  7253. * an exception for a safe combined case where curried functions have `_.ary`
  7254. * and or `_.rearg` applied.
  7255. *
  7256. * @private
  7257. * @param {Array} data The destination metadata.
  7258. * @param {Array} source The source metadata.
  7259. * @returns {Array} Returns `data`.
  7260. */
  7261. function mergeData(data, source) {
  7262. var bitmask = data[1],
  7263. srcBitmask = source[1],
  7264. newBitmask = bitmask | srcBitmask,
  7265. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  7266. var isCombo =
  7267. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  7268. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  7269. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  7270. // Exit early if metadata can't be merged.
  7271. if (!(isCommon || isCombo)) {
  7272. return data;
  7273. }
  7274. // Use source `thisArg` if available.
  7275. if (srcBitmask & WRAP_BIND_FLAG) {
  7276. data[2] = source[2];
  7277. // Set when currying a bound function.
  7278. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  7279. }
  7280. // Compose partial arguments.
  7281. var value = source[3];
  7282. if (value) {
  7283. var partials = data[3];
  7284. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  7285. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  7286. }
  7287. // Compose partial right arguments.
  7288. value = source[5];
  7289. if (value) {
  7290. partials = data[5];
  7291. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  7292. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  7293. }
  7294. // Use source `argPos` if available.
  7295. value = source[7];
  7296. if (value) {
  7297. data[7] = value;
  7298. }
  7299. // Use source `ary` if it's smaller.
  7300. if (srcBitmask & WRAP_ARY_FLAG) {
  7301. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  7302. }
  7303. // Use source `arity` if one is not provided.
  7304. if (data[9] == null) {
  7305. data[9] = source[9];
  7306. }
  7307. // Use source `func` and merge bitmasks.
  7308. data[0] = source[0];
  7309. data[1] = newBitmask;
  7310. return data;
  7311. }
  7312. /**
  7313. * This function is like
  7314. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7315. * except that it includes inherited enumerable properties.
  7316. *
  7317. * @private
  7318. * @param {Object} object The object to query.
  7319. * @returns {Array} Returns the array of property names.
  7320. */
  7321. function nativeKeysIn(object) {
  7322. var result = [];
  7323. if (object != null) {
  7324. for (var key in Object(object)) {
  7325. result.push(key);
  7326. }
  7327. }
  7328. return result;
  7329. }
  7330. /**
  7331. * Converts `value` to a string using `Object.prototype.toString`.
  7332. *
  7333. * @private
  7334. * @param {*} value The value to convert.
  7335. * @returns {string} Returns the converted string.
  7336. */
  7337. function objectToString(value) {
  7338. return nativeObjectToString.call(value);
  7339. }
  7340. /**
  7341. * A specialized version of `baseRest` which transforms the rest array.
  7342. *
  7343. * @private
  7344. * @param {Function} func The function to apply a rest parameter to.
  7345. * @param {number} [start=func.length-1] The start position of the rest parameter.
  7346. * @param {Function} transform The rest array transform.
  7347. * @returns {Function} Returns the new function.
  7348. */
  7349. function overRest(func, start, transform) {
  7350. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  7351. return function() {
  7352. var args = arguments,
  7353. index = -1,
  7354. length = nativeMax(args.length - start, 0),
  7355. array = Array(length);
  7356. while (++index < length) {
  7357. array[index] = args[start + index];
  7358. }
  7359. index = -1;
  7360. var otherArgs = Array(start + 1);
  7361. while (++index < start) {
  7362. otherArgs[index] = args[index];
  7363. }
  7364. otherArgs[start] = transform(array);
  7365. return apply(func, this, otherArgs);
  7366. };
  7367. }
  7368. /**
  7369. * Gets the parent value at `path` of `object`.
  7370. *
  7371. * @private
  7372. * @param {Object} object The object to query.
  7373. * @param {Array} path The path to get the parent value of.
  7374. * @returns {*} Returns the parent value.
  7375. */
  7376. function parent(object, path) {
  7377. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  7378. }
  7379. /**
  7380. * Reorder `array` according to the specified indexes where the element at
  7381. * the first index is assigned as the first element, the element at
  7382. * the second index is assigned as the second element, and so on.
  7383. *
  7384. * @private
  7385. * @param {Array} array The array to reorder.
  7386. * @param {Array} indexes The arranged array indexes.
  7387. * @returns {Array} Returns `array`.
  7388. */
  7389. function reorder(array, indexes) {
  7390. var arrLength = array.length,
  7391. length = nativeMin(indexes.length, arrLength),
  7392. oldArray = copyArray(array);
  7393. while (length--) {
  7394. var index = indexes[length];
  7395. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  7396. }
  7397. return array;
  7398. }
  7399. /**
  7400. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  7401. *
  7402. * @private
  7403. * @param {Object} object The object to query.
  7404. * @param {string} key The key of the property to get.
  7405. * @returns {*} Returns the property value.
  7406. */
  7407. function safeGet(object, key) {
  7408. if (key === 'constructor' && typeof object[key] === 'function') {
  7409. return;
  7410. }
  7411. if (key == '__proto__') {
  7412. return;
  7413. }
  7414. return object[key];
  7415. }
  7416. /**
  7417. * Sets metadata for `func`.
  7418. *
  7419. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  7420. * period of time, it will trip its breaker and transition to an identity
  7421. * function to avoid garbage collection pauses in V8. See
  7422. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  7423. * for more details.
  7424. *
  7425. * @private
  7426. * @param {Function} func The function to associate metadata with.
  7427. * @param {*} data The metadata.
  7428. * @returns {Function} Returns `func`.
  7429. */
  7430. var setData = shortOut(baseSetData);
  7431. /**
  7432. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  7433. *
  7434. * @private
  7435. * @param {Function} func The function to delay.
  7436. * @param {number} wait The number of milliseconds to delay invocation.
  7437. * @returns {number|Object} Returns the timer id or timeout object.
  7438. */
  7439. var setTimeout = ctxSetTimeout || function(func, wait) {
  7440. return root.setTimeout(func, wait);
  7441. };
  7442. /**
  7443. * Sets the `toString` method of `func` to return `string`.
  7444. *
  7445. * @private
  7446. * @param {Function} func The function to modify.
  7447. * @param {Function} string The `toString` result.
  7448. * @returns {Function} Returns `func`.
  7449. */
  7450. var setToString = shortOut(baseSetToString);
  7451. /**
  7452. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  7453. * with wrapper details in a comment at the top of the source body.
  7454. *
  7455. * @private
  7456. * @param {Function} wrapper The function to modify.
  7457. * @param {Function} reference The reference function.
  7458. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7459. * @returns {Function} Returns `wrapper`.
  7460. */
  7461. function setWrapToString(wrapper, reference, bitmask) {
  7462. var source = (reference + '');
  7463. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  7464. }
  7465. /**
  7466. * Creates a function that'll short out and invoke `identity` instead
  7467. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  7468. * milliseconds.
  7469. *
  7470. * @private
  7471. * @param {Function} func The function to restrict.
  7472. * @returns {Function} Returns the new shortable function.
  7473. */
  7474. function shortOut(func) {
  7475. var count = 0,
  7476. lastCalled = 0;
  7477. return function() {
  7478. var stamp = nativeNow(),
  7479. remaining = HOT_SPAN - (stamp - lastCalled);
  7480. lastCalled = stamp;
  7481. if (remaining > 0) {
  7482. if (++count >= HOT_COUNT) {
  7483. return arguments[0];
  7484. }
  7485. } else {
  7486. count = 0;
  7487. }
  7488. return func.apply(undefined, arguments);
  7489. };
  7490. }
  7491. /**
  7492. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7493. *
  7494. * @private
  7495. * @param {Array} array The array to shuffle.
  7496. * @param {number} [size=array.length] The size of `array`.
  7497. * @returns {Array} Returns `array`.
  7498. */
  7499. function shuffleSelf(array, size) {
  7500. var index = -1,
  7501. length = array.length,
  7502. lastIndex = length - 1;
  7503. size = size === undefined ? length : size;
  7504. while (++index < size) {
  7505. var rand = baseRandom(index, lastIndex),
  7506. value = array[rand];
  7507. array[rand] = array[index];
  7508. array[index] = value;
  7509. }
  7510. array.length = size;
  7511. return array;
  7512. }
  7513. /**
  7514. * Converts `string` to a property path array.
  7515. *
  7516. * @private
  7517. * @param {string} string The string to convert.
  7518. * @returns {Array} Returns the property path array.
  7519. */
  7520. var stringToPath = memoizeCapped(function(string) {
  7521. var result = [];
  7522. if (string.charCodeAt(0) === 46 /* . */) {
  7523. result.push('');
  7524. }
  7525. string.replace(rePropName, function(match, number, quote, subString) {
  7526. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7527. });
  7528. return result;
  7529. });
  7530. /**
  7531. * Converts `value` to a string key if it's not a string or symbol.
  7532. *
  7533. * @private
  7534. * @param {*} value The value to inspect.
  7535. * @returns {string|symbol} Returns the key.
  7536. */
  7537. function toKey(value) {
  7538. if (typeof value == 'string' || isSymbol(value)) {
  7539. return value;
  7540. }
  7541. var result = (value + '');
  7542. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7543. }
  7544. /**
  7545. * Converts `func` to its source code.
  7546. *
  7547. * @private
  7548. * @param {Function} func The function to convert.
  7549. * @returns {string} Returns the source code.
  7550. */
  7551. function toSource(func) {
  7552. if (func != null) {
  7553. try {
  7554. return funcToString.call(func);
  7555. } catch (e) {}
  7556. try {
  7557. return (func + '');
  7558. } catch (e) {}
  7559. }
  7560. return '';
  7561. }
  7562. /**
  7563. * Updates wrapper `details` based on `bitmask` flags.
  7564. *
  7565. * @private
  7566. * @returns {Array} details The details to modify.
  7567. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7568. * @returns {Array} Returns `details`.
  7569. */
  7570. function updateWrapDetails(details, bitmask) {
  7571. arrayEach(wrapFlags, function(pair) {
  7572. var value = '_.' + pair[0];
  7573. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7574. details.push(value);
  7575. }
  7576. });
  7577. return details.sort();
  7578. }
  7579. /**
  7580. * Creates a clone of `wrapper`.
  7581. *
  7582. * @private
  7583. * @param {Object} wrapper The wrapper to clone.
  7584. * @returns {Object} Returns the cloned wrapper.
  7585. */
  7586. function wrapperClone(wrapper) {
  7587. if (wrapper instanceof LazyWrapper) {
  7588. return wrapper.clone();
  7589. }
  7590. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7591. result.__actions__ = copyArray(wrapper.__actions__);
  7592. result.__index__ = wrapper.__index__;
  7593. result.__values__ = wrapper.__values__;
  7594. return result;
  7595. }
  7596. /*------------------------------------------------------------------------*/
  7597. /**
  7598. * Creates an array of elements split into groups the length of `size`.
  7599. * If `array` can't be split evenly, the final chunk will be the remaining
  7600. * elements.
  7601. *
  7602. * @static
  7603. * @memberOf _
  7604. * @since 3.0.0
  7605. * @category Array
  7606. * @param {Array} array The array to process.
  7607. * @param {number} [size=1] The length of each chunk
  7608. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7609. * @returns {Array} Returns the new array of chunks.
  7610. * @example
  7611. *
  7612. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7613. * // => [['a', 'b'], ['c', 'd']]
  7614. *
  7615. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7616. * // => [['a', 'b', 'c'], ['d']]
  7617. */
  7618. function chunk(array, size, guard) {
  7619. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7620. size = 1;
  7621. } else {
  7622. size = nativeMax(toInteger(size), 0);
  7623. }
  7624. var length = array == null ? 0 : array.length;
  7625. if (!length || size < 1) {
  7626. return [];
  7627. }
  7628. var index = 0,
  7629. resIndex = 0,
  7630. result = Array(nativeCeil(length / size));
  7631. while (index < length) {
  7632. result[resIndex++] = baseSlice(array, index, (index += size));
  7633. }
  7634. return result;
  7635. }
  7636. /**
  7637. * Creates an array with all falsey values removed. The values `false`, `null`,
  7638. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7639. *
  7640. * @static
  7641. * @memberOf _
  7642. * @since 0.1.0
  7643. * @category Array
  7644. * @param {Array} array The array to compact.
  7645. * @returns {Array} Returns the new array of filtered values.
  7646. * @example
  7647. *
  7648. * _.compact([0, 1, false, 2, '', 3]);
  7649. * // => [1, 2, 3]
  7650. */
  7651. function compact(array) {
  7652. var index = -1,
  7653. length = array == null ? 0 : array.length,
  7654. resIndex = 0,
  7655. result = [];
  7656. while (++index < length) {
  7657. var value = array[index];
  7658. if (value) {
  7659. result[resIndex++] = value;
  7660. }
  7661. }
  7662. return result;
  7663. }
  7664. /**
  7665. * Creates a new array concatenating `array` with any additional arrays
  7666. * and/or values.
  7667. *
  7668. * @static
  7669. * @memberOf _
  7670. * @since 4.0.0
  7671. * @category Array
  7672. * @param {Array} array The array to concatenate.
  7673. * @param {...*} [values] The values to concatenate.
  7674. * @returns {Array} Returns the new concatenated array.
  7675. * @example
  7676. *
  7677. * var array = [1];
  7678. * var other = _.concat(array, 2, [3], [[4]]);
  7679. *
  7680. * console.log(other);
  7681. * // => [1, 2, 3, [4]]
  7682. *
  7683. * console.log(array);
  7684. * // => [1]
  7685. */
  7686. function concat() {
  7687. var length = arguments.length;
  7688. if (!length) {
  7689. return [];
  7690. }
  7691. var args = Array(length - 1),
  7692. array = arguments[0],
  7693. index = length;
  7694. while (index--) {
  7695. args[index - 1] = arguments[index];
  7696. }
  7697. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7698. }
  7699. /**
  7700. * Creates an array of `array` values not included in the other given arrays
  7701. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7702. * for equality comparisons. The order and references of result values are
  7703. * determined by the first array.
  7704. *
  7705. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7706. *
  7707. * @static
  7708. * @memberOf _
  7709. * @since 0.1.0
  7710. * @category Array
  7711. * @param {Array} array The array to inspect.
  7712. * @param {...Array} [values] The values to exclude.
  7713. * @returns {Array} Returns the new array of filtered values.
  7714. * @see _.without, _.xor
  7715. * @example
  7716. *
  7717. * _.difference([2, 1], [2, 3]);
  7718. * // => [1]
  7719. */
  7720. var difference = baseRest(function(array, values) {
  7721. return isArrayLikeObject(array)
  7722. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7723. : [];
  7724. });
  7725. /**
  7726. * This method is like `_.difference` except that it accepts `iteratee` which
  7727. * is invoked for each element of `array` and `values` to generate the criterion
  7728. * by which they're compared. The order and references of result values are
  7729. * determined by the first array. The iteratee is invoked with one argument:
  7730. * (value).
  7731. *
  7732. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7733. *
  7734. * @static
  7735. * @memberOf _
  7736. * @since 4.0.0
  7737. * @category Array
  7738. * @param {Array} array The array to inspect.
  7739. * @param {...Array} [values] The values to exclude.
  7740. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7741. * @returns {Array} Returns the new array of filtered values.
  7742. * @example
  7743. *
  7744. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7745. * // => [1.2]
  7746. *
  7747. * // The `_.property` iteratee shorthand.
  7748. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7749. * // => [{ 'x': 2 }]
  7750. */
  7751. var differenceBy = baseRest(function(array, values) {
  7752. var iteratee = last(values);
  7753. if (isArrayLikeObject(iteratee)) {
  7754. iteratee = undefined;
  7755. }
  7756. return isArrayLikeObject(array)
  7757. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7758. : [];
  7759. });
  7760. /**
  7761. * This method is like `_.difference` except that it accepts `comparator`
  7762. * which is invoked to compare elements of `array` to `values`. The order and
  7763. * references of result values are determined by the first array. The comparator
  7764. * is invoked with two arguments: (arrVal, othVal).
  7765. *
  7766. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7767. *
  7768. * @static
  7769. * @memberOf _
  7770. * @since 4.0.0
  7771. * @category Array
  7772. * @param {Array} array The array to inspect.
  7773. * @param {...Array} [values] The values to exclude.
  7774. * @param {Function} [comparator] The comparator invoked per element.
  7775. * @returns {Array} Returns the new array of filtered values.
  7776. * @example
  7777. *
  7778. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7779. *
  7780. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7781. * // => [{ 'x': 2, 'y': 1 }]
  7782. */
  7783. var differenceWith = baseRest(function(array, values) {
  7784. var comparator = last(values);
  7785. if (isArrayLikeObject(comparator)) {
  7786. comparator = undefined;
  7787. }
  7788. return isArrayLikeObject(array)
  7789. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7790. : [];
  7791. });
  7792. /**
  7793. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7794. *
  7795. * @static
  7796. * @memberOf _
  7797. * @since 0.5.0
  7798. * @category Array
  7799. * @param {Array} array The array to query.
  7800. * @param {number} [n=1] The number of elements to drop.
  7801. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7802. * @returns {Array} Returns the slice of `array`.
  7803. * @example
  7804. *
  7805. * _.drop([1, 2, 3]);
  7806. * // => [2, 3]
  7807. *
  7808. * _.drop([1, 2, 3], 2);
  7809. * // => [3]
  7810. *
  7811. * _.drop([1, 2, 3], 5);
  7812. * // => []
  7813. *
  7814. * _.drop([1, 2, 3], 0);
  7815. * // => [1, 2, 3]
  7816. */
  7817. function drop(array, n, guard) {
  7818. var length = array == null ? 0 : array.length;
  7819. if (!length) {
  7820. return [];
  7821. }
  7822. n = (guard || n === undefined) ? 1 : toInteger(n);
  7823. return baseSlice(array, n < 0 ? 0 : n, length);
  7824. }
  7825. /**
  7826. * Creates a slice of `array` with `n` elements dropped from the end.
  7827. *
  7828. * @static
  7829. * @memberOf _
  7830. * @since 3.0.0
  7831. * @category Array
  7832. * @param {Array} array The array to query.
  7833. * @param {number} [n=1] The number of elements to drop.
  7834. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7835. * @returns {Array} Returns the slice of `array`.
  7836. * @example
  7837. *
  7838. * _.dropRight([1, 2, 3]);
  7839. * // => [1, 2]
  7840. *
  7841. * _.dropRight([1, 2, 3], 2);
  7842. * // => [1]
  7843. *
  7844. * _.dropRight([1, 2, 3], 5);
  7845. * // => []
  7846. *
  7847. * _.dropRight([1, 2, 3], 0);
  7848. * // => [1, 2, 3]
  7849. */
  7850. function dropRight(array, n, guard) {
  7851. var length = array == null ? 0 : array.length;
  7852. if (!length) {
  7853. return [];
  7854. }
  7855. n = (guard || n === undefined) ? 1 : toInteger(n);
  7856. n = length - n;
  7857. return baseSlice(array, 0, n < 0 ? 0 : n);
  7858. }
  7859. /**
  7860. * Creates a slice of `array` excluding elements dropped from the end.
  7861. * Elements are dropped until `predicate` returns falsey. The predicate is
  7862. * invoked with three arguments: (value, index, array).
  7863. *
  7864. * @static
  7865. * @memberOf _
  7866. * @since 3.0.0
  7867. * @category Array
  7868. * @param {Array} array The array to query.
  7869. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7870. * @returns {Array} Returns the slice of `array`.
  7871. * @example
  7872. *
  7873. * var users = [
  7874. * { 'user': 'barney', 'active': true },
  7875. * { 'user': 'fred', 'active': false },
  7876. * { 'user': 'pebbles', 'active': false }
  7877. * ];
  7878. *
  7879. * _.dropRightWhile(users, function(o) { return !o.active; });
  7880. * // => objects for ['barney']
  7881. *
  7882. * // The `_.matches` iteratee shorthand.
  7883. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7884. * // => objects for ['barney', 'fred']
  7885. *
  7886. * // The `_.matchesProperty` iteratee shorthand.
  7887. * _.dropRightWhile(users, ['active', false]);
  7888. * // => objects for ['barney']
  7889. *
  7890. * // The `_.property` iteratee shorthand.
  7891. * _.dropRightWhile(users, 'active');
  7892. * // => objects for ['barney', 'fred', 'pebbles']
  7893. */
  7894. function dropRightWhile(array, predicate) {
  7895. return (array && array.length)
  7896. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7897. : [];
  7898. }
  7899. /**
  7900. * Creates a slice of `array` excluding elements dropped from the beginning.
  7901. * Elements are dropped until `predicate` returns falsey. The predicate is
  7902. * invoked with three arguments: (value, index, array).
  7903. *
  7904. * @static
  7905. * @memberOf _
  7906. * @since 3.0.0
  7907. * @category Array
  7908. * @param {Array} array The array to query.
  7909. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7910. * @returns {Array} Returns the slice of `array`.
  7911. * @example
  7912. *
  7913. * var users = [
  7914. * { 'user': 'barney', 'active': false },
  7915. * { 'user': 'fred', 'active': false },
  7916. * { 'user': 'pebbles', 'active': true }
  7917. * ];
  7918. *
  7919. * _.dropWhile(users, function(o) { return !o.active; });
  7920. * // => objects for ['pebbles']
  7921. *
  7922. * // The `_.matches` iteratee shorthand.
  7923. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7924. * // => objects for ['fred', 'pebbles']
  7925. *
  7926. * // The `_.matchesProperty` iteratee shorthand.
  7927. * _.dropWhile(users, ['active', false]);
  7928. * // => objects for ['pebbles']
  7929. *
  7930. * // The `_.property` iteratee shorthand.
  7931. * _.dropWhile(users, 'active');
  7932. * // => objects for ['barney', 'fred', 'pebbles']
  7933. */
  7934. function dropWhile(array, predicate) {
  7935. return (array && array.length)
  7936. ? baseWhile(array, getIteratee(predicate, 3), true)
  7937. : [];
  7938. }
  7939. /**
  7940. * Fills elements of `array` with `value` from `start` up to, but not
  7941. * including, `end`.
  7942. *
  7943. * **Note:** This method mutates `array`.
  7944. *
  7945. * @static
  7946. * @memberOf _
  7947. * @since 3.2.0
  7948. * @category Array
  7949. * @param {Array} array The array to fill.
  7950. * @param {*} value The value to fill `array` with.
  7951. * @param {number} [start=0] The start position.
  7952. * @param {number} [end=array.length] The end position.
  7953. * @returns {Array} Returns `array`.
  7954. * @example
  7955. *
  7956. * var array = [1, 2, 3];
  7957. *
  7958. * _.fill(array, 'a');
  7959. * console.log(array);
  7960. * // => ['a', 'a', 'a']
  7961. *
  7962. * _.fill(Array(3), 2);
  7963. * // => [2, 2, 2]
  7964. *
  7965. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7966. * // => [4, '*', '*', 10]
  7967. */
  7968. function fill(array, value, start, end) {
  7969. var length = array == null ? 0 : array.length;
  7970. if (!length) {
  7971. return [];
  7972. }
  7973. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7974. start = 0;
  7975. end = length;
  7976. }
  7977. return baseFill(array, value, start, end);
  7978. }
  7979. /**
  7980. * This method is like `_.find` except that it returns the index of the first
  7981. * element `predicate` returns truthy for instead of the element itself.
  7982. *
  7983. * @static
  7984. * @memberOf _
  7985. * @since 1.1.0
  7986. * @category Array
  7987. * @param {Array} array The array to inspect.
  7988. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7989. * @param {number} [fromIndex=0] The index to search from.
  7990. * @returns {number} Returns the index of the found element, else `-1`.
  7991. * @example
  7992. *
  7993. * var users = [
  7994. * { 'user': 'barney', 'active': false },
  7995. * { 'user': 'fred', 'active': false },
  7996. * { 'user': 'pebbles', 'active': true }
  7997. * ];
  7998. *
  7999. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  8000. * // => 0
  8001. *
  8002. * // The `_.matches` iteratee shorthand.
  8003. * _.findIndex(users, { 'user': 'fred', 'active': false });
  8004. * // => 1
  8005. *
  8006. * // The `_.matchesProperty` iteratee shorthand.
  8007. * _.findIndex(users, ['active', false]);
  8008. * // => 0
  8009. *
  8010. * // The `_.property` iteratee shorthand.
  8011. * _.findIndex(users, 'active');
  8012. * // => 2
  8013. */
  8014. function findIndex(array, predicate, fromIndex) {
  8015. var length = array == null ? 0 : array.length;
  8016. if (!length) {
  8017. return -1;
  8018. }
  8019. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8020. if (index < 0) {
  8021. index = nativeMax(length + index, 0);
  8022. }
  8023. return baseFindIndex(array, getIteratee(predicate, 3), index);
  8024. }
  8025. /**
  8026. * This method is like `_.findIndex` except that it iterates over elements
  8027. * of `collection` from right to left.
  8028. *
  8029. * @static
  8030. * @memberOf _
  8031. * @since 2.0.0
  8032. * @category Array
  8033. * @param {Array} array The array to inspect.
  8034. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8035. * @param {number} [fromIndex=array.length-1] The index to search from.
  8036. * @returns {number} Returns the index of the found element, else `-1`.
  8037. * @example
  8038. *
  8039. * var users = [
  8040. * { 'user': 'barney', 'active': true },
  8041. * { 'user': 'fred', 'active': false },
  8042. * { 'user': 'pebbles', 'active': false }
  8043. * ];
  8044. *
  8045. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  8046. * // => 2
  8047. *
  8048. * // The `_.matches` iteratee shorthand.
  8049. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  8050. * // => 0
  8051. *
  8052. * // The `_.matchesProperty` iteratee shorthand.
  8053. * _.findLastIndex(users, ['active', false]);
  8054. * // => 2
  8055. *
  8056. * // The `_.property` iteratee shorthand.
  8057. * _.findLastIndex(users, 'active');
  8058. * // => 0
  8059. */
  8060. function findLastIndex(array, predicate, fromIndex) {
  8061. var length = array == null ? 0 : array.length;
  8062. if (!length) {
  8063. return -1;
  8064. }
  8065. var index = length - 1;
  8066. if (fromIndex !== undefined) {
  8067. index = toInteger(fromIndex);
  8068. index = fromIndex < 0
  8069. ? nativeMax(length + index, 0)
  8070. : nativeMin(index, length - 1);
  8071. }
  8072. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  8073. }
  8074. /**
  8075. * Flattens `array` a single level deep.
  8076. *
  8077. * @static
  8078. * @memberOf _
  8079. * @since 0.1.0
  8080. * @category Array
  8081. * @param {Array} array The array to flatten.
  8082. * @returns {Array} Returns the new flattened array.
  8083. * @example
  8084. *
  8085. * _.flatten([1, [2, [3, [4]], 5]]);
  8086. * // => [1, 2, [3, [4]], 5]
  8087. */
  8088. function flatten(array) {
  8089. var length = array == null ? 0 : array.length;
  8090. return length ? baseFlatten(array, 1) : [];
  8091. }
  8092. /**
  8093. * Recursively flattens `array`.
  8094. *
  8095. * @static
  8096. * @memberOf _
  8097. * @since 3.0.0
  8098. * @category Array
  8099. * @param {Array} array The array to flatten.
  8100. * @returns {Array} Returns the new flattened array.
  8101. * @example
  8102. *
  8103. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  8104. * // => [1, 2, 3, 4, 5]
  8105. */
  8106. function flattenDeep(array) {
  8107. var length = array == null ? 0 : array.length;
  8108. return length ? baseFlatten(array, INFINITY) : [];
  8109. }
  8110. /**
  8111. * Recursively flatten `array` up to `depth` times.
  8112. *
  8113. * @static
  8114. * @memberOf _
  8115. * @since 4.4.0
  8116. * @category Array
  8117. * @param {Array} array The array to flatten.
  8118. * @param {number} [depth=1] The maximum recursion depth.
  8119. * @returns {Array} Returns the new flattened array.
  8120. * @example
  8121. *
  8122. * var array = [1, [2, [3, [4]], 5]];
  8123. *
  8124. * _.flattenDepth(array, 1);
  8125. * // => [1, 2, [3, [4]], 5]
  8126. *
  8127. * _.flattenDepth(array, 2);
  8128. * // => [1, 2, 3, [4], 5]
  8129. */
  8130. function flattenDepth(array, depth) {
  8131. var length = array == null ? 0 : array.length;
  8132. if (!length) {
  8133. return [];
  8134. }
  8135. depth = depth === undefined ? 1 : toInteger(depth);
  8136. return baseFlatten(array, depth);
  8137. }
  8138. /**
  8139. * The inverse of `_.toPairs`; this method returns an object composed
  8140. * from key-value `pairs`.
  8141. *
  8142. * @static
  8143. * @memberOf _
  8144. * @since 4.0.0
  8145. * @category Array
  8146. * @param {Array} pairs The key-value pairs.
  8147. * @returns {Object} Returns the new object.
  8148. * @example
  8149. *
  8150. * _.fromPairs([['a', 1], ['b', 2]]);
  8151. * // => { 'a': 1, 'b': 2 }
  8152. */
  8153. function fromPairs(pairs) {
  8154. var index = -1,
  8155. length = pairs == null ? 0 : pairs.length,
  8156. result = {};
  8157. while (++index < length) {
  8158. var pair = pairs[index];
  8159. result[pair[0]] = pair[1];
  8160. }
  8161. return result;
  8162. }
  8163. /**
  8164. * Gets the first element of `array`.
  8165. *
  8166. * @static
  8167. * @memberOf _
  8168. * @since 0.1.0
  8169. * @alias first
  8170. * @category Array
  8171. * @param {Array} array The array to query.
  8172. * @returns {*} Returns the first element of `array`.
  8173. * @example
  8174. *
  8175. * _.head([1, 2, 3]);
  8176. * // => 1
  8177. *
  8178. * _.head([]);
  8179. * // => undefined
  8180. */
  8181. function head(array) {
  8182. return (array && array.length) ? array[0] : undefined;
  8183. }
  8184. /**
  8185. * Gets the index at which the first occurrence of `value` is found in `array`
  8186. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8187. * for equality comparisons. If `fromIndex` is negative, it's used as the
  8188. * offset from the end of `array`.
  8189. *
  8190. * @static
  8191. * @memberOf _
  8192. * @since 0.1.0
  8193. * @category Array
  8194. * @param {Array} array The array to inspect.
  8195. * @param {*} value The value to search for.
  8196. * @param {number} [fromIndex=0] The index to search from.
  8197. * @returns {number} Returns the index of the matched value, else `-1`.
  8198. * @example
  8199. *
  8200. * _.indexOf([1, 2, 1, 2], 2);
  8201. * // => 1
  8202. *
  8203. * // Search from the `fromIndex`.
  8204. * _.indexOf([1, 2, 1, 2], 2, 2);
  8205. * // => 3
  8206. */
  8207. function indexOf(array, value, fromIndex) {
  8208. var length = array == null ? 0 : array.length;
  8209. if (!length) {
  8210. return -1;
  8211. }
  8212. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8213. if (index < 0) {
  8214. index = nativeMax(length + index, 0);
  8215. }
  8216. return baseIndexOf(array, value, index);
  8217. }
  8218. /**
  8219. * Gets all but the last element of `array`.
  8220. *
  8221. * @static
  8222. * @memberOf _
  8223. * @since 0.1.0
  8224. * @category Array
  8225. * @param {Array} array The array to query.
  8226. * @returns {Array} Returns the slice of `array`.
  8227. * @example
  8228. *
  8229. * _.initial([1, 2, 3]);
  8230. * // => [1, 2]
  8231. */
  8232. function initial(array) {
  8233. var length = array == null ? 0 : array.length;
  8234. return length ? baseSlice(array, 0, -1) : [];
  8235. }
  8236. /**
  8237. * Creates an array of unique values that are included in all given arrays
  8238. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8239. * for equality comparisons. The order and references of result values are
  8240. * determined by the first array.
  8241. *
  8242. * @static
  8243. * @memberOf _
  8244. * @since 0.1.0
  8245. * @category Array
  8246. * @param {...Array} [arrays] The arrays to inspect.
  8247. * @returns {Array} Returns the new array of intersecting values.
  8248. * @example
  8249. *
  8250. * _.intersection([2, 1], [2, 3]);
  8251. * // => [2]
  8252. */
  8253. var intersection = baseRest(function(arrays) {
  8254. var mapped = arrayMap(arrays, castArrayLikeObject);
  8255. return (mapped.length && mapped[0] === arrays[0])
  8256. ? baseIntersection(mapped)
  8257. : [];
  8258. });
  8259. /**
  8260. * This method is like `_.intersection` except that it accepts `iteratee`
  8261. * which is invoked for each element of each `arrays` to generate the criterion
  8262. * by which they're compared. The order and references of result values are
  8263. * determined by the first array. The iteratee is invoked with one argument:
  8264. * (value).
  8265. *
  8266. * @static
  8267. * @memberOf _
  8268. * @since 4.0.0
  8269. * @category Array
  8270. * @param {...Array} [arrays] The arrays to inspect.
  8271. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8272. * @returns {Array} Returns the new array of intersecting values.
  8273. * @example
  8274. *
  8275. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8276. * // => [2.1]
  8277. *
  8278. * // The `_.property` iteratee shorthand.
  8279. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8280. * // => [{ 'x': 1 }]
  8281. */
  8282. var intersectionBy = baseRest(function(arrays) {
  8283. var iteratee = last(arrays),
  8284. mapped = arrayMap(arrays, castArrayLikeObject);
  8285. if (iteratee === last(mapped)) {
  8286. iteratee = undefined;
  8287. } else {
  8288. mapped.pop();
  8289. }
  8290. return (mapped.length && mapped[0] === arrays[0])
  8291. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  8292. : [];
  8293. });
  8294. /**
  8295. * This method is like `_.intersection` except that it accepts `comparator`
  8296. * which is invoked to compare elements of `arrays`. The order and references
  8297. * of result values are determined by the first array. The comparator is
  8298. * invoked with two arguments: (arrVal, othVal).
  8299. *
  8300. * @static
  8301. * @memberOf _
  8302. * @since 4.0.0
  8303. * @category Array
  8304. * @param {...Array} [arrays] The arrays to inspect.
  8305. * @param {Function} [comparator] The comparator invoked per element.
  8306. * @returns {Array} Returns the new array of intersecting values.
  8307. * @example
  8308. *
  8309. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8310. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8311. *
  8312. * _.intersectionWith(objects, others, _.isEqual);
  8313. * // => [{ 'x': 1, 'y': 2 }]
  8314. */
  8315. var intersectionWith = baseRest(function(arrays) {
  8316. var comparator = last(arrays),
  8317. mapped = arrayMap(arrays, castArrayLikeObject);
  8318. comparator = typeof comparator == 'function' ? comparator : undefined;
  8319. if (comparator) {
  8320. mapped.pop();
  8321. }
  8322. return (mapped.length && mapped[0] === arrays[0])
  8323. ? baseIntersection(mapped, undefined, comparator)
  8324. : [];
  8325. });
  8326. /**
  8327. * Converts all elements in `array` into a string separated by `separator`.
  8328. *
  8329. * @static
  8330. * @memberOf _
  8331. * @since 4.0.0
  8332. * @category Array
  8333. * @param {Array} array The array to convert.
  8334. * @param {string} [separator=','] The element separator.
  8335. * @returns {string} Returns the joined string.
  8336. * @example
  8337. *
  8338. * _.join(['a', 'b', 'c'], '~');
  8339. * // => 'a~b~c'
  8340. */
  8341. function join(array, separator) {
  8342. return array == null ? '' : nativeJoin.call(array, separator);
  8343. }
  8344. /**
  8345. * Gets the last element of `array`.
  8346. *
  8347. * @static
  8348. * @memberOf _
  8349. * @since 0.1.0
  8350. * @category Array
  8351. * @param {Array} array The array to query.
  8352. * @returns {*} Returns the last element of `array`.
  8353. * @example
  8354. *
  8355. * _.last([1, 2, 3]);
  8356. * // => 3
  8357. */
  8358. function last(array) {
  8359. var length = array == null ? 0 : array.length;
  8360. return length ? array[length - 1] : undefined;
  8361. }
  8362. /**
  8363. * This method is like `_.indexOf` except that it iterates over elements of
  8364. * `array` from right to left.
  8365. *
  8366. * @static
  8367. * @memberOf _
  8368. * @since 0.1.0
  8369. * @category Array
  8370. * @param {Array} array The array to inspect.
  8371. * @param {*} value The value to search for.
  8372. * @param {number} [fromIndex=array.length-1] The index to search from.
  8373. * @returns {number} Returns the index of the matched value, else `-1`.
  8374. * @example
  8375. *
  8376. * _.lastIndexOf([1, 2, 1, 2], 2);
  8377. * // => 3
  8378. *
  8379. * // Search from the `fromIndex`.
  8380. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  8381. * // => 1
  8382. */
  8383. function lastIndexOf(array, value, fromIndex) {
  8384. var length = array == null ? 0 : array.length;
  8385. if (!length) {
  8386. return -1;
  8387. }
  8388. var index = length;
  8389. if (fromIndex !== undefined) {
  8390. index = toInteger(fromIndex);
  8391. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  8392. }
  8393. return value === value
  8394. ? strictLastIndexOf(array, value, index)
  8395. : baseFindIndex(array, baseIsNaN, index, true);
  8396. }
  8397. /**
  8398. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  8399. * element from the end is returned.
  8400. *
  8401. * @static
  8402. * @memberOf _
  8403. * @since 4.11.0
  8404. * @category Array
  8405. * @param {Array} array The array to query.
  8406. * @param {number} [n=0] The index of the element to return.
  8407. * @returns {*} Returns the nth element of `array`.
  8408. * @example
  8409. *
  8410. * var array = ['a', 'b', 'c', 'd'];
  8411. *
  8412. * _.nth(array, 1);
  8413. * // => 'b'
  8414. *
  8415. * _.nth(array, -2);
  8416. * // => 'c';
  8417. */
  8418. function nth(array, n) {
  8419. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  8420. }
  8421. /**
  8422. * Removes all given values from `array` using
  8423. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8424. * for equality comparisons.
  8425. *
  8426. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  8427. * to remove elements from an array by predicate.
  8428. *
  8429. * @static
  8430. * @memberOf _
  8431. * @since 2.0.0
  8432. * @category Array
  8433. * @param {Array} array The array to modify.
  8434. * @param {...*} [values] The values to remove.
  8435. * @returns {Array} Returns `array`.
  8436. * @example
  8437. *
  8438. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8439. *
  8440. * _.pull(array, 'a', 'c');
  8441. * console.log(array);
  8442. * // => ['b', 'b']
  8443. */
  8444. var pull = baseRest(pullAll);
  8445. /**
  8446. * This method is like `_.pull` except that it accepts an array of values to remove.
  8447. *
  8448. * **Note:** Unlike `_.difference`, this method mutates `array`.
  8449. *
  8450. * @static
  8451. * @memberOf _
  8452. * @since 4.0.0
  8453. * @category Array
  8454. * @param {Array} array The array to modify.
  8455. * @param {Array} values The values to remove.
  8456. * @returns {Array} Returns `array`.
  8457. * @example
  8458. *
  8459. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8460. *
  8461. * _.pullAll(array, ['a', 'c']);
  8462. * console.log(array);
  8463. * // => ['b', 'b']
  8464. */
  8465. function pullAll(array, values) {
  8466. return (array && array.length && values && values.length)
  8467. ? basePullAll(array, values)
  8468. : array;
  8469. }
  8470. /**
  8471. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  8472. * invoked for each element of `array` and `values` to generate the criterion
  8473. * by which they're compared. The iteratee is invoked with one argument: (value).
  8474. *
  8475. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  8476. *
  8477. * @static
  8478. * @memberOf _
  8479. * @since 4.0.0
  8480. * @category Array
  8481. * @param {Array} array The array to modify.
  8482. * @param {Array} values The values to remove.
  8483. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8484. * @returns {Array} Returns `array`.
  8485. * @example
  8486. *
  8487. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8488. *
  8489. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8490. * console.log(array);
  8491. * // => [{ 'x': 2 }]
  8492. */
  8493. function pullAllBy(array, values, iteratee) {
  8494. return (array && array.length && values && values.length)
  8495. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8496. : array;
  8497. }
  8498. /**
  8499. * This method is like `_.pullAll` except that it accepts `comparator` which
  8500. * is invoked to compare elements of `array` to `values`. The comparator is
  8501. * invoked with two arguments: (arrVal, othVal).
  8502. *
  8503. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8504. *
  8505. * @static
  8506. * @memberOf _
  8507. * @since 4.6.0
  8508. * @category Array
  8509. * @param {Array} array The array to modify.
  8510. * @param {Array} values The values to remove.
  8511. * @param {Function} [comparator] The comparator invoked per element.
  8512. * @returns {Array} Returns `array`.
  8513. * @example
  8514. *
  8515. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8516. *
  8517. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8518. * console.log(array);
  8519. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8520. */
  8521. function pullAllWith(array, values, comparator) {
  8522. return (array && array.length && values && values.length)
  8523. ? basePullAll(array, values, undefined, comparator)
  8524. : array;
  8525. }
  8526. /**
  8527. * Removes elements from `array` corresponding to `indexes` and returns an
  8528. * array of removed elements.
  8529. *
  8530. * **Note:** Unlike `_.at`, this method mutates `array`.
  8531. *
  8532. * @static
  8533. * @memberOf _
  8534. * @since 3.0.0
  8535. * @category Array
  8536. * @param {Array} array The array to modify.
  8537. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8538. * @returns {Array} Returns the new array of removed elements.
  8539. * @example
  8540. *
  8541. * var array = ['a', 'b', 'c', 'd'];
  8542. * var pulled = _.pullAt(array, [1, 3]);
  8543. *
  8544. * console.log(array);
  8545. * // => ['a', 'c']
  8546. *
  8547. * console.log(pulled);
  8548. * // => ['b', 'd']
  8549. */
  8550. var pullAt = flatRest(function(array, indexes) {
  8551. var length = array == null ? 0 : array.length,
  8552. result = baseAt(array, indexes);
  8553. basePullAt(array, arrayMap(indexes, function(index) {
  8554. return isIndex(index, length) ? +index : index;
  8555. }).sort(compareAscending));
  8556. return result;
  8557. });
  8558. /**
  8559. * Removes all elements from `array` that `predicate` returns truthy for
  8560. * and returns an array of the removed elements. The predicate is invoked
  8561. * with three arguments: (value, index, array).
  8562. *
  8563. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8564. * to pull elements from an array by value.
  8565. *
  8566. * @static
  8567. * @memberOf _
  8568. * @since 2.0.0
  8569. * @category Array
  8570. * @param {Array} array The array to modify.
  8571. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8572. * @returns {Array} Returns the new array of removed elements.
  8573. * @example
  8574. *
  8575. * var array = [1, 2, 3, 4];
  8576. * var evens = _.remove(array, function(n) {
  8577. * return n % 2 == 0;
  8578. * });
  8579. *
  8580. * console.log(array);
  8581. * // => [1, 3]
  8582. *
  8583. * console.log(evens);
  8584. * // => [2, 4]
  8585. */
  8586. function remove(array, predicate) {
  8587. var result = [];
  8588. if (!(array && array.length)) {
  8589. return result;
  8590. }
  8591. var index = -1,
  8592. indexes = [],
  8593. length = array.length;
  8594. predicate = getIteratee(predicate, 3);
  8595. while (++index < length) {
  8596. var value = array[index];
  8597. if (predicate(value, index, array)) {
  8598. result.push(value);
  8599. indexes.push(index);
  8600. }
  8601. }
  8602. basePullAt(array, indexes);
  8603. return result;
  8604. }
  8605. /**
  8606. * Reverses `array` so that the first element becomes the last, the second
  8607. * element becomes the second to last, and so on.
  8608. *
  8609. * **Note:** This method mutates `array` and is based on
  8610. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8611. *
  8612. * @static
  8613. * @memberOf _
  8614. * @since 4.0.0
  8615. * @category Array
  8616. * @param {Array} array The array to modify.
  8617. * @returns {Array} Returns `array`.
  8618. * @example
  8619. *
  8620. * var array = [1, 2, 3];
  8621. *
  8622. * _.reverse(array);
  8623. * // => [3, 2, 1]
  8624. *
  8625. * console.log(array);
  8626. * // => [3, 2, 1]
  8627. */
  8628. function reverse(array) {
  8629. return array == null ? array : nativeReverse.call(array);
  8630. }
  8631. /**
  8632. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8633. *
  8634. * **Note:** This method is used instead of
  8635. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8636. * returned.
  8637. *
  8638. * @static
  8639. * @memberOf _
  8640. * @since 3.0.0
  8641. * @category Array
  8642. * @param {Array} array The array to slice.
  8643. * @param {number} [start=0] The start position.
  8644. * @param {number} [end=array.length] The end position.
  8645. * @returns {Array} Returns the slice of `array`.
  8646. */
  8647. function slice(array, start, end) {
  8648. var length = array == null ? 0 : array.length;
  8649. if (!length) {
  8650. return [];
  8651. }
  8652. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8653. start = 0;
  8654. end = length;
  8655. }
  8656. else {
  8657. start = start == null ? 0 : toInteger(start);
  8658. end = end === undefined ? length : toInteger(end);
  8659. }
  8660. return baseSlice(array, start, end);
  8661. }
  8662. /**
  8663. * Uses a binary search to determine the lowest index at which `value`
  8664. * should be inserted into `array` in order to maintain its sort order.
  8665. *
  8666. * @static
  8667. * @memberOf _
  8668. * @since 0.1.0
  8669. * @category Array
  8670. * @param {Array} array The sorted array to inspect.
  8671. * @param {*} value The value to evaluate.
  8672. * @returns {number} Returns the index at which `value` should be inserted
  8673. * into `array`.
  8674. * @example
  8675. *
  8676. * _.sortedIndex([30, 50], 40);
  8677. * // => 1
  8678. */
  8679. function sortedIndex(array, value) {
  8680. return baseSortedIndex(array, value);
  8681. }
  8682. /**
  8683. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8684. * which is invoked for `value` and each element of `array` to compute their
  8685. * sort ranking. The iteratee is invoked with one argument: (value).
  8686. *
  8687. * @static
  8688. * @memberOf _
  8689. * @since 4.0.0
  8690. * @category Array
  8691. * @param {Array} array The sorted array to inspect.
  8692. * @param {*} value The value to evaluate.
  8693. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8694. * @returns {number} Returns the index at which `value` should be inserted
  8695. * into `array`.
  8696. * @example
  8697. *
  8698. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8699. *
  8700. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8701. * // => 0
  8702. *
  8703. * // The `_.property` iteratee shorthand.
  8704. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8705. * // => 0
  8706. */
  8707. function sortedIndexBy(array, value, iteratee) {
  8708. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8709. }
  8710. /**
  8711. * This method is like `_.indexOf` except that it performs a binary
  8712. * search on a sorted `array`.
  8713. *
  8714. * @static
  8715. * @memberOf _
  8716. * @since 4.0.0
  8717. * @category Array
  8718. * @param {Array} array The array to inspect.
  8719. * @param {*} value The value to search for.
  8720. * @returns {number} Returns the index of the matched value, else `-1`.
  8721. * @example
  8722. *
  8723. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8724. * // => 1
  8725. */
  8726. function sortedIndexOf(array, value) {
  8727. var length = array == null ? 0 : array.length;
  8728. if (length) {
  8729. var index = baseSortedIndex(array, value);
  8730. if (index < length && eq(array[index], value)) {
  8731. return index;
  8732. }
  8733. }
  8734. return -1;
  8735. }
  8736. /**
  8737. * This method is like `_.sortedIndex` except that it returns the highest
  8738. * index at which `value` should be inserted into `array` in order to
  8739. * maintain its sort order.
  8740. *
  8741. * @static
  8742. * @memberOf _
  8743. * @since 3.0.0
  8744. * @category Array
  8745. * @param {Array} array The sorted array to inspect.
  8746. * @param {*} value The value to evaluate.
  8747. * @returns {number} Returns the index at which `value` should be inserted
  8748. * into `array`.
  8749. * @example
  8750. *
  8751. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8752. * // => 4
  8753. */
  8754. function sortedLastIndex(array, value) {
  8755. return baseSortedIndex(array, value, true);
  8756. }
  8757. /**
  8758. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8759. * which is invoked for `value` and each element of `array` to compute their
  8760. * sort ranking. The iteratee is invoked with one argument: (value).
  8761. *
  8762. * @static
  8763. * @memberOf _
  8764. * @since 4.0.0
  8765. * @category Array
  8766. * @param {Array} array The sorted array to inspect.
  8767. * @param {*} value The value to evaluate.
  8768. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8769. * @returns {number} Returns the index at which `value` should be inserted
  8770. * into `array`.
  8771. * @example
  8772. *
  8773. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8774. *
  8775. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8776. * // => 1
  8777. *
  8778. * // The `_.property` iteratee shorthand.
  8779. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8780. * // => 1
  8781. */
  8782. function sortedLastIndexBy(array, value, iteratee) {
  8783. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8784. }
  8785. /**
  8786. * This method is like `_.lastIndexOf` except that it performs a binary
  8787. * search on a sorted `array`.
  8788. *
  8789. * @static
  8790. * @memberOf _
  8791. * @since 4.0.0
  8792. * @category Array
  8793. * @param {Array} array The array to inspect.
  8794. * @param {*} value The value to search for.
  8795. * @returns {number} Returns the index of the matched value, else `-1`.
  8796. * @example
  8797. *
  8798. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8799. * // => 3
  8800. */
  8801. function sortedLastIndexOf(array, value) {
  8802. var length = array == null ? 0 : array.length;
  8803. if (length) {
  8804. var index = baseSortedIndex(array, value, true) - 1;
  8805. if (eq(array[index], value)) {
  8806. return index;
  8807. }
  8808. }
  8809. return -1;
  8810. }
  8811. /**
  8812. * This method is like `_.uniq` except that it's designed and optimized
  8813. * for sorted arrays.
  8814. *
  8815. * @static
  8816. * @memberOf _
  8817. * @since 4.0.0
  8818. * @category Array
  8819. * @param {Array} array The array to inspect.
  8820. * @returns {Array} Returns the new duplicate free array.
  8821. * @example
  8822. *
  8823. * _.sortedUniq([1, 1, 2]);
  8824. * // => [1, 2]
  8825. */
  8826. function sortedUniq(array) {
  8827. return (array && array.length)
  8828. ? baseSortedUniq(array)
  8829. : [];
  8830. }
  8831. /**
  8832. * This method is like `_.uniqBy` except that it's designed and optimized
  8833. * for sorted arrays.
  8834. *
  8835. * @static
  8836. * @memberOf _
  8837. * @since 4.0.0
  8838. * @category Array
  8839. * @param {Array} array The array to inspect.
  8840. * @param {Function} [iteratee] The iteratee invoked per element.
  8841. * @returns {Array} Returns the new duplicate free array.
  8842. * @example
  8843. *
  8844. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8845. * // => [1.1, 2.3]
  8846. */
  8847. function sortedUniqBy(array, iteratee) {
  8848. return (array && array.length)
  8849. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8850. : [];
  8851. }
  8852. /**
  8853. * Gets all but the first element of `array`.
  8854. *
  8855. * @static
  8856. * @memberOf _
  8857. * @since 4.0.0
  8858. * @category Array
  8859. * @param {Array} array The array to query.
  8860. * @returns {Array} Returns the slice of `array`.
  8861. * @example
  8862. *
  8863. * _.tail([1, 2, 3]);
  8864. * // => [2, 3]
  8865. */
  8866. function tail(array) {
  8867. var length = array == null ? 0 : array.length;
  8868. return length ? baseSlice(array, 1, length) : [];
  8869. }
  8870. /**
  8871. * Creates a slice of `array` with `n` elements taken from the beginning.
  8872. *
  8873. * @static
  8874. * @memberOf _
  8875. * @since 0.1.0
  8876. * @category Array
  8877. * @param {Array} array The array to query.
  8878. * @param {number} [n=1] The number of elements to take.
  8879. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8880. * @returns {Array} Returns the slice of `array`.
  8881. * @example
  8882. *
  8883. * _.take([1, 2, 3]);
  8884. * // => [1]
  8885. *
  8886. * _.take([1, 2, 3], 2);
  8887. * // => [1, 2]
  8888. *
  8889. * _.take([1, 2, 3], 5);
  8890. * // => [1, 2, 3]
  8891. *
  8892. * _.take([1, 2, 3], 0);
  8893. * // => []
  8894. */
  8895. function take(array, n, guard) {
  8896. if (!(array && array.length)) {
  8897. return [];
  8898. }
  8899. n = (guard || n === undefined) ? 1 : toInteger(n);
  8900. return baseSlice(array, 0, n < 0 ? 0 : n);
  8901. }
  8902. /**
  8903. * Creates a slice of `array` with `n` elements taken from the end.
  8904. *
  8905. * @static
  8906. * @memberOf _
  8907. * @since 3.0.0
  8908. * @category Array
  8909. * @param {Array} array The array to query.
  8910. * @param {number} [n=1] The number of elements to take.
  8911. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8912. * @returns {Array} Returns the slice of `array`.
  8913. * @example
  8914. *
  8915. * _.takeRight([1, 2, 3]);
  8916. * // => [3]
  8917. *
  8918. * _.takeRight([1, 2, 3], 2);
  8919. * // => [2, 3]
  8920. *
  8921. * _.takeRight([1, 2, 3], 5);
  8922. * // => [1, 2, 3]
  8923. *
  8924. * _.takeRight([1, 2, 3], 0);
  8925. * // => []
  8926. */
  8927. function takeRight(array, n, guard) {
  8928. var length = array == null ? 0 : array.length;
  8929. if (!length) {
  8930. return [];
  8931. }
  8932. n = (guard || n === undefined) ? 1 : toInteger(n);
  8933. n = length - n;
  8934. return baseSlice(array, n < 0 ? 0 : n, length);
  8935. }
  8936. /**
  8937. * Creates a slice of `array` with elements taken from the end. Elements are
  8938. * taken until `predicate` returns falsey. The predicate is invoked with
  8939. * three arguments: (value, index, array).
  8940. *
  8941. * @static
  8942. * @memberOf _
  8943. * @since 3.0.0
  8944. * @category Array
  8945. * @param {Array} array The array to query.
  8946. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8947. * @returns {Array} Returns the slice of `array`.
  8948. * @example
  8949. *
  8950. * var users = [
  8951. * { 'user': 'barney', 'active': true },
  8952. * { 'user': 'fred', 'active': false },
  8953. * { 'user': 'pebbles', 'active': false }
  8954. * ];
  8955. *
  8956. * _.takeRightWhile(users, function(o) { return !o.active; });
  8957. * // => objects for ['fred', 'pebbles']
  8958. *
  8959. * // The `_.matches` iteratee shorthand.
  8960. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8961. * // => objects for ['pebbles']
  8962. *
  8963. * // The `_.matchesProperty` iteratee shorthand.
  8964. * _.takeRightWhile(users, ['active', false]);
  8965. * // => objects for ['fred', 'pebbles']
  8966. *
  8967. * // The `_.property` iteratee shorthand.
  8968. * _.takeRightWhile(users, 'active');
  8969. * // => []
  8970. */
  8971. function takeRightWhile(array, predicate) {
  8972. return (array && array.length)
  8973. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8974. : [];
  8975. }
  8976. /**
  8977. * Creates a slice of `array` with elements taken from the beginning. Elements
  8978. * are taken until `predicate` returns falsey. The predicate is invoked with
  8979. * three arguments: (value, index, array).
  8980. *
  8981. * @static
  8982. * @memberOf _
  8983. * @since 3.0.0
  8984. * @category Array
  8985. * @param {Array} array The array to query.
  8986. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8987. * @returns {Array} Returns the slice of `array`.
  8988. * @example
  8989. *
  8990. * var users = [
  8991. * { 'user': 'barney', 'active': false },
  8992. * { 'user': 'fred', 'active': false },
  8993. * { 'user': 'pebbles', 'active': true }
  8994. * ];
  8995. *
  8996. * _.takeWhile(users, function(o) { return !o.active; });
  8997. * // => objects for ['barney', 'fred']
  8998. *
  8999. * // The `_.matches` iteratee shorthand.
  9000. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  9001. * // => objects for ['barney']
  9002. *
  9003. * // The `_.matchesProperty` iteratee shorthand.
  9004. * _.takeWhile(users, ['active', false]);
  9005. * // => objects for ['barney', 'fred']
  9006. *
  9007. * // The `_.property` iteratee shorthand.
  9008. * _.takeWhile(users, 'active');
  9009. * // => []
  9010. */
  9011. function takeWhile(array, predicate) {
  9012. return (array && array.length)
  9013. ? baseWhile(array, getIteratee(predicate, 3))
  9014. : [];
  9015. }
  9016. /**
  9017. * Creates an array of unique values, in order, from all given arrays using
  9018. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9019. * for equality comparisons.
  9020. *
  9021. * @static
  9022. * @memberOf _
  9023. * @since 0.1.0
  9024. * @category Array
  9025. * @param {...Array} [arrays] The arrays to inspect.
  9026. * @returns {Array} Returns the new array of combined values.
  9027. * @example
  9028. *
  9029. * _.union([2], [1, 2]);
  9030. * // => [2, 1]
  9031. */
  9032. var union = baseRest(function(arrays) {
  9033. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  9034. });
  9035. /**
  9036. * This method is like `_.union` except that it accepts `iteratee` which is
  9037. * invoked for each element of each `arrays` to generate the criterion by
  9038. * which uniqueness is computed. Result values are chosen from the first
  9039. * array in which the value occurs. The iteratee is invoked with one argument:
  9040. * (value).
  9041. *
  9042. * @static
  9043. * @memberOf _
  9044. * @since 4.0.0
  9045. * @category Array
  9046. * @param {...Array} [arrays] The arrays to inspect.
  9047. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9048. * @returns {Array} Returns the new array of combined values.
  9049. * @example
  9050. *
  9051. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  9052. * // => [2.1, 1.2]
  9053. *
  9054. * // The `_.property` iteratee shorthand.
  9055. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9056. * // => [{ 'x': 1 }, { 'x': 2 }]
  9057. */
  9058. var unionBy = baseRest(function(arrays) {
  9059. var iteratee = last(arrays);
  9060. if (isArrayLikeObject(iteratee)) {
  9061. iteratee = undefined;
  9062. }
  9063. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  9064. });
  9065. /**
  9066. * This method is like `_.union` except that it accepts `comparator` which
  9067. * is invoked to compare elements of `arrays`. Result values are chosen from
  9068. * the first array in which the value occurs. The comparator is invoked
  9069. * with two arguments: (arrVal, othVal).
  9070. *
  9071. * @static
  9072. * @memberOf _
  9073. * @since 4.0.0
  9074. * @category Array
  9075. * @param {...Array} [arrays] The arrays to inspect.
  9076. * @param {Function} [comparator] The comparator invoked per element.
  9077. * @returns {Array} Returns the new array of combined values.
  9078. * @example
  9079. *
  9080. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9081. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9082. *
  9083. * _.unionWith(objects, others, _.isEqual);
  9084. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9085. */
  9086. var unionWith = baseRest(function(arrays) {
  9087. var comparator = last(arrays);
  9088. comparator = typeof comparator == 'function' ? comparator : undefined;
  9089. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  9090. });
  9091. /**
  9092. * Creates a duplicate-free version of an array, using
  9093. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9094. * for equality comparisons, in which only the first occurrence of each element
  9095. * is kept. The order of result values is determined by the order they occur
  9096. * in the array.
  9097. *
  9098. * @static
  9099. * @memberOf _
  9100. * @since 0.1.0
  9101. * @category Array
  9102. * @param {Array} array The array to inspect.
  9103. * @returns {Array} Returns the new duplicate free array.
  9104. * @example
  9105. *
  9106. * _.uniq([2, 1, 2]);
  9107. * // => [2, 1]
  9108. */
  9109. function uniq(array) {
  9110. return (array && array.length) ? baseUniq(array) : [];
  9111. }
  9112. /**
  9113. * This method is like `_.uniq` except that it accepts `iteratee` which is
  9114. * invoked for each element in `array` to generate the criterion by which
  9115. * uniqueness is computed. The order of result values is determined by the
  9116. * order they occur in the array. The iteratee is invoked with one argument:
  9117. * (value).
  9118. *
  9119. * @static
  9120. * @memberOf _
  9121. * @since 4.0.0
  9122. * @category Array
  9123. * @param {Array} array The array to inspect.
  9124. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9125. * @returns {Array} Returns the new duplicate free array.
  9126. * @example
  9127. *
  9128. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  9129. * // => [2.1, 1.2]
  9130. *
  9131. * // The `_.property` iteratee shorthand.
  9132. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  9133. * // => [{ 'x': 1 }, { 'x': 2 }]
  9134. */
  9135. function uniqBy(array, iteratee) {
  9136. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  9137. }
  9138. /**
  9139. * This method is like `_.uniq` except that it accepts `comparator` which
  9140. * is invoked to compare elements of `array`. The order of result values is
  9141. * determined by the order they occur in the array.The comparator is invoked
  9142. * with two arguments: (arrVal, othVal).
  9143. *
  9144. * @static
  9145. * @memberOf _
  9146. * @since 4.0.0
  9147. * @category Array
  9148. * @param {Array} array The array to inspect.
  9149. * @param {Function} [comparator] The comparator invoked per element.
  9150. * @returns {Array} Returns the new duplicate free array.
  9151. * @example
  9152. *
  9153. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9154. *
  9155. * _.uniqWith(objects, _.isEqual);
  9156. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  9157. */
  9158. function uniqWith(array, comparator) {
  9159. comparator = typeof comparator == 'function' ? comparator : undefined;
  9160. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  9161. }
  9162. /**
  9163. * This method is like `_.zip` except that it accepts an array of grouped
  9164. * elements and creates an array regrouping the elements to their pre-zip
  9165. * configuration.
  9166. *
  9167. * @static
  9168. * @memberOf _
  9169. * @since 1.2.0
  9170. * @category Array
  9171. * @param {Array} array The array of grouped elements to process.
  9172. * @returns {Array} Returns the new array of regrouped elements.
  9173. * @example
  9174. *
  9175. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  9176. * // => [['a', 1, true], ['b', 2, false]]
  9177. *
  9178. * _.unzip(zipped);
  9179. * // => [['a', 'b'], [1, 2], [true, false]]
  9180. */
  9181. function unzip(array) {
  9182. if (!(array && array.length)) {
  9183. return [];
  9184. }
  9185. var length = 0;
  9186. array = arrayFilter(array, function(group) {
  9187. if (isArrayLikeObject(group)) {
  9188. length = nativeMax(group.length, length);
  9189. return true;
  9190. }
  9191. });
  9192. return baseTimes(length, function(index) {
  9193. return arrayMap(array, baseProperty(index));
  9194. });
  9195. }
  9196. /**
  9197. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  9198. * how regrouped values should be combined. The iteratee is invoked with the
  9199. * elements of each group: (...group).
  9200. *
  9201. * @static
  9202. * @memberOf _
  9203. * @since 3.8.0
  9204. * @category Array
  9205. * @param {Array} array The array of grouped elements to process.
  9206. * @param {Function} [iteratee=_.identity] The function to combine
  9207. * regrouped values.
  9208. * @returns {Array} Returns the new array of regrouped elements.
  9209. * @example
  9210. *
  9211. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  9212. * // => [[1, 10, 100], [2, 20, 200]]
  9213. *
  9214. * _.unzipWith(zipped, _.add);
  9215. * // => [3, 30, 300]
  9216. */
  9217. function unzipWith(array, iteratee) {
  9218. if (!(array && array.length)) {
  9219. return [];
  9220. }
  9221. var result = unzip(array);
  9222. if (iteratee == null) {
  9223. return result;
  9224. }
  9225. return arrayMap(result, function(group) {
  9226. return apply(iteratee, undefined, group);
  9227. });
  9228. }
  9229. /**
  9230. * Creates an array excluding all given values using
  9231. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9232. * for equality comparisons.
  9233. *
  9234. * **Note:** Unlike `_.pull`, this method returns a new array.
  9235. *
  9236. * @static
  9237. * @memberOf _
  9238. * @since 0.1.0
  9239. * @category Array
  9240. * @param {Array} array The array to inspect.
  9241. * @param {...*} [values] The values to exclude.
  9242. * @returns {Array} Returns the new array of filtered values.
  9243. * @see _.difference, _.xor
  9244. * @example
  9245. *
  9246. * _.without([2, 1, 2, 3], 1, 2);
  9247. * // => [3]
  9248. */
  9249. var without = baseRest(function(array, values) {
  9250. return isArrayLikeObject(array)
  9251. ? baseDifference(array, values)
  9252. : [];
  9253. });
  9254. /**
  9255. * Creates an array of unique values that is the
  9256. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  9257. * of the given arrays. The order of result values is determined by the order
  9258. * they occur in the arrays.
  9259. *
  9260. * @static
  9261. * @memberOf _
  9262. * @since 2.4.0
  9263. * @category Array
  9264. * @param {...Array} [arrays] The arrays to inspect.
  9265. * @returns {Array} Returns the new array of filtered values.
  9266. * @see _.difference, _.without
  9267. * @example
  9268. *
  9269. * _.xor([2, 1], [2, 3]);
  9270. * // => [1, 3]
  9271. */
  9272. var xor = baseRest(function(arrays) {
  9273. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  9274. });
  9275. /**
  9276. * This method is like `_.xor` except that it accepts `iteratee` which is
  9277. * invoked for each element of each `arrays` to generate the criterion by
  9278. * which by which they're compared. The order of result values is determined
  9279. * by the order they occur in the arrays. The iteratee is invoked with one
  9280. * argument: (value).
  9281. *
  9282. * @static
  9283. * @memberOf _
  9284. * @since 4.0.0
  9285. * @category Array
  9286. * @param {...Array} [arrays] The arrays to inspect.
  9287. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9288. * @returns {Array} Returns the new array of filtered values.
  9289. * @example
  9290. *
  9291. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  9292. * // => [1.2, 3.4]
  9293. *
  9294. * // The `_.property` iteratee shorthand.
  9295. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9296. * // => [{ 'x': 2 }]
  9297. */
  9298. var xorBy = baseRest(function(arrays) {
  9299. var iteratee = last(arrays);
  9300. if (isArrayLikeObject(iteratee)) {
  9301. iteratee = undefined;
  9302. }
  9303. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  9304. });
  9305. /**
  9306. * This method is like `_.xor` except that it accepts `comparator` which is
  9307. * invoked to compare elements of `arrays`. The order of result values is
  9308. * determined by the order they occur in the arrays. The comparator is invoked
  9309. * with two arguments: (arrVal, othVal).
  9310. *
  9311. * @static
  9312. * @memberOf _
  9313. * @since 4.0.0
  9314. * @category Array
  9315. * @param {...Array} [arrays] The arrays to inspect.
  9316. * @param {Function} [comparator] The comparator invoked per element.
  9317. * @returns {Array} Returns the new array of filtered values.
  9318. * @example
  9319. *
  9320. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9321. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9322. *
  9323. * _.xorWith(objects, others, _.isEqual);
  9324. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9325. */
  9326. var xorWith = baseRest(function(arrays) {
  9327. var comparator = last(arrays);
  9328. comparator = typeof comparator == 'function' ? comparator : undefined;
  9329. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  9330. });
  9331. /**
  9332. * Creates an array of grouped elements, the first of which contains the
  9333. * first elements of the given arrays, the second of which contains the
  9334. * second elements of the given arrays, and so on.
  9335. *
  9336. * @static
  9337. * @memberOf _
  9338. * @since 0.1.0
  9339. * @category Array
  9340. * @param {...Array} [arrays] The arrays to process.
  9341. * @returns {Array} Returns the new array of grouped elements.
  9342. * @example
  9343. *
  9344. * _.zip(['a', 'b'], [1, 2], [true, false]);
  9345. * // => [['a', 1, true], ['b', 2, false]]
  9346. */
  9347. var zip = baseRest(unzip);
  9348. /**
  9349. * This method is like `_.fromPairs` except that it accepts two arrays,
  9350. * one of property identifiers and one of corresponding values.
  9351. *
  9352. * @static
  9353. * @memberOf _
  9354. * @since 0.4.0
  9355. * @category Array
  9356. * @param {Array} [props=[]] The property identifiers.
  9357. * @param {Array} [values=[]] The property values.
  9358. * @returns {Object} Returns the new object.
  9359. * @example
  9360. *
  9361. * _.zipObject(['a', 'b'], [1, 2]);
  9362. * // => { 'a': 1, 'b': 2 }
  9363. */
  9364. function zipObject(props, values) {
  9365. return baseZipObject(props || [], values || [], assignValue);
  9366. }
  9367. /**
  9368. * This method is like `_.zipObject` except that it supports property paths.
  9369. *
  9370. * @static
  9371. * @memberOf _
  9372. * @since 4.1.0
  9373. * @category Array
  9374. * @param {Array} [props=[]] The property identifiers.
  9375. * @param {Array} [values=[]] The property values.
  9376. * @returns {Object} Returns the new object.
  9377. * @example
  9378. *
  9379. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  9380. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  9381. */
  9382. function zipObjectDeep(props, values) {
  9383. return baseZipObject(props || [], values || [], baseSet);
  9384. }
  9385. /**
  9386. * This method is like `_.zip` except that it accepts `iteratee` to specify
  9387. * how grouped values should be combined. The iteratee is invoked with the
  9388. * elements of each group: (...group).
  9389. *
  9390. * @static
  9391. * @memberOf _
  9392. * @since 3.8.0
  9393. * @category Array
  9394. * @param {...Array} [arrays] The arrays to process.
  9395. * @param {Function} [iteratee=_.identity] The function to combine
  9396. * grouped values.
  9397. * @returns {Array} Returns the new array of grouped elements.
  9398. * @example
  9399. *
  9400. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  9401. * return a + b + c;
  9402. * });
  9403. * // => [111, 222]
  9404. */
  9405. var zipWith = baseRest(function(arrays) {
  9406. var length = arrays.length,
  9407. iteratee = length > 1 ? arrays[length - 1] : undefined;
  9408. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  9409. return unzipWith(arrays, iteratee);
  9410. });
  9411. /*------------------------------------------------------------------------*/
  9412. /**
  9413. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  9414. * chain sequences enabled. The result of such sequences must be unwrapped
  9415. * with `_#value`.
  9416. *
  9417. * @static
  9418. * @memberOf _
  9419. * @since 1.3.0
  9420. * @category Seq
  9421. * @param {*} value The value to wrap.
  9422. * @returns {Object} Returns the new `lodash` wrapper instance.
  9423. * @example
  9424. *
  9425. * var users = [
  9426. * { 'user': 'barney', 'age': 36 },
  9427. * { 'user': 'fred', 'age': 40 },
  9428. * { 'user': 'pebbles', 'age': 1 }
  9429. * ];
  9430. *
  9431. * var youngest = _
  9432. * .chain(users)
  9433. * .sortBy('age')
  9434. * .map(function(o) {
  9435. * return o.user + ' is ' + o.age;
  9436. * })
  9437. * .head()
  9438. * .value();
  9439. * // => 'pebbles is 1'
  9440. */
  9441. function chain(value) {
  9442. var result = lodash(value);
  9443. result.__chain__ = true;
  9444. return result;
  9445. }
  9446. /**
  9447. * This method invokes `interceptor` and returns `value`. The interceptor
  9448. * is invoked with one argument; (value). The purpose of this method is to
  9449. * "tap into" a method chain sequence in order to modify intermediate results.
  9450. *
  9451. * @static
  9452. * @memberOf _
  9453. * @since 0.1.0
  9454. * @category Seq
  9455. * @param {*} value The value to provide to `interceptor`.
  9456. * @param {Function} interceptor The function to invoke.
  9457. * @returns {*} Returns `value`.
  9458. * @example
  9459. *
  9460. * _([1, 2, 3])
  9461. * .tap(function(array) {
  9462. * // Mutate input array.
  9463. * array.pop();
  9464. * })
  9465. * .reverse()
  9466. * .value();
  9467. * // => [2, 1]
  9468. */
  9469. function tap(value, interceptor) {
  9470. interceptor(value);
  9471. return value;
  9472. }
  9473. /**
  9474. * This method is like `_.tap` except that it returns the result of `interceptor`.
  9475. * The purpose of this method is to "pass thru" values replacing intermediate
  9476. * results in a method chain sequence.
  9477. *
  9478. * @static
  9479. * @memberOf _
  9480. * @since 3.0.0
  9481. * @category Seq
  9482. * @param {*} value The value to provide to `interceptor`.
  9483. * @param {Function} interceptor The function to invoke.
  9484. * @returns {*} Returns the result of `interceptor`.
  9485. * @example
  9486. *
  9487. * _(' abc ')
  9488. * .chain()
  9489. * .trim()
  9490. * .thru(function(value) {
  9491. * return [value];
  9492. * })
  9493. * .value();
  9494. * // => ['abc']
  9495. */
  9496. function thru(value, interceptor) {
  9497. return interceptor(value);
  9498. }
  9499. /**
  9500. * This method is the wrapper version of `_.at`.
  9501. *
  9502. * @name at
  9503. * @memberOf _
  9504. * @since 1.0.0
  9505. * @category Seq
  9506. * @param {...(string|string[])} [paths] The property paths to pick.
  9507. * @returns {Object} Returns the new `lodash` wrapper instance.
  9508. * @example
  9509. *
  9510. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9511. *
  9512. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9513. * // => [3, 4]
  9514. */
  9515. var wrapperAt = flatRest(function(paths) {
  9516. var length = paths.length,
  9517. start = length ? paths[0] : 0,
  9518. value = this.__wrapped__,
  9519. interceptor = function(object) { return baseAt(object, paths); };
  9520. if (length > 1 || this.__actions__.length ||
  9521. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9522. return this.thru(interceptor);
  9523. }
  9524. value = value.slice(start, +start + (length ? 1 : 0));
  9525. value.__actions__.push({
  9526. 'func': thru,
  9527. 'args': [interceptor],
  9528. 'thisArg': undefined
  9529. });
  9530. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9531. if (length && !array.length) {
  9532. array.push(undefined);
  9533. }
  9534. return array;
  9535. });
  9536. });
  9537. /**
  9538. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9539. *
  9540. * @name chain
  9541. * @memberOf _
  9542. * @since 0.1.0
  9543. * @category Seq
  9544. * @returns {Object} Returns the new `lodash` wrapper instance.
  9545. * @example
  9546. *
  9547. * var users = [
  9548. * { 'user': 'barney', 'age': 36 },
  9549. * { 'user': 'fred', 'age': 40 }
  9550. * ];
  9551. *
  9552. * // A sequence without explicit chaining.
  9553. * _(users).head();
  9554. * // => { 'user': 'barney', 'age': 36 }
  9555. *
  9556. * // A sequence with explicit chaining.
  9557. * _(users)
  9558. * .chain()
  9559. * .head()
  9560. * .pick('user')
  9561. * .value();
  9562. * // => { 'user': 'barney' }
  9563. */
  9564. function wrapperChain() {
  9565. return chain(this);
  9566. }
  9567. /**
  9568. * Executes the chain sequence and returns the wrapped result.
  9569. *
  9570. * @name commit
  9571. * @memberOf _
  9572. * @since 3.2.0
  9573. * @category Seq
  9574. * @returns {Object} Returns the new `lodash` wrapper instance.
  9575. * @example
  9576. *
  9577. * var array = [1, 2];
  9578. * var wrapped = _(array).push(3);
  9579. *
  9580. * console.log(array);
  9581. * // => [1, 2]
  9582. *
  9583. * wrapped = wrapped.commit();
  9584. * console.log(array);
  9585. * // => [1, 2, 3]
  9586. *
  9587. * wrapped.last();
  9588. * // => 3
  9589. *
  9590. * console.log(array);
  9591. * // => [1, 2, 3]
  9592. */
  9593. function wrapperCommit() {
  9594. return new LodashWrapper(this.value(), this.__chain__);
  9595. }
  9596. /**
  9597. * Gets the next value on a wrapped object following the
  9598. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9599. *
  9600. * @name next
  9601. * @memberOf _
  9602. * @since 4.0.0
  9603. * @category Seq
  9604. * @returns {Object} Returns the next iterator value.
  9605. * @example
  9606. *
  9607. * var wrapped = _([1, 2]);
  9608. *
  9609. * wrapped.next();
  9610. * // => { 'done': false, 'value': 1 }
  9611. *
  9612. * wrapped.next();
  9613. * // => { 'done': false, 'value': 2 }
  9614. *
  9615. * wrapped.next();
  9616. * // => { 'done': true, 'value': undefined }
  9617. */
  9618. function wrapperNext() {
  9619. if (this.__values__ === undefined) {
  9620. this.__values__ = toArray(this.value());
  9621. }
  9622. var done = this.__index__ >= this.__values__.length,
  9623. value = done ? undefined : this.__values__[this.__index__++];
  9624. return { 'done': done, 'value': value };
  9625. }
  9626. /**
  9627. * Enables the wrapper to be iterable.
  9628. *
  9629. * @name Symbol.iterator
  9630. * @memberOf _
  9631. * @since 4.0.0
  9632. * @category Seq
  9633. * @returns {Object} Returns the wrapper object.
  9634. * @example
  9635. *
  9636. * var wrapped = _([1, 2]);
  9637. *
  9638. * wrapped[Symbol.iterator]() === wrapped;
  9639. * // => true
  9640. *
  9641. * Array.from(wrapped);
  9642. * // => [1, 2]
  9643. */
  9644. function wrapperToIterator() {
  9645. return this;
  9646. }
  9647. /**
  9648. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9649. *
  9650. * @name plant
  9651. * @memberOf _
  9652. * @since 3.2.0
  9653. * @category Seq
  9654. * @param {*} value The value to plant.
  9655. * @returns {Object} Returns the new `lodash` wrapper instance.
  9656. * @example
  9657. *
  9658. * function square(n) {
  9659. * return n * n;
  9660. * }
  9661. *
  9662. * var wrapped = _([1, 2]).map(square);
  9663. * var other = wrapped.plant([3, 4]);
  9664. *
  9665. * other.value();
  9666. * // => [9, 16]
  9667. *
  9668. * wrapped.value();
  9669. * // => [1, 4]
  9670. */
  9671. function wrapperPlant(value) {
  9672. var result,
  9673. parent = this;
  9674. while (parent instanceof baseLodash) {
  9675. var clone = wrapperClone(parent);
  9676. clone.__index__ = 0;
  9677. clone.__values__ = undefined;
  9678. if (result) {
  9679. previous.__wrapped__ = clone;
  9680. } else {
  9681. result = clone;
  9682. }
  9683. var previous = clone;
  9684. parent = parent.__wrapped__;
  9685. }
  9686. previous.__wrapped__ = value;
  9687. return result;
  9688. }
  9689. /**
  9690. * This method is the wrapper version of `_.reverse`.
  9691. *
  9692. * **Note:** This method mutates the wrapped array.
  9693. *
  9694. * @name reverse
  9695. * @memberOf _
  9696. * @since 0.1.0
  9697. * @category Seq
  9698. * @returns {Object} Returns the new `lodash` wrapper instance.
  9699. * @example
  9700. *
  9701. * var array = [1, 2, 3];
  9702. *
  9703. * _(array).reverse().value()
  9704. * // => [3, 2, 1]
  9705. *
  9706. * console.log(array);
  9707. * // => [3, 2, 1]
  9708. */
  9709. function wrapperReverse() {
  9710. var value = this.__wrapped__;
  9711. if (value instanceof LazyWrapper) {
  9712. var wrapped = value;
  9713. if (this.__actions__.length) {
  9714. wrapped = new LazyWrapper(this);
  9715. }
  9716. wrapped = wrapped.reverse();
  9717. wrapped.__actions__.push({
  9718. 'func': thru,
  9719. 'args': [reverse],
  9720. 'thisArg': undefined
  9721. });
  9722. return new LodashWrapper(wrapped, this.__chain__);
  9723. }
  9724. return this.thru(reverse);
  9725. }
  9726. /**
  9727. * Executes the chain sequence to resolve the unwrapped value.
  9728. *
  9729. * @name value
  9730. * @memberOf _
  9731. * @since 0.1.0
  9732. * @alias toJSON, valueOf
  9733. * @category Seq
  9734. * @returns {*} Returns the resolved unwrapped value.
  9735. * @example
  9736. *
  9737. * _([1, 2, 3]).value();
  9738. * // => [1, 2, 3]
  9739. */
  9740. function wrapperValue() {
  9741. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9742. }
  9743. /*------------------------------------------------------------------------*/
  9744. /**
  9745. * Creates an object composed of keys generated from the results of running
  9746. * each element of `collection` thru `iteratee`. The corresponding value of
  9747. * each key is the number of times the key was returned by `iteratee`. The
  9748. * iteratee is invoked with one argument: (value).
  9749. *
  9750. * @static
  9751. * @memberOf _
  9752. * @since 0.5.0
  9753. * @category Collection
  9754. * @param {Array|Object} collection The collection to iterate over.
  9755. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9756. * @returns {Object} Returns the composed aggregate object.
  9757. * @example
  9758. *
  9759. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9760. * // => { '4': 1, '6': 2 }
  9761. *
  9762. * // The `_.property` iteratee shorthand.
  9763. * _.countBy(['one', 'two', 'three'], 'length');
  9764. * // => { '3': 2, '5': 1 }
  9765. */
  9766. var countBy = createAggregator(function(result, value, key) {
  9767. if (hasOwnProperty.call(result, key)) {
  9768. ++result[key];
  9769. } else {
  9770. baseAssignValue(result, key, 1);
  9771. }
  9772. });
  9773. /**
  9774. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9775. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9776. * invoked with three arguments: (value, index|key, collection).
  9777. *
  9778. * **Note:** This method returns `true` for
  9779. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9780. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9781. * elements of empty collections.
  9782. *
  9783. * @static
  9784. * @memberOf _
  9785. * @since 0.1.0
  9786. * @category Collection
  9787. * @param {Array|Object} collection The collection to iterate over.
  9788. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9789. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9790. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9791. * else `false`.
  9792. * @example
  9793. *
  9794. * _.every([true, 1, null, 'yes'], Boolean);
  9795. * // => false
  9796. *
  9797. * var users = [
  9798. * { 'user': 'barney', 'age': 36, 'active': false },
  9799. * { 'user': 'fred', 'age': 40, 'active': false }
  9800. * ];
  9801. *
  9802. * // The `_.matches` iteratee shorthand.
  9803. * _.every(users, { 'user': 'barney', 'active': false });
  9804. * // => false
  9805. *
  9806. * // The `_.matchesProperty` iteratee shorthand.
  9807. * _.every(users, ['active', false]);
  9808. * // => true
  9809. *
  9810. * // The `_.property` iteratee shorthand.
  9811. * _.every(users, 'active');
  9812. * // => false
  9813. */
  9814. function every(collection, predicate, guard) {
  9815. var func = isArray(collection) ? arrayEvery : baseEvery;
  9816. if (guard && isIterateeCall(collection, predicate, guard)) {
  9817. predicate = undefined;
  9818. }
  9819. return func(collection, getIteratee(predicate, 3));
  9820. }
  9821. /**
  9822. * Iterates over elements of `collection`, returning an array of all elements
  9823. * `predicate` returns truthy for. The predicate is invoked with three
  9824. * arguments: (value, index|key, collection).
  9825. *
  9826. * **Note:** Unlike `_.remove`, this method returns a new array.
  9827. *
  9828. * @static
  9829. * @memberOf _
  9830. * @since 0.1.0
  9831. * @category Collection
  9832. * @param {Array|Object} collection The collection to iterate over.
  9833. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9834. * @returns {Array} Returns the new filtered array.
  9835. * @see _.reject
  9836. * @example
  9837. *
  9838. * var users = [
  9839. * { 'user': 'barney', 'age': 36, 'active': true },
  9840. * { 'user': 'fred', 'age': 40, 'active': false }
  9841. * ];
  9842. *
  9843. * _.filter(users, function(o) { return !o.active; });
  9844. * // => objects for ['fred']
  9845. *
  9846. * // The `_.matches` iteratee shorthand.
  9847. * _.filter(users, { 'age': 36, 'active': true });
  9848. * // => objects for ['barney']
  9849. *
  9850. * // The `_.matchesProperty` iteratee shorthand.
  9851. * _.filter(users, ['active', false]);
  9852. * // => objects for ['fred']
  9853. *
  9854. * // The `_.property` iteratee shorthand.
  9855. * _.filter(users, 'active');
  9856. * // => objects for ['barney']
  9857. *
  9858. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  9859. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  9860. * // => objects for ['fred', 'barney']
  9861. */
  9862. function filter(collection, predicate) {
  9863. var func = isArray(collection) ? arrayFilter : baseFilter;
  9864. return func(collection, getIteratee(predicate, 3));
  9865. }
  9866. /**
  9867. * Iterates over elements of `collection`, returning the first element
  9868. * `predicate` returns truthy for. The predicate is invoked with three
  9869. * arguments: (value, index|key, collection).
  9870. *
  9871. * @static
  9872. * @memberOf _
  9873. * @since 0.1.0
  9874. * @category Collection
  9875. * @param {Array|Object} collection The collection to inspect.
  9876. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9877. * @param {number} [fromIndex=0] The index to search from.
  9878. * @returns {*} Returns the matched element, else `undefined`.
  9879. * @example
  9880. *
  9881. * var users = [
  9882. * { 'user': 'barney', 'age': 36, 'active': true },
  9883. * { 'user': 'fred', 'age': 40, 'active': false },
  9884. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9885. * ];
  9886. *
  9887. * _.find(users, function(o) { return o.age < 40; });
  9888. * // => object for 'barney'
  9889. *
  9890. * // The `_.matches` iteratee shorthand.
  9891. * _.find(users, { 'age': 1, 'active': true });
  9892. * // => object for 'pebbles'
  9893. *
  9894. * // The `_.matchesProperty` iteratee shorthand.
  9895. * _.find(users, ['active', false]);
  9896. * // => object for 'fred'
  9897. *
  9898. * // The `_.property` iteratee shorthand.
  9899. * _.find(users, 'active');
  9900. * // => object for 'barney'
  9901. */
  9902. var find = createFind(findIndex);
  9903. /**
  9904. * This method is like `_.find` except that it iterates over elements of
  9905. * `collection` from right to left.
  9906. *
  9907. * @static
  9908. * @memberOf _
  9909. * @since 2.0.0
  9910. * @category Collection
  9911. * @param {Array|Object} collection The collection to inspect.
  9912. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9913. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9914. * @returns {*} Returns the matched element, else `undefined`.
  9915. * @example
  9916. *
  9917. * _.findLast([1, 2, 3, 4], function(n) {
  9918. * return n % 2 == 1;
  9919. * });
  9920. * // => 3
  9921. */
  9922. var findLast = createFind(findLastIndex);
  9923. /**
  9924. * Creates a flattened array of values by running each element in `collection`
  9925. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9926. * with three arguments: (value, index|key, collection).
  9927. *
  9928. * @static
  9929. * @memberOf _
  9930. * @since 4.0.0
  9931. * @category Collection
  9932. * @param {Array|Object} collection The collection to iterate over.
  9933. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9934. * @returns {Array} Returns the new flattened array.
  9935. * @example
  9936. *
  9937. * function duplicate(n) {
  9938. * return [n, n];
  9939. * }
  9940. *
  9941. * _.flatMap([1, 2], duplicate);
  9942. * // => [1, 1, 2, 2]
  9943. */
  9944. function flatMap(collection, iteratee) {
  9945. return baseFlatten(map(collection, iteratee), 1);
  9946. }
  9947. /**
  9948. * This method is like `_.flatMap` except that it recursively flattens the
  9949. * mapped results.
  9950. *
  9951. * @static
  9952. * @memberOf _
  9953. * @since 4.7.0
  9954. * @category Collection
  9955. * @param {Array|Object} collection The collection to iterate over.
  9956. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9957. * @returns {Array} Returns the new flattened array.
  9958. * @example
  9959. *
  9960. * function duplicate(n) {
  9961. * return [[[n, n]]];
  9962. * }
  9963. *
  9964. * _.flatMapDeep([1, 2], duplicate);
  9965. * // => [1, 1, 2, 2]
  9966. */
  9967. function flatMapDeep(collection, iteratee) {
  9968. return baseFlatten(map(collection, iteratee), INFINITY);
  9969. }
  9970. /**
  9971. * This method is like `_.flatMap` except that it recursively flattens the
  9972. * mapped results up to `depth` times.
  9973. *
  9974. * @static
  9975. * @memberOf _
  9976. * @since 4.7.0
  9977. * @category Collection
  9978. * @param {Array|Object} collection The collection to iterate over.
  9979. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9980. * @param {number} [depth=1] The maximum recursion depth.
  9981. * @returns {Array} Returns the new flattened array.
  9982. * @example
  9983. *
  9984. * function duplicate(n) {
  9985. * return [[[n, n]]];
  9986. * }
  9987. *
  9988. * _.flatMapDepth([1, 2], duplicate, 2);
  9989. * // => [[1, 1], [2, 2]]
  9990. */
  9991. function flatMapDepth(collection, iteratee, depth) {
  9992. depth = depth === undefined ? 1 : toInteger(depth);
  9993. return baseFlatten(map(collection, iteratee), depth);
  9994. }
  9995. /**
  9996. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9997. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9998. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9999. *
  10000. * **Note:** As with other "Collections" methods, objects with a "length"
  10001. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  10002. * or `_.forOwn` for object iteration.
  10003. *
  10004. * @static
  10005. * @memberOf _
  10006. * @since 0.1.0
  10007. * @alias each
  10008. * @category Collection
  10009. * @param {Array|Object} collection The collection to iterate over.
  10010. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10011. * @returns {Array|Object} Returns `collection`.
  10012. * @see _.forEachRight
  10013. * @example
  10014. *
  10015. * _.forEach([1, 2], function(value) {
  10016. * console.log(value);
  10017. * });
  10018. * // => Logs `1` then `2`.
  10019. *
  10020. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  10021. * console.log(key);
  10022. * });
  10023. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  10024. */
  10025. function forEach(collection, iteratee) {
  10026. var func = isArray(collection) ? arrayEach : baseEach;
  10027. return func(collection, getIteratee(iteratee, 3));
  10028. }
  10029. /**
  10030. * This method is like `_.forEach` except that it iterates over elements of
  10031. * `collection` from right to left.
  10032. *
  10033. * @static
  10034. * @memberOf _
  10035. * @since 2.0.0
  10036. * @alias eachRight
  10037. * @category Collection
  10038. * @param {Array|Object} collection The collection to iterate over.
  10039. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10040. * @returns {Array|Object} Returns `collection`.
  10041. * @see _.forEach
  10042. * @example
  10043. *
  10044. * _.forEachRight([1, 2], function(value) {
  10045. * console.log(value);
  10046. * });
  10047. * // => Logs `2` then `1`.
  10048. */
  10049. function forEachRight(collection, iteratee) {
  10050. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  10051. return func(collection, getIteratee(iteratee, 3));
  10052. }
  10053. /**
  10054. * Creates an object composed of keys generated from the results of running
  10055. * each element of `collection` thru `iteratee`. The order of grouped values
  10056. * is determined by the order they occur in `collection`. The corresponding
  10057. * value of each key is an array of elements responsible for generating the
  10058. * key. The iteratee is invoked with one argument: (value).
  10059. *
  10060. * @static
  10061. * @memberOf _
  10062. * @since 0.1.0
  10063. * @category Collection
  10064. * @param {Array|Object} collection The collection to iterate over.
  10065. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10066. * @returns {Object} Returns the composed aggregate object.
  10067. * @example
  10068. *
  10069. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  10070. * // => { '4': [4.2], '6': [6.1, 6.3] }
  10071. *
  10072. * // The `_.property` iteratee shorthand.
  10073. * _.groupBy(['one', 'two', 'three'], 'length');
  10074. * // => { '3': ['one', 'two'], '5': ['three'] }
  10075. */
  10076. var groupBy = createAggregator(function(result, value, key) {
  10077. if (hasOwnProperty.call(result, key)) {
  10078. result[key].push(value);
  10079. } else {
  10080. baseAssignValue(result, key, [value]);
  10081. }
  10082. });
  10083. /**
  10084. * Checks if `value` is in `collection`. If `collection` is a string, it's
  10085. * checked for a substring of `value`, otherwise
  10086. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  10087. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  10088. * the offset from the end of `collection`.
  10089. *
  10090. * @static
  10091. * @memberOf _
  10092. * @since 0.1.0
  10093. * @category Collection
  10094. * @param {Array|Object|string} collection The collection to inspect.
  10095. * @param {*} value The value to search for.
  10096. * @param {number} [fromIndex=0] The index to search from.
  10097. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10098. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  10099. * @example
  10100. *
  10101. * _.includes([1, 2, 3], 1);
  10102. * // => true
  10103. *
  10104. * _.includes([1, 2, 3], 1, 2);
  10105. * // => false
  10106. *
  10107. * _.includes({ 'a': 1, 'b': 2 }, 1);
  10108. * // => true
  10109. *
  10110. * _.includes('abcd', 'bc');
  10111. * // => true
  10112. */
  10113. function includes(collection, value, fromIndex, guard) {
  10114. collection = isArrayLike(collection) ? collection : values(collection);
  10115. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  10116. var length = collection.length;
  10117. if (fromIndex < 0) {
  10118. fromIndex = nativeMax(length + fromIndex, 0);
  10119. }
  10120. return isString(collection)
  10121. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  10122. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  10123. }
  10124. /**
  10125. * Invokes the method at `path` of each element in `collection`, returning
  10126. * an array of the results of each invoked method. Any additional arguments
  10127. * are provided to each invoked method. If `path` is a function, it's invoked
  10128. * for, and `this` bound to, each element in `collection`.
  10129. *
  10130. * @static
  10131. * @memberOf _
  10132. * @since 4.0.0
  10133. * @category Collection
  10134. * @param {Array|Object} collection The collection to iterate over.
  10135. * @param {Array|Function|string} path The path of the method to invoke or
  10136. * the function invoked per iteration.
  10137. * @param {...*} [args] The arguments to invoke each method with.
  10138. * @returns {Array} Returns the array of results.
  10139. * @example
  10140. *
  10141. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  10142. * // => [[1, 5, 7], [1, 2, 3]]
  10143. *
  10144. * _.invokeMap([123, 456], String.prototype.split, '');
  10145. * // => [['1', '2', '3'], ['4', '5', '6']]
  10146. */
  10147. var invokeMap = baseRest(function(collection, path, args) {
  10148. var index = -1,
  10149. isFunc = typeof path == 'function',
  10150. result = isArrayLike(collection) ? Array(collection.length) : [];
  10151. baseEach(collection, function(value) {
  10152. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  10153. });
  10154. return result;
  10155. });
  10156. /**
  10157. * Creates an object composed of keys generated from the results of running
  10158. * each element of `collection` thru `iteratee`. The corresponding value of
  10159. * each key is the last element responsible for generating the key. The
  10160. * iteratee is invoked with one argument: (value).
  10161. *
  10162. * @static
  10163. * @memberOf _
  10164. * @since 4.0.0
  10165. * @category Collection
  10166. * @param {Array|Object} collection The collection to iterate over.
  10167. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10168. * @returns {Object} Returns the composed aggregate object.
  10169. * @example
  10170. *
  10171. * var array = [
  10172. * { 'dir': 'left', 'code': 97 },
  10173. * { 'dir': 'right', 'code': 100 }
  10174. * ];
  10175. *
  10176. * _.keyBy(array, function(o) {
  10177. * return String.fromCharCode(o.code);
  10178. * });
  10179. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  10180. *
  10181. * _.keyBy(array, 'dir');
  10182. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  10183. */
  10184. var keyBy = createAggregator(function(result, value, key) {
  10185. baseAssignValue(result, key, value);
  10186. });
  10187. /**
  10188. * Creates an array of values by running each element in `collection` thru
  10189. * `iteratee`. The iteratee is invoked with three arguments:
  10190. * (value, index|key, collection).
  10191. *
  10192. * Many lodash methods are guarded to work as iteratees for methods like
  10193. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  10194. *
  10195. * The guarded methods are:
  10196. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  10197. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  10198. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  10199. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  10200. *
  10201. * @static
  10202. * @memberOf _
  10203. * @since 0.1.0
  10204. * @category Collection
  10205. * @param {Array|Object} collection The collection to iterate over.
  10206. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10207. * @returns {Array} Returns the new mapped array.
  10208. * @example
  10209. *
  10210. * function square(n) {
  10211. * return n * n;
  10212. * }
  10213. *
  10214. * _.map([4, 8], square);
  10215. * // => [16, 64]
  10216. *
  10217. * _.map({ 'a': 4, 'b': 8 }, square);
  10218. * // => [16, 64] (iteration order is not guaranteed)
  10219. *
  10220. * var users = [
  10221. * { 'user': 'barney' },
  10222. * { 'user': 'fred' }
  10223. * ];
  10224. *
  10225. * // The `_.property` iteratee shorthand.
  10226. * _.map(users, 'user');
  10227. * // => ['barney', 'fred']
  10228. */
  10229. function map(collection, iteratee) {
  10230. var func = isArray(collection) ? arrayMap : baseMap;
  10231. return func(collection, getIteratee(iteratee, 3));
  10232. }
  10233. /**
  10234. * This method is like `_.sortBy` except that it allows specifying the sort
  10235. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  10236. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  10237. * descending or "asc" for ascending sort order of corresponding values.
  10238. *
  10239. * @static
  10240. * @memberOf _
  10241. * @since 4.0.0
  10242. * @category Collection
  10243. * @param {Array|Object} collection The collection to iterate over.
  10244. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  10245. * The iteratees to sort by.
  10246. * @param {string[]} [orders] The sort orders of `iteratees`.
  10247. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10248. * @returns {Array} Returns the new sorted array.
  10249. * @example
  10250. *
  10251. * var users = [
  10252. * { 'user': 'fred', 'age': 48 },
  10253. * { 'user': 'barney', 'age': 34 },
  10254. * { 'user': 'fred', 'age': 40 },
  10255. * { 'user': 'barney', 'age': 36 }
  10256. * ];
  10257. *
  10258. * // Sort by `user` in ascending order and by `age` in descending order.
  10259. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  10260. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10261. */
  10262. function orderBy(collection, iteratees, orders, guard) {
  10263. if (collection == null) {
  10264. return [];
  10265. }
  10266. if (!isArray(iteratees)) {
  10267. iteratees = iteratees == null ? [] : [iteratees];
  10268. }
  10269. orders = guard ? undefined : orders;
  10270. if (!isArray(orders)) {
  10271. orders = orders == null ? [] : [orders];
  10272. }
  10273. return baseOrderBy(collection, iteratees, orders);
  10274. }
  10275. /**
  10276. * Creates an array of elements split into two groups, the first of which
  10277. * contains elements `predicate` returns truthy for, the second of which
  10278. * contains elements `predicate` returns falsey for. The predicate is
  10279. * invoked with one argument: (value).
  10280. *
  10281. * @static
  10282. * @memberOf _
  10283. * @since 3.0.0
  10284. * @category Collection
  10285. * @param {Array|Object} collection The collection to iterate over.
  10286. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10287. * @returns {Array} Returns the array of grouped elements.
  10288. * @example
  10289. *
  10290. * var users = [
  10291. * { 'user': 'barney', 'age': 36, 'active': false },
  10292. * { 'user': 'fred', 'age': 40, 'active': true },
  10293. * { 'user': 'pebbles', 'age': 1, 'active': false }
  10294. * ];
  10295. *
  10296. * _.partition(users, function(o) { return o.active; });
  10297. * // => objects for [['fred'], ['barney', 'pebbles']]
  10298. *
  10299. * // The `_.matches` iteratee shorthand.
  10300. * _.partition(users, { 'age': 1, 'active': false });
  10301. * // => objects for [['pebbles'], ['barney', 'fred']]
  10302. *
  10303. * // The `_.matchesProperty` iteratee shorthand.
  10304. * _.partition(users, ['active', false]);
  10305. * // => objects for [['barney', 'pebbles'], ['fred']]
  10306. *
  10307. * // The `_.property` iteratee shorthand.
  10308. * _.partition(users, 'active');
  10309. * // => objects for [['fred'], ['barney', 'pebbles']]
  10310. */
  10311. var partition = createAggregator(function(result, value, key) {
  10312. result[key ? 0 : 1].push(value);
  10313. }, function() { return [[], []]; });
  10314. /**
  10315. * Reduces `collection` to a value which is the accumulated result of running
  10316. * each element in `collection` thru `iteratee`, where each successive
  10317. * invocation is supplied the return value of the previous. If `accumulator`
  10318. * is not given, the first element of `collection` is used as the initial
  10319. * value. The iteratee is invoked with four arguments:
  10320. * (accumulator, value, index|key, collection).
  10321. *
  10322. * Many lodash methods are guarded to work as iteratees for methods like
  10323. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  10324. *
  10325. * The guarded methods are:
  10326. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  10327. * and `sortBy`
  10328. *
  10329. * @static
  10330. * @memberOf _
  10331. * @since 0.1.0
  10332. * @category Collection
  10333. * @param {Array|Object} collection The collection to iterate over.
  10334. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10335. * @param {*} [accumulator] The initial value.
  10336. * @returns {*} Returns the accumulated value.
  10337. * @see _.reduceRight
  10338. * @example
  10339. *
  10340. * _.reduce([1, 2], function(sum, n) {
  10341. * return sum + n;
  10342. * }, 0);
  10343. * // => 3
  10344. *
  10345. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  10346. * (result[value] || (result[value] = [])).push(key);
  10347. * return result;
  10348. * }, {});
  10349. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  10350. */
  10351. function reduce(collection, iteratee, accumulator) {
  10352. var func = isArray(collection) ? arrayReduce : baseReduce,
  10353. initAccum = arguments.length < 3;
  10354. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  10355. }
  10356. /**
  10357. * This method is like `_.reduce` except that it iterates over elements of
  10358. * `collection` from right to left.
  10359. *
  10360. * @static
  10361. * @memberOf _
  10362. * @since 0.1.0
  10363. * @category Collection
  10364. * @param {Array|Object} collection The collection to iterate over.
  10365. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10366. * @param {*} [accumulator] The initial value.
  10367. * @returns {*} Returns the accumulated value.
  10368. * @see _.reduce
  10369. * @example
  10370. *
  10371. * var array = [[0, 1], [2, 3], [4, 5]];
  10372. *
  10373. * _.reduceRight(array, function(flattened, other) {
  10374. * return flattened.concat(other);
  10375. * }, []);
  10376. * // => [4, 5, 2, 3, 0, 1]
  10377. */
  10378. function reduceRight(collection, iteratee, accumulator) {
  10379. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  10380. initAccum = arguments.length < 3;
  10381. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  10382. }
  10383. /**
  10384. * The opposite of `_.filter`; this method returns the elements of `collection`
  10385. * that `predicate` does **not** return truthy for.
  10386. *
  10387. * @static
  10388. * @memberOf _
  10389. * @since 0.1.0
  10390. * @category Collection
  10391. * @param {Array|Object} collection The collection to iterate over.
  10392. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10393. * @returns {Array} Returns the new filtered array.
  10394. * @see _.filter
  10395. * @example
  10396. *
  10397. * var users = [
  10398. * { 'user': 'barney', 'age': 36, 'active': false },
  10399. * { 'user': 'fred', 'age': 40, 'active': true }
  10400. * ];
  10401. *
  10402. * _.reject(users, function(o) { return !o.active; });
  10403. * // => objects for ['fred']
  10404. *
  10405. * // The `_.matches` iteratee shorthand.
  10406. * _.reject(users, { 'age': 40, 'active': true });
  10407. * // => objects for ['barney']
  10408. *
  10409. * // The `_.matchesProperty` iteratee shorthand.
  10410. * _.reject(users, ['active', false]);
  10411. * // => objects for ['fred']
  10412. *
  10413. * // The `_.property` iteratee shorthand.
  10414. * _.reject(users, 'active');
  10415. * // => objects for ['barney']
  10416. */
  10417. function reject(collection, predicate) {
  10418. var func = isArray(collection) ? arrayFilter : baseFilter;
  10419. return func(collection, negate(getIteratee(predicate, 3)));
  10420. }
  10421. /**
  10422. * Gets a random element from `collection`.
  10423. *
  10424. * @static
  10425. * @memberOf _
  10426. * @since 2.0.0
  10427. * @category Collection
  10428. * @param {Array|Object} collection The collection to sample.
  10429. * @returns {*} Returns the random element.
  10430. * @example
  10431. *
  10432. * _.sample([1, 2, 3, 4]);
  10433. * // => 2
  10434. */
  10435. function sample(collection) {
  10436. var func = isArray(collection) ? arraySample : baseSample;
  10437. return func(collection);
  10438. }
  10439. /**
  10440. * Gets `n` random elements at unique keys from `collection` up to the
  10441. * size of `collection`.
  10442. *
  10443. * @static
  10444. * @memberOf _
  10445. * @since 4.0.0
  10446. * @category Collection
  10447. * @param {Array|Object} collection The collection to sample.
  10448. * @param {number} [n=1] The number of elements to sample.
  10449. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10450. * @returns {Array} Returns the random elements.
  10451. * @example
  10452. *
  10453. * _.sampleSize([1, 2, 3], 2);
  10454. * // => [3, 1]
  10455. *
  10456. * _.sampleSize([1, 2, 3], 4);
  10457. * // => [2, 3, 1]
  10458. */
  10459. function sampleSize(collection, n, guard) {
  10460. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  10461. n = 1;
  10462. } else {
  10463. n = toInteger(n);
  10464. }
  10465. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  10466. return func(collection, n);
  10467. }
  10468. /**
  10469. * Creates an array of shuffled values, using a version of the
  10470. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  10471. *
  10472. * @static
  10473. * @memberOf _
  10474. * @since 0.1.0
  10475. * @category Collection
  10476. * @param {Array|Object} collection The collection to shuffle.
  10477. * @returns {Array} Returns the new shuffled array.
  10478. * @example
  10479. *
  10480. * _.shuffle([1, 2, 3, 4]);
  10481. * // => [4, 1, 3, 2]
  10482. */
  10483. function shuffle(collection) {
  10484. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  10485. return func(collection);
  10486. }
  10487. /**
  10488. * Gets the size of `collection` by returning its length for array-like
  10489. * values or the number of own enumerable string keyed properties for objects.
  10490. *
  10491. * @static
  10492. * @memberOf _
  10493. * @since 0.1.0
  10494. * @category Collection
  10495. * @param {Array|Object|string} collection The collection to inspect.
  10496. * @returns {number} Returns the collection size.
  10497. * @example
  10498. *
  10499. * _.size([1, 2, 3]);
  10500. * // => 3
  10501. *
  10502. * _.size({ 'a': 1, 'b': 2 });
  10503. * // => 2
  10504. *
  10505. * _.size('pebbles');
  10506. * // => 7
  10507. */
  10508. function size(collection) {
  10509. if (collection == null) {
  10510. return 0;
  10511. }
  10512. if (isArrayLike(collection)) {
  10513. return isString(collection) ? stringSize(collection) : collection.length;
  10514. }
  10515. var tag = getTag(collection);
  10516. if (tag == mapTag || tag == setTag) {
  10517. return collection.size;
  10518. }
  10519. return baseKeys(collection).length;
  10520. }
  10521. /**
  10522. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10523. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10524. * invoked with three arguments: (value, index|key, collection).
  10525. *
  10526. * @static
  10527. * @memberOf _
  10528. * @since 0.1.0
  10529. * @category Collection
  10530. * @param {Array|Object} collection The collection to iterate over.
  10531. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10532. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10533. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10534. * else `false`.
  10535. * @example
  10536. *
  10537. * _.some([null, 0, 'yes', false], Boolean);
  10538. * // => true
  10539. *
  10540. * var users = [
  10541. * { 'user': 'barney', 'active': true },
  10542. * { 'user': 'fred', 'active': false }
  10543. * ];
  10544. *
  10545. * // The `_.matches` iteratee shorthand.
  10546. * _.some(users, { 'user': 'barney', 'active': false });
  10547. * // => false
  10548. *
  10549. * // The `_.matchesProperty` iteratee shorthand.
  10550. * _.some(users, ['active', false]);
  10551. * // => true
  10552. *
  10553. * // The `_.property` iteratee shorthand.
  10554. * _.some(users, 'active');
  10555. * // => true
  10556. */
  10557. function some(collection, predicate, guard) {
  10558. var func = isArray(collection) ? arraySome : baseSome;
  10559. if (guard && isIterateeCall(collection, predicate, guard)) {
  10560. predicate = undefined;
  10561. }
  10562. return func(collection, getIteratee(predicate, 3));
  10563. }
  10564. /**
  10565. * Creates an array of elements, sorted in ascending order by the results of
  10566. * running each element in a collection thru each iteratee. This method
  10567. * performs a stable sort, that is, it preserves the original sort order of
  10568. * equal elements. The iteratees are invoked with one argument: (value).
  10569. *
  10570. * @static
  10571. * @memberOf _
  10572. * @since 0.1.0
  10573. * @category Collection
  10574. * @param {Array|Object} collection The collection to iterate over.
  10575. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10576. * The iteratees to sort by.
  10577. * @returns {Array} Returns the new sorted array.
  10578. * @example
  10579. *
  10580. * var users = [
  10581. * { 'user': 'fred', 'age': 48 },
  10582. * { 'user': 'barney', 'age': 36 },
  10583. * { 'user': 'fred', 'age': 30 },
  10584. * { 'user': 'barney', 'age': 34 }
  10585. * ];
  10586. *
  10587. * _.sortBy(users, [function(o) { return o.user; }]);
  10588. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  10589. *
  10590. * _.sortBy(users, ['user', 'age']);
  10591. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  10592. */
  10593. var sortBy = baseRest(function(collection, iteratees) {
  10594. if (collection == null) {
  10595. return [];
  10596. }
  10597. var length = iteratees.length;
  10598. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10599. iteratees = [];
  10600. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10601. iteratees = [iteratees[0]];
  10602. }
  10603. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10604. });
  10605. /*------------------------------------------------------------------------*/
  10606. /**
  10607. * Gets the timestamp of the number of milliseconds that have elapsed since
  10608. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10609. *
  10610. * @static
  10611. * @memberOf _
  10612. * @since 2.4.0
  10613. * @category Date
  10614. * @returns {number} Returns the timestamp.
  10615. * @example
  10616. *
  10617. * _.defer(function(stamp) {
  10618. * console.log(_.now() - stamp);
  10619. * }, _.now());
  10620. * // => Logs the number of milliseconds it took for the deferred invocation.
  10621. */
  10622. var now = ctxNow || function() {
  10623. return root.Date.now();
  10624. };
  10625. /*------------------------------------------------------------------------*/
  10626. /**
  10627. * The opposite of `_.before`; this method creates a function that invokes
  10628. * `func` once it's called `n` or more times.
  10629. *
  10630. * @static
  10631. * @memberOf _
  10632. * @since 0.1.0
  10633. * @category Function
  10634. * @param {number} n The number of calls before `func` is invoked.
  10635. * @param {Function} func The function to restrict.
  10636. * @returns {Function} Returns the new restricted function.
  10637. * @example
  10638. *
  10639. * var saves = ['profile', 'settings'];
  10640. *
  10641. * var done = _.after(saves.length, function() {
  10642. * console.log('done saving!');
  10643. * });
  10644. *
  10645. * _.forEach(saves, function(type) {
  10646. * asyncSave({ 'type': type, 'complete': done });
  10647. * });
  10648. * // => Logs 'done saving!' after the two async saves have completed.
  10649. */
  10650. function after(n, func) {
  10651. if (typeof func != 'function') {
  10652. throw new TypeError(FUNC_ERROR_TEXT);
  10653. }
  10654. n = toInteger(n);
  10655. return function() {
  10656. if (--n < 1) {
  10657. return func.apply(this, arguments);
  10658. }
  10659. };
  10660. }
  10661. /**
  10662. * Creates a function that invokes `func`, with up to `n` arguments,
  10663. * ignoring any additional arguments.
  10664. *
  10665. * @static
  10666. * @memberOf _
  10667. * @since 3.0.0
  10668. * @category Function
  10669. * @param {Function} func The function to cap arguments for.
  10670. * @param {number} [n=func.length] The arity cap.
  10671. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10672. * @returns {Function} Returns the new capped function.
  10673. * @example
  10674. *
  10675. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10676. * // => [6, 8, 10]
  10677. */
  10678. function ary(func, n, guard) {
  10679. n = guard ? undefined : n;
  10680. n = (func && n == null) ? func.length : n;
  10681. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10682. }
  10683. /**
  10684. * Creates a function that invokes `func`, with the `this` binding and arguments
  10685. * of the created function, while it's called less than `n` times. Subsequent
  10686. * calls to the created function return the result of the last `func` invocation.
  10687. *
  10688. * @static
  10689. * @memberOf _
  10690. * @since 3.0.0
  10691. * @category Function
  10692. * @param {number} n The number of calls at which `func` is no longer invoked.
  10693. * @param {Function} func The function to restrict.
  10694. * @returns {Function} Returns the new restricted function.
  10695. * @example
  10696. *
  10697. * jQuery(element).on('click', _.before(5, addContactToList));
  10698. * // => Allows adding up to 4 contacts to the list.
  10699. */
  10700. function before(n, func) {
  10701. var result;
  10702. if (typeof func != 'function') {
  10703. throw new TypeError(FUNC_ERROR_TEXT);
  10704. }
  10705. n = toInteger(n);
  10706. return function() {
  10707. if (--n > 0) {
  10708. result = func.apply(this, arguments);
  10709. }
  10710. if (n <= 1) {
  10711. func = undefined;
  10712. }
  10713. return result;
  10714. };
  10715. }
  10716. /**
  10717. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10718. * and `partials` prepended to the arguments it receives.
  10719. *
  10720. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10721. * may be used as a placeholder for partially applied arguments.
  10722. *
  10723. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10724. * property of bound functions.
  10725. *
  10726. * @static
  10727. * @memberOf _
  10728. * @since 0.1.0
  10729. * @category Function
  10730. * @param {Function} func The function to bind.
  10731. * @param {*} thisArg The `this` binding of `func`.
  10732. * @param {...*} [partials] The arguments to be partially applied.
  10733. * @returns {Function} Returns the new bound function.
  10734. * @example
  10735. *
  10736. * function greet(greeting, punctuation) {
  10737. * return greeting + ' ' + this.user + punctuation;
  10738. * }
  10739. *
  10740. * var object = { 'user': 'fred' };
  10741. *
  10742. * var bound = _.bind(greet, object, 'hi');
  10743. * bound('!');
  10744. * // => 'hi fred!'
  10745. *
  10746. * // Bound with placeholders.
  10747. * var bound = _.bind(greet, object, _, '!');
  10748. * bound('hi');
  10749. * // => 'hi fred!'
  10750. */
  10751. var bind = baseRest(function(func, thisArg, partials) {
  10752. var bitmask = WRAP_BIND_FLAG;
  10753. if (partials.length) {
  10754. var holders = replaceHolders(partials, getHolder(bind));
  10755. bitmask |= WRAP_PARTIAL_FLAG;
  10756. }
  10757. return createWrap(func, bitmask, thisArg, partials, holders);
  10758. });
  10759. /**
  10760. * Creates a function that invokes the method at `object[key]` with `partials`
  10761. * prepended to the arguments it receives.
  10762. *
  10763. * This method differs from `_.bind` by allowing bound functions to reference
  10764. * methods that may be redefined or don't yet exist. See
  10765. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10766. * for more details.
  10767. *
  10768. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10769. * builds, may be used as a placeholder for partially applied arguments.
  10770. *
  10771. * @static
  10772. * @memberOf _
  10773. * @since 0.10.0
  10774. * @category Function
  10775. * @param {Object} object The object to invoke the method on.
  10776. * @param {string} key The key of the method.
  10777. * @param {...*} [partials] The arguments to be partially applied.
  10778. * @returns {Function} Returns the new bound function.
  10779. * @example
  10780. *
  10781. * var object = {
  10782. * 'user': 'fred',
  10783. * 'greet': function(greeting, punctuation) {
  10784. * return greeting + ' ' + this.user + punctuation;
  10785. * }
  10786. * };
  10787. *
  10788. * var bound = _.bindKey(object, 'greet', 'hi');
  10789. * bound('!');
  10790. * // => 'hi fred!'
  10791. *
  10792. * object.greet = function(greeting, punctuation) {
  10793. * return greeting + 'ya ' + this.user + punctuation;
  10794. * };
  10795. *
  10796. * bound('!');
  10797. * // => 'hiya fred!'
  10798. *
  10799. * // Bound with placeholders.
  10800. * var bound = _.bindKey(object, 'greet', _, '!');
  10801. * bound('hi');
  10802. * // => 'hiya fred!'
  10803. */
  10804. var bindKey = baseRest(function(object, key, partials) {
  10805. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10806. if (partials.length) {
  10807. var holders = replaceHolders(partials, getHolder(bindKey));
  10808. bitmask |= WRAP_PARTIAL_FLAG;
  10809. }
  10810. return createWrap(key, bitmask, object, partials, holders);
  10811. });
  10812. /**
  10813. * Creates a function that accepts arguments of `func` and either invokes
  10814. * `func` returning its result, if at least `arity` number of arguments have
  10815. * been provided, or returns a function that accepts the remaining `func`
  10816. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10817. * is not sufficient.
  10818. *
  10819. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10820. * may be used as a placeholder for provided arguments.
  10821. *
  10822. * **Note:** This method doesn't set the "length" property of curried functions.
  10823. *
  10824. * @static
  10825. * @memberOf _
  10826. * @since 2.0.0
  10827. * @category Function
  10828. * @param {Function} func The function to curry.
  10829. * @param {number} [arity=func.length] The arity of `func`.
  10830. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10831. * @returns {Function} Returns the new curried function.
  10832. * @example
  10833. *
  10834. * var abc = function(a, b, c) {
  10835. * return [a, b, c];
  10836. * };
  10837. *
  10838. * var curried = _.curry(abc);
  10839. *
  10840. * curried(1)(2)(3);
  10841. * // => [1, 2, 3]
  10842. *
  10843. * curried(1, 2)(3);
  10844. * // => [1, 2, 3]
  10845. *
  10846. * curried(1, 2, 3);
  10847. * // => [1, 2, 3]
  10848. *
  10849. * // Curried with placeholders.
  10850. * curried(1)(_, 3)(2);
  10851. * // => [1, 2, 3]
  10852. */
  10853. function curry(func, arity, guard) {
  10854. arity = guard ? undefined : arity;
  10855. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10856. result.placeholder = curry.placeholder;
  10857. return result;
  10858. }
  10859. /**
  10860. * This method is like `_.curry` except that arguments are applied to `func`
  10861. * in the manner of `_.partialRight` instead of `_.partial`.
  10862. *
  10863. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10864. * builds, may be used as a placeholder for provided arguments.
  10865. *
  10866. * **Note:** This method doesn't set the "length" property of curried functions.
  10867. *
  10868. * @static
  10869. * @memberOf _
  10870. * @since 3.0.0
  10871. * @category Function
  10872. * @param {Function} func The function to curry.
  10873. * @param {number} [arity=func.length] The arity of `func`.
  10874. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10875. * @returns {Function} Returns the new curried function.
  10876. * @example
  10877. *
  10878. * var abc = function(a, b, c) {
  10879. * return [a, b, c];
  10880. * };
  10881. *
  10882. * var curried = _.curryRight(abc);
  10883. *
  10884. * curried(3)(2)(1);
  10885. * // => [1, 2, 3]
  10886. *
  10887. * curried(2, 3)(1);
  10888. * // => [1, 2, 3]
  10889. *
  10890. * curried(1, 2, 3);
  10891. * // => [1, 2, 3]
  10892. *
  10893. * // Curried with placeholders.
  10894. * curried(3)(1, _)(2);
  10895. * // => [1, 2, 3]
  10896. */
  10897. function curryRight(func, arity, guard) {
  10898. arity = guard ? undefined : arity;
  10899. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10900. result.placeholder = curryRight.placeholder;
  10901. return result;
  10902. }
  10903. /**
  10904. * Creates a debounced function that delays invoking `func` until after `wait`
  10905. * milliseconds have elapsed since the last time the debounced function was
  10906. * invoked. The debounced function comes with a `cancel` method to cancel
  10907. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10908. * Provide `options` to indicate whether `func` should be invoked on the
  10909. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10910. * with the last arguments provided to the debounced function. Subsequent
  10911. * calls to the debounced function return the result of the last `func`
  10912. * invocation.
  10913. *
  10914. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10915. * invoked on the trailing edge of the timeout only if the debounced function
  10916. * is invoked more than once during the `wait` timeout.
  10917. *
  10918. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10919. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10920. *
  10921. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10922. * for details over the differences between `_.debounce` and `_.throttle`.
  10923. *
  10924. * @static
  10925. * @memberOf _
  10926. * @since 0.1.0
  10927. * @category Function
  10928. * @param {Function} func The function to debounce.
  10929. * @param {number} [wait=0] The number of milliseconds to delay.
  10930. * @param {Object} [options={}] The options object.
  10931. * @param {boolean} [options.leading=false]
  10932. * Specify invoking on the leading edge of the timeout.
  10933. * @param {number} [options.maxWait]
  10934. * The maximum time `func` is allowed to be delayed before it's invoked.
  10935. * @param {boolean} [options.trailing=true]
  10936. * Specify invoking on the trailing edge of the timeout.
  10937. * @returns {Function} Returns the new debounced function.
  10938. * @example
  10939. *
  10940. * // Avoid costly calculations while the window size is in flux.
  10941. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10942. *
  10943. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10944. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10945. * 'leading': true,
  10946. * 'trailing': false
  10947. * }));
  10948. *
  10949. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10950. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10951. * var source = new EventSource('/stream');
  10952. * jQuery(source).on('message', debounced);
  10953. *
  10954. * // Cancel the trailing debounced invocation.
  10955. * jQuery(window).on('popstate', debounced.cancel);
  10956. */
  10957. function debounce(func, wait, options) {
  10958. var lastArgs,
  10959. lastThis,
  10960. maxWait,
  10961. result,
  10962. timerId,
  10963. lastCallTime,
  10964. lastInvokeTime = 0,
  10965. leading = false,
  10966. maxing = false,
  10967. trailing = true;
  10968. if (typeof func != 'function') {
  10969. throw new TypeError(FUNC_ERROR_TEXT);
  10970. }
  10971. wait = toNumber(wait) || 0;
  10972. if (isObject(options)) {
  10973. leading = !!options.leading;
  10974. maxing = 'maxWait' in options;
  10975. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10976. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10977. }
  10978. function invokeFunc(time) {
  10979. var args = lastArgs,
  10980. thisArg = lastThis;
  10981. lastArgs = lastThis = undefined;
  10982. lastInvokeTime = time;
  10983. result = func.apply(thisArg, args);
  10984. return result;
  10985. }
  10986. function leadingEdge(time) {
  10987. // Reset any `maxWait` timer.
  10988. lastInvokeTime = time;
  10989. // Start the timer for the trailing edge.
  10990. timerId = setTimeout(timerExpired, wait);
  10991. // Invoke the leading edge.
  10992. return leading ? invokeFunc(time) : result;
  10993. }
  10994. function remainingWait(time) {
  10995. var timeSinceLastCall = time - lastCallTime,
  10996. timeSinceLastInvoke = time - lastInvokeTime,
  10997. timeWaiting = wait - timeSinceLastCall;
  10998. return maxing
  10999. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  11000. : timeWaiting;
  11001. }
  11002. function shouldInvoke(time) {
  11003. var timeSinceLastCall = time - lastCallTime,
  11004. timeSinceLastInvoke = time - lastInvokeTime;
  11005. // Either this is the first call, activity has stopped and we're at the
  11006. // trailing edge, the system time has gone backwards and we're treating
  11007. // it as the trailing edge, or we've hit the `maxWait` limit.
  11008. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  11009. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  11010. }
  11011. function timerExpired() {
  11012. var time = now();
  11013. if (shouldInvoke(time)) {
  11014. return trailingEdge(time);
  11015. }
  11016. // Restart the timer.
  11017. timerId = setTimeout(timerExpired, remainingWait(time));
  11018. }
  11019. function trailingEdge(time) {
  11020. timerId = undefined;
  11021. // Only invoke if we have `lastArgs` which means `func` has been
  11022. // debounced at least once.
  11023. if (trailing && lastArgs) {
  11024. return invokeFunc(time);
  11025. }
  11026. lastArgs = lastThis = undefined;
  11027. return result;
  11028. }
  11029. function cancel() {
  11030. if (timerId !== undefined) {
  11031. clearTimeout(timerId);
  11032. }
  11033. lastInvokeTime = 0;
  11034. lastArgs = lastCallTime = lastThis = timerId = undefined;
  11035. }
  11036. function flush() {
  11037. return timerId === undefined ? result : trailingEdge(now());
  11038. }
  11039. function debounced() {
  11040. var time = now(),
  11041. isInvoking = shouldInvoke(time);
  11042. lastArgs = arguments;
  11043. lastThis = this;
  11044. lastCallTime = time;
  11045. if (isInvoking) {
  11046. if (timerId === undefined) {
  11047. return leadingEdge(lastCallTime);
  11048. }
  11049. if (maxing) {
  11050. // Handle invocations in a tight loop.
  11051. clearTimeout(timerId);
  11052. timerId = setTimeout(timerExpired, wait);
  11053. return invokeFunc(lastCallTime);
  11054. }
  11055. }
  11056. if (timerId === undefined) {
  11057. timerId = setTimeout(timerExpired, wait);
  11058. }
  11059. return result;
  11060. }
  11061. debounced.cancel = cancel;
  11062. debounced.flush = flush;
  11063. return debounced;
  11064. }
  11065. /**
  11066. * Defers invoking the `func` until the current call stack has cleared. Any
  11067. * additional arguments are provided to `func` when it's invoked.
  11068. *
  11069. * @static
  11070. * @memberOf _
  11071. * @since 0.1.0
  11072. * @category Function
  11073. * @param {Function} func The function to defer.
  11074. * @param {...*} [args] The arguments to invoke `func` with.
  11075. * @returns {number} Returns the timer id.
  11076. * @example
  11077. *
  11078. * _.defer(function(text) {
  11079. * console.log(text);
  11080. * }, 'deferred');
  11081. * // => Logs 'deferred' after one millisecond.
  11082. */
  11083. var defer = baseRest(function(func, args) {
  11084. return baseDelay(func, 1, args);
  11085. });
  11086. /**
  11087. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  11088. * provided to `func` when it's invoked.
  11089. *
  11090. * @static
  11091. * @memberOf _
  11092. * @since 0.1.0
  11093. * @category Function
  11094. * @param {Function} func The function to delay.
  11095. * @param {number} wait The number of milliseconds to delay invocation.
  11096. * @param {...*} [args] The arguments to invoke `func` with.
  11097. * @returns {number} Returns the timer id.
  11098. * @example
  11099. *
  11100. * _.delay(function(text) {
  11101. * console.log(text);
  11102. * }, 1000, 'later');
  11103. * // => Logs 'later' after one second.
  11104. */
  11105. var delay = baseRest(function(func, wait, args) {
  11106. return baseDelay(func, toNumber(wait) || 0, args);
  11107. });
  11108. /**
  11109. * Creates a function that invokes `func` with arguments reversed.
  11110. *
  11111. * @static
  11112. * @memberOf _
  11113. * @since 4.0.0
  11114. * @category Function
  11115. * @param {Function} func The function to flip arguments for.
  11116. * @returns {Function} Returns the new flipped function.
  11117. * @example
  11118. *
  11119. * var flipped = _.flip(function() {
  11120. * return _.toArray(arguments);
  11121. * });
  11122. *
  11123. * flipped('a', 'b', 'c', 'd');
  11124. * // => ['d', 'c', 'b', 'a']
  11125. */
  11126. function flip(func) {
  11127. return createWrap(func, WRAP_FLIP_FLAG);
  11128. }
  11129. /**
  11130. * Creates a function that memoizes the result of `func`. If `resolver` is
  11131. * provided, it determines the cache key for storing the result based on the
  11132. * arguments provided to the memoized function. By default, the first argument
  11133. * provided to the memoized function is used as the map cache key. The `func`
  11134. * is invoked with the `this` binding of the memoized function.
  11135. *
  11136. * **Note:** The cache is exposed as the `cache` property on the memoized
  11137. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  11138. * constructor with one whose instances implement the
  11139. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  11140. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  11141. *
  11142. * @static
  11143. * @memberOf _
  11144. * @since 0.1.0
  11145. * @category Function
  11146. * @param {Function} func The function to have its output memoized.
  11147. * @param {Function} [resolver] The function to resolve the cache key.
  11148. * @returns {Function} Returns the new memoized function.
  11149. * @example
  11150. *
  11151. * var object = { 'a': 1, 'b': 2 };
  11152. * var other = { 'c': 3, 'd': 4 };
  11153. *
  11154. * var values = _.memoize(_.values);
  11155. * values(object);
  11156. * // => [1, 2]
  11157. *
  11158. * values(other);
  11159. * // => [3, 4]
  11160. *
  11161. * object.a = 2;
  11162. * values(object);
  11163. * // => [1, 2]
  11164. *
  11165. * // Modify the result cache.
  11166. * values.cache.set(object, ['a', 'b']);
  11167. * values(object);
  11168. * // => ['a', 'b']
  11169. *
  11170. * // Replace `_.memoize.Cache`.
  11171. * _.memoize.Cache = WeakMap;
  11172. */
  11173. function memoize(func, resolver) {
  11174. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  11175. throw new TypeError(FUNC_ERROR_TEXT);
  11176. }
  11177. var memoized = function() {
  11178. var args = arguments,
  11179. key = resolver ? resolver.apply(this, args) : args[0],
  11180. cache = memoized.cache;
  11181. if (cache.has(key)) {
  11182. return cache.get(key);
  11183. }
  11184. var result = func.apply(this, args);
  11185. memoized.cache = cache.set(key, result) || cache;
  11186. return result;
  11187. };
  11188. memoized.cache = new (memoize.Cache || MapCache);
  11189. return memoized;
  11190. }
  11191. // Expose `MapCache`.
  11192. memoize.Cache = MapCache;
  11193. /**
  11194. * Creates a function that negates the result of the predicate `func`. The
  11195. * `func` predicate is invoked with the `this` binding and arguments of the
  11196. * created function.
  11197. *
  11198. * @static
  11199. * @memberOf _
  11200. * @since 3.0.0
  11201. * @category Function
  11202. * @param {Function} predicate The predicate to negate.
  11203. * @returns {Function} Returns the new negated function.
  11204. * @example
  11205. *
  11206. * function isEven(n) {
  11207. * return n % 2 == 0;
  11208. * }
  11209. *
  11210. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  11211. * // => [1, 3, 5]
  11212. */
  11213. function negate(predicate) {
  11214. if (typeof predicate != 'function') {
  11215. throw new TypeError(FUNC_ERROR_TEXT);
  11216. }
  11217. return function() {
  11218. var args = arguments;
  11219. switch (args.length) {
  11220. case 0: return !predicate.call(this);
  11221. case 1: return !predicate.call(this, args[0]);
  11222. case 2: return !predicate.call(this, args[0], args[1]);
  11223. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  11224. }
  11225. return !predicate.apply(this, args);
  11226. };
  11227. }
  11228. /**
  11229. * Creates a function that is restricted to invoking `func` once. Repeat calls
  11230. * to the function return the value of the first invocation. The `func` is
  11231. * invoked with the `this` binding and arguments of the created function.
  11232. *
  11233. * @static
  11234. * @memberOf _
  11235. * @since 0.1.0
  11236. * @category Function
  11237. * @param {Function} func The function to restrict.
  11238. * @returns {Function} Returns the new restricted function.
  11239. * @example
  11240. *
  11241. * var initialize = _.once(createApplication);
  11242. * initialize();
  11243. * initialize();
  11244. * // => `createApplication` is invoked once
  11245. */
  11246. function once(func) {
  11247. return before(2, func);
  11248. }
  11249. /**
  11250. * Creates a function that invokes `func` with its arguments transformed.
  11251. *
  11252. * @static
  11253. * @since 4.0.0
  11254. * @memberOf _
  11255. * @category Function
  11256. * @param {Function} func The function to wrap.
  11257. * @param {...(Function|Function[])} [transforms=[_.identity]]
  11258. * The argument transforms.
  11259. * @returns {Function} Returns the new function.
  11260. * @example
  11261. *
  11262. * function doubled(n) {
  11263. * return n * 2;
  11264. * }
  11265. *
  11266. * function square(n) {
  11267. * return n * n;
  11268. * }
  11269. *
  11270. * var func = _.overArgs(function(x, y) {
  11271. * return [x, y];
  11272. * }, [square, doubled]);
  11273. *
  11274. * func(9, 3);
  11275. * // => [81, 6]
  11276. *
  11277. * func(10, 5);
  11278. * // => [100, 10]
  11279. */
  11280. var overArgs = castRest(function(func, transforms) {
  11281. transforms = (transforms.length == 1 && isArray(transforms[0]))
  11282. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  11283. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  11284. var funcsLength = transforms.length;
  11285. return baseRest(function(args) {
  11286. var index = -1,
  11287. length = nativeMin(args.length, funcsLength);
  11288. while (++index < length) {
  11289. args[index] = transforms[index].call(this, args[index]);
  11290. }
  11291. return apply(func, this, args);
  11292. });
  11293. });
  11294. /**
  11295. * Creates a function that invokes `func` with `partials` prepended to the
  11296. * arguments it receives. This method is like `_.bind` except it does **not**
  11297. * alter the `this` binding.
  11298. *
  11299. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  11300. * builds, may be used as a placeholder for partially applied arguments.
  11301. *
  11302. * **Note:** This method doesn't set the "length" property of partially
  11303. * applied functions.
  11304. *
  11305. * @static
  11306. * @memberOf _
  11307. * @since 0.2.0
  11308. * @category Function
  11309. * @param {Function} func The function to partially apply arguments to.
  11310. * @param {...*} [partials] The arguments to be partially applied.
  11311. * @returns {Function} Returns the new partially applied function.
  11312. * @example
  11313. *
  11314. * function greet(greeting, name) {
  11315. * return greeting + ' ' + name;
  11316. * }
  11317. *
  11318. * var sayHelloTo = _.partial(greet, 'hello');
  11319. * sayHelloTo('fred');
  11320. * // => 'hello fred'
  11321. *
  11322. * // Partially applied with placeholders.
  11323. * var greetFred = _.partial(greet, _, 'fred');
  11324. * greetFred('hi');
  11325. * // => 'hi fred'
  11326. */
  11327. var partial = baseRest(function(func, partials) {
  11328. var holders = replaceHolders(partials, getHolder(partial));
  11329. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  11330. });
  11331. /**
  11332. * This method is like `_.partial` except that partially applied arguments
  11333. * are appended to the arguments it receives.
  11334. *
  11335. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  11336. * builds, may be used as a placeholder for partially applied arguments.
  11337. *
  11338. * **Note:** This method doesn't set the "length" property of partially
  11339. * applied functions.
  11340. *
  11341. * @static
  11342. * @memberOf _
  11343. * @since 1.0.0
  11344. * @category Function
  11345. * @param {Function} func The function to partially apply arguments to.
  11346. * @param {...*} [partials] The arguments to be partially applied.
  11347. * @returns {Function} Returns the new partially applied function.
  11348. * @example
  11349. *
  11350. * function greet(greeting, name) {
  11351. * return greeting + ' ' + name;
  11352. * }
  11353. *
  11354. * var greetFred = _.partialRight(greet, 'fred');
  11355. * greetFred('hi');
  11356. * // => 'hi fred'
  11357. *
  11358. * // Partially applied with placeholders.
  11359. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  11360. * sayHelloTo('fred');
  11361. * // => 'hello fred'
  11362. */
  11363. var partialRight = baseRest(function(func, partials) {
  11364. var holders = replaceHolders(partials, getHolder(partialRight));
  11365. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  11366. });
  11367. /**
  11368. * Creates a function that invokes `func` with arguments arranged according
  11369. * to the specified `indexes` where the argument value at the first index is
  11370. * provided as the first argument, the argument value at the second index is
  11371. * provided as the second argument, and so on.
  11372. *
  11373. * @static
  11374. * @memberOf _
  11375. * @since 3.0.0
  11376. * @category Function
  11377. * @param {Function} func The function to rearrange arguments for.
  11378. * @param {...(number|number[])} indexes The arranged argument indexes.
  11379. * @returns {Function} Returns the new function.
  11380. * @example
  11381. *
  11382. * var rearged = _.rearg(function(a, b, c) {
  11383. * return [a, b, c];
  11384. * }, [2, 0, 1]);
  11385. *
  11386. * rearged('b', 'c', 'a')
  11387. * // => ['a', 'b', 'c']
  11388. */
  11389. var rearg = flatRest(function(func, indexes) {
  11390. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  11391. });
  11392. /**
  11393. * Creates a function that invokes `func` with the `this` binding of the
  11394. * created function and arguments from `start` and beyond provided as
  11395. * an array.
  11396. *
  11397. * **Note:** This method is based on the
  11398. * [rest parameter](https://mdn.io/rest_parameters).
  11399. *
  11400. * @static
  11401. * @memberOf _
  11402. * @since 4.0.0
  11403. * @category Function
  11404. * @param {Function} func The function to apply a rest parameter to.
  11405. * @param {number} [start=func.length-1] The start position of the rest parameter.
  11406. * @returns {Function} Returns the new function.
  11407. * @example
  11408. *
  11409. * var say = _.rest(function(what, names) {
  11410. * return what + ' ' + _.initial(names).join(', ') +
  11411. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  11412. * });
  11413. *
  11414. * say('hello', 'fred', 'barney', 'pebbles');
  11415. * // => 'hello fred, barney, & pebbles'
  11416. */
  11417. function rest(func, start) {
  11418. if (typeof func != 'function') {
  11419. throw new TypeError(FUNC_ERROR_TEXT);
  11420. }
  11421. start = start === undefined ? start : toInteger(start);
  11422. return baseRest(func, start);
  11423. }
  11424. /**
  11425. * Creates a function that invokes `func` with the `this` binding of the
  11426. * create function and an array of arguments much like
  11427. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  11428. *
  11429. * **Note:** This method is based on the
  11430. * [spread operator](https://mdn.io/spread_operator).
  11431. *
  11432. * @static
  11433. * @memberOf _
  11434. * @since 3.2.0
  11435. * @category Function
  11436. * @param {Function} func The function to spread arguments over.
  11437. * @param {number} [start=0] The start position of the spread.
  11438. * @returns {Function} Returns the new function.
  11439. * @example
  11440. *
  11441. * var say = _.spread(function(who, what) {
  11442. * return who + ' says ' + what;
  11443. * });
  11444. *
  11445. * say(['fred', 'hello']);
  11446. * // => 'fred says hello'
  11447. *
  11448. * var numbers = Promise.all([
  11449. * Promise.resolve(40),
  11450. * Promise.resolve(36)
  11451. * ]);
  11452. *
  11453. * numbers.then(_.spread(function(x, y) {
  11454. * return x + y;
  11455. * }));
  11456. * // => a Promise of 76
  11457. */
  11458. function spread(func, start) {
  11459. if (typeof func != 'function') {
  11460. throw new TypeError(FUNC_ERROR_TEXT);
  11461. }
  11462. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  11463. return baseRest(function(args) {
  11464. var array = args[start],
  11465. otherArgs = castSlice(args, 0, start);
  11466. if (array) {
  11467. arrayPush(otherArgs, array);
  11468. }
  11469. return apply(func, this, otherArgs);
  11470. });
  11471. }
  11472. /**
  11473. * Creates a throttled function that only invokes `func` at most once per
  11474. * every `wait` milliseconds. The throttled function comes with a `cancel`
  11475. * method to cancel delayed `func` invocations and a `flush` method to
  11476. * immediately invoke them. Provide `options` to indicate whether `func`
  11477. * should be invoked on the leading and/or trailing edge of the `wait`
  11478. * timeout. The `func` is invoked with the last arguments provided to the
  11479. * throttled function. Subsequent calls to the throttled function return the
  11480. * result of the last `func` invocation.
  11481. *
  11482. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11483. * invoked on the trailing edge of the timeout only if the throttled function
  11484. * is invoked more than once during the `wait` timeout.
  11485. *
  11486. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11487. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11488. *
  11489. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11490. * for details over the differences between `_.throttle` and `_.debounce`.
  11491. *
  11492. * @static
  11493. * @memberOf _
  11494. * @since 0.1.0
  11495. * @category Function
  11496. * @param {Function} func The function to throttle.
  11497. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11498. * @param {Object} [options={}] The options object.
  11499. * @param {boolean} [options.leading=true]
  11500. * Specify invoking on the leading edge of the timeout.
  11501. * @param {boolean} [options.trailing=true]
  11502. * Specify invoking on the trailing edge of the timeout.
  11503. * @returns {Function} Returns the new throttled function.
  11504. * @example
  11505. *
  11506. * // Avoid excessively updating the position while scrolling.
  11507. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11508. *
  11509. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11510. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11511. * jQuery(element).on('click', throttled);
  11512. *
  11513. * // Cancel the trailing throttled invocation.
  11514. * jQuery(window).on('popstate', throttled.cancel);
  11515. */
  11516. function throttle(func, wait, options) {
  11517. var leading = true,
  11518. trailing = true;
  11519. if (typeof func != 'function') {
  11520. throw new TypeError(FUNC_ERROR_TEXT);
  11521. }
  11522. if (isObject(options)) {
  11523. leading = 'leading' in options ? !!options.leading : leading;
  11524. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11525. }
  11526. return debounce(func, wait, {
  11527. 'leading': leading,
  11528. 'maxWait': wait,
  11529. 'trailing': trailing
  11530. });
  11531. }
  11532. /**
  11533. * Creates a function that accepts up to one argument, ignoring any
  11534. * additional arguments.
  11535. *
  11536. * @static
  11537. * @memberOf _
  11538. * @since 4.0.0
  11539. * @category Function
  11540. * @param {Function} func The function to cap arguments for.
  11541. * @returns {Function} Returns the new capped function.
  11542. * @example
  11543. *
  11544. * _.map(['6', '8', '10'], _.unary(parseInt));
  11545. * // => [6, 8, 10]
  11546. */
  11547. function unary(func) {
  11548. return ary(func, 1);
  11549. }
  11550. /**
  11551. * Creates a function that provides `value` to `wrapper` as its first
  11552. * argument. Any additional arguments provided to the function are appended
  11553. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11554. * binding of the created function.
  11555. *
  11556. * @static
  11557. * @memberOf _
  11558. * @since 0.1.0
  11559. * @category Function
  11560. * @param {*} value The value to wrap.
  11561. * @param {Function} [wrapper=identity] The wrapper function.
  11562. * @returns {Function} Returns the new function.
  11563. * @example
  11564. *
  11565. * var p = _.wrap(_.escape, function(func, text) {
  11566. * return '<p>' + func(text) + '</p>';
  11567. * });
  11568. *
  11569. * p('fred, barney, & pebbles');
  11570. * // => '<p>fred, barney, &amp; pebbles</p>'
  11571. */
  11572. function wrap(value, wrapper) {
  11573. return partial(castFunction(wrapper), value);
  11574. }
  11575. /*------------------------------------------------------------------------*/
  11576. /**
  11577. * Casts `value` as an array if it's not one.
  11578. *
  11579. * @static
  11580. * @memberOf _
  11581. * @since 4.4.0
  11582. * @category Lang
  11583. * @param {*} value The value to inspect.
  11584. * @returns {Array} Returns the cast array.
  11585. * @example
  11586. *
  11587. * _.castArray(1);
  11588. * // => [1]
  11589. *
  11590. * _.castArray({ 'a': 1 });
  11591. * // => [{ 'a': 1 }]
  11592. *
  11593. * _.castArray('abc');
  11594. * // => ['abc']
  11595. *
  11596. * _.castArray(null);
  11597. * // => [null]
  11598. *
  11599. * _.castArray(undefined);
  11600. * // => [undefined]
  11601. *
  11602. * _.castArray();
  11603. * // => []
  11604. *
  11605. * var array = [1, 2, 3];
  11606. * console.log(_.castArray(array) === array);
  11607. * // => true
  11608. */
  11609. function castArray() {
  11610. if (!arguments.length) {
  11611. return [];
  11612. }
  11613. var value = arguments[0];
  11614. return isArray(value) ? value : [value];
  11615. }
  11616. /**
  11617. * Creates a shallow clone of `value`.
  11618. *
  11619. * **Note:** This method is loosely based on the
  11620. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11621. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11622. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11623. * arrays. The own enumerable properties of `arguments` objects are cloned
  11624. * as plain objects. An empty object is returned for uncloneable values such
  11625. * as error objects, functions, DOM nodes, and WeakMaps.
  11626. *
  11627. * @static
  11628. * @memberOf _
  11629. * @since 0.1.0
  11630. * @category Lang
  11631. * @param {*} value The value to clone.
  11632. * @returns {*} Returns the cloned value.
  11633. * @see _.cloneDeep
  11634. * @example
  11635. *
  11636. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11637. *
  11638. * var shallow = _.clone(objects);
  11639. * console.log(shallow[0] === objects[0]);
  11640. * // => true
  11641. */
  11642. function clone(value) {
  11643. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11644. }
  11645. /**
  11646. * This method is like `_.clone` except that it accepts `customizer` which
  11647. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11648. * cloning is handled by the method instead. The `customizer` is invoked with
  11649. * up to four arguments; (value [, index|key, object, stack]).
  11650. *
  11651. * @static
  11652. * @memberOf _
  11653. * @since 4.0.0
  11654. * @category Lang
  11655. * @param {*} value The value to clone.
  11656. * @param {Function} [customizer] The function to customize cloning.
  11657. * @returns {*} Returns the cloned value.
  11658. * @see _.cloneDeepWith
  11659. * @example
  11660. *
  11661. * function customizer(value) {
  11662. * if (_.isElement(value)) {
  11663. * return value.cloneNode(false);
  11664. * }
  11665. * }
  11666. *
  11667. * var el = _.cloneWith(document.body, customizer);
  11668. *
  11669. * console.log(el === document.body);
  11670. * // => false
  11671. * console.log(el.nodeName);
  11672. * // => 'BODY'
  11673. * console.log(el.childNodes.length);
  11674. * // => 0
  11675. */
  11676. function cloneWith(value, customizer) {
  11677. customizer = typeof customizer == 'function' ? customizer : undefined;
  11678. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11679. }
  11680. /**
  11681. * This method is like `_.clone` except that it recursively clones `value`.
  11682. *
  11683. * @static
  11684. * @memberOf _
  11685. * @since 1.0.0
  11686. * @category Lang
  11687. * @param {*} value The value to recursively clone.
  11688. * @returns {*} Returns the deep cloned value.
  11689. * @see _.clone
  11690. * @example
  11691. *
  11692. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11693. *
  11694. * var deep = _.cloneDeep(objects);
  11695. * console.log(deep[0] === objects[0]);
  11696. * // => false
  11697. */
  11698. function cloneDeep(value) {
  11699. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11700. }
  11701. /**
  11702. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11703. *
  11704. * @static
  11705. * @memberOf _
  11706. * @since 4.0.0
  11707. * @category Lang
  11708. * @param {*} value The value to recursively clone.
  11709. * @param {Function} [customizer] The function to customize cloning.
  11710. * @returns {*} Returns the deep cloned value.
  11711. * @see _.cloneWith
  11712. * @example
  11713. *
  11714. * function customizer(value) {
  11715. * if (_.isElement(value)) {
  11716. * return value.cloneNode(true);
  11717. * }
  11718. * }
  11719. *
  11720. * var el = _.cloneDeepWith(document.body, customizer);
  11721. *
  11722. * console.log(el === document.body);
  11723. * // => false
  11724. * console.log(el.nodeName);
  11725. * // => 'BODY'
  11726. * console.log(el.childNodes.length);
  11727. * // => 20
  11728. */
  11729. function cloneDeepWith(value, customizer) {
  11730. customizer = typeof customizer == 'function' ? customizer : undefined;
  11731. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11732. }
  11733. /**
  11734. * Checks if `object` conforms to `source` by invoking the predicate
  11735. * properties of `source` with the corresponding property values of `object`.
  11736. *
  11737. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11738. * partially applied.
  11739. *
  11740. * @static
  11741. * @memberOf _
  11742. * @since 4.14.0
  11743. * @category Lang
  11744. * @param {Object} object The object to inspect.
  11745. * @param {Object} source The object of property predicates to conform to.
  11746. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11747. * @example
  11748. *
  11749. * var object = { 'a': 1, 'b': 2 };
  11750. *
  11751. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11752. * // => true
  11753. *
  11754. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11755. * // => false
  11756. */
  11757. function conformsTo(object, source) {
  11758. return source == null || baseConformsTo(object, source, keys(source));
  11759. }
  11760. /**
  11761. * Performs a
  11762. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11763. * comparison between two values to determine if they are equivalent.
  11764. *
  11765. * @static
  11766. * @memberOf _
  11767. * @since 4.0.0
  11768. * @category Lang
  11769. * @param {*} value The value to compare.
  11770. * @param {*} other The other value to compare.
  11771. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11772. * @example
  11773. *
  11774. * var object = { 'a': 1 };
  11775. * var other = { 'a': 1 };
  11776. *
  11777. * _.eq(object, object);
  11778. * // => true
  11779. *
  11780. * _.eq(object, other);
  11781. * // => false
  11782. *
  11783. * _.eq('a', 'a');
  11784. * // => true
  11785. *
  11786. * _.eq('a', Object('a'));
  11787. * // => false
  11788. *
  11789. * _.eq(NaN, NaN);
  11790. * // => true
  11791. */
  11792. function eq(value, other) {
  11793. return value === other || (value !== value && other !== other);
  11794. }
  11795. /**
  11796. * Checks if `value` is greater than `other`.
  11797. *
  11798. * @static
  11799. * @memberOf _
  11800. * @since 3.9.0
  11801. * @category Lang
  11802. * @param {*} value The value to compare.
  11803. * @param {*} other The other value to compare.
  11804. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11805. * else `false`.
  11806. * @see _.lt
  11807. * @example
  11808. *
  11809. * _.gt(3, 1);
  11810. * // => true
  11811. *
  11812. * _.gt(3, 3);
  11813. * // => false
  11814. *
  11815. * _.gt(1, 3);
  11816. * // => false
  11817. */
  11818. var gt = createRelationalOperation(baseGt);
  11819. /**
  11820. * Checks if `value` is greater than or equal to `other`.
  11821. *
  11822. * @static
  11823. * @memberOf _
  11824. * @since 3.9.0
  11825. * @category Lang
  11826. * @param {*} value The value to compare.
  11827. * @param {*} other The other value to compare.
  11828. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11829. * `other`, else `false`.
  11830. * @see _.lte
  11831. * @example
  11832. *
  11833. * _.gte(3, 1);
  11834. * // => true
  11835. *
  11836. * _.gte(3, 3);
  11837. * // => true
  11838. *
  11839. * _.gte(1, 3);
  11840. * // => false
  11841. */
  11842. var gte = createRelationalOperation(function(value, other) {
  11843. return value >= other;
  11844. });
  11845. /**
  11846. * Checks if `value` is likely an `arguments` object.
  11847. *
  11848. * @static
  11849. * @memberOf _
  11850. * @since 0.1.0
  11851. * @category Lang
  11852. * @param {*} value The value to check.
  11853. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11854. * else `false`.
  11855. * @example
  11856. *
  11857. * _.isArguments(function() { return arguments; }());
  11858. * // => true
  11859. *
  11860. * _.isArguments([1, 2, 3]);
  11861. * // => false
  11862. */
  11863. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11864. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11865. !propertyIsEnumerable.call(value, 'callee');
  11866. };
  11867. /**
  11868. * Checks if `value` is classified as an `Array` object.
  11869. *
  11870. * @static
  11871. * @memberOf _
  11872. * @since 0.1.0
  11873. * @category Lang
  11874. * @param {*} value The value to check.
  11875. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11876. * @example
  11877. *
  11878. * _.isArray([1, 2, 3]);
  11879. * // => true
  11880. *
  11881. * _.isArray(document.body.children);
  11882. * // => false
  11883. *
  11884. * _.isArray('abc');
  11885. * // => false
  11886. *
  11887. * _.isArray(_.noop);
  11888. * // => false
  11889. */
  11890. var isArray = Array.isArray;
  11891. /**
  11892. * Checks if `value` is classified as an `ArrayBuffer` object.
  11893. *
  11894. * @static
  11895. * @memberOf _
  11896. * @since 4.3.0
  11897. * @category Lang
  11898. * @param {*} value The value to check.
  11899. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11900. * @example
  11901. *
  11902. * _.isArrayBuffer(new ArrayBuffer(2));
  11903. * // => true
  11904. *
  11905. * _.isArrayBuffer(new Array(2));
  11906. * // => false
  11907. */
  11908. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11909. /**
  11910. * Checks if `value` is array-like. A value is considered array-like if it's
  11911. * not a function and has a `value.length` that's an integer greater than or
  11912. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11913. *
  11914. * @static
  11915. * @memberOf _
  11916. * @since 4.0.0
  11917. * @category Lang
  11918. * @param {*} value The value to check.
  11919. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11920. * @example
  11921. *
  11922. * _.isArrayLike([1, 2, 3]);
  11923. * // => true
  11924. *
  11925. * _.isArrayLike(document.body.children);
  11926. * // => true
  11927. *
  11928. * _.isArrayLike('abc');
  11929. * // => true
  11930. *
  11931. * _.isArrayLike(_.noop);
  11932. * // => false
  11933. */
  11934. function isArrayLike(value) {
  11935. return value != null && isLength(value.length) && !isFunction(value);
  11936. }
  11937. /**
  11938. * This method is like `_.isArrayLike` except that it also checks if `value`
  11939. * is an object.
  11940. *
  11941. * @static
  11942. * @memberOf _
  11943. * @since 4.0.0
  11944. * @category Lang
  11945. * @param {*} value The value to check.
  11946. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11947. * else `false`.
  11948. * @example
  11949. *
  11950. * _.isArrayLikeObject([1, 2, 3]);
  11951. * // => true
  11952. *
  11953. * _.isArrayLikeObject(document.body.children);
  11954. * // => true
  11955. *
  11956. * _.isArrayLikeObject('abc');
  11957. * // => false
  11958. *
  11959. * _.isArrayLikeObject(_.noop);
  11960. * // => false
  11961. */
  11962. function isArrayLikeObject(value) {
  11963. return isObjectLike(value) && isArrayLike(value);
  11964. }
  11965. /**
  11966. * Checks if `value` is classified as a boolean primitive or object.
  11967. *
  11968. * @static
  11969. * @memberOf _
  11970. * @since 0.1.0
  11971. * @category Lang
  11972. * @param {*} value The value to check.
  11973. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11974. * @example
  11975. *
  11976. * _.isBoolean(false);
  11977. * // => true
  11978. *
  11979. * _.isBoolean(null);
  11980. * // => false
  11981. */
  11982. function isBoolean(value) {
  11983. return value === true || value === false ||
  11984. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11985. }
  11986. /**
  11987. * Checks if `value` is a buffer.
  11988. *
  11989. * @static
  11990. * @memberOf _
  11991. * @since 4.3.0
  11992. * @category Lang
  11993. * @param {*} value The value to check.
  11994. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  11995. * @example
  11996. *
  11997. * _.isBuffer(new Buffer(2));
  11998. * // => true
  11999. *
  12000. * _.isBuffer(new Uint8Array(2));
  12001. * // => false
  12002. */
  12003. var isBuffer = nativeIsBuffer || stubFalse;
  12004. /**
  12005. * Checks if `value` is classified as a `Date` object.
  12006. *
  12007. * @static
  12008. * @memberOf _
  12009. * @since 0.1.0
  12010. * @category Lang
  12011. * @param {*} value The value to check.
  12012. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  12013. * @example
  12014. *
  12015. * _.isDate(new Date);
  12016. * // => true
  12017. *
  12018. * _.isDate('Mon April 23 2012');
  12019. * // => false
  12020. */
  12021. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  12022. /**
  12023. * Checks if `value` is likely a DOM element.
  12024. *
  12025. * @static
  12026. * @memberOf _
  12027. * @since 0.1.0
  12028. * @category Lang
  12029. * @param {*} value The value to check.
  12030. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  12031. * @example
  12032. *
  12033. * _.isElement(document.body);
  12034. * // => true
  12035. *
  12036. * _.isElement('<body>');
  12037. * // => false
  12038. */
  12039. function isElement(value) {
  12040. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  12041. }
  12042. /**
  12043. * Checks if `value` is an empty object, collection, map, or set.
  12044. *
  12045. * Objects are considered empty if they have no own enumerable string keyed
  12046. * properties.
  12047. *
  12048. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  12049. * jQuery-like collections are considered empty if they have a `length` of `0`.
  12050. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  12051. *
  12052. * @static
  12053. * @memberOf _
  12054. * @since 0.1.0
  12055. * @category Lang
  12056. * @param {*} value The value to check.
  12057. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  12058. * @example
  12059. *
  12060. * _.isEmpty(null);
  12061. * // => true
  12062. *
  12063. * _.isEmpty(true);
  12064. * // => true
  12065. *
  12066. * _.isEmpty(1);
  12067. * // => true
  12068. *
  12069. * _.isEmpty([1, 2, 3]);
  12070. * // => false
  12071. *
  12072. * _.isEmpty({ 'a': 1 });
  12073. * // => false
  12074. */
  12075. function isEmpty(value) {
  12076. if (value == null) {
  12077. return true;
  12078. }
  12079. if (isArrayLike(value) &&
  12080. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  12081. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  12082. return !value.length;
  12083. }
  12084. var tag = getTag(value);
  12085. if (tag == mapTag || tag == setTag) {
  12086. return !value.size;
  12087. }
  12088. if (isPrototype(value)) {
  12089. return !baseKeys(value).length;
  12090. }
  12091. for (var key in value) {
  12092. if (hasOwnProperty.call(value, key)) {
  12093. return false;
  12094. }
  12095. }
  12096. return true;
  12097. }
  12098. /**
  12099. * Performs a deep comparison between two values to determine if they are
  12100. * equivalent.
  12101. *
  12102. * **Note:** This method supports comparing arrays, array buffers, booleans,
  12103. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  12104. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  12105. * by their own, not inherited, enumerable properties. Functions and DOM
  12106. * nodes are compared by strict equality, i.e. `===`.
  12107. *
  12108. * @static
  12109. * @memberOf _
  12110. * @since 0.1.0
  12111. * @category Lang
  12112. * @param {*} value The value to compare.
  12113. * @param {*} other The other value to compare.
  12114. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12115. * @example
  12116. *
  12117. * var object = { 'a': 1 };
  12118. * var other = { 'a': 1 };
  12119. *
  12120. * _.isEqual(object, other);
  12121. * // => true
  12122. *
  12123. * object === other;
  12124. * // => false
  12125. */
  12126. function isEqual(value, other) {
  12127. return baseIsEqual(value, other);
  12128. }
  12129. /**
  12130. * This method is like `_.isEqual` except that it accepts `customizer` which
  12131. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12132. * are handled by the method instead. The `customizer` is invoked with up to
  12133. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  12134. *
  12135. * @static
  12136. * @memberOf _
  12137. * @since 4.0.0
  12138. * @category Lang
  12139. * @param {*} value The value to compare.
  12140. * @param {*} other The other value to compare.
  12141. * @param {Function} [customizer] The function to customize comparisons.
  12142. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12143. * @example
  12144. *
  12145. * function isGreeting(value) {
  12146. * return /^h(?:i|ello)$/.test(value);
  12147. * }
  12148. *
  12149. * function customizer(objValue, othValue) {
  12150. * if (isGreeting(objValue) && isGreeting(othValue)) {
  12151. * return true;
  12152. * }
  12153. * }
  12154. *
  12155. * var array = ['hello', 'goodbye'];
  12156. * var other = ['hi', 'goodbye'];
  12157. *
  12158. * _.isEqualWith(array, other, customizer);
  12159. * // => true
  12160. */
  12161. function isEqualWith(value, other, customizer) {
  12162. customizer = typeof customizer == 'function' ? customizer : undefined;
  12163. var result = customizer ? customizer(value, other) : undefined;
  12164. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  12165. }
  12166. /**
  12167. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  12168. * `SyntaxError`, `TypeError`, or `URIError` object.
  12169. *
  12170. * @static
  12171. * @memberOf _
  12172. * @since 3.0.0
  12173. * @category Lang
  12174. * @param {*} value The value to check.
  12175. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  12176. * @example
  12177. *
  12178. * _.isError(new Error);
  12179. * // => true
  12180. *
  12181. * _.isError(Error);
  12182. * // => false
  12183. */
  12184. function isError(value) {
  12185. if (!isObjectLike(value)) {
  12186. return false;
  12187. }
  12188. var tag = baseGetTag(value);
  12189. return tag == errorTag || tag == domExcTag ||
  12190. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  12191. }
  12192. /**
  12193. * Checks if `value` is a finite primitive number.
  12194. *
  12195. * **Note:** This method is based on
  12196. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  12197. *
  12198. * @static
  12199. * @memberOf _
  12200. * @since 0.1.0
  12201. * @category Lang
  12202. * @param {*} value The value to check.
  12203. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  12204. * @example
  12205. *
  12206. * _.isFinite(3);
  12207. * // => true
  12208. *
  12209. * _.isFinite(Number.MIN_VALUE);
  12210. * // => true
  12211. *
  12212. * _.isFinite(Infinity);
  12213. * // => false
  12214. *
  12215. * _.isFinite('3');
  12216. * // => false
  12217. */
  12218. function isFinite(value) {
  12219. return typeof value == 'number' && nativeIsFinite(value);
  12220. }
  12221. /**
  12222. * Checks if `value` is classified as a `Function` object.
  12223. *
  12224. * @static
  12225. * @memberOf _
  12226. * @since 0.1.0
  12227. * @category Lang
  12228. * @param {*} value The value to check.
  12229. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  12230. * @example
  12231. *
  12232. * _.isFunction(_);
  12233. * // => true
  12234. *
  12235. * _.isFunction(/abc/);
  12236. * // => false
  12237. */
  12238. function isFunction(value) {
  12239. if (!isObject(value)) {
  12240. return false;
  12241. }
  12242. // The use of `Object#toString` avoids issues with the `typeof` operator
  12243. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  12244. var tag = baseGetTag(value);
  12245. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  12246. }
  12247. /**
  12248. * Checks if `value` is an integer.
  12249. *
  12250. * **Note:** This method is based on
  12251. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  12252. *
  12253. * @static
  12254. * @memberOf _
  12255. * @since 4.0.0
  12256. * @category Lang
  12257. * @param {*} value The value to check.
  12258. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  12259. * @example
  12260. *
  12261. * _.isInteger(3);
  12262. * // => true
  12263. *
  12264. * _.isInteger(Number.MIN_VALUE);
  12265. * // => false
  12266. *
  12267. * _.isInteger(Infinity);
  12268. * // => false
  12269. *
  12270. * _.isInteger('3');
  12271. * // => false
  12272. */
  12273. function isInteger(value) {
  12274. return typeof value == 'number' && value == toInteger(value);
  12275. }
  12276. /**
  12277. * Checks if `value` is a valid array-like length.
  12278. *
  12279. * **Note:** This method is loosely based on
  12280. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12281. *
  12282. * @static
  12283. * @memberOf _
  12284. * @since 4.0.0
  12285. * @category Lang
  12286. * @param {*} value The value to check.
  12287. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  12288. * @example
  12289. *
  12290. * _.isLength(3);
  12291. * // => true
  12292. *
  12293. * _.isLength(Number.MIN_VALUE);
  12294. * // => false
  12295. *
  12296. * _.isLength(Infinity);
  12297. * // => false
  12298. *
  12299. * _.isLength('3');
  12300. * // => false
  12301. */
  12302. function isLength(value) {
  12303. return typeof value == 'number' &&
  12304. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  12305. }
  12306. /**
  12307. * Checks if `value` is the
  12308. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  12309. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  12310. *
  12311. * @static
  12312. * @memberOf _
  12313. * @since 0.1.0
  12314. * @category Lang
  12315. * @param {*} value The value to check.
  12316. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  12317. * @example
  12318. *
  12319. * _.isObject({});
  12320. * // => true
  12321. *
  12322. * _.isObject([1, 2, 3]);
  12323. * // => true
  12324. *
  12325. * _.isObject(_.noop);
  12326. * // => true
  12327. *
  12328. * _.isObject(null);
  12329. * // => false
  12330. */
  12331. function isObject(value) {
  12332. var type = typeof value;
  12333. return value != null && (type == 'object' || type == 'function');
  12334. }
  12335. /**
  12336. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12337. * and has a `typeof` result of "object".
  12338. *
  12339. * @static
  12340. * @memberOf _
  12341. * @since 4.0.0
  12342. * @category Lang
  12343. * @param {*} value The value to check.
  12344. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12345. * @example
  12346. *
  12347. * _.isObjectLike({});
  12348. * // => true
  12349. *
  12350. * _.isObjectLike([1, 2, 3]);
  12351. * // => true
  12352. *
  12353. * _.isObjectLike(_.noop);
  12354. * // => false
  12355. *
  12356. * _.isObjectLike(null);
  12357. * // => false
  12358. */
  12359. function isObjectLike(value) {
  12360. return value != null && typeof value == 'object';
  12361. }
  12362. /**
  12363. * Checks if `value` is classified as a `Map` object.
  12364. *
  12365. * @static
  12366. * @memberOf _
  12367. * @since 4.3.0
  12368. * @category Lang
  12369. * @param {*} value The value to check.
  12370. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12371. * @example
  12372. *
  12373. * _.isMap(new Map);
  12374. * // => true
  12375. *
  12376. * _.isMap(new WeakMap);
  12377. * // => false
  12378. */
  12379. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  12380. /**
  12381. * Performs a partial deep comparison between `object` and `source` to
  12382. * determine if `object` contains equivalent property values.
  12383. *
  12384. * **Note:** This method is equivalent to `_.matches` when `source` is
  12385. * partially applied.
  12386. *
  12387. * Partial comparisons will match empty array and empty object `source`
  12388. * values against any array or object value, respectively. See `_.isEqual`
  12389. * for a list of supported value comparisons.
  12390. *
  12391. * @static
  12392. * @memberOf _
  12393. * @since 3.0.0
  12394. * @category Lang
  12395. * @param {Object} object The object to inspect.
  12396. * @param {Object} source The object of property values to match.
  12397. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12398. * @example
  12399. *
  12400. * var object = { 'a': 1, 'b': 2 };
  12401. *
  12402. * _.isMatch(object, { 'b': 2 });
  12403. * // => true
  12404. *
  12405. * _.isMatch(object, { 'b': 1 });
  12406. * // => false
  12407. */
  12408. function isMatch(object, source) {
  12409. return object === source || baseIsMatch(object, source, getMatchData(source));
  12410. }
  12411. /**
  12412. * This method is like `_.isMatch` except that it accepts `customizer` which
  12413. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12414. * are handled by the method instead. The `customizer` is invoked with five
  12415. * arguments: (objValue, srcValue, index|key, object, source).
  12416. *
  12417. * @static
  12418. * @memberOf _
  12419. * @since 4.0.0
  12420. * @category Lang
  12421. * @param {Object} object The object to inspect.
  12422. * @param {Object} source The object of property values to match.
  12423. * @param {Function} [customizer] The function to customize comparisons.
  12424. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12425. * @example
  12426. *
  12427. * function isGreeting(value) {
  12428. * return /^h(?:i|ello)$/.test(value);
  12429. * }
  12430. *
  12431. * function customizer(objValue, srcValue) {
  12432. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  12433. * return true;
  12434. * }
  12435. * }
  12436. *
  12437. * var object = { 'greeting': 'hello' };
  12438. * var source = { 'greeting': 'hi' };
  12439. *
  12440. * _.isMatchWith(object, source, customizer);
  12441. * // => true
  12442. */
  12443. function isMatchWith(object, source, customizer) {
  12444. customizer = typeof customizer == 'function' ? customizer : undefined;
  12445. return baseIsMatch(object, source, getMatchData(source), customizer);
  12446. }
  12447. /**
  12448. * Checks if `value` is `NaN`.
  12449. *
  12450. * **Note:** This method is based on
  12451. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  12452. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  12453. * `undefined` and other non-number values.
  12454. *
  12455. * @static
  12456. * @memberOf _
  12457. * @since 0.1.0
  12458. * @category Lang
  12459. * @param {*} value The value to check.
  12460. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12461. * @example
  12462. *
  12463. * _.isNaN(NaN);
  12464. * // => true
  12465. *
  12466. * _.isNaN(new Number(NaN));
  12467. * // => true
  12468. *
  12469. * isNaN(undefined);
  12470. * // => true
  12471. *
  12472. * _.isNaN(undefined);
  12473. * // => false
  12474. */
  12475. function isNaN(value) {
  12476. // An `NaN` primitive is the only value that is not equal to itself.
  12477. // Perform the `toStringTag` check first to avoid errors with some
  12478. // ActiveX objects in IE.
  12479. return isNumber(value) && value != +value;
  12480. }
  12481. /**
  12482. * Checks if `value` is a pristine native function.
  12483. *
  12484. * **Note:** This method can't reliably detect native functions in the presence
  12485. * of the core-js package because core-js circumvents this kind of detection.
  12486. * Despite multiple requests, the core-js maintainer has made it clear: any
  12487. * attempt to fix the detection will be obstructed. As a result, we're left
  12488. * with little choice but to throw an error. Unfortunately, this also affects
  12489. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  12490. * which rely on core-js.
  12491. *
  12492. * @static
  12493. * @memberOf _
  12494. * @since 3.0.0
  12495. * @category Lang
  12496. * @param {*} value The value to check.
  12497. * @returns {boolean} Returns `true` if `value` is a native function,
  12498. * else `false`.
  12499. * @example
  12500. *
  12501. * _.isNative(Array.prototype.push);
  12502. * // => true
  12503. *
  12504. * _.isNative(_);
  12505. * // => false
  12506. */
  12507. function isNative(value) {
  12508. if (isMaskable(value)) {
  12509. throw new Error(CORE_ERROR_TEXT);
  12510. }
  12511. return baseIsNative(value);
  12512. }
  12513. /**
  12514. * Checks if `value` is `null`.
  12515. *
  12516. * @static
  12517. * @memberOf _
  12518. * @since 0.1.0
  12519. * @category Lang
  12520. * @param {*} value The value to check.
  12521. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12522. * @example
  12523. *
  12524. * _.isNull(null);
  12525. * // => true
  12526. *
  12527. * _.isNull(void 0);
  12528. * // => false
  12529. */
  12530. function isNull(value) {
  12531. return value === null;
  12532. }
  12533. /**
  12534. * Checks if `value` is `null` or `undefined`.
  12535. *
  12536. * @static
  12537. * @memberOf _
  12538. * @since 4.0.0
  12539. * @category Lang
  12540. * @param {*} value The value to check.
  12541. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12542. * @example
  12543. *
  12544. * _.isNil(null);
  12545. * // => true
  12546. *
  12547. * _.isNil(void 0);
  12548. * // => true
  12549. *
  12550. * _.isNil(NaN);
  12551. * // => false
  12552. */
  12553. function isNil(value) {
  12554. return value == null;
  12555. }
  12556. /**
  12557. * Checks if `value` is classified as a `Number` primitive or object.
  12558. *
  12559. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12560. * classified as numbers, use the `_.isFinite` method.
  12561. *
  12562. * @static
  12563. * @memberOf _
  12564. * @since 0.1.0
  12565. * @category Lang
  12566. * @param {*} value The value to check.
  12567. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12568. * @example
  12569. *
  12570. * _.isNumber(3);
  12571. * // => true
  12572. *
  12573. * _.isNumber(Number.MIN_VALUE);
  12574. * // => true
  12575. *
  12576. * _.isNumber(Infinity);
  12577. * // => true
  12578. *
  12579. * _.isNumber('3');
  12580. * // => false
  12581. */
  12582. function isNumber(value) {
  12583. return typeof value == 'number' ||
  12584. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12585. }
  12586. /**
  12587. * Checks if `value` is a plain object, that is, an object created by the
  12588. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12589. *
  12590. * @static
  12591. * @memberOf _
  12592. * @since 0.8.0
  12593. * @category Lang
  12594. * @param {*} value The value to check.
  12595. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12596. * @example
  12597. *
  12598. * function Foo() {
  12599. * this.a = 1;
  12600. * }
  12601. *
  12602. * _.isPlainObject(new Foo);
  12603. * // => false
  12604. *
  12605. * _.isPlainObject([1, 2, 3]);
  12606. * // => false
  12607. *
  12608. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12609. * // => true
  12610. *
  12611. * _.isPlainObject(Object.create(null));
  12612. * // => true
  12613. */
  12614. function isPlainObject(value) {
  12615. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12616. return false;
  12617. }
  12618. var proto = getPrototype(value);
  12619. if (proto === null) {
  12620. return true;
  12621. }
  12622. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12623. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12624. funcToString.call(Ctor) == objectCtorString;
  12625. }
  12626. /**
  12627. * Checks if `value` is classified as a `RegExp` object.
  12628. *
  12629. * @static
  12630. * @memberOf _
  12631. * @since 0.1.0
  12632. * @category Lang
  12633. * @param {*} value The value to check.
  12634. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12635. * @example
  12636. *
  12637. * _.isRegExp(/abc/);
  12638. * // => true
  12639. *
  12640. * _.isRegExp('/abc/');
  12641. * // => false
  12642. */
  12643. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12644. /**
  12645. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12646. * double precision number which isn't the result of a rounded unsafe integer.
  12647. *
  12648. * **Note:** This method is based on
  12649. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12650. *
  12651. * @static
  12652. * @memberOf _
  12653. * @since 4.0.0
  12654. * @category Lang
  12655. * @param {*} value The value to check.
  12656. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12657. * @example
  12658. *
  12659. * _.isSafeInteger(3);
  12660. * // => true
  12661. *
  12662. * _.isSafeInteger(Number.MIN_VALUE);
  12663. * // => false
  12664. *
  12665. * _.isSafeInteger(Infinity);
  12666. * // => false
  12667. *
  12668. * _.isSafeInteger('3');
  12669. * // => false
  12670. */
  12671. function isSafeInteger(value) {
  12672. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12673. }
  12674. /**
  12675. * Checks if `value` is classified as a `Set` object.
  12676. *
  12677. * @static
  12678. * @memberOf _
  12679. * @since 4.3.0
  12680. * @category Lang
  12681. * @param {*} value The value to check.
  12682. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12683. * @example
  12684. *
  12685. * _.isSet(new Set);
  12686. * // => true
  12687. *
  12688. * _.isSet(new WeakSet);
  12689. * // => false
  12690. */
  12691. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12692. /**
  12693. * Checks if `value` is classified as a `String` primitive or object.
  12694. *
  12695. * @static
  12696. * @since 0.1.0
  12697. * @memberOf _
  12698. * @category Lang
  12699. * @param {*} value The value to check.
  12700. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12701. * @example
  12702. *
  12703. * _.isString('abc');
  12704. * // => true
  12705. *
  12706. * _.isString(1);
  12707. * // => false
  12708. */
  12709. function isString(value) {
  12710. return typeof value == 'string' ||
  12711. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12712. }
  12713. /**
  12714. * Checks if `value` is classified as a `Symbol` primitive or object.
  12715. *
  12716. * @static
  12717. * @memberOf _
  12718. * @since 4.0.0
  12719. * @category Lang
  12720. * @param {*} value The value to check.
  12721. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12722. * @example
  12723. *
  12724. * _.isSymbol(Symbol.iterator);
  12725. * // => true
  12726. *
  12727. * _.isSymbol('abc');
  12728. * // => false
  12729. */
  12730. function isSymbol(value) {
  12731. return typeof value == 'symbol' ||
  12732. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12733. }
  12734. /**
  12735. * Checks if `value` is classified as a typed array.
  12736. *
  12737. * @static
  12738. * @memberOf _
  12739. * @since 3.0.0
  12740. * @category Lang
  12741. * @param {*} value The value to check.
  12742. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12743. * @example
  12744. *
  12745. * _.isTypedArray(new Uint8Array);
  12746. * // => true
  12747. *
  12748. * _.isTypedArray([]);
  12749. * // => false
  12750. */
  12751. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12752. /**
  12753. * Checks if `value` is `undefined`.
  12754. *
  12755. * @static
  12756. * @since 0.1.0
  12757. * @memberOf _
  12758. * @category Lang
  12759. * @param {*} value The value to check.
  12760. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12761. * @example
  12762. *
  12763. * _.isUndefined(void 0);
  12764. * // => true
  12765. *
  12766. * _.isUndefined(null);
  12767. * // => false
  12768. */
  12769. function isUndefined(value) {
  12770. return value === undefined;
  12771. }
  12772. /**
  12773. * Checks if `value` is classified as a `WeakMap` object.
  12774. *
  12775. * @static
  12776. * @memberOf _
  12777. * @since 4.3.0
  12778. * @category Lang
  12779. * @param {*} value The value to check.
  12780. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12781. * @example
  12782. *
  12783. * _.isWeakMap(new WeakMap);
  12784. * // => true
  12785. *
  12786. * _.isWeakMap(new Map);
  12787. * // => false
  12788. */
  12789. function isWeakMap(value) {
  12790. return isObjectLike(value) && getTag(value) == weakMapTag;
  12791. }
  12792. /**
  12793. * Checks if `value` is classified as a `WeakSet` object.
  12794. *
  12795. * @static
  12796. * @memberOf _
  12797. * @since 4.3.0
  12798. * @category Lang
  12799. * @param {*} value The value to check.
  12800. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12801. * @example
  12802. *
  12803. * _.isWeakSet(new WeakSet);
  12804. * // => true
  12805. *
  12806. * _.isWeakSet(new Set);
  12807. * // => false
  12808. */
  12809. function isWeakSet(value) {
  12810. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12811. }
  12812. /**
  12813. * Checks if `value` is less than `other`.
  12814. *
  12815. * @static
  12816. * @memberOf _
  12817. * @since 3.9.0
  12818. * @category Lang
  12819. * @param {*} value The value to compare.
  12820. * @param {*} other The other value to compare.
  12821. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12822. * else `false`.
  12823. * @see _.gt
  12824. * @example
  12825. *
  12826. * _.lt(1, 3);
  12827. * // => true
  12828. *
  12829. * _.lt(3, 3);
  12830. * // => false
  12831. *
  12832. * _.lt(3, 1);
  12833. * // => false
  12834. */
  12835. var lt = createRelationalOperation(baseLt);
  12836. /**
  12837. * Checks if `value` is less than or equal to `other`.
  12838. *
  12839. * @static
  12840. * @memberOf _
  12841. * @since 3.9.0
  12842. * @category Lang
  12843. * @param {*} value The value to compare.
  12844. * @param {*} other The other value to compare.
  12845. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12846. * `other`, else `false`.
  12847. * @see _.gte
  12848. * @example
  12849. *
  12850. * _.lte(1, 3);
  12851. * // => true
  12852. *
  12853. * _.lte(3, 3);
  12854. * // => true
  12855. *
  12856. * _.lte(3, 1);
  12857. * // => false
  12858. */
  12859. var lte = createRelationalOperation(function(value, other) {
  12860. return value <= other;
  12861. });
  12862. /**
  12863. * Converts `value` to an array.
  12864. *
  12865. * @static
  12866. * @since 0.1.0
  12867. * @memberOf _
  12868. * @category Lang
  12869. * @param {*} value The value to convert.
  12870. * @returns {Array} Returns the converted array.
  12871. * @example
  12872. *
  12873. * _.toArray({ 'a': 1, 'b': 2 });
  12874. * // => [1, 2]
  12875. *
  12876. * _.toArray('abc');
  12877. * // => ['a', 'b', 'c']
  12878. *
  12879. * _.toArray(1);
  12880. * // => []
  12881. *
  12882. * _.toArray(null);
  12883. * // => []
  12884. */
  12885. function toArray(value) {
  12886. if (!value) {
  12887. return [];
  12888. }
  12889. if (isArrayLike(value)) {
  12890. return isString(value) ? stringToArray(value) : copyArray(value);
  12891. }
  12892. if (symIterator && value[symIterator]) {
  12893. return iteratorToArray(value[symIterator]());
  12894. }
  12895. var tag = getTag(value),
  12896. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12897. return func(value);
  12898. }
  12899. /**
  12900. * Converts `value` to a finite number.
  12901. *
  12902. * @static
  12903. * @memberOf _
  12904. * @since 4.12.0
  12905. * @category Lang
  12906. * @param {*} value The value to convert.
  12907. * @returns {number} Returns the converted number.
  12908. * @example
  12909. *
  12910. * _.toFinite(3.2);
  12911. * // => 3.2
  12912. *
  12913. * _.toFinite(Number.MIN_VALUE);
  12914. * // => 5e-324
  12915. *
  12916. * _.toFinite(Infinity);
  12917. * // => 1.7976931348623157e+308
  12918. *
  12919. * _.toFinite('3.2');
  12920. * // => 3.2
  12921. */
  12922. function toFinite(value) {
  12923. if (!value) {
  12924. return value === 0 ? value : 0;
  12925. }
  12926. value = toNumber(value);
  12927. if (value === INFINITY || value === -INFINITY) {
  12928. var sign = (value < 0 ? -1 : 1);
  12929. return sign * MAX_INTEGER;
  12930. }
  12931. return value === value ? value : 0;
  12932. }
  12933. /**
  12934. * Converts `value` to an integer.
  12935. *
  12936. * **Note:** This method is loosely based on
  12937. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12938. *
  12939. * @static
  12940. * @memberOf _
  12941. * @since 4.0.0
  12942. * @category Lang
  12943. * @param {*} value The value to convert.
  12944. * @returns {number} Returns the converted integer.
  12945. * @example
  12946. *
  12947. * _.toInteger(3.2);
  12948. * // => 3
  12949. *
  12950. * _.toInteger(Number.MIN_VALUE);
  12951. * // => 0
  12952. *
  12953. * _.toInteger(Infinity);
  12954. * // => 1.7976931348623157e+308
  12955. *
  12956. * _.toInteger('3.2');
  12957. * // => 3
  12958. */
  12959. function toInteger(value) {
  12960. var result = toFinite(value),
  12961. remainder = result % 1;
  12962. return result === result ? (remainder ? result - remainder : result) : 0;
  12963. }
  12964. /**
  12965. * Converts `value` to an integer suitable for use as the length of an
  12966. * array-like object.
  12967. *
  12968. * **Note:** This method is based on
  12969. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12970. *
  12971. * @static
  12972. * @memberOf _
  12973. * @since 4.0.0
  12974. * @category Lang
  12975. * @param {*} value The value to convert.
  12976. * @returns {number} Returns the converted integer.
  12977. * @example
  12978. *
  12979. * _.toLength(3.2);
  12980. * // => 3
  12981. *
  12982. * _.toLength(Number.MIN_VALUE);
  12983. * // => 0
  12984. *
  12985. * _.toLength(Infinity);
  12986. * // => 4294967295
  12987. *
  12988. * _.toLength('3.2');
  12989. * // => 3
  12990. */
  12991. function toLength(value) {
  12992. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  12993. }
  12994. /**
  12995. * Converts `value` to a number.
  12996. *
  12997. * @static
  12998. * @memberOf _
  12999. * @since 4.0.0
  13000. * @category Lang
  13001. * @param {*} value The value to process.
  13002. * @returns {number} Returns the number.
  13003. * @example
  13004. *
  13005. * _.toNumber(3.2);
  13006. * // => 3.2
  13007. *
  13008. * _.toNumber(Number.MIN_VALUE);
  13009. * // => 5e-324
  13010. *
  13011. * _.toNumber(Infinity);
  13012. * // => Infinity
  13013. *
  13014. * _.toNumber('3.2');
  13015. * // => 3.2
  13016. */
  13017. function toNumber(value) {
  13018. if (typeof value == 'number') {
  13019. return value;
  13020. }
  13021. if (isSymbol(value)) {
  13022. return NAN;
  13023. }
  13024. if (isObject(value)) {
  13025. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  13026. value = isObject(other) ? (other + '') : other;
  13027. }
  13028. if (typeof value != 'string') {
  13029. return value === 0 ? value : +value;
  13030. }
  13031. value = baseTrim(value);
  13032. var isBinary = reIsBinary.test(value);
  13033. return (isBinary || reIsOctal.test(value))
  13034. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  13035. : (reIsBadHex.test(value) ? NAN : +value);
  13036. }
  13037. /**
  13038. * Converts `value` to a plain object flattening inherited enumerable string
  13039. * keyed properties of `value` to own properties of the plain object.
  13040. *
  13041. * @static
  13042. * @memberOf _
  13043. * @since 3.0.0
  13044. * @category Lang
  13045. * @param {*} value The value to convert.
  13046. * @returns {Object} Returns the converted plain object.
  13047. * @example
  13048. *
  13049. * function Foo() {
  13050. * this.b = 2;
  13051. * }
  13052. *
  13053. * Foo.prototype.c = 3;
  13054. *
  13055. * _.assign({ 'a': 1 }, new Foo);
  13056. * // => { 'a': 1, 'b': 2 }
  13057. *
  13058. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  13059. * // => { 'a': 1, 'b': 2, 'c': 3 }
  13060. */
  13061. function toPlainObject(value) {
  13062. return copyObject(value, keysIn(value));
  13063. }
  13064. /**
  13065. * Converts `value` to a safe integer. A safe integer can be compared and
  13066. * represented correctly.
  13067. *
  13068. * @static
  13069. * @memberOf _
  13070. * @since 4.0.0
  13071. * @category Lang
  13072. * @param {*} value The value to convert.
  13073. * @returns {number} Returns the converted integer.
  13074. * @example
  13075. *
  13076. * _.toSafeInteger(3.2);
  13077. * // => 3
  13078. *
  13079. * _.toSafeInteger(Number.MIN_VALUE);
  13080. * // => 0
  13081. *
  13082. * _.toSafeInteger(Infinity);
  13083. * // => 9007199254740991
  13084. *
  13085. * _.toSafeInteger('3.2');
  13086. * // => 3
  13087. */
  13088. function toSafeInteger(value) {
  13089. return value
  13090. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  13091. : (value === 0 ? value : 0);
  13092. }
  13093. /**
  13094. * Converts `value` to a string. An empty string is returned for `null`
  13095. * and `undefined` values. The sign of `-0` is preserved.
  13096. *
  13097. * @static
  13098. * @memberOf _
  13099. * @since 4.0.0
  13100. * @category Lang
  13101. * @param {*} value The value to convert.
  13102. * @returns {string} Returns the converted string.
  13103. * @example
  13104. *
  13105. * _.toString(null);
  13106. * // => ''
  13107. *
  13108. * _.toString(-0);
  13109. * // => '-0'
  13110. *
  13111. * _.toString([1, 2, 3]);
  13112. * // => '1,2,3'
  13113. */
  13114. function toString(value) {
  13115. return value == null ? '' : baseToString(value);
  13116. }
  13117. /*------------------------------------------------------------------------*/
  13118. /**
  13119. * Assigns own enumerable string keyed properties of source objects to the
  13120. * destination object. Source objects are applied from left to right.
  13121. * Subsequent sources overwrite property assignments of previous sources.
  13122. *
  13123. * **Note:** This method mutates `object` and is loosely based on
  13124. * [`Object.assign`](https://mdn.io/Object/assign).
  13125. *
  13126. * @static
  13127. * @memberOf _
  13128. * @since 0.10.0
  13129. * @category Object
  13130. * @param {Object} object The destination object.
  13131. * @param {...Object} [sources] The source objects.
  13132. * @returns {Object} Returns `object`.
  13133. * @see _.assignIn
  13134. * @example
  13135. *
  13136. * function Foo() {
  13137. * this.a = 1;
  13138. * }
  13139. *
  13140. * function Bar() {
  13141. * this.c = 3;
  13142. * }
  13143. *
  13144. * Foo.prototype.b = 2;
  13145. * Bar.prototype.d = 4;
  13146. *
  13147. * _.assign({ 'a': 0 }, new Foo, new Bar);
  13148. * // => { 'a': 1, 'c': 3 }
  13149. */
  13150. var assign = createAssigner(function(object, source) {
  13151. if (isPrototype(source) || isArrayLike(source)) {
  13152. copyObject(source, keys(source), object);
  13153. return;
  13154. }
  13155. for (var key in source) {
  13156. if (hasOwnProperty.call(source, key)) {
  13157. assignValue(object, key, source[key]);
  13158. }
  13159. }
  13160. });
  13161. /**
  13162. * This method is like `_.assign` except that it iterates over own and
  13163. * inherited source properties.
  13164. *
  13165. * **Note:** This method mutates `object`.
  13166. *
  13167. * @static
  13168. * @memberOf _
  13169. * @since 4.0.0
  13170. * @alias extend
  13171. * @category Object
  13172. * @param {Object} object The destination object.
  13173. * @param {...Object} [sources] The source objects.
  13174. * @returns {Object} Returns `object`.
  13175. * @see _.assign
  13176. * @example
  13177. *
  13178. * function Foo() {
  13179. * this.a = 1;
  13180. * }
  13181. *
  13182. * function Bar() {
  13183. * this.c = 3;
  13184. * }
  13185. *
  13186. * Foo.prototype.b = 2;
  13187. * Bar.prototype.d = 4;
  13188. *
  13189. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  13190. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  13191. */
  13192. var assignIn = createAssigner(function(object, source) {
  13193. copyObject(source, keysIn(source), object);
  13194. });
  13195. /**
  13196. * This method is like `_.assignIn` except that it accepts `customizer`
  13197. * which is invoked to produce the assigned values. If `customizer` returns
  13198. * `undefined`, assignment is handled by the method instead. The `customizer`
  13199. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13200. *
  13201. * **Note:** This method mutates `object`.
  13202. *
  13203. * @static
  13204. * @memberOf _
  13205. * @since 4.0.0
  13206. * @alias extendWith
  13207. * @category Object
  13208. * @param {Object} object The destination object.
  13209. * @param {...Object} sources The source objects.
  13210. * @param {Function} [customizer] The function to customize assigned values.
  13211. * @returns {Object} Returns `object`.
  13212. * @see _.assignWith
  13213. * @example
  13214. *
  13215. * function customizer(objValue, srcValue) {
  13216. * return _.isUndefined(objValue) ? srcValue : objValue;
  13217. * }
  13218. *
  13219. * var defaults = _.partialRight(_.assignInWith, customizer);
  13220. *
  13221. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13222. * // => { 'a': 1, 'b': 2 }
  13223. */
  13224. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  13225. copyObject(source, keysIn(source), object, customizer);
  13226. });
  13227. /**
  13228. * This method is like `_.assign` except that it accepts `customizer`
  13229. * which is invoked to produce the assigned values. If `customizer` returns
  13230. * `undefined`, assignment is handled by the method instead. The `customizer`
  13231. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13232. *
  13233. * **Note:** This method mutates `object`.
  13234. *
  13235. * @static
  13236. * @memberOf _
  13237. * @since 4.0.0
  13238. * @category Object
  13239. * @param {Object} object The destination object.
  13240. * @param {...Object} sources The source objects.
  13241. * @param {Function} [customizer] The function to customize assigned values.
  13242. * @returns {Object} Returns `object`.
  13243. * @see _.assignInWith
  13244. * @example
  13245. *
  13246. * function customizer(objValue, srcValue) {
  13247. * return _.isUndefined(objValue) ? srcValue : objValue;
  13248. * }
  13249. *
  13250. * var defaults = _.partialRight(_.assignWith, customizer);
  13251. *
  13252. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13253. * // => { 'a': 1, 'b': 2 }
  13254. */
  13255. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  13256. copyObject(source, keys(source), object, customizer);
  13257. });
  13258. /**
  13259. * Creates an array of values corresponding to `paths` of `object`.
  13260. *
  13261. * @static
  13262. * @memberOf _
  13263. * @since 1.0.0
  13264. * @category Object
  13265. * @param {Object} object The object to iterate over.
  13266. * @param {...(string|string[])} [paths] The property paths to pick.
  13267. * @returns {Array} Returns the picked values.
  13268. * @example
  13269. *
  13270. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  13271. *
  13272. * _.at(object, ['a[0].b.c', 'a[1]']);
  13273. * // => [3, 4]
  13274. */
  13275. var at = flatRest(baseAt);
  13276. /**
  13277. * Creates an object that inherits from the `prototype` object. If a
  13278. * `properties` object is given, its own enumerable string keyed properties
  13279. * are assigned to the created object.
  13280. *
  13281. * @static
  13282. * @memberOf _
  13283. * @since 2.3.0
  13284. * @category Object
  13285. * @param {Object} prototype The object to inherit from.
  13286. * @param {Object} [properties] The properties to assign to the object.
  13287. * @returns {Object} Returns the new object.
  13288. * @example
  13289. *
  13290. * function Shape() {
  13291. * this.x = 0;
  13292. * this.y = 0;
  13293. * }
  13294. *
  13295. * function Circle() {
  13296. * Shape.call(this);
  13297. * }
  13298. *
  13299. * Circle.prototype = _.create(Shape.prototype, {
  13300. * 'constructor': Circle
  13301. * });
  13302. *
  13303. * var circle = new Circle;
  13304. * circle instanceof Circle;
  13305. * // => true
  13306. *
  13307. * circle instanceof Shape;
  13308. * // => true
  13309. */
  13310. function create(prototype, properties) {
  13311. var result = baseCreate(prototype);
  13312. return properties == null ? result : baseAssign(result, properties);
  13313. }
  13314. /**
  13315. * Assigns own and inherited enumerable string keyed properties of source
  13316. * objects to the destination object for all destination properties that
  13317. * resolve to `undefined`. Source objects are applied from left to right.
  13318. * Once a property is set, additional values of the same property are ignored.
  13319. *
  13320. * **Note:** This method mutates `object`.
  13321. *
  13322. * @static
  13323. * @since 0.1.0
  13324. * @memberOf _
  13325. * @category Object
  13326. * @param {Object} object The destination object.
  13327. * @param {...Object} [sources] The source objects.
  13328. * @returns {Object} Returns `object`.
  13329. * @see _.defaultsDeep
  13330. * @example
  13331. *
  13332. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13333. * // => { 'a': 1, 'b': 2 }
  13334. */
  13335. var defaults = baseRest(function(object, sources) {
  13336. object = Object(object);
  13337. var index = -1;
  13338. var length = sources.length;
  13339. var guard = length > 2 ? sources[2] : undefined;
  13340. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13341. length = 1;
  13342. }
  13343. while (++index < length) {
  13344. var source = sources[index];
  13345. var props = keysIn(source);
  13346. var propsIndex = -1;
  13347. var propsLength = props.length;
  13348. while (++propsIndex < propsLength) {
  13349. var key = props[propsIndex];
  13350. var value = object[key];
  13351. if (value === undefined ||
  13352. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  13353. object[key] = source[key];
  13354. }
  13355. }
  13356. }
  13357. return object;
  13358. });
  13359. /**
  13360. * This method is like `_.defaults` except that it recursively assigns
  13361. * default properties.
  13362. *
  13363. * **Note:** This method mutates `object`.
  13364. *
  13365. * @static
  13366. * @memberOf _
  13367. * @since 3.10.0
  13368. * @category Object
  13369. * @param {Object} object The destination object.
  13370. * @param {...Object} [sources] The source objects.
  13371. * @returns {Object} Returns `object`.
  13372. * @see _.defaults
  13373. * @example
  13374. *
  13375. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  13376. * // => { 'a': { 'b': 2, 'c': 3 } }
  13377. */
  13378. var defaultsDeep = baseRest(function(args) {
  13379. args.push(undefined, customDefaultsMerge);
  13380. return apply(mergeWith, undefined, args);
  13381. });
  13382. /**
  13383. * This method is like `_.find` except that it returns the key of the first
  13384. * element `predicate` returns truthy for instead of the element itself.
  13385. *
  13386. * @static
  13387. * @memberOf _
  13388. * @since 1.1.0
  13389. * @category Object
  13390. * @param {Object} object The object to inspect.
  13391. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13392. * @returns {string|undefined} Returns the key of the matched element,
  13393. * else `undefined`.
  13394. * @example
  13395. *
  13396. * var users = {
  13397. * 'barney': { 'age': 36, 'active': true },
  13398. * 'fred': { 'age': 40, 'active': false },
  13399. * 'pebbles': { 'age': 1, 'active': true }
  13400. * };
  13401. *
  13402. * _.findKey(users, function(o) { return o.age < 40; });
  13403. * // => 'barney' (iteration order is not guaranteed)
  13404. *
  13405. * // The `_.matches` iteratee shorthand.
  13406. * _.findKey(users, { 'age': 1, 'active': true });
  13407. * // => 'pebbles'
  13408. *
  13409. * // The `_.matchesProperty` iteratee shorthand.
  13410. * _.findKey(users, ['active', false]);
  13411. * // => 'fred'
  13412. *
  13413. * // The `_.property` iteratee shorthand.
  13414. * _.findKey(users, 'active');
  13415. * // => 'barney'
  13416. */
  13417. function findKey(object, predicate) {
  13418. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  13419. }
  13420. /**
  13421. * This method is like `_.findKey` except that it iterates over elements of
  13422. * a collection in the opposite order.
  13423. *
  13424. * @static
  13425. * @memberOf _
  13426. * @since 2.0.0
  13427. * @category Object
  13428. * @param {Object} object The object to inspect.
  13429. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13430. * @returns {string|undefined} Returns the key of the matched element,
  13431. * else `undefined`.
  13432. * @example
  13433. *
  13434. * var users = {
  13435. * 'barney': { 'age': 36, 'active': true },
  13436. * 'fred': { 'age': 40, 'active': false },
  13437. * 'pebbles': { 'age': 1, 'active': true }
  13438. * };
  13439. *
  13440. * _.findLastKey(users, function(o) { return o.age < 40; });
  13441. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  13442. *
  13443. * // The `_.matches` iteratee shorthand.
  13444. * _.findLastKey(users, { 'age': 36, 'active': true });
  13445. * // => 'barney'
  13446. *
  13447. * // The `_.matchesProperty` iteratee shorthand.
  13448. * _.findLastKey(users, ['active', false]);
  13449. * // => 'fred'
  13450. *
  13451. * // The `_.property` iteratee shorthand.
  13452. * _.findLastKey(users, 'active');
  13453. * // => 'pebbles'
  13454. */
  13455. function findLastKey(object, predicate) {
  13456. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  13457. }
  13458. /**
  13459. * Iterates over own and inherited enumerable string keyed properties of an
  13460. * object and invokes `iteratee` for each property. The iteratee is invoked
  13461. * with three arguments: (value, key, object). Iteratee functions may exit
  13462. * iteration early by explicitly returning `false`.
  13463. *
  13464. * @static
  13465. * @memberOf _
  13466. * @since 0.3.0
  13467. * @category Object
  13468. * @param {Object} object The object to iterate over.
  13469. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13470. * @returns {Object} Returns `object`.
  13471. * @see _.forInRight
  13472. * @example
  13473. *
  13474. * function Foo() {
  13475. * this.a = 1;
  13476. * this.b = 2;
  13477. * }
  13478. *
  13479. * Foo.prototype.c = 3;
  13480. *
  13481. * _.forIn(new Foo, function(value, key) {
  13482. * console.log(key);
  13483. * });
  13484. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  13485. */
  13486. function forIn(object, iteratee) {
  13487. return object == null
  13488. ? object
  13489. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  13490. }
  13491. /**
  13492. * This method is like `_.forIn` except that it iterates over properties of
  13493. * `object` in the opposite order.
  13494. *
  13495. * @static
  13496. * @memberOf _
  13497. * @since 2.0.0
  13498. * @category Object
  13499. * @param {Object} object The object to iterate over.
  13500. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13501. * @returns {Object} Returns `object`.
  13502. * @see _.forIn
  13503. * @example
  13504. *
  13505. * function Foo() {
  13506. * this.a = 1;
  13507. * this.b = 2;
  13508. * }
  13509. *
  13510. * Foo.prototype.c = 3;
  13511. *
  13512. * _.forInRight(new Foo, function(value, key) {
  13513. * console.log(key);
  13514. * });
  13515. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13516. */
  13517. function forInRight(object, iteratee) {
  13518. return object == null
  13519. ? object
  13520. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13521. }
  13522. /**
  13523. * Iterates over own enumerable string keyed properties of an object and
  13524. * invokes `iteratee` for each property. The iteratee is invoked with three
  13525. * arguments: (value, key, object). Iteratee functions may exit iteration
  13526. * early by explicitly returning `false`.
  13527. *
  13528. * @static
  13529. * @memberOf _
  13530. * @since 0.3.0
  13531. * @category Object
  13532. * @param {Object} object The object to iterate over.
  13533. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13534. * @returns {Object} Returns `object`.
  13535. * @see _.forOwnRight
  13536. * @example
  13537. *
  13538. * function Foo() {
  13539. * this.a = 1;
  13540. * this.b = 2;
  13541. * }
  13542. *
  13543. * Foo.prototype.c = 3;
  13544. *
  13545. * _.forOwn(new Foo, function(value, key) {
  13546. * console.log(key);
  13547. * });
  13548. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13549. */
  13550. function forOwn(object, iteratee) {
  13551. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13552. }
  13553. /**
  13554. * This method is like `_.forOwn` except that it iterates over properties of
  13555. * `object` in the opposite order.
  13556. *
  13557. * @static
  13558. * @memberOf _
  13559. * @since 2.0.0
  13560. * @category Object
  13561. * @param {Object} object The object to iterate over.
  13562. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13563. * @returns {Object} Returns `object`.
  13564. * @see _.forOwn
  13565. * @example
  13566. *
  13567. * function Foo() {
  13568. * this.a = 1;
  13569. * this.b = 2;
  13570. * }
  13571. *
  13572. * Foo.prototype.c = 3;
  13573. *
  13574. * _.forOwnRight(new Foo, function(value, key) {
  13575. * console.log(key);
  13576. * });
  13577. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13578. */
  13579. function forOwnRight(object, iteratee) {
  13580. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13581. }
  13582. /**
  13583. * Creates an array of function property names from own enumerable properties
  13584. * of `object`.
  13585. *
  13586. * @static
  13587. * @since 0.1.0
  13588. * @memberOf _
  13589. * @category Object
  13590. * @param {Object} object The object to inspect.
  13591. * @returns {Array} Returns the function names.
  13592. * @see _.functionsIn
  13593. * @example
  13594. *
  13595. * function Foo() {
  13596. * this.a = _.constant('a');
  13597. * this.b = _.constant('b');
  13598. * }
  13599. *
  13600. * Foo.prototype.c = _.constant('c');
  13601. *
  13602. * _.functions(new Foo);
  13603. * // => ['a', 'b']
  13604. */
  13605. function functions(object) {
  13606. return object == null ? [] : baseFunctions(object, keys(object));
  13607. }
  13608. /**
  13609. * Creates an array of function property names from own and inherited
  13610. * enumerable properties of `object`.
  13611. *
  13612. * @static
  13613. * @memberOf _
  13614. * @since 4.0.0
  13615. * @category Object
  13616. * @param {Object} object The object to inspect.
  13617. * @returns {Array} Returns the function names.
  13618. * @see _.functions
  13619. * @example
  13620. *
  13621. * function Foo() {
  13622. * this.a = _.constant('a');
  13623. * this.b = _.constant('b');
  13624. * }
  13625. *
  13626. * Foo.prototype.c = _.constant('c');
  13627. *
  13628. * _.functionsIn(new Foo);
  13629. * // => ['a', 'b', 'c']
  13630. */
  13631. function functionsIn(object) {
  13632. return object == null ? [] : baseFunctions(object, keysIn(object));
  13633. }
  13634. /**
  13635. * Gets the value at `path` of `object`. If the resolved value is
  13636. * `undefined`, the `defaultValue` is returned in its place.
  13637. *
  13638. * @static
  13639. * @memberOf _
  13640. * @since 3.7.0
  13641. * @category Object
  13642. * @param {Object} object The object to query.
  13643. * @param {Array|string} path The path of the property to get.
  13644. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13645. * @returns {*} Returns the resolved value.
  13646. * @example
  13647. *
  13648. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13649. *
  13650. * _.get(object, 'a[0].b.c');
  13651. * // => 3
  13652. *
  13653. * _.get(object, ['a', '0', 'b', 'c']);
  13654. * // => 3
  13655. *
  13656. * _.get(object, 'a.b.c', 'default');
  13657. * // => 'default'
  13658. */
  13659. function get(object, path, defaultValue) {
  13660. var result = object == null ? undefined : baseGet(object, path);
  13661. return result === undefined ? defaultValue : result;
  13662. }
  13663. /**
  13664. * Checks if `path` is a direct property of `object`.
  13665. *
  13666. * @static
  13667. * @since 0.1.0
  13668. * @memberOf _
  13669. * @category Object
  13670. * @param {Object} object The object to query.
  13671. * @param {Array|string} path The path to check.
  13672. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13673. * @example
  13674. *
  13675. * var object = { 'a': { 'b': 2 } };
  13676. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13677. *
  13678. * _.has(object, 'a');
  13679. * // => true
  13680. *
  13681. * _.has(object, 'a.b');
  13682. * // => true
  13683. *
  13684. * _.has(object, ['a', 'b']);
  13685. * // => true
  13686. *
  13687. * _.has(other, 'a');
  13688. * // => false
  13689. */
  13690. function has(object, path) {
  13691. return object != null && hasPath(object, path, baseHas);
  13692. }
  13693. /**
  13694. * Checks if `path` is a direct or inherited property of `object`.
  13695. *
  13696. * @static
  13697. * @memberOf _
  13698. * @since 4.0.0
  13699. * @category Object
  13700. * @param {Object} object The object to query.
  13701. * @param {Array|string} path The path to check.
  13702. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13703. * @example
  13704. *
  13705. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13706. *
  13707. * _.hasIn(object, 'a');
  13708. * // => true
  13709. *
  13710. * _.hasIn(object, 'a.b');
  13711. * // => true
  13712. *
  13713. * _.hasIn(object, ['a', 'b']);
  13714. * // => true
  13715. *
  13716. * _.hasIn(object, 'b');
  13717. * // => false
  13718. */
  13719. function hasIn(object, path) {
  13720. return object != null && hasPath(object, path, baseHasIn);
  13721. }
  13722. /**
  13723. * Creates an object composed of the inverted keys and values of `object`.
  13724. * If `object` contains duplicate values, subsequent values overwrite
  13725. * property assignments of previous values.
  13726. *
  13727. * @static
  13728. * @memberOf _
  13729. * @since 0.7.0
  13730. * @category Object
  13731. * @param {Object} object The object to invert.
  13732. * @returns {Object} Returns the new inverted object.
  13733. * @example
  13734. *
  13735. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13736. *
  13737. * _.invert(object);
  13738. * // => { '1': 'c', '2': 'b' }
  13739. */
  13740. var invert = createInverter(function(result, value, key) {
  13741. if (value != null &&
  13742. typeof value.toString != 'function') {
  13743. value = nativeObjectToString.call(value);
  13744. }
  13745. result[value] = key;
  13746. }, constant(identity));
  13747. /**
  13748. * This method is like `_.invert` except that the inverted object is generated
  13749. * from the results of running each element of `object` thru `iteratee`. The
  13750. * corresponding inverted value of each inverted key is an array of keys
  13751. * responsible for generating the inverted value. The iteratee is invoked
  13752. * with one argument: (value).
  13753. *
  13754. * @static
  13755. * @memberOf _
  13756. * @since 4.1.0
  13757. * @category Object
  13758. * @param {Object} object The object to invert.
  13759. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13760. * @returns {Object} Returns the new inverted object.
  13761. * @example
  13762. *
  13763. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13764. *
  13765. * _.invertBy(object);
  13766. * // => { '1': ['a', 'c'], '2': ['b'] }
  13767. *
  13768. * _.invertBy(object, function(value) {
  13769. * return 'group' + value;
  13770. * });
  13771. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13772. */
  13773. var invertBy = createInverter(function(result, value, key) {
  13774. if (value != null &&
  13775. typeof value.toString != 'function') {
  13776. value = nativeObjectToString.call(value);
  13777. }
  13778. if (hasOwnProperty.call(result, value)) {
  13779. result[value].push(key);
  13780. } else {
  13781. result[value] = [key];
  13782. }
  13783. }, getIteratee);
  13784. /**
  13785. * Invokes the method at `path` of `object`.
  13786. *
  13787. * @static
  13788. * @memberOf _
  13789. * @since 4.0.0
  13790. * @category Object
  13791. * @param {Object} object The object to query.
  13792. * @param {Array|string} path The path of the method to invoke.
  13793. * @param {...*} [args] The arguments to invoke the method with.
  13794. * @returns {*} Returns the result of the invoked method.
  13795. * @example
  13796. *
  13797. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13798. *
  13799. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13800. * // => [2, 3]
  13801. */
  13802. var invoke = baseRest(baseInvoke);
  13803. /**
  13804. * Creates an array of the own enumerable property names of `object`.
  13805. *
  13806. * **Note:** Non-object values are coerced to objects. See the
  13807. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13808. * for more details.
  13809. *
  13810. * @static
  13811. * @since 0.1.0
  13812. * @memberOf _
  13813. * @category Object
  13814. * @param {Object} object The object to query.
  13815. * @returns {Array} Returns the array of property names.
  13816. * @example
  13817. *
  13818. * function Foo() {
  13819. * this.a = 1;
  13820. * this.b = 2;
  13821. * }
  13822. *
  13823. * Foo.prototype.c = 3;
  13824. *
  13825. * _.keys(new Foo);
  13826. * // => ['a', 'b'] (iteration order is not guaranteed)
  13827. *
  13828. * _.keys('hi');
  13829. * // => ['0', '1']
  13830. */
  13831. function keys(object) {
  13832. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13833. }
  13834. /**
  13835. * Creates an array of the own and inherited enumerable property names of `object`.
  13836. *
  13837. * **Note:** Non-object values are coerced to objects.
  13838. *
  13839. * @static
  13840. * @memberOf _
  13841. * @since 3.0.0
  13842. * @category Object
  13843. * @param {Object} object The object to query.
  13844. * @returns {Array} Returns the array of property names.
  13845. * @example
  13846. *
  13847. * function Foo() {
  13848. * this.a = 1;
  13849. * this.b = 2;
  13850. * }
  13851. *
  13852. * Foo.prototype.c = 3;
  13853. *
  13854. * _.keysIn(new Foo);
  13855. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13856. */
  13857. function keysIn(object) {
  13858. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13859. }
  13860. /**
  13861. * The opposite of `_.mapValues`; this method creates an object with the
  13862. * same values as `object` and keys generated by running each own enumerable
  13863. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13864. * with three arguments: (value, key, object).
  13865. *
  13866. * @static
  13867. * @memberOf _
  13868. * @since 3.8.0
  13869. * @category Object
  13870. * @param {Object} object The object to iterate over.
  13871. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13872. * @returns {Object} Returns the new mapped object.
  13873. * @see _.mapValues
  13874. * @example
  13875. *
  13876. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13877. * return key + value;
  13878. * });
  13879. * // => { 'a1': 1, 'b2': 2 }
  13880. */
  13881. function mapKeys(object, iteratee) {
  13882. var result = {};
  13883. iteratee = getIteratee(iteratee, 3);
  13884. baseForOwn(object, function(value, key, object) {
  13885. baseAssignValue(result, iteratee(value, key, object), value);
  13886. });
  13887. return result;
  13888. }
  13889. /**
  13890. * Creates an object with the same keys as `object` and values generated
  13891. * by running each own enumerable string keyed property of `object` thru
  13892. * `iteratee`. The iteratee is invoked with three arguments:
  13893. * (value, key, object).
  13894. *
  13895. * @static
  13896. * @memberOf _
  13897. * @since 2.4.0
  13898. * @category Object
  13899. * @param {Object} object The object to iterate over.
  13900. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13901. * @returns {Object} Returns the new mapped object.
  13902. * @see _.mapKeys
  13903. * @example
  13904. *
  13905. * var users = {
  13906. * 'fred': { 'user': 'fred', 'age': 40 },
  13907. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13908. * };
  13909. *
  13910. * _.mapValues(users, function(o) { return o.age; });
  13911. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13912. *
  13913. * // The `_.property` iteratee shorthand.
  13914. * _.mapValues(users, 'age');
  13915. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13916. */
  13917. function mapValues(object, iteratee) {
  13918. var result = {};
  13919. iteratee = getIteratee(iteratee, 3);
  13920. baseForOwn(object, function(value, key, object) {
  13921. baseAssignValue(result, key, iteratee(value, key, object));
  13922. });
  13923. return result;
  13924. }
  13925. /**
  13926. * This method is like `_.assign` except that it recursively merges own and
  13927. * inherited enumerable string keyed properties of source objects into the
  13928. * destination object. Source properties that resolve to `undefined` are
  13929. * skipped if a destination value exists. Array and plain object properties
  13930. * are merged recursively. Other objects and value types are overridden by
  13931. * assignment. Source objects are applied from left to right. Subsequent
  13932. * sources overwrite property assignments of previous sources.
  13933. *
  13934. * **Note:** This method mutates `object`.
  13935. *
  13936. * @static
  13937. * @memberOf _
  13938. * @since 0.5.0
  13939. * @category Object
  13940. * @param {Object} object The destination object.
  13941. * @param {...Object} [sources] The source objects.
  13942. * @returns {Object} Returns `object`.
  13943. * @example
  13944. *
  13945. * var object = {
  13946. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13947. * };
  13948. *
  13949. * var other = {
  13950. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13951. * };
  13952. *
  13953. * _.merge(object, other);
  13954. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13955. */
  13956. var merge = createAssigner(function(object, source, srcIndex) {
  13957. baseMerge(object, source, srcIndex);
  13958. });
  13959. /**
  13960. * This method is like `_.merge` except that it accepts `customizer` which
  13961. * is invoked to produce the merged values of the destination and source
  13962. * properties. If `customizer` returns `undefined`, merging is handled by the
  13963. * method instead. The `customizer` is invoked with six arguments:
  13964. * (objValue, srcValue, key, object, source, stack).
  13965. *
  13966. * **Note:** This method mutates `object`.
  13967. *
  13968. * @static
  13969. * @memberOf _
  13970. * @since 4.0.0
  13971. * @category Object
  13972. * @param {Object} object The destination object.
  13973. * @param {...Object} sources The source objects.
  13974. * @param {Function} customizer The function to customize assigned values.
  13975. * @returns {Object} Returns `object`.
  13976. * @example
  13977. *
  13978. * function customizer(objValue, srcValue) {
  13979. * if (_.isArray(objValue)) {
  13980. * return objValue.concat(srcValue);
  13981. * }
  13982. * }
  13983. *
  13984. * var object = { 'a': [1], 'b': [2] };
  13985. * var other = { 'a': [3], 'b': [4] };
  13986. *
  13987. * _.mergeWith(object, other, customizer);
  13988. * // => { 'a': [1, 3], 'b': [2, 4] }
  13989. */
  13990. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13991. baseMerge(object, source, srcIndex, customizer);
  13992. });
  13993. /**
  13994. * The opposite of `_.pick`; this method creates an object composed of the
  13995. * own and inherited enumerable property paths of `object` that are not omitted.
  13996. *
  13997. * **Note:** This method is considerably slower than `_.pick`.
  13998. *
  13999. * @static
  14000. * @since 0.1.0
  14001. * @memberOf _
  14002. * @category Object
  14003. * @param {Object} object The source object.
  14004. * @param {...(string|string[])} [paths] The property paths to omit.
  14005. * @returns {Object} Returns the new object.
  14006. * @example
  14007. *
  14008. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14009. *
  14010. * _.omit(object, ['a', 'c']);
  14011. * // => { 'b': '2' }
  14012. */
  14013. var omit = flatRest(function(object, paths) {
  14014. var result = {};
  14015. if (object == null) {
  14016. return result;
  14017. }
  14018. var isDeep = false;
  14019. paths = arrayMap(paths, function(path) {
  14020. path = castPath(path, object);
  14021. isDeep || (isDeep = path.length > 1);
  14022. return path;
  14023. });
  14024. copyObject(object, getAllKeysIn(object), result);
  14025. if (isDeep) {
  14026. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  14027. }
  14028. var length = paths.length;
  14029. while (length--) {
  14030. baseUnset(result, paths[length]);
  14031. }
  14032. return result;
  14033. });
  14034. /**
  14035. * The opposite of `_.pickBy`; this method creates an object composed of
  14036. * the own and inherited enumerable string keyed properties of `object` that
  14037. * `predicate` doesn't return truthy for. The predicate is invoked with two
  14038. * arguments: (value, key).
  14039. *
  14040. * @static
  14041. * @memberOf _
  14042. * @since 4.0.0
  14043. * @category Object
  14044. * @param {Object} object The source object.
  14045. * @param {Function} [predicate=_.identity] The function invoked per property.
  14046. * @returns {Object} Returns the new object.
  14047. * @example
  14048. *
  14049. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14050. *
  14051. * _.omitBy(object, _.isNumber);
  14052. * // => { 'b': '2' }
  14053. */
  14054. function omitBy(object, predicate) {
  14055. return pickBy(object, negate(getIteratee(predicate)));
  14056. }
  14057. /**
  14058. * Creates an object composed of the picked `object` properties.
  14059. *
  14060. * @static
  14061. * @since 0.1.0
  14062. * @memberOf _
  14063. * @category Object
  14064. * @param {Object} object The source object.
  14065. * @param {...(string|string[])} [paths] The property paths to pick.
  14066. * @returns {Object} Returns the new object.
  14067. * @example
  14068. *
  14069. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14070. *
  14071. * _.pick(object, ['a', 'c']);
  14072. * // => { 'a': 1, 'c': 3 }
  14073. */
  14074. var pick = flatRest(function(object, paths) {
  14075. return object == null ? {} : basePick(object, paths);
  14076. });
  14077. /**
  14078. * Creates an object composed of the `object` properties `predicate` returns
  14079. * truthy for. The predicate is invoked with two arguments: (value, key).
  14080. *
  14081. * @static
  14082. * @memberOf _
  14083. * @since 4.0.0
  14084. * @category Object
  14085. * @param {Object} object The source object.
  14086. * @param {Function} [predicate=_.identity] The function invoked per property.
  14087. * @returns {Object} Returns the new object.
  14088. * @example
  14089. *
  14090. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14091. *
  14092. * _.pickBy(object, _.isNumber);
  14093. * // => { 'a': 1, 'c': 3 }
  14094. */
  14095. function pickBy(object, predicate) {
  14096. if (object == null) {
  14097. return {};
  14098. }
  14099. var props = arrayMap(getAllKeysIn(object), function(prop) {
  14100. return [prop];
  14101. });
  14102. predicate = getIteratee(predicate);
  14103. return basePickBy(object, props, function(value, path) {
  14104. return predicate(value, path[0]);
  14105. });
  14106. }
  14107. /**
  14108. * This method is like `_.get` except that if the resolved value is a
  14109. * function it's invoked with the `this` binding of its parent object and
  14110. * its result is returned.
  14111. *
  14112. * @static
  14113. * @since 0.1.0
  14114. * @memberOf _
  14115. * @category Object
  14116. * @param {Object} object The object to query.
  14117. * @param {Array|string} path The path of the property to resolve.
  14118. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14119. * @returns {*} Returns the resolved value.
  14120. * @example
  14121. *
  14122. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  14123. *
  14124. * _.result(object, 'a[0].b.c1');
  14125. * // => 3
  14126. *
  14127. * _.result(object, 'a[0].b.c2');
  14128. * // => 4
  14129. *
  14130. * _.result(object, 'a[0].b.c3', 'default');
  14131. * // => 'default'
  14132. *
  14133. * _.result(object, 'a[0].b.c3', _.constant('default'));
  14134. * // => 'default'
  14135. */
  14136. function result(object, path, defaultValue) {
  14137. path = castPath(path, object);
  14138. var index = -1,
  14139. length = path.length;
  14140. // Ensure the loop is entered when path is empty.
  14141. if (!length) {
  14142. length = 1;
  14143. object = undefined;
  14144. }
  14145. while (++index < length) {
  14146. var value = object == null ? undefined : object[toKey(path[index])];
  14147. if (value === undefined) {
  14148. index = length;
  14149. value = defaultValue;
  14150. }
  14151. object = isFunction(value) ? value.call(object) : value;
  14152. }
  14153. return object;
  14154. }
  14155. /**
  14156. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  14157. * it's created. Arrays are created for missing index properties while objects
  14158. * are created for all other missing properties. Use `_.setWith` to customize
  14159. * `path` creation.
  14160. *
  14161. * **Note:** This method mutates `object`.
  14162. *
  14163. * @static
  14164. * @memberOf _
  14165. * @since 3.7.0
  14166. * @category Object
  14167. * @param {Object} object The object to modify.
  14168. * @param {Array|string} path The path of the property to set.
  14169. * @param {*} value The value to set.
  14170. * @returns {Object} Returns `object`.
  14171. * @example
  14172. *
  14173. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14174. *
  14175. * _.set(object, 'a[0].b.c', 4);
  14176. * console.log(object.a[0].b.c);
  14177. * // => 4
  14178. *
  14179. * _.set(object, ['x', '0', 'y', 'z'], 5);
  14180. * console.log(object.x[0].y.z);
  14181. * // => 5
  14182. */
  14183. function set(object, path, value) {
  14184. return object == null ? object : baseSet(object, path, value);
  14185. }
  14186. /**
  14187. * This method is like `_.set` except that it accepts `customizer` which is
  14188. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14189. * path creation is handled by the method instead. The `customizer` is invoked
  14190. * with three arguments: (nsValue, key, nsObject).
  14191. *
  14192. * **Note:** This method mutates `object`.
  14193. *
  14194. * @static
  14195. * @memberOf _
  14196. * @since 4.0.0
  14197. * @category Object
  14198. * @param {Object} object The object to modify.
  14199. * @param {Array|string} path The path of the property to set.
  14200. * @param {*} value The value to set.
  14201. * @param {Function} [customizer] The function to customize assigned values.
  14202. * @returns {Object} Returns `object`.
  14203. * @example
  14204. *
  14205. * var object = {};
  14206. *
  14207. * _.setWith(object, '[0][1]', 'a', Object);
  14208. * // => { '0': { '1': 'a' } }
  14209. */
  14210. function setWith(object, path, value, customizer) {
  14211. customizer = typeof customizer == 'function' ? customizer : undefined;
  14212. return object == null ? object : baseSet(object, path, value, customizer);
  14213. }
  14214. /**
  14215. * Creates an array of own enumerable string keyed-value pairs for `object`
  14216. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  14217. * entries are returned.
  14218. *
  14219. * @static
  14220. * @memberOf _
  14221. * @since 4.0.0
  14222. * @alias entries
  14223. * @category Object
  14224. * @param {Object} object The object to query.
  14225. * @returns {Array} Returns the key-value pairs.
  14226. * @example
  14227. *
  14228. * function Foo() {
  14229. * this.a = 1;
  14230. * this.b = 2;
  14231. * }
  14232. *
  14233. * Foo.prototype.c = 3;
  14234. *
  14235. * _.toPairs(new Foo);
  14236. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  14237. */
  14238. var toPairs = createToPairs(keys);
  14239. /**
  14240. * Creates an array of own and inherited enumerable string keyed-value pairs
  14241. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  14242. * or set, its entries are returned.
  14243. *
  14244. * @static
  14245. * @memberOf _
  14246. * @since 4.0.0
  14247. * @alias entriesIn
  14248. * @category Object
  14249. * @param {Object} object The object to query.
  14250. * @returns {Array} Returns the key-value pairs.
  14251. * @example
  14252. *
  14253. * function Foo() {
  14254. * this.a = 1;
  14255. * this.b = 2;
  14256. * }
  14257. *
  14258. * Foo.prototype.c = 3;
  14259. *
  14260. * _.toPairsIn(new Foo);
  14261. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  14262. */
  14263. var toPairsIn = createToPairs(keysIn);
  14264. /**
  14265. * An alternative to `_.reduce`; this method transforms `object` to a new
  14266. * `accumulator` object which is the result of running each of its own
  14267. * enumerable string keyed properties thru `iteratee`, with each invocation
  14268. * potentially mutating the `accumulator` object. If `accumulator` is not
  14269. * provided, a new object with the same `[[Prototype]]` will be used. The
  14270. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  14271. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14272. *
  14273. * @static
  14274. * @memberOf _
  14275. * @since 1.3.0
  14276. * @category Object
  14277. * @param {Object} object The object to iterate over.
  14278. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14279. * @param {*} [accumulator] The custom accumulator value.
  14280. * @returns {*} Returns the accumulated value.
  14281. * @example
  14282. *
  14283. * _.transform([2, 3, 4], function(result, n) {
  14284. * result.push(n *= n);
  14285. * return n % 2 == 0;
  14286. * }, []);
  14287. * // => [4, 9]
  14288. *
  14289. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  14290. * (result[value] || (result[value] = [])).push(key);
  14291. * }, {});
  14292. * // => { '1': ['a', 'c'], '2': ['b'] }
  14293. */
  14294. function transform(object, iteratee, accumulator) {
  14295. var isArr = isArray(object),
  14296. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  14297. iteratee = getIteratee(iteratee, 4);
  14298. if (accumulator == null) {
  14299. var Ctor = object && object.constructor;
  14300. if (isArrLike) {
  14301. accumulator = isArr ? new Ctor : [];
  14302. }
  14303. else if (isObject(object)) {
  14304. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  14305. }
  14306. else {
  14307. accumulator = {};
  14308. }
  14309. }
  14310. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  14311. return iteratee(accumulator, value, index, object);
  14312. });
  14313. return accumulator;
  14314. }
  14315. /**
  14316. * Removes the property at `path` of `object`.
  14317. *
  14318. * **Note:** This method mutates `object`.
  14319. *
  14320. * @static
  14321. * @memberOf _
  14322. * @since 4.0.0
  14323. * @category Object
  14324. * @param {Object} object The object to modify.
  14325. * @param {Array|string} path The path of the property to unset.
  14326. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  14327. * @example
  14328. *
  14329. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  14330. * _.unset(object, 'a[0].b.c');
  14331. * // => true
  14332. *
  14333. * console.log(object);
  14334. * // => { 'a': [{ 'b': {} }] };
  14335. *
  14336. * _.unset(object, ['a', '0', 'b', 'c']);
  14337. * // => true
  14338. *
  14339. * console.log(object);
  14340. * // => { 'a': [{ 'b': {} }] };
  14341. */
  14342. function unset(object, path) {
  14343. return object == null ? true : baseUnset(object, path);
  14344. }
  14345. /**
  14346. * This method is like `_.set` except that accepts `updater` to produce the
  14347. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  14348. * is invoked with one argument: (value).
  14349. *
  14350. * **Note:** This method mutates `object`.
  14351. *
  14352. * @static
  14353. * @memberOf _
  14354. * @since 4.6.0
  14355. * @category Object
  14356. * @param {Object} object The object to modify.
  14357. * @param {Array|string} path The path of the property to set.
  14358. * @param {Function} updater The function to produce the updated value.
  14359. * @returns {Object} Returns `object`.
  14360. * @example
  14361. *
  14362. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14363. *
  14364. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  14365. * console.log(object.a[0].b.c);
  14366. * // => 9
  14367. *
  14368. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  14369. * console.log(object.x[0].y.z);
  14370. * // => 0
  14371. */
  14372. function update(object, path, updater) {
  14373. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  14374. }
  14375. /**
  14376. * This method is like `_.update` except that it accepts `customizer` which is
  14377. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14378. * path creation is handled by the method instead. The `customizer` is invoked
  14379. * with three arguments: (nsValue, key, nsObject).
  14380. *
  14381. * **Note:** This method mutates `object`.
  14382. *
  14383. * @static
  14384. * @memberOf _
  14385. * @since 4.6.0
  14386. * @category Object
  14387. * @param {Object} object The object to modify.
  14388. * @param {Array|string} path The path of the property to set.
  14389. * @param {Function} updater The function to produce the updated value.
  14390. * @param {Function} [customizer] The function to customize assigned values.
  14391. * @returns {Object} Returns `object`.
  14392. * @example
  14393. *
  14394. * var object = {};
  14395. *
  14396. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  14397. * // => { '0': { '1': 'a' } }
  14398. */
  14399. function updateWith(object, path, updater, customizer) {
  14400. customizer = typeof customizer == 'function' ? customizer : undefined;
  14401. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  14402. }
  14403. /**
  14404. * Creates an array of the own enumerable string keyed property values of `object`.
  14405. *
  14406. * **Note:** Non-object values are coerced to objects.
  14407. *
  14408. * @static
  14409. * @since 0.1.0
  14410. * @memberOf _
  14411. * @category Object
  14412. * @param {Object} object The object to query.
  14413. * @returns {Array} Returns the array of property values.
  14414. * @example
  14415. *
  14416. * function Foo() {
  14417. * this.a = 1;
  14418. * this.b = 2;
  14419. * }
  14420. *
  14421. * Foo.prototype.c = 3;
  14422. *
  14423. * _.values(new Foo);
  14424. * // => [1, 2] (iteration order is not guaranteed)
  14425. *
  14426. * _.values('hi');
  14427. * // => ['h', 'i']
  14428. */
  14429. function values(object) {
  14430. return object == null ? [] : baseValues(object, keys(object));
  14431. }
  14432. /**
  14433. * Creates an array of the own and inherited enumerable string keyed property
  14434. * values of `object`.
  14435. *
  14436. * **Note:** Non-object values are coerced to objects.
  14437. *
  14438. * @static
  14439. * @memberOf _
  14440. * @since 3.0.0
  14441. * @category Object
  14442. * @param {Object} object The object to query.
  14443. * @returns {Array} Returns the array of property values.
  14444. * @example
  14445. *
  14446. * function Foo() {
  14447. * this.a = 1;
  14448. * this.b = 2;
  14449. * }
  14450. *
  14451. * Foo.prototype.c = 3;
  14452. *
  14453. * _.valuesIn(new Foo);
  14454. * // => [1, 2, 3] (iteration order is not guaranteed)
  14455. */
  14456. function valuesIn(object) {
  14457. return object == null ? [] : baseValues(object, keysIn(object));
  14458. }
  14459. /*------------------------------------------------------------------------*/
  14460. /**
  14461. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  14462. *
  14463. * @static
  14464. * @memberOf _
  14465. * @since 4.0.0
  14466. * @category Number
  14467. * @param {number} number The number to clamp.
  14468. * @param {number} [lower] The lower bound.
  14469. * @param {number} upper The upper bound.
  14470. * @returns {number} Returns the clamped number.
  14471. * @example
  14472. *
  14473. * _.clamp(-10, -5, 5);
  14474. * // => -5
  14475. *
  14476. * _.clamp(10, -5, 5);
  14477. * // => 5
  14478. */
  14479. function clamp(number, lower, upper) {
  14480. if (upper === undefined) {
  14481. upper = lower;
  14482. lower = undefined;
  14483. }
  14484. if (upper !== undefined) {
  14485. upper = toNumber(upper);
  14486. upper = upper === upper ? upper : 0;
  14487. }
  14488. if (lower !== undefined) {
  14489. lower = toNumber(lower);
  14490. lower = lower === lower ? lower : 0;
  14491. }
  14492. return baseClamp(toNumber(number), lower, upper);
  14493. }
  14494. /**
  14495. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14496. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14497. * If `start` is greater than `end` the params are swapped to support
  14498. * negative ranges.
  14499. *
  14500. * @static
  14501. * @memberOf _
  14502. * @since 3.3.0
  14503. * @category Number
  14504. * @param {number} number The number to check.
  14505. * @param {number} [start=0] The start of the range.
  14506. * @param {number} end The end of the range.
  14507. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14508. * @see _.range, _.rangeRight
  14509. * @example
  14510. *
  14511. * _.inRange(3, 2, 4);
  14512. * // => true
  14513. *
  14514. * _.inRange(4, 8);
  14515. * // => true
  14516. *
  14517. * _.inRange(4, 2);
  14518. * // => false
  14519. *
  14520. * _.inRange(2, 2);
  14521. * // => false
  14522. *
  14523. * _.inRange(1.2, 2);
  14524. * // => true
  14525. *
  14526. * _.inRange(5.2, 4);
  14527. * // => false
  14528. *
  14529. * _.inRange(-3, -2, -6);
  14530. * // => true
  14531. */
  14532. function inRange(number, start, end) {
  14533. start = toFinite(start);
  14534. if (end === undefined) {
  14535. end = start;
  14536. start = 0;
  14537. } else {
  14538. end = toFinite(end);
  14539. }
  14540. number = toNumber(number);
  14541. return baseInRange(number, start, end);
  14542. }
  14543. /**
  14544. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14545. * If only one argument is provided a number between `0` and the given number
  14546. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14547. * floats, a floating-point number is returned instead of an integer.
  14548. *
  14549. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14550. * floating-point values which can produce unexpected results.
  14551. *
  14552. * @static
  14553. * @memberOf _
  14554. * @since 0.7.0
  14555. * @category Number
  14556. * @param {number} [lower=0] The lower bound.
  14557. * @param {number} [upper=1] The upper bound.
  14558. * @param {boolean} [floating] Specify returning a floating-point number.
  14559. * @returns {number} Returns the random number.
  14560. * @example
  14561. *
  14562. * _.random(0, 5);
  14563. * // => an integer between 0 and 5
  14564. *
  14565. * _.random(5);
  14566. * // => also an integer between 0 and 5
  14567. *
  14568. * _.random(5, true);
  14569. * // => a floating-point number between 0 and 5
  14570. *
  14571. * _.random(1.2, 5.2);
  14572. * // => a floating-point number between 1.2 and 5.2
  14573. */
  14574. function random(lower, upper, floating) {
  14575. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14576. upper = floating = undefined;
  14577. }
  14578. if (floating === undefined) {
  14579. if (typeof upper == 'boolean') {
  14580. floating = upper;
  14581. upper = undefined;
  14582. }
  14583. else if (typeof lower == 'boolean') {
  14584. floating = lower;
  14585. lower = undefined;
  14586. }
  14587. }
  14588. if (lower === undefined && upper === undefined) {
  14589. lower = 0;
  14590. upper = 1;
  14591. }
  14592. else {
  14593. lower = toFinite(lower);
  14594. if (upper === undefined) {
  14595. upper = lower;
  14596. lower = 0;
  14597. } else {
  14598. upper = toFinite(upper);
  14599. }
  14600. }
  14601. if (lower > upper) {
  14602. var temp = lower;
  14603. lower = upper;
  14604. upper = temp;
  14605. }
  14606. if (floating || lower % 1 || upper % 1) {
  14607. var rand = nativeRandom();
  14608. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14609. }
  14610. return baseRandom(lower, upper);
  14611. }
  14612. /*------------------------------------------------------------------------*/
  14613. /**
  14614. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14615. *
  14616. * @static
  14617. * @memberOf _
  14618. * @since 3.0.0
  14619. * @category String
  14620. * @param {string} [string=''] The string to convert.
  14621. * @returns {string} Returns the camel cased string.
  14622. * @example
  14623. *
  14624. * _.camelCase('Foo Bar');
  14625. * // => 'fooBar'
  14626. *
  14627. * _.camelCase('--foo-bar--');
  14628. * // => 'fooBar'
  14629. *
  14630. * _.camelCase('__FOO_BAR__');
  14631. * // => 'fooBar'
  14632. */
  14633. var camelCase = createCompounder(function(result, word, index) {
  14634. word = word.toLowerCase();
  14635. return result + (index ? capitalize(word) : word);
  14636. });
  14637. /**
  14638. * Converts the first character of `string` to upper case and the remaining
  14639. * to lower case.
  14640. *
  14641. * @static
  14642. * @memberOf _
  14643. * @since 3.0.0
  14644. * @category String
  14645. * @param {string} [string=''] The string to capitalize.
  14646. * @returns {string} Returns the capitalized string.
  14647. * @example
  14648. *
  14649. * _.capitalize('FRED');
  14650. * // => 'Fred'
  14651. */
  14652. function capitalize(string) {
  14653. return upperFirst(toString(string).toLowerCase());
  14654. }
  14655. /**
  14656. * Deburrs `string` by converting
  14657. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  14658. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  14659. * letters to basic Latin letters and removing
  14660. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  14661. *
  14662. * @static
  14663. * @memberOf _
  14664. * @since 3.0.0
  14665. * @category String
  14666. * @param {string} [string=''] The string to deburr.
  14667. * @returns {string} Returns the deburred string.
  14668. * @example
  14669. *
  14670. * _.deburr('déjà vu');
  14671. * // => 'deja vu'
  14672. */
  14673. function deburr(string) {
  14674. string = toString(string);
  14675. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14676. }
  14677. /**
  14678. * Checks if `string` ends with the given target string.
  14679. *
  14680. * @static
  14681. * @memberOf _
  14682. * @since 3.0.0
  14683. * @category String
  14684. * @param {string} [string=''] The string to inspect.
  14685. * @param {string} [target] The string to search for.
  14686. * @param {number} [position=string.length] The position to search up to.
  14687. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14688. * else `false`.
  14689. * @example
  14690. *
  14691. * _.endsWith('abc', 'c');
  14692. * // => true
  14693. *
  14694. * _.endsWith('abc', 'b');
  14695. * // => false
  14696. *
  14697. * _.endsWith('abc', 'b', 2);
  14698. * // => true
  14699. */
  14700. function endsWith(string, target, position) {
  14701. string = toString(string);
  14702. target = baseToString(target);
  14703. var length = string.length;
  14704. position = position === undefined
  14705. ? length
  14706. : baseClamp(toInteger(position), 0, length);
  14707. var end = position;
  14708. position -= target.length;
  14709. return position >= 0 && string.slice(position, end) == target;
  14710. }
  14711. /**
  14712. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14713. * corresponding HTML entities.
  14714. *
  14715. * **Note:** No other characters are escaped. To escape additional
  14716. * characters use a third-party library like [_he_](https://mths.be/he).
  14717. *
  14718. * Though the ">" character is escaped for symmetry, characters like
  14719. * ">" and "/" don't need escaping in HTML and have no special meaning
  14720. * unless they're part of a tag or unquoted attribute value. See
  14721. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14722. * (under "semi-related fun fact") for more details.
  14723. *
  14724. * When working with HTML you should always
  14725. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14726. * XSS vectors.
  14727. *
  14728. * @static
  14729. * @since 0.1.0
  14730. * @memberOf _
  14731. * @category String
  14732. * @param {string} [string=''] The string to escape.
  14733. * @returns {string} Returns the escaped string.
  14734. * @example
  14735. *
  14736. * _.escape('fred, barney, & pebbles');
  14737. * // => 'fred, barney, &amp; pebbles'
  14738. */
  14739. function escape(string) {
  14740. string = toString(string);
  14741. return (string && reHasUnescapedHtml.test(string))
  14742. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14743. : string;
  14744. }
  14745. /**
  14746. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14747. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14748. *
  14749. * @static
  14750. * @memberOf _
  14751. * @since 3.0.0
  14752. * @category String
  14753. * @param {string} [string=''] The string to escape.
  14754. * @returns {string} Returns the escaped string.
  14755. * @example
  14756. *
  14757. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14758. * // => '\[lodash\]\(https://lodash\.com/\)'
  14759. */
  14760. function escapeRegExp(string) {
  14761. string = toString(string);
  14762. return (string && reHasRegExpChar.test(string))
  14763. ? string.replace(reRegExpChar, '\\$&')
  14764. : string;
  14765. }
  14766. /**
  14767. * Converts `string` to
  14768. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14769. *
  14770. * @static
  14771. * @memberOf _
  14772. * @since 3.0.0
  14773. * @category String
  14774. * @param {string} [string=''] The string to convert.
  14775. * @returns {string} Returns the kebab cased string.
  14776. * @example
  14777. *
  14778. * _.kebabCase('Foo Bar');
  14779. * // => 'foo-bar'
  14780. *
  14781. * _.kebabCase('fooBar');
  14782. * // => 'foo-bar'
  14783. *
  14784. * _.kebabCase('__FOO_BAR__');
  14785. * // => 'foo-bar'
  14786. */
  14787. var kebabCase = createCompounder(function(result, word, index) {
  14788. return result + (index ? '-' : '') + word.toLowerCase();
  14789. });
  14790. /**
  14791. * Converts `string`, as space separated words, to lower case.
  14792. *
  14793. * @static
  14794. * @memberOf _
  14795. * @since 4.0.0
  14796. * @category String
  14797. * @param {string} [string=''] The string to convert.
  14798. * @returns {string} Returns the lower cased string.
  14799. * @example
  14800. *
  14801. * _.lowerCase('--Foo-Bar--');
  14802. * // => 'foo bar'
  14803. *
  14804. * _.lowerCase('fooBar');
  14805. * // => 'foo bar'
  14806. *
  14807. * _.lowerCase('__FOO_BAR__');
  14808. * // => 'foo bar'
  14809. */
  14810. var lowerCase = createCompounder(function(result, word, index) {
  14811. return result + (index ? ' ' : '') + word.toLowerCase();
  14812. });
  14813. /**
  14814. * Converts the first character of `string` to lower case.
  14815. *
  14816. * @static
  14817. * @memberOf _
  14818. * @since 4.0.0
  14819. * @category String
  14820. * @param {string} [string=''] The string to convert.
  14821. * @returns {string} Returns the converted string.
  14822. * @example
  14823. *
  14824. * _.lowerFirst('Fred');
  14825. * // => 'fred'
  14826. *
  14827. * _.lowerFirst('FRED');
  14828. * // => 'fRED'
  14829. */
  14830. var lowerFirst = createCaseFirst('toLowerCase');
  14831. /**
  14832. * Pads `string` on the left and right sides if it's shorter than `length`.
  14833. * Padding characters are truncated if they can't be evenly divided by `length`.
  14834. *
  14835. * @static
  14836. * @memberOf _
  14837. * @since 3.0.0
  14838. * @category String
  14839. * @param {string} [string=''] The string to pad.
  14840. * @param {number} [length=0] The padding length.
  14841. * @param {string} [chars=' '] The string used as padding.
  14842. * @returns {string} Returns the padded string.
  14843. * @example
  14844. *
  14845. * _.pad('abc', 8);
  14846. * // => ' abc '
  14847. *
  14848. * _.pad('abc', 8, '_-');
  14849. * // => '_-abc_-_'
  14850. *
  14851. * _.pad('abc', 3);
  14852. * // => 'abc'
  14853. */
  14854. function pad(string, length, chars) {
  14855. string = toString(string);
  14856. length = toInteger(length);
  14857. var strLength = length ? stringSize(string) : 0;
  14858. if (!length || strLength >= length) {
  14859. return string;
  14860. }
  14861. var mid = (length - strLength) / 2;
  14862. return (
  14863. createPadding(nativeFloor(mid), chars) +
  14864. string +
  14865. createPadding(nativeCeil(mid), chars)
  14866. );
  14867. }
  14868. /**
  14869. * Pads `string` on the right side if it's shorter than `length`. Padding
  14870. * characters are truncated if they exceed `length`.
  14871. *
  14872. * @static
  14873. * @memberOf _
  14874. * @since 4.0.0
  14875. * @category String
  14876. * @param {string} [string=''] The string to pad.
  14877. * @param {number} [length=0] The padding length.
  14878. * @param {string} [chars=' '] The string used as padding.
  14879. * @returns {string} Returns the padded string.
  14880. * @example
  14881. *
  14882. * _.padEnd('abc', 6);
  14883. * // => 'abc '
  14884. *
  14885. * _.padEnd('abc', 6, '_-');
  14886. * // => 'abc_-_'
  14887. *
  14888. * _.padEnd('abc', 3);
  14889. * // => 'abc'
  14890. */
  14891. function padEnd(string, length, chars) {
  14892. string = toString(string);
  14893. length = toInteger(length);
  14894. var strLength = length ? stringSize(string) : 0;
  14895. return (length && strLength < length)
  14896. ? (string + createPadding(length - strLength, chars))
  14897. : string;
  14898. }
  14899. /**
  14900. * Pads `string` on the left side if it's shorter than `length`. Padding
  14901. * characters are truncated if they exceed `length`.
  14902. *
  14903. * @static
  14904. * @memberOf _
  14905. * @since 4.0.0
  14906. * @category String
  14907. * @param {string} [string=''] The string to pad.
  14908. * @param {number} [length=0] The padding length.
  14909. * @param {string} [chars=' '] The string used as padding.
  14910. * @returns {string} Returns the padded string.
  14911. * @example
  14912. *
  14913. * _.padStart('abc', 6);
  14914. * // => ' abc'
  14915. *
  14916. * _.padStart('abc', 6, '_-');
  14917. * // => '_-_abc'
  14918. *
  14919. * _.padStart('abc', 3);
  14920. * // => 'abc'
  14921. */
  14922. function padStart(string, length, chars) {
  14923. string = toString(string);
  14924. length = toInteger(length);
  14925. var strLength = length ? stringSize(string) : 0;
  14926. return (length && strLength < length)
  14927. ? (createPadding(length - strLength, chars) + string)
  14928. : string;
  14929. }
  14930. /**
  14931. * Converts `string` to an integer of the specified radix. If `radix` is
  14932. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14933. * hexadecimal, in which case a `radix` of `16` is used.
  14934. *
  14935. * **Note:** This method aligns with the
  14936. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14937. *
  14938. * @static
  14939. * @memberOf _
  14940. * @since 1.1.0
  14941. * @category String
  14942. * @param {string} string The string to convert.
  14943. * @param {number} [radix=10] The radix to interpret `value` by.
  14944. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14945. * @returns {number} Returns the converted integer.
  14946. * @example
  14947. *
  14948. * _.parseInt('08');
  14949. * // => 8
  14950. *
  14951. * _.map(['6', '08', '10'], _.parseInt);
  14952. * // => [6, 8, 10]
  14953. */
  14954. function parseInt(string, radix, guard) {
  14955. if (guard || radix == null) {
  14956. radix = 0;
  14957. } else if (radix) {
  14958. radix = +radix;
  14959. }
  14960. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14961. }
  14962. /**
  14963. * Repeats the given string `n` times.
  14964. *
  14965. * @static
  14966. * @memberOf _
  14967. * @since 3.0.0
  14968. * @category String
  14969. * @param {string} [string=''] The string to repeat.
  14970. * @param {number} [n=1] The number of times to repeat the string.
  14971. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14972. * @returns {string} Returns the repeated string.
  14973. * @example
  14974. *
  14975. * _.repeat('*', 3);
  14976. * // => '***'
  14977. *
  14978. * _.repeat('abc', 2);
  14979. * // => 'abcabc'
  14980. *
  14981. * _.repeat('abc', 0);
  14982. * // => ''
  14983. */
  14984. function repeat(string, n, guard) {
  14985. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14986. n = 1;
  14987. } else {
  14988. n = toInteger(n);
  14989. }
  14990. return baseRepeat(toString(string), n);
  14991. }
  14992. /**
  14993. * Replaces matches for `pattern` in `string` with `replacement`.
  14994. *
  14995. * **Note:** This method is based on
  14996. * [`String#replace`](https://mdn.io/String/replace).
  14997. *
  14998. * @static
  14999. * @memberOf _
  15000. * @since 4.0.0
  15001. * @category String
  15002. * @param {string} [string=''] The string to modify.
  15003. * @param {RegExp|string} pattern The pattern to replace.
  15004. * @param {Function|string} replacement The match replacement.
  15005. * @returns {string} Returns the modified string.
  15006. * @example
  15007. *
  15008. * _.replace('Hi Fred', 'Fred', 'Barney');
  15009. * // => 'Hi Barney'
  15010. */
  15011. function replace() {
  15012. var args = arguments,
  15013. string = toString(args[0]);
  15014. return args.length < 3 ? string : string.replace(args[1], args[2]);
  15015. }
  15016. /**
  15017. * Converts `string` to
  15018. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  15019. *
  15020. * @static
  15021. * @memberOf _
  15022. * @since 3.0.0
  15023. * @category String
  15024. * @param {string} [string=''] The string to convert.
  15025. * @returns {string} Returns the snake cased string.
  15026. * @example
  15027. *
  15028. * _.snakeCase('Foo Bar');
  15029. * // => 'foo_bar'
  15030. *
  15031. * _.snakeCase('fooBar');
  15032. * // => 'foo_bar'
  15033. *
  15034. * _.snakeCase('--FOO-BAR--');
  15035. * // => 'foo_bar'
  15036. */
  15037. var snakeCase = createCompounder(function(result, word, index) {
  15038. return result + (index ? '_' : '') + word.toLowerCase();
  15039. });
  15040. /**
  15041. * Splits `string` by `separator`.
  15042. *
  15043. * **Note:** This method is based on
  15044. * [`String#split`](https://mdn.io/String/split).
  15045. *
  15046. * @static
  15047. * @memberOf _
  15048. * @since 4.0.0
  15049. * @category String
  15050. * @param {string} [string=''] The string to split.
  15051. * @param {RegExp|string} separator The separator pattern to split by.
  15052. * @param {number} [limit] The length to truncate results to.
  15053. * @returns {Array} Returns the string segments.
  15054. * @example
  15055. *
  15056. * _.split('a-b-c', '-', 2);
  15057. * // => ['a', 'b']
  15058. */
  15059. function split(string, separator, limit) {
  15060. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  15061. separator = limit = undefined;
  15062. }
  15063. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  15064. if (!limit) {
  15065. return [];
  15066. }
  15067. string = toString(string);
  15068. if (string && (
  15069. typeof separator == 'string' ||
  15070. (separator != null && !isRegExp(separator))
  15071. )) {
  15072. separator = baseToString(separator);
  15073. if (!separator && hasUnicode(string)) {
  15074. return castSlice(stringToArray(string), 0, limit);
  15075. }
  15076. }
  15077. return string.split(separator, limit);
  15078. }
  15079. /**
  15080. * Converts `string` to
  15081. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  15082. *
  15083. * @static
  15084. * @memberOf _
  15085. * @since 3.1.0
  15086. * @category String
  15087. * @param {string} [string=''] The string to convert.
  15088. * @returns {string} Returns the start cased string.
  15089. * @example
  15090. *
  15091. * _.startCase('--foo-bar--');
  15092. * // => 'Foo Bar'
  15093. *
  15094. * _.startCase('fooBar');
  15095. * // => 'Foo Bar'
  15096. *
  15097. * _.startCase('__FOO_BAR__');
  15098. * // => 'FOO BAR'
  15099. */
  15100. var startCase = createCompounder(function(result, word, index) {
  15101. return result + (index ? ' ' : '') + upperFirst(word);
  15102. });
  15103. /**
  15104. * Checks if `string` starts with the given target string.
  15105. *
  15106. * @static
  15107. * @memberOf _
  15108. * @since 3.0.0
  15109. * @category String
  15110. * @param {string} [string=''] The string to inspect.
  15111. * @param {string} [target] The string to search for.
  15112. * @param {number} [position=0] The position to search from.
  15113. * @returns {boolean} Returns `true` if `string` starts with `target`,
  15114. * else `false`.
  15115. * @example
  15116. *
  15117. * _.startsWith('abc', 'a');
  15118. * // => true
  15119. *
  15120. * _.startsWith('abc', 'b');
  15121. * // => false
  15122. *
  15123. * _.startsWith('abc', 'b', 1);
  15124. * // => true
  15125. */
  15126. function startsWith(string, target, position) {
  15127. string = toString(string);
  15128. position = position == null
  15129. ? 0
  15130. : baseClamp(toInteger(position), 0, string.length);
  15131. target = baseToString(target);
  15132. return string.slice(position, position + target.length) == target;
  15133. }
  15134. /**
  15135. * Creates a compiled template function that can interpolate data properties
  15136. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  15137. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  15138. * properties may be accessed as free variables in the template. If a setting
  15139. * object is given, it takes precedence over `_.templateSettings` values.
  15140. *
  15141. * **Note:** In the development build `_.template` utilizes
  15142. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  15143. * for easier debugging.
  15144. *
  15145. * For more information on precompiling templates see
  15146. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  15147. *
  15148. * For more information on Chrome extension sandboxes see
  15149. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  15150. *
  15151. * @static
  15152. * @since 0.1.0
  15153. * @memberOf _
  15154. * @category String
  15155. * @param {string} [string=''] The template string.
  15156. * @param {Object} [options={}] The options object.
  15157. * @param {RegExp} [options.escape=_.templateSettings.escape]
  15158. * The HTML "escape" delimiter.
  15159. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  15160. * The "evaluate" delimiter.
  15161. * @param {Object} [options.imports=_.templateSettings.imports]
  15162. * An object to import into the template as free variables.
  15163. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  15164. * The "interpolate" delimiter.
  15165. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  15166. * The sourceURL of the compiled template.
  15167. * @param {string} [options.variable='obj']
  15168. * The data object variable name.
  15169. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15170. * @returns {Function} Returns the compiled template function.
  15171. * @example
  15172. *
  15173. * // Use the "interpolate" delimiter to create a compiled template.
  15174. * var compiled = _.template('hello <%= user %>!');
  15175. * compiled({ 'user': 'fred' });
  15176. * // => 'hello fred!'
  15177. *
  15178. * // Use the HTML "escape" delimiter to escape data property values.
  15179. * var compiled = _.template('<b><%- value %></b>');
  15180. * compiled({ 'value': '<script>' });
  15181. * // => '<b>&lt;script&gt;</b>'
  15182. *
  15183. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  15184. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  15185. * compiled({ 'users': ['fred', 'barney'] });
  15186. * // => '<li>fred</li><li>barney</li>'
  15187. *
  15188. * // Use the internal `print` function in "evaluate" delimiters.
  15189. * var compiled = _.template('<% print("hello " + user); %>!');
  15190. * compiled({ 'user': 'barney' });
  15191. * // => 'hello barney!'
  15192. *
  15193. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  15194. * // Disable support by replacing the "interpolate" delimiter.
  15195. * var compiled = _.template('hello ${ user }!');
  15196. * compiled({ 'user': 'pebbles' });
  15197. * // => 'hello pebbles!'
  15198. *
  15199. * // Use backslashes to treat delimiters as plain text.
  15200. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  15201. * compiled({ 'value': 'ignored' });
  15202. * // => '<%- value %>'
  15203. *
  15204. * // Use the `imports` option to import `jQuery` as `jq`.
  15205. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  15206. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  15207. * compiled({ 'users': ['fred', 'barney'] });
  15208. * // => '<li>fred</li><li>barney</li>'
  15209. *
  15210. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  15211. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  15212. * compiled(data);
  15213. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  15214. *
  15215. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  15216. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  15217. * compiled.source;
  15218. * // => function(data) {
  15219. * // var __t, __p = '';
  15220. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  15221. * // return __p;
  15222. * // }
  15223. *
  15224. * // Use custom template delimiters.
  15225. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  15226. * var compiled = _.template('hello {{ user }}!');
  15227. * compiled({ 'user': 'mustache' });
  15228. * // => 'hello mustache!'
  15229. *
  15230. * // Use the `source` property to inline compiled templates for meaningful
  15231. * // line numbers in error messages and stack traces.
  15232. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  15233. * var JST = {\
  15234. * "main": ' + _.template(mainText).source + '\
  15235. * };\
  15236. * ');
  15237. */
  15238. function template(string, options, guard) {
  15239. // Based on John Resig's `tmpl` implementation
  15240. // (http://ejohn.org/blog/javascript-micro-templating/)
  15241. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  15242. var settings = lodash.templateSettings;
  15243. if (guard && isIterateeCall(string, options, guard)) {
  15244. options = undefined;
  15245. }
  15246. string = toString(string);
  15247. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  15248. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  15249. importsKeys = keys(imports),
  15250. importsValues = baseValues(imports, importsKeys);
  15251. var isEscaping,
  15252. isEvaluating,
  15253. index = 0,
  15254. interpolate = options.interpolate || reNoMatch,
  15255. source = "__p += '";
  15256. // Compile the regexp to match each delimiter.
  15257. var reDelimiters = RegExp(
  15258. (options.escape || reNoMatch).source + '|' +
  15259. interpolate.source + '|' +
  15260. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  15261. (options.evaluate || reNoMatch).source + '|$'
  15262. , 'g');
  15263. // Use a sourceURL for easier debugging.
  15264. // The sourceURL gets injected into the source that's eval-ed, so be careful
  15265. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  15266. // and escape the comment, thus injecting code that gets evaled.
  15267. var sourceURL = '//# sourceURL=' +
  15268. (hasOwnProperty.call(options, 'sourceURL')
  15269. ? (options.sourceURL + '').replace(/\s/g, ' ')
  15270. : ('lodash.templateSources[' + (++templateCounter) + ']')
  15271. ) + '\n';
  15272. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  15273. interpolateValue || (interpolateValue = esTemplateValue);
  15274. // Escape characters that can't be included in string literals.
  15275. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  15276. // Replace delimiters with snippets.
  15277. if (escapeValue) {
  15278. isEscaping = true;
  15279. source += "' +\n__e(" + escapeValue + ") +\n'";
  15280. }
  15281. if (evaluateValue) {
  15282. isEvaluating = true;
  15283. source += "';\n" + evaluateValue + ";\n__p += '";
  15284. }
  15285. if (interpolateValue) {
  15286. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  15287. }
  15288. index = offset + match.length;
  15289. // The JS engine embedded in Adobe products needs `match` returned in
  15290. // order to produce the correct `offset` value.
  15291. return match;
  15292. });
  15293. source += "';\n";
  15294. // If `variable` is not specified wrap a with-statement around the generated
  15295. // code to add the data object to the top of the scope chain.
  15296. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  15297. if (!variable) {
  15298. source = 'with (obj) {\n' + source + '\n}\n';
  15299. }
  15300. // Throw an error if a forbidden character was found in `variable`, to prevent
  15301. // potential command injection attacks.
  15302. else if (reForbiddenIdentifierChars.test(variable)) {
  15303. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  15304. }
  15305. // Cleanup code by stripping empty strings.
  15306. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  15307. .replace(reEmptyStringMiddle, '$1')
  15308. .replace(reEmptyStringTrailing, '$1;');
  15309. // Frame code as the function body.
  15310. source = 'function(' + (variable || 'obj') + ') {\n' +
  15311. (variable
  15312. ? ''
  15313. : 'obj || (obj = {});\n'
  15314. ) +
  15315. "var __t, __p = ''" +
  15316. (isEscaping
  15317. ? ', __e = _.escape'
  15318. : ''
  15319. ) +
  15320. (isEvaluating
  15321. ? ', __j = Array.prototype.join;\n' +
  15322. "function print() { __p += __j.call(arguments, '') }\n"
  15323. : ';\n'
  15324. ) +
  15325. source +
  15326. 'return __p\n}';
  15327. var result = attempt(function() {
  15328. return Function(importsKeys, sourceURL + 'return ' + source)
  15329. .apply(undefined, importsValues);
  15330. });
  15331. // Provide the compiled function's source by its `toString` method or
  15332. // the `source` property as a convenience for inlining compiled templates.
  15333. result.source = source;
  15334. if (isError(result)) {
  15335. throw result;
  15336. }
  15337. return result;
  15338. }
  15339. /**
  15340. * Converts `string`, as a whole, to lower case just like
  15341. * [String#toLowerCase](https://mdn.io/toLowerCase).
  15342. *
  15343. * @static
  15344. * @memberOf _
  15345. * @since 4.0.0
  15346. * @category String
  15347. * @param {string} [string=''] The string to convert.
  15348. * @returns {string} Returns the lower cased string.
  15349. * @example
  15350. *
  15351. * _.toLower('--Foo-Bar--');
  15352. * // => '--foo-bar--'
  15353. *
  15354. * _.toLower('fooBar');
  15355. * // => 'foobar'
  15356. *
  15357. * _.toLower('__FOO_BAR__');
  15358. * // => '__foo_bar__'
  15359. */
  15360. function toLower(value) {
  15361. return toString(value).toLowerCase();
  15362. }
  15363. /**
  15364. * Converts `string`, as a whole, to upper case just like
  15365. * [String#toUpperCase](https://mdn.io/toUpperCase).
  15366. *
  15367. * @static
  15368. * @memberOf _
  15369. * @since 4.0.0
  15370. * @category String
  15371. * @param {string} [string=''] The string to convert.
  15372. * @returns {string} Returns the upper cased string.
  15373. * @example
  15374. *
  15375. * _.toUpper('--foo-bar--');
  15376. * // => '--FOO-BAR--'
  15377. *
  15378. * _.toUpper('fooBar');
  15379. * // => 'FOOBAR'
  15380. *
  15381. * _.toUpper('__foo_bar__');
  15382. * // => '__FOO_BAR__'
  15383. */
  15384. function toUpper(value) {
  15385. return toString(value).toUpperCase();
  15386. }
  15387. /**
  15388. * Removes leading and trailing whitespace or specified characters from `string`.
  15389. *
  15390. * @static
  15391. * @memberOf _
  15392. * @since 3.0.0
  15393. * @category String
  15394. * @param {string} [string=''] The string to trim.
  15395. * @param {string} [chars=whitespace] The characters to trim.
  15396. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15397. * @returns {string} Returns the trimmed string.
  15398. * @example
  15399. *
  15400. * _.trim(' abc ');
  15401. * // => 'abc'
  15402. *
  15403. * _.trim('-_-abc-_-', '_-');
  15404. * // => 'abc'
  15405. *
  15406. * _.map([' foo ', ' bar '], _.trim);
  15407. * // => ['foo', 'bar']
  15408. */
  15409. function trim(string, chars, guard) {
  15410. string = toString(string);
  15411. if (string && (guard || chars === undefined)) {
  15412. return baseTrim(string);
  15413. }
  15414. if (!string || !(chars = baseToString(chars))) {
  15415. return string;
  15416. }
  15417. var strSymbols = stringToArray(string),
  15418. chrSymbols = stringToArray(chars),
  15419. start = charsStartIndex(strSymbols, chrSymbols),
  15420. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  15421. return castSlice(strSymbols, start, end).join('');
  15422. }
  15423. /**
  15424. * Removes trailing whitespace or specified characters from `string`.
  15425. *
  15426. * @static
  15427. * @memberOf _
  15428. * @since 4.0.0
  15429. * @category String
  15430. * @param {string} [string=''] The string to trim.
  15431. * @param {string} [chars=whitespace] The characters to trim.
  15432. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15433. * @returns {string} Returns the trimmed string.
  15434. * @example
  15435. *
  15436. * _.trimEnd(' abc ');
  15437. * // => ' abc'
  15438. *
  15439. * _.trimEnd('-_-abc-_-', '_-');
  15440. * // => '-_-abc'
  15441. */
  15442. function trimEnd(string, chars, guard) {
  15443. string = toString(string);
  15444. if (string && (guard || chars === undefined)) {
  15445. return string.slice(0, trimmedEndIndex(string) + 1);
  15446. }
  15447. if (!string || !(chars = baseToString(chars))) {
  15448. return string;
  15449. }
  15450. var strSymbols = stringToArray(string),
  15451. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  15452. return castSlice(strSymbols, 0, end).join('');
  15453. }
  15454. /**
  15455. * Removes leading whitespace or specified characters from `string`.
  15456. *
  15457. * @static
  15458. * @memberOf _
  15459. * @since 4.0.0
  15460. * @category String
  15461. * @param {string} [string=''] The string to trim.
  15462. * @param {string} [chars=whitespace] The characters to trim.
  15463. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15464. * @returns {string} Returns the trimmed string.
  15465. * @example
  15466. *
  15467. * _.trimStart(' abc ');
  15468. * // => 'abc '
  15469. *
  15470. * _.trimStart('-_-abc-_-', '_-');
  15471. * // => 'abc-_-'
  15472. */
  15473. function trimStart(string, chars, guard) {
  15474. string = toString(string);
  15475. if (string && (guard || chars === undefined)) {
  15476. return string.replace(reTrimStart, '');
  15477. }
  15478. if (!string || !(chars = baseToString(chars))) {
  15479. return string;
  15480. }
  15481. var strSymbols = stringToArray(string),
  15482. start = charsStartIndex(strSymbols, stringToArray(chars));
  15483. return castSlice(strSymbols, start).join('');
  15484. }
  15485. /**
  15486. * Truncates `string` if it's longer than the given maximum string length.
  15487. * The last characters of the truncated string are replaced with the omission
  15488. * string which defaults to "...".
  15489. *
  15490. * @static
  15491. * @memberOf _
  15492. * @since 4.0.0
  15493. * @category String
  15494. * @param {string} [string=''] The string to truncate.
  15495. * @param {Object} [options={}] The options object.
  15496. * @param {number} [options.length=30] The maximum string length.
  15497. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  15498. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15499. * @returns {string} Returns the truncated string.
  15500. * @example
  15501. *
  15502. * _.truncate('hi-diddly-ho there, neighborino');
  15503. * // => 'hi-diddly-ho there, neighbo...'
  15504. *
  15505. * _.truncate('hi-diddly-ho there, neighborino', {
  15506. * 'length': 24,
  15507. * 'separator': ' '
  15508. * });
  15509. * // => 'hi-diddly-ho there,...'
  15510. *
  15511. * _.truncate('hi-diddly-ho there, neighborino', {
  15512. * 'length': 24,
  15513. * 'separator': /,? +/
  15514. * });
  15515. * // => 'hi-diddly-ho there...'
  15516. *
  15517. * _.truncate('hi-diddly-ho there, neighborino', {
  15518. * 'omission': ' [...]'
  15519. * });
  15520. * // => 'hi-diddly-ho there, neig [...]'
  15521. */
  15522. function truncate(string, options) {
  15523. var length = DEFAULT_TRUNC_LENGTH,
  15524. omission = DEFAULT_TRUNC_OMISSION;
  15525. if (isObject(options)) {
  15526. var separator = 'separator' in options ? options.separator : separator;
  15527. length = 'length' in options ? toInteger(options.length) : length;
  15528. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15529. }
  15530. string = toString(string);
  15531. var strLength = string.length;
  15532. if (hasUnicode(string)) {
  15533. var strSymbols = stringToArray(string);
  15534. strLength = strSymbols.length;
  15535. }
  15536. if (length >= strLength) {
  15537. return string;
  15538. }
  15539. var end = length - stringSize(omission);
  15540. if (end < 1) {
  15541. return omission;
  15542. }
  15543. var result = strSymbols
  15544. ? castSlice(strSymbols, 0, end).join('')
  15545. : string.slice(0, end);
  15546. if (separator === undefined) {
  15547. return result + omission;
  15548. }
  15549. if (strSymbols) {
  15550. end += (result.length - end);
  15551. }
  15552. if (isRegExp(separator)) {
  15553. if (string.slice(end).search(separator)) {
  15554. var match,
  15555. substring = result;
  15556. if (!separator.global) {
  15557. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15558. }
  15559. separator.lastIndex = 0;
  15560. while ((match = separator.exec(substring))) {
  15561. var newEnd = match.index;
  15562. }
  15563. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15564. }
  15565. } else if (string.indexOf(baseToString(separator), end) != end) {
  15566. var index = result.lastIndexOf(separator);
  15567. if (index > -1) {
  15568. result = result.slice(0, index);
  15569. }
  15570. }
  15571. return result + omission;
  15572. }
  15573. /**
  15574. * The inverse of `_.escape`; this method converts the HTML entities
  15575. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15576. * their corresponding characters.
  15577. *
  15578. * **Note:** No other HTML entities are unescaped. To unescape additional
  15579. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15580. *
  15581. * @static
  15582. * @memberOf _
  15583. * @since 0.6.0
  15584. * @category String
  15585. * @param {string} [string=''] The string to unescape.
  15586. * @returns {string} Returns the unescaped string.
  15587. * @example
  15588. *
  15589. * _.unescape('fred, barney, &amp; pebbles');
  15590. * // => 'fred, barney, & pebbles'
  15591. */
  15592. function unescape(string) {
  15593. string = toString(string);
  15594. return (string && reHasEscapedHtml.test(string))
  15595. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15596. : string;
  15597. }
  15598. /**
  15599. * Converts `string`, as space separated words, to upper case.
  15600. *
  15601. * @static
  15602. * @memberOf _
  15603. * @since 4.0.0
  15604. * @category String
  15605. * @param {string} [string=''] The string to convert.
  15606. * @returns {string} Returns the upper cased string.
  15607. * @example
  15608. *
  15609. * _.upperCase('--foo-bar');
  15610. * // => 'FOO BAR'
  15611. *
  15612. * _.upperCase('fooBar');
  15613. * // => 'FOO BAR'
  15614. *
  15615. * _.upperCase('__foo_bar__');
  15616. * // => 'FOO BAR'
  15617. */
  15618. var upperCase = createCompounder(function(result, word, index) {
  15619. return result + (index ? ' ' : '') + word.toUpperCase();
  15620. });
  15621. /**
  15622. * Converts the first character of `string` to upper case.
  15623. *
  15624. * @static
  15625. * @memberOf _
  15626. * @since 4.0.0
  15627. * @category String
  15628. * @param {string} [string=''] The string to convert.
  15629. * @returns {string} Returns the converted string.
  15630. * @example
  15631. *
  15632. * _.upperFirst('fred');
  15633. * // => 'Fred'
  15634. *
  15635. * _.upperFirst('FRED');
  15636. * // => 'FRED'
  15637. */
  15638. var upperFirst = createCaseFirst('toUpperCase');
  15639. /**
  15640. * Splits `string` into an array of its words.
  15641. *
  15642. * @static
  15643. * @memberOf _
  15644. * @since 3.0.0
  15645. * @category String
  15646. * @param {string} [string=''] The string to inspect.
  15647. * @param {RegExp|string} [pattern] The pattern to match words.
  15648. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15649. * @returns {Array} Returns the words of `string`.
  15650. * @example
  15651. *
  15652. * _.words('fred, barney, & pebbles');
  15653. * // => ['fred', 'barney', 'pebbles']
  15654. *
  15655. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  15656. * // => ['fred', 'barney', '&', 'pebbles']
  15657. */
  15658. function words(string, pattern, guard) {
  15659. string = toString(string);
  15660. pattern = guard ? undefined : pattern;
  15661. if (pattern === undefined) {
  15662. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  15663. }
  15664. return string.match(pattern) || [];
  15665. }
  15666. /*------------------------------------------------------------------------*/
  15667. /**
  15668. * Attempts to invoke `func`, returning either the result or the caught error
  15669. * object. Any additional arguments are provided to `func` when it's invoked.
  15670. *
  15671. * @static
  15672. * @memberOf _
  15673. * @since 3.0.0
  15674. * @category Util
  15675. * @param {Function} func The function to attempt.
  15676. * @param {...*} [args] The arguments to invoke `func` with.
  15677. * @returns {*} Returns the `func` result or error object.
  15678. * @example
  15679. *
  15680. * // Avoid throwing errors for invalid selectors.
  15681. * var elements = _.attempt(function(selector) {
  15682. * return document.querySelectorAll(selector);
  15683. * }, '>_>');
  15684. *
  15685. * if (_.isError(elements)) {
  15686. * elements = [];
  15687. * }
  15688. */
  15689. var attempt = baseRest(function(func, args) {
  15690. try {
  15691. return apply(func, undefined, args);
  15692. } catch (e) {
  15693. return isError(e) ? e : new Error(e);
  15694. }
  15695. });
  15696. /**
  15697. * Binds methods of an object to the object itself, overwriting the existing
  15698. * method.
  15699. *
  15700. * **Note:** This method doesn't set the "length" property of bound functions.
  15701. *
  15702. * @static
  15703. * @since 0.1.0
  15704. * @memberOf _
  15705. * @category Util
  15706. * @param {Object} object The object to bind and assign the bound methods to.
  15707. * @param {...(string|string[])} methodNames The object method names to bind.
  15708. * @returns {Object} Returns `object`.
  15709. * @example
  15710. *
  15711. * var view = {
  15712. * 'label': 'docs',
  15713. * 'click': function() {
  15714. * console.log('clicked ' + this.label);
  15715. * }
  15716. * };
  15717. *
  15718. * _.bindAll(view, ['click']);
  15719. * jQuery(element).on('click', view.click);
  15720. * // => Logs 'clicked docs' when clicked.
  15721. */
  15722. var bindAll = flatRest(function(object, methodNames) {
  15723. arrayEach(methodNames, function(key) {
  15724. key = toKey(key);
  15725. baseAssignValue(object, key, bind(object[key], object));
  15726. });
  15727. return object;
  15728. });
  15729. /**
  15730. * Creates a function that iterates over `pairs` and invokes the corresponding
  15731. * function of the first predicate to return truthy. The predicate-function
  15732. * pairs are invoked with the `this` binding and arguments of the created
  15733. * function.
  15734. *
  15735. * @static
  15736. * @memberOf _
  15737. * @since 4.0.0
  15738. * @category Util
  15739. * @param {Array} pairs The predicate-function pairs.
  15740. * @returns {Function} Returns the new composite function.
  15741. * @example
  15742. *
  15743. * var func = _.cond([
  15744. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15745. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15746. * [_.stubTrue, _.constant('no match')]
  15747. * ]);
  15748. *
  15749. * func({ 'a': 1, 'b': 2 });
  15750. * // => 'matches A'
  15751. *
  15752. * func({ 'a': 0, 'b': 1 });
  15753. * // => 'matches B'
  15754. *
  15755. * func({ 'a': '1', 'b': '2' });
  15756. * // => 'no match'
  15757. */
  15758. function cond(pairs) {
  15759. var length = pairs == null ? 0 : pairs.length,
  15760. toIteratee = getIteratee();
  15761. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15762. if (typeof pair[1] != 'function') {
  15763. throw new TypeError(FUNC_ERROR_TEXT);
  15764. }
  15765. return [toIteratee(pair[0]), pair[1]];
  15766. });
  15767. return baseRest(function(args) {
  15768. var index = -1;
  15769. while (++index < length) {
  15770. var pair = pairs[index];
  15771. if (apply(pair[0], this, args)) {
  15772. return apply(pair[1], this, args);
  15773. }
  15774. }
  15775. });
  15776. }
  15777. /**
  15778. * Creates a function that invokes the predicate properties of `source` with
  15779. * the corresponding property values of a given object, returning `true` if
  15780. * all predicates return truthy, else `false`.
  15781. *
  15782. * **Note:** The created function is equivalent to `_.conformsTo` with
  15783. * `source` partially applied.
  15784. *
  15785. * @static
  15786. * @memberOf _
  15787. * @since 4.0.0
  15788. * @category Util
  15789. * @param {Object} source The object of property predicates to conform to.
  15790. * @returns {Function} Returns the new spec function.
  15791. * @example
  15792. *
  15793. * var objects = [
  15794. * { 'a': 2, 'b': 1 },
  15795. * { 'a': 1, 'b': 2 }
  15796. * ];
  15797. *
  15798. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15799. * // => [{ 'a': 1, 'b': 2 }]
  15800. */
  15801. function conforms(source) {
  15802. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15803. }
  15804. /**
  15805. * Creates a function that returns `value`.
  15806. *
  15807. * @static
  15808. * @memberOf _
  15809. * @since 2.4.0
  15810. * @category Util
  15811. * @param {*} value The value to return from the new function.
  15812. * @returns {Function} Returns the new constant function.
  15813. * @example
  15814. *
  15815. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15816. *
  15817. * console.log(objects);
  15818. * // => [{ 'a': 1 }, { 'a': 1 }]
  15819. *
  15820. * console.log(objects[0] === objects[1]);
  15821. * // => true
  15822. */
  15823. function constant(value) {
  15824. return function() {
  15825. return value;
  15826. };
  15827. }
  15828. /**
  15829. * Checks `value` to determine whether a default value should be returned in
  15830. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15831. * or `undefined`.
  15832. *
  15833. * @static
  15834. * @memberOf _
  15835. * @since 4.14.0
  15836. * @category Util
  15837. * @param {*} value The value to check.
  15838. * @param {*} defaultValue The default value.
  15839. * @returns {*} Returns the resolved value.
  15840. * @example
  15841. *
  15842. * _.defaultTo(1, 10);
  15843. * // => 1
  15844. *
  15845. * _.defaultTo(undefined, 10);
  15846. * // => 10
  15847. */
  15848. function defaultTo(value, defaultValue) {
  15849. return (value == null || value !== value) ? defaultValue : value;
  15850. }
  15851. /**
  15852. * Creates a function that returns the result of invoking the given functions
  15853. * with the `this` binding of the created function, where each successive
  15854. * invocation is supplied the return value of the previous.
  15855. *
  15856. * @static
  15857. * @memberOf _
  15858. * @since 3.0.0
  15859. * @category Util
  15860. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15861. * @returns {Function} Returns the new composite function.
  15862. * @see _.flowRight
  15863. * @example
  15864. *
  15865. * function square(n) {
  15866. * return n * n;
  15867. * }
  15868. *
  15869. * var addSquare = _.flow([_.add, square]);
  15870. * addSquare(1, 2);
  15871. * // => 9
  15872. */
  15873. var flow = createFlow();
  15874. /**
  15875. * This method is like `_.flow` except that it creates a function that
  15876. * invokes the given functions from right to left.
  15877. *
  15878. * @static
  15879. * @since 3.0.0
  15880. * @memberOf _
  15881. * @category Util
  15882. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15883. * @returns {Function} Returns the new composite function.
  15884. * @see _.flow
  15885. * @example
  15886. *
  15887. * function square(n) {
  15888. * return n * n;
  15889. * }
  15890. *
  15891. * var addSquare = _.flowRight([square, _.add]);
  15892. * addSquare(1, 2);
  15893. * // => 9
  15894. */
  15895. var flowRight = createFlow(true);
  15896. /**
  15897. * This method returns the first argument it receives.
  15898. *
  15899. * @static
  15900. * @since 0.1.0
  15901. * @memberOf _
  15902. * @category Util
  15903. * @param {*} value Any value.
  15904. * @returns {*} Returns `value`.
  15905. * @example
  15906. *
  15907. * var object = { 'a': 1 };
  15908. *
  15909. * console.log(_.identity(object) === object);
  15910. * // => true
  15911. */
  15912. function identity(value) {
  15913. return value;
  15914. }
  15915. /**
  15916. * Creates a function that invokes `func` with the arguments of the created
  15917. * function. If `func` is a property name, the created function returns the
  15918. * property value for a given element. If `func` is an array or object, the
  15919. * created function returns `true` for elements that contain the equivalent
  15920. * source properties, otherwise it returns `false`.
  15921. *
  15922. * @static
  15923. * @since 4.0.0
  15924. * @memberOf _
  15925. * @category Util
  15926. * @param {*} [func=_.identity] The value to convert to a callback.
  15927. * @returns {Function} Returns the callback.
  15928. * @example
  15929. *
  15930. * var users = [
  15931. * { 'user': 'barney', 'age': 36, 'active': true },
  15932. * { 'user': 'fred', 'age': 40, 'active': false }
  15933. * ];
  15934. *
  15935. * // The `_.matches` iteratee shorthand.
  15936. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15937. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15938. *
  15939. * // The `_.matchesProperty` iteratee shorthand.
  15940. * _.filter(users, _.iteratee(['user', 'fred']));
  15941. * // => [{ 'user': 'fred', 'age': 40 }]
  15942. *
  15943. * // The `_.property` iteratee shorthand.
  15944. * _.map(users, _.iteratee('user'));
  15945. * // => ['barney', 'fred']
  15946. *
  15947. * // Create custom iteratee shorthands.
  15948. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15949. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15950. * return func.test(string);
  15951. * };
  15952. * });
  15953. *
  15954. * _.filter(['abc', 'def'], /ef/);
  15955. * // => ['def']
  15956. */
  15957. function iteratee(func) {
  15958. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15959. }
  15960. /**
  15961. * Creates a function that performs a partial deep comparison between a given
  15962. * object and `source`, returning `true` if the given object has equivalent
  15963. * property values, else `false`.
  15964. *
  15965. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15966. * partially applied.
  15967. *
  15968. * Partial comparisons will match empty array and empty object `source`
  15969. * values against any array or object value, respectively. See `_.isEqual`
  15970. * for a list of supported value comparisons.
  15971. *
  15972. * **Note:** Multiple values can be checked by combining several matchers
  15973. * using `_.overSome`
  15974. *
  15975. * @static
  15976. * @memberOf _
  15977. * @since 3.0.0
  15978. * @category Util
  15979. * @param {Object} source The object of property values to match.
  15980. * @returns {Function} Returns the new spec function.
  15981. * @example
  15982. *
  15983. * var objects = [
  15984. * { 'a': 1, 'b': 2, 'c': 3 },
  15985. * { 'a': 4, 'b': 5, 'c': 6 }
  15986. * ];
  15987. *
  15988. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15989. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15990. *
  15991. * // Checking for several possible values
  15992. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  15993. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  15994. */
  15995. function matches(source) {
  15996. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  15997. }
  15998. /**
  15999. * Creates a function that performs a partial deep comparison between the
  16000. * value at `path` of a given object to `srcValue`, returning `true` if the
  16001. * object value is equivalent, else `false`.
  16002. *
  16003. * **Note:** Partial comparisons will match empty array and empty object
  16004. * `srcValue` values against any array or object value, respectively. See
  16005. * `_.isEqual` for a list of supported value comparisons.
  16006. *
  16007. * **Note:** Multiple values can be checked by combining several matchers
  16008. * using `_.overSome`
  16009. *
  16010. * @static
  16011. * @memberOf _
  16012. * @since 3.2.0
  16013. * @category Util
  16014. * @param {Array|string} path The path of the property to get.
  16015. * @param {*} srcValue The value to match.
  16016. * @returns {Function} Returns the new spec function.
  16017. * @example
  16018. *
  16019. * var objects = [
  16020. * { 'a': 1, 'b': 2, 'c': 3 },
  16021. * { 'a': 4, 'b': 5, 'c': 6 }
  16022. * ];
  16023. *
  16024. * _.find(objects, _.matchesProperty('a', 4));
  16025. * // => { 'a': 4, 'b': 5, 'c': 6 }
  16026. *
  16027. * // Checking for several possible values
  16028. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  16029. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16030. */
  16031. function matchesProperty(path, srcValue) {
  16032. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  16033. }
  16034. /**
  16035. * Creates a function that invokes the method at `path` of a given object.
  16036. * Any additional arguments are provided to the invoked method.
  16037. *
  16038. * @static
  16039. * @memberOf _
  16040. * @since 3.7.0
  16041. * @category Util
  16042. * @param {Array|string} path The path of the method to invoke.
  16043. * @param {...*} [args] The arguments to invoke the method with.
  16044. * @returns {Function} Returns the new invoker function.
  16045. * @example
  16046. *
  16047. * var objects = [
  16048. * { 'a': { 'b': _.constant(2) } },
  16049. * { 'a': { 'b': _.constant(1) } }
  16050. * ];
  16051. *
  16052. * _.map(objects, _.method('a.b'));
  16053. * // => [2, 1]
  16054. *
  16055. * _.map(objects, _.method(['a', 'b']));
  16056. * // => [2, 1]
  16057. */
  16058. var method = baseRest(function(path, args) {
  16059. return function(object) {
  16060. return baseInvoke(object, path, args);
  16061. };
  16062. });
  16063. /**
  16064. * The opposite of `_.method`; this method creates a function that invokes
  16065. * the method at a given path of `object`. Any additional arguments are
  16066. * provided to the invoked method.
  16067. *
  16068. * @static
  16069. * @memberOf _
  16070. * @since 3.7.0
  16071. * @category Util
  16072. * @param {Object} object The object to query.
  16073. * @param {...*} [args] The arguments to invoke the method with.
  16074. * @returns {Function} Returns the new invoker function.
  16075. * @example
  16076. *
  16077. * var array = _.times(3, _.constant),
  16078. * object = { 'a': array, 'b': array, 'c': array };
  16079. *
  16080. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  16081. * // => [2, 0]
  16082. *
  16083. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  16084. * // => [2, 0]
  16085. */
  16086. var methodOf = baseRest(function(object, args) {
  16087. return function(path) {
  16088. return baseInvoke(object, path, args);
  16089. };
  16090. });
  16091. /**
  16092. * Adds all own enumerable string keyed function properties of a source
  16093. * object to the destination object. If `object` is a function, then methods
  16094. * are added to its prototype as well.
  16095. *
  16096. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  16097. * avoid conflicts caused by modifying the original.
  16098. *
  16099. * @static
  16100. * @since 0.1.0
  16101. * @memberOf _
  16102. * @category Util
  16103. * @param {Function|Object} [object=lodash] The destination object.
  16104. * @param {Object} source The object of functions to add.
  16105. * @param {Object} [options={}] The options object.
  16106. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  16107. * @returns {Function|Object} Returns `object`.
  16108. * @example
  16109. *
  16110. * function vowels(string) {
  16111. * return _.filter(string, function(v) {
  16112. * return /[aeiou]/i.test(v);
  16113. * });
  16114. * }
  16115. *
  16116. * _.mixin({ 'vowels': vowels });
  16117. * _.vowels('fred');
  16118. * // => ['e']
  16119. *
  16120. * _('fred').vowels().value();
  16121. * // => ['e']
  16122. *
  16123. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  16124. * _('fred').vowels();
  16125. * // => ['e']
  16126. */
  16127. function mixin(object, source, options) {
  16128. var props = keys(source),
  16129. methodNames = baseFunctions(source, props);
  16130. if (options == null &&
  16131. !(isObject(source) && (methodNames.length || !props.length))) {
  16132. options = source;
  16133. source = object;
  16134. object = this;
  16135. methodNames = baseFunctions(source, keys(source));
  16136. }
  16137. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  16138. isFunc = isFunction(object);
  16139. arrayEach(methodNames, function(methodName) {
  16140. var func = source[methodName];
  16141. object[methodName] = func;
  16142. if (isFunc) {
  16143. object.prototype[methodName] = function() {
  16144. var chainAll = this.__chain__;
  16145. if (chain || chainAll) {
  16146. var result = object(this.__wrapped__),
  16147. actions = result.__actions__ = copyArray(this.__actions__);
  16148. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  16149. result.__chain__ = chainAll;
  16150. return result;
  16151. }
  16152. return func.apply(object, arrayPush([this.value()], arguments));
  16153. };
  16154. }
  16155. });
  16156. return object;
  16157. }
  16158. /**
  16159. * Reverts the `_` variable to its previous value and returns a reference to
  16160. * the `lodash` function.
  16161. *
  16162. * @static
  16163. * @since 0.1.0
  16164. * @memberOf _
  16165. * @category Util
  16166. * @returns {Function} Returns the `lodash` function.
  16167. * @example
  16168. *
  16169. * var lodash = _.noConflict();
  16170. */
  16171. function noConflict() {
  16172. if (root._ === this) {
  16173. root._ = oldDash;
  16174. }
  16175. return this;
  16176. }
  16177. /**
  16178. * This method returns `undefined`.
  16179. *
  16180. * @static
  16181. * @memberOf _
  16182. * @since 2.3.0
  16183. * @category Util
  16184. * @example
  16185. *
  16186. * _.times(2, _.noop);
  16187. * // => [undefined, undefined]
  16188. */
  16189. function noop() {
  16190. // No operation performed.
  16191. }
  16192. /**
  16193. * Creates a function that gets the argument at index `n`. If `n` is negative,
  16194. * the nth argument from the end is returned.
  16195. *
  16196. * @static
  16197. * @memberOf _
  16198. * @since 4.0.0
  16199. * @category Util
  16200. * @param {number} [n=0] The index of the argument to return.
  16201. * @returns {Function} Returns the new pass-thru function.
  16202. * @example
  16203. *
  16204. * var func = _.nthArg(1);
  16205. * func('a', 'b', 'c', 'd');
  16206. * // => 'b'
  16207. *
  16208. * var func = _.nthArg(-2);
  16209. * func('a', 'b', 'c', 'd');
  16210. * // => 'c'
  16211. */
  16212. function nthArg(n) {
  16213. n = toInteger(n);
  16214. return baseRest(function(args) {
  16215. return baseNth(args, n);
  16216. });
  16217. }
  16218. /**
  16219. * Creates a function that invokes `iteratees` with the arguments it receives
  16220. * and returns their results.
  16221. *
  16222. * @static
  16223. * @memberOf _
  16224. * @since 4.0.0
  16225. * @category Util
  16226. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  16227. * The iteratees to invoke.
  16228. * @returns {Function} Returns the new function.
  16229. * @example
  16230. *
  16231. * var func = _.over([Math.max, Math.min]);
  16232. *
  16233. * func(1, 2, 3, 4);
  16234. * // => [4, 1]
  16235. */
  16236. var over = createOver(arrayMap);
  16237. /**
  16238. * Creates a function that checks if **all** of the `predicates` return
  16239. * truthy when invoked with the arguments it receives.
  16240. *
  16241. * Following shorthands are possible for providing predicates.
  16242. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16243. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16244. *
  16245. * @static
  16246. * @memberOf _
  16247. * @since 4.0.0
  16248. * @category Util
  16249. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16250. * The predicates to check.
  16251. * @returns {Function} Returns the new function.
  16252. * @example
  16253. *
  16254. * var func = _.overEvery([Boolean, isFinite]);
  16255. *
  16256. * func('1');
  16257. * // => true
  16258. *
  16259. * func(null);
  16260. * // => false
  16261. *
  16262. * func(NaN);
  16263. * // => false
  16264. */
  16265. var overEvery = createOver(arrayEvery);
  16266. /**
  16267. * Creates a function that checks if **any** of the `predicates` return
  16268. * truthy when invoked with the arguments it receives.
  16269. *
  16270. * Following shorthands are possible for providing predicates.
  16271. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16272. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16273. *
  16274. * @static
  16275. * @memberOf _
  16276. * @since 4.0.0
  16277. * @category Util
  16278. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16279. * The predicates to check.
  16280. * @returns {Function} Returns the new function.
  16281. * @example
  16282. *
  16283. * var func = _.overSome([Boolean, isFinite]);
  16284. *
  16285. * func('1');
  16286. * // => true
  16287. *
  16288. * func(null);
  16289. * // => true
  16290. *
  16291. * func(NaN);
  16292. * // => false
  16293. *
  16294. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  16295. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  16296. */
  16297. var overSome = createOver(arraySome);
  16298. /**
  16299. * Creates a function that returns the value at `path` of a given object.
  16300. *
  16301. * @static
  16302. * @memberOf _
  16303. * @since 2.4.0
  16304. * @category Util
  16305. * @param {Array|string} path The path of the property to get.
  16306. * @returns {Function} Returns the new accessor function.
  16307. * @example
  16308. *
  16309. * var objects = [
  16310. * { 'a': { 'b': 2 } },
  16311. * { 'a': { 'b': 1 } }
  16312. * ];
  16313. *
  16314. * _.map(objects, _.property('a.b'));
  16315. * // => [2, 1]
  16316. *
  16317. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  16318. * // => [1, 2]
  16319. */
  16320. function property(path) {
  16321. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  16322. }
  16323. /**
  16324. * The opposite of `_.property`; this method creates a function that returns
  16325. * the value at a given path of `object`.
  16326. *
  16327. * @static
  16328. * @memberOf _
  16329. * @since 3.0.0
  16330. * @category Util
  16331. * @param {Object} object The object to query.
  16332. * @returns {Function} Returns the new accessor function.
  16333. * @example
  16334. *
  16335. * var array = [0, 1, 2],
  16336. * object = { 'a': array, 'b': array, 'c': array };
  16337. *
  16338. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  16339. * // => [2, 0]
  16340. *
  16341. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  16342. * // => [2, 0]
  16343. */
  16344. function propertyOf(object) {
  16345. return function(path) {
  16346. return object == null ? undefined : baseGet(object, path);
  16347. };
  16348. }
  16349. /**
  16350. * Creates an array of numbers (positive and/or negative) progressing from
  16351. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  16352. * `start` is specified without an `end` or `step`. If `end` is not specified,
  16353. * it's set to `start` with `start` then set to `0`.
  16354. *
  16355. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  16356. * floating-point values which can produce unexpected results.
  16357. *
  16358. * @static
  16359. * @since 0.1.0
  16360. * @memberOf _
  16361. * @category Util
  16362. * @param {number} [start=0] The start of the range.
  16363. * @param {number} end The end of the range.
  16364. * @param {number} [step=1] The value to increment or decrement by.
  16365. * @returns {Array} Returns the range of numbers.
  16366. * @see _.inRange, _.rangeRight
  16367. * @example
  16368. *
  16369. * _.range(4);
  16370. * // => [0, 1, 2, 3]
  16371. *
  16372. * _.range(-4);
  16373. * // => [0, -1, -2, -3]
  16374. *
  16375. * _.range(1, 5);
  16376. * // => [1, 2, 3, 4]
  16377. *
  16378. * _.range(0, 20, 5);
  16379. * // => [0, 5, 10, 15]
  16380. *
  16381. * _.range(0, -4, -1);
  16382. * // => [0, -1, -2, -3]
  16383. *
  16384. * _.range(1, 4, 0);
  16385. * // => [1, 1, 1]
  16386. *
  16387. * _.range(0);
  16388. * // => []
  16389. */
  16390. var range = createRange();
  16391. /**
  16392. * This method is like `_.range` except that it populates values in
  16393. * descending order.
  16394. *
  16395. * @static
  16396. * @memberOf _
  16397. * @since 4.0.0
  16398. * @category Util
  16399. * @param {number} [start=0] The start of the range.
  16400. * @param {number} end The end of the range.
  16401. * @param {number} [step=1] The value to increment or decrement by.
  16402. * @returns {Array} Returns the range of numbers.
  16403. * @see _.inRange, _.range
  16404. * @example
  16405. *
  16406. * _.rangeRight(4);
  16407. * // => [3, 2, 1, 0]
  16408. *
  16409. * _.rangeRight(-4);
  16410. * // => [-3, -2, -1, 0]
  16411. *
  16412. * _.rangeRight(1, 5);
  16413. * // => [4, 3, 2, 1]
  16414. *
  16415. * _.rangeRight(0, 20, 5);
  16416. * // => [15, 10, 5, 0]
  16417. *
  16418. * _.rangeRight(0, -4, -1);
  16419. * // => [-3, -2, -1, 0]
  16420. *
  16421. * _.rangeRight(1, 4, 0);
  16422. * // => [1, 1, 1]
  16423. *
  16424. * _.rangeRight(0);
  16425. * // => []
  16426. */
  16427. var rangeRight = createRange(true);
  16428. /**
  16429. * This method returns a new empty array.
  16430. *
  16431. * @static
  16432. * @memberOf _
  16433. * @since 4.13.0
  16434. * @category Util
  16435. * @returns {Array} Returns the new empty array.
  16436. * @example
  16437. *
  16438. * var arrays = _.times(2, _.stubArray);
  16439. *
  16440. * console.log(arrays);
  16441. * // => [[], []]
  16442. *
  16443. * console.log(arrays[0] === arrays[1]);
  16444. * // => false
  16445. */
  16446. function stubArray() {
  16447. return [];
  16448. }
  16449. /**
  16450. * This method returns `false`.
  16451. *
  16452. * @static
  16453. * @memberOf _
  16454. * @since 4.13.0
  16455. * @category Util
  16456. * @returns {boolean} Returns `false`.
  16457. * @example
  16458. *
  16459. * _.times(2, _.stubFalse);
  16460. * // => [false, false]
  16461. */
  16462. function stubFalse() {
  16463. return false;
  16464. }
  16465. /**
  16466. * This method returns a new empty object.
  16467. *
  16468. * @static
  16469. * @memberOf _
  16470. * @since 4.13.0
  16471. * @category Util
  16472. * @returns {Object} Returns the new empty object.
  16473. * @example
  16474. *
  16475. * var objects = _.times(2, _.stubObject);
  16476. *
  16477. * console.log(objects);
  16478. * // => [{}, {}]
  16479. *
  16480. * console.log(objects[0] === objects[1]);
  16481. * // => false
  16482. */
  16483. function stubObject() {
  16484. return {};
  16485. }
  16486. /**
  16487. * This method returns an empty string.
  16488. *
  16489. * @static
  16490. * @memberOf _
  16491. * @since 4.13.0
  16492. * @category Util
  16493. * @returns {string} Returns the empty string.
  16494. * @example
  16495. *
  16496. * _.times(2, _.stubString);
  16497. * // => ['', '']
  16498. */
  16499. function stubString() {
  16500. return '';
  16501. }
  16502. /**
  16503. * This method returns `true`.
  16504. *
  16505. * @static
  16506. * @memberOf _
  16507. * @since 4.13.0
  16508. * @category Util
  16509. * @returns {boolean} Returns `true`.
  16510. * @example
  16511. *
  16512. * _.times(2, _.stubTrue);
  16513. * // => [true, true]
  16514. */
  16515. function stubTrue() {
  16516. return true;
  16517. }
  16518. /**
  16519. * Invokes the iteratee `n` times, returning an array of the results of
  16520. * each invocation. The iteratee is invoked with one argument; (index).
  16521. *
  16522. * @static
  16523. * @since 0.1.0
  16524. * @memberOf _
  16525. * @category Util
  16526. * @param {number} n The number of times to invoke `iteratee`.
  16527. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16528. * @returns {Array} Returns the array of results.
  16529. * @example
  16530. *
  16531. * _.times(3, String);
  16532. * // => ['0', '1', '2']
  16533. *
  16534. * _.times(4, _.constant(0));
  16535. * // => [0, 0, 0, 0]
  16536. */
  16537. function times(n, iteratee) {
  16538. n = toInteger(n);
  16539. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16540. return [];
  16541. }
  16542. var index = MAX_ARRAY_LENGTH,
  16543. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16544. iteratee = getIteratee(iteratee);
  16545. n -= MAX_ARRAY_LENGTH;
  16546. var result = baseTimes(length, iteratee);
  16547. while (++index < n) {
  16548. iteratee(index);
  16549. }
  16550. return result;
  16551. }
  16552. /**
  16553. * Converts `value` to a property path array.
  16554. *
  16555. * @static
  16556. * @memberOf _
  16557. * @since 4.0.0
  16558. * @category Util
  16559. * @param {*} value The value to convert.
  16560. * @returns {Array} Returns the new property path array.
  16561. * @example
  16562. *
  16563. * _.toPath('a.b.c');
  16564. * // => ['a', 'b', 'c']
  16565. *
  16566. * _.toPath('a[0].b.c');
  16567. * // => ['a', '0', 'b', 'c']
  16568. */
  16569. function toPath(value) {
  16570. if (isArray(value)) {
  16571. return arrayMap(value, toKey);
  16572. }
  16573. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16574. }
  16575. /**
  16576. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16577. *
  16578. * @static
  16579. * @since 0.1.0
  16580. * @memberOf _
  16581. * @category Util
  16582. * @param {string} [prefix=''] The value to prefix the ID with.
  16583. * @returns {string} Returns the unique ID.
  16584. * @example
  16585. *
  16586. * _.uniqueId('contact_');
  16587. * // => 'contact_104'
  16588. *
  16589. * _.uniqueId();
  16590. * // => '105'
  16591. */
  16592. function uniqueId(prefix) {
  16593. var id = ++idCounter;
  16594. return toString(prefix) + id;
  16595. }
  16596. /*------------------------------------------------------------------------*/
  16597. /**
  16598. * Adds two numbers.
  16599. *
  16600. * @static
  16601. * @memberOf _
  16602. * @since 3.4.0
  16603. * @category Math
  16604. * @param {number} augend The first number in an addition.
  16605. * @param {number} addend The second number in an addition.
  16606. * @returns {number} Returns the total.
  16607. * @example
  16608. *
  16609. * _.add(6, 4);
  16610. * // => 10
  16611. */
  16612. var add = createMathOperation(function(augend, addend) {
  16613. return augend + addend;
  16614. }, 0);
  16615. /**
  16616. * Computes `number` rounded up to `precision`.
  16617. *
  16618. * @static
  16619. * @memberOf _
  16620. * @since 3.10.0
  16621. * @category Math
  16622. * @param {number} number The number to round up.
  16623. * @param {number} [precision=0] The precision to round up to.
  16624. * @returns {number} Returns the rounded up number.
  16625. * @example
  16626. *
  16627. * _.ceil(4.006);
  16628. * // => 5
  16629. *
  16630. * _.ceil(6.004, 2);
  16631. * // => 6.01
  16632. *
  16633. * _.ceil(6040, -2);
  16634. * // => 6100
  16635. */
  16636. var ceil = createRound('ceil');
  16637. /**
  16638. * Divide two numbers.
  16639. *
  16640. * @static
  16641. * @memberOf _
  16642. * @since 4.7.0
  16643. * @category Math
  16644. * @param {number} dividend The first number in a division.
  16645. * @param {number} divisor The second number in a division.
  16646. * @returns {number} Returns the quotient.
  16647. * @example
  16648. *
  16649. * _.divide(6, 4);
  16650. * // => 1.5
  16651. */
  16652. var divide = createMathOperation(function(dividend, divisor) {
  16653. return dividend / divisor;
  16654. }, 1);
  16655. /**
  16656. * Computes `number` rounded down to `precision`.
  16657. *
  16658. * @static
  16659. * @memberOf _
  16660. * @since 3.10.0
  16661. * @category Math
  16662. * @param {number} number The number to round down.
  16663. * @param {number} [precision=0] The precision to round down to.
  16664. * @returns {number} Returns the rounded down number.
  16665. * @example
  16666. *
  16667. * _.floor(4.006);
  16668. * // => 4
  16669. *
  16670. * _.floor(0.046, 2);
  16671. * // => 0.04
  16672. *
  16673. * _.floor(4060, -2);
  16674. * // => 4000
  16675. */
  16676. var floor = createRound('floor');
  16677. /**
  16678. * Computes the maximum value of `array`. If `array` is empty or falsey,
  16679. * `undefined` is returned.
  16680. *
  16681. * @static
  16682. * @since 0.1.0
  16683. * @memberOf _
  16684. * @category Math
  16685. * @param {Array} array The array to iterate over.
  16686. * @returns {*} Returns the maximum value.
  16687. * @example
  16688. *
  16689. * _.max([4, 2, 8, 6]);
  16690. * // => 8
  16691. *
  16692. * _.max([]);
  16693. * // => undefined
  16694. */
  16695. function max(array) {
  16696. return (array && array.length)
  16697. ? baseExtremum(array, identity, baseGt)
  16698. : undefined;
  16699. }
  16700. /**
  16701. * This method is like `_.max` except that it accepts `iteratee` which is
  16702. * invoked for each element in `array` to generate the criterion by which
  16703. * the value is ranked. The iteratee is invoked with one argument: (value).
  16704. *
  16705. * @static
  16706. * @memberOf _
  16707. * @since 4.0.0
  16708. * @category Math
  16709. * @param {Array} array The array to iterate over.
  16710. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16711. * @returns {*} Returns the maximum value.
  16712. * @example
  16713. *
  16714. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16715. *
  16716. * _.maxBy(objects, function(o) { return o.n; });
  16717. * // => { 'n': 2 }
  16718. *
  16719. * // The `_.property` iteratee shorthand.
  16720. * _.maxBy(objects, 'n');
  16721. * // => { 'n': 2 }
  16722. */
  16723. function maxBy(array, iteratee) {
  16724. return (array && array.length)
  16725. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16726. : undefined;
  16727. }
  16728. /**
  16729. * Computes the mean of the values in `array`.
  16730. *
  16731. * @static
  16732. * @memberOf _
  16733. * @since 4.0.0
  16734. * @category Math
  16735. * @param {Array} array The array to iterate over.
  16736. * @returns {number} Returns the mean.
  16737. * @example
  16738. *
  16739. * _.mean([4, 2, 8, 6]);
  16740. * // => 5
  16741. */
  16742. function mean(array) {
  16743. return baseMean(array, identity);
  16744. }
  16745. /**
  16746. * This method is like `_.mean` except that it accepts `iteratee` which is
  16747. * invoked for each element in `array` to generate the value to be averaged.
  16748. * The iteratee is invoked with one argument: (value).
  16749. *
  16750. * @static
  16751. * @memberOf _
  16752. * @since 4.7.0
  16753. * @category Math
  16754. * @param {Array} array The array to iterate over.
  16755. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16756. * @returns {number} Returns the mean.
  16757. * @example
  16758. *
  16759. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16760. *
  16761. * _.meanBy(objects, function(o) { return o.n; });
  16762. * // => 5
  16763. *
  16764. * // The `_.property` iteratee shorthand.
  16765. * _.meanBy(objects, 'n');
  16766. * // => 5
  16767. */
  16768. function meanBy(array, iteratee) {
  16769. return baseMean(array, getIteratee(iteratee, 2));
  16770. }
  16771. /**
  16772. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16773. * `undefined` is returned.
  16774. *
  16775. * @static
  16776. * @since 0.1.0
  16777. * @memberOf _
  16778. * @category Math
  16779. * @param {Array} array The array to iterate over.
  16780. * @returns {*} Returns the minimum value.
  16781. * @example
  16782. *
  16783. * _.min([4, 2, 8, 6]);
  16784. * // => 2
  16785. *
  16786. * _.min([]);
  16787. * // => undefined
  16788. */
  16789. function min(array) {
  16790. return (array && array.length)
  16791. ? baseExtremum(array, identity, baseLt)
  16792. : undefined;
  16793. }
  16794. /**
  16795. * This method is like `_.min` except that it accepts `iteratee` which is
  16796. * invoked for each element in `array` to generate the criterion by which
  16797. * the value is ranked. The iteratee is invoked with one argument: (value).
  16798. *
  16799. * @static
  16800. * @memberOf _
  16801. * @since 4.0.0
  16802. * @category Math
  16803. * @param {Array} array The array to iterate over.
  16804. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16805. * @returns {*} Returns the minimum value.
  16806. * @example
  16807. *
  16808. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16809. *
  16810. * _.minBy(objects, function(o) { return o.n; });
  16811. * // => { 'n': 1 }
  16812. *
  16813. * // The `_.property` iteratee shorthand.
  16814. * _.minBy(objects, 'n');
  16815. * // => { 'n': 1 }
  16816. */
  16817. function minBy(array, iteratee) {
  16818. return (array && array.length)
  16819. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16820. : undefined;
  16821. }
  16822. /**
  16823. * Multiply two numbers.
  16824. *
  16825. * @static
  16826. * @memberOf _
  16827. * @since 4.7.0
  16828. * @category Math
  16829. * @param {number} multiplier The first number in a multiplication.
  16830. * @param {number} multiplicand The second number in a multiplication.
  16831. * @returns {number} Returns the product.
  16832. * @example
  16833. *
  16834. * _.multiply(6, 4);
  16835. * // => 24
  16836. */
  16837. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16838. return multiplier * multiplicand;
  16839. }, 1);
  16840. /**
  16841. * Computes `number` rounded to `precision`.
  16842. *
  16843. * @static
  16844. * @memberOf _
  16845. * @since 3.10.0
  16846. * @category Math
  16847. * @param {number} number The number to round.
  16848. * @param {number} [precision=0] The precision to round to.
  16849. * @returns {number} Returns the rounded number.
  16850. * @example
  16851. *
  16852. * _.round(4.006);
  16853. * // => 4
  16854. *
  16855. * _.round(4.006, 2);
  16856. * // => 4.01
  16857. *
  16858. * _.round(4060, -2);
  16859. * // => 4100
  16860. */
  16861. var round = createRound('round');
  16862. /**
  16863. * Subtract two numbers.
  16864. *
  16865. * @static
  16866. * @memberOf _
  16867. * @since 4.0.0
  16868. * @category Math
  16869. * @param {number} minuend The first number in a subtraction.
  16870. * @param {number} subtrahend The second number in a subtraction.
  16871. * @returns {number} Returns the difference.
  16872. * @example
  16873. *
  16874. * _.subtract(6, 4);
  16875. * // => 2
  16876. */
  16877. var subtract = createMathOperation(function(minuend, subtrahend) {
  16878. return minuend - subtrahend;
  16879. }, 0);
  16880. /**
  16881. * Computes the sum of the values in `array`.
  16882. *
  16883. * @static
  16884. * @memberOf _
  16885. * @since 3.4.0
  16886. * @category Math
  16887. * @param {Array} array The array to iterate over.
  16888. * @returns {number} Returns the sum.
  16889. * @example
  16890. *
  16891. * _.sum([4, 2, 8, 6]);
  16892. * // => 20
  16893. */
  16894. function sum(array) {
  16895. return (array && array.length)
  16896. ? baseSum(array, identity)
  16897. : 0;
  16898. }
  16899. /**
  16900. * This method is like `_.sum` except that it accepts `iteratee` which is
  16901. * invoked for each element in `array` to generate the value to be summed.
  16902. * The iteratee is invoked with one argument: (value).
  16903. *
  16904. * @static
  16905. * @memberOf _
  16906. * @since 4.0.0
  16907. * @category Math
  16908. * @param {Array} array The array to iterate over.
  16909. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16910. * @returns {number} Returns the sum.
  16911. * @example
  16912. *
  16913. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16914. *
  16915. * _.sumBy(objects, function(o) { return o.n; });
  16916. * // => 20
  16917. *
  16918. * // The `_.property` iteratee shorthand.
  16919. * _.sumBy(objects, 'n');
  16920. * // => 20
  16921. */
  16922. function sumBy(array, iteratee) {
  16923. return (array && array.length)
  16924. ? baseSum(array, getIteratee(iteratee, 2))
  16925. : 0;
  16926. }
  16927. /*------------------------------------------------------------------------*/
  16928. // Add methods that return wrapped values in chain sequences.
  16929. lodash.after = after;
  16930. lodash.ary = ary;
  16931. lodash.assign = assign;
  16932. lodash.assignIn = assignIn;
  16933. lodash.assignInWith = assignInWith;
  16934. lodash.assignWith = assignWith;
  16935. lodash.at = at;
  16936. lodash.before = before;
  16937. lodash.bind = bind;
  16938. lodash.bindAll = bindAll;
  16939. lodash.bindKey = bindKey;
  16940. lodash.castArray = castArray;
  16941. lodash.chain = chain;
  16942. lodash.chunk = chunk;
  16943. lodash.compact = compact;
  16944. lodash.concat = concat;
  16945. lodash.cond = cond;
  16946. lodash.conforms = conforms;
  16947. lodash.constant = constant;
  16948. lodash.countBy = countBy;
  16949. lodash.create = create;
  16950. lodash.curry = curry;
  16951. lodash.curryRight = curryRight;
  16952. lodash.debounce = debounce;
  16953. lodash.defaults = defaults;
  16954. lodash.defaultsDeep = defaultsDeep;
  16955. lodash.defer = defer;
  16956. lodash.delay = delay;
  16957. lodash.difference = difference;
  16958. lodash.differenceBy = differenceBy;
  16959. lodash.differenceWith = differenceWith;
  16960. lodash.drop = drop;
  16961. lodash.dropRight = dropRight;
  16962. lodash.dropRightWhile = dropRightWhile;
  16963. lodash.dropWhile = dropWhile;
  16964. lodash.fill = fill;
  16965. lodash.filter = filter;
  16966. lodash.flatMap = flatMap;
  16967. lodash.flatMapDeep = flatMapDeep;
  16968. lodash.flatMapDepth = flatMapDepth;
  16969. lodash.flatten = flatten;
  16970. lodash.flattenDeep = flattenDeep;
  16971. lodash.flattenDepth = flattenDepth;
  16972. lodash.flip = flip;
  16973. lodash.flow = flow;
  16974. lodash.flowRight = flowRight;
  16975. lodash.fromPairs = fromPairs;
  16976. lodash.functions = functions;
  16977. lodash.functionsIn = functionsIn;
  16978. lodash.groupBy = groupBy;
  16979. lodash.initial = initial;
  16980. lodash.intersection = intersection;
  16981. lodash.intersectionBy = intersectionBy;
  16982. lodash.intersectionWith = intersectionWith;
  16983. lodash.invert = invert;
  16984. lodash.invertBy = invertBy;
  16985. lodash.invokeMap = invokeMap;
  16986. lodash.iteratee = iteratee;
  16987. lodash.keyBy = keyBy;
  16988. lodash.keys = keys;
  16989. lodash.keysIn = keysIn;
  16990. lodash.map = map;
  16991. lodash.mapKeys = mapKeys;
  16992. lodash.mapValues = mapValues;
  16993. lodash.matches = matches;
  16994. lodash.matchesProperty = matchesProperty;
  16995. lodash.memoize = memoize;
  16996. lodash.merge = merge;
  16997. lodash.mergeWith = mergeWith;
  16998. lodash.method = method;
  16999. lodash.methodOf = methodOf;
  17000. lodash.mixin = mixin;
  17001. lodash.negate = negate;
  17002. lodash.nthArg = nthArg;
  17003. lodash.omit = omit;
  17004. lodash.omitBy = omitBy;
  17005. lodash.once = once;
  17006. lodash.orderBy = orderBy;
  17007. lodash.over = over;
  17008. lodash.overArgs = overArgs;
  17009. lodash.overEvery = overEvery;
  17010. lodash.overSome = overSome;
  17011. lodash.partial = partial;
  17012. lodash.partialRight = partialRight;
  17013. lodash.partition = partition;
  17014. lodash.pick = pick;
  17015. lodash.pickBy = pickBy;
  17016. lodash.property = property;
  17017. lodash.propertyOf = propertyOf;
  17018. lodash.pull = pull;
  17019. lodash.pullAll = pullAll;
  17020. lodash.pullAllBy = pullAllBy;
  17021. lodash.pullAllWith = pullAllWith;
  17022. lodash.pullAt = pullAt;
  17023. lodash.range = range;
  17024. lodash.rangeRight = rangeRight;
  17025. lodash.rearg = rearg;
  17026. lodash.reject = reject;
  17027. lodash.remove = remove;
  17028. lodash.rest = rest;
  17029. lodash.reverse = reverse;
  17030. lodash.sampleSize = sampleSize;
  17031. lodash.set = set;
  17032. lodash.setWith = setWith;
  17033. lodash.shuffle = shuffle;
  17034. lodash.slice = slice;
  17035. lodash.sortBy = sortBy;
  17036. lodash.sortedUniq = sortedUniq;
  17037. lodash.sortedUniqBy = sortedUniqBy;
  17038. lodash.split = split;
  17039. lodash.spread = spread;
  17040. lodash.tail = tail;
  17041. lodash.take = take;
  17042. lodash.takeRight = takeRight;
  17043. lodash.takeRightWhile = takeRightWhile;
  17044. lodash.takeWhile = takeWhile;
  17045. lodash.tap = tap;
  17046. lodash.throttle = throttle;
  17047. lodash.thru = thru;
  17048. lodash.toArray = toArray;
  17049. lodash.toPairs = toPairs;
  17050. lodash.toPairsIn = toPairsIn;
  17051. lodash.toPath = toPath;
  17052. lodash.toPlainObject = toPlainObject;
  17053. lodash.transform = transform;
  17054. lodash.unary = unary;
  17055. lodash.union = union;
  17056. lodash.unionBy = unionBy;
  17057. lodash.unionWith = unionWith;
  17058. lodash.uniq = uniq;
  17059. lodash.uniqBy = uniqBy;
  17060. lodash.uniqWith = uniqWith;
  17061. lodash.unset = unset;
  17062. lodash.unzip = unzip;
  17063. lodash.unzipWith = unzipWith;
  17064. lodash.update = update;
  17065. lodash.updateWith = updateWith;
  17066. lodash.values = values;
  17067. lodash.valuesIn = valuesIn;
  17068. lodash.without = without;
  17069. lodash.words = words;
  17070. lodash.wrap = wrap;
  17071. lodash.xor = xor;
  17072. lodash.xorBy = xorBy;
  17073. lodash.xorWith = xorWith;
  17074. lodash.zip = zip;
  17075. lodash.zipObject = zipObject;
  17076. lodash.zipObjectDeep = zipObjectDeep;
  17077. lodash.zipWith = zipWith;
  17078. // Add aliases.
  17079. lodash.entries = toPairs;
  17080. lodash.entriesIn = toPairsIn;
  17081. lodash.extend = assignIn;
  17082. lodash.extendWith = assignInWith;
  17083. // Add methods to `lodash.prototype`.
  17084. mixin(lodash, lodash);
  17085. /*------------------------------------------------------------------------*/
  17086. // Add methods that return unwrapped values in chain sequences.
  17087. lodash.add = add;
  17088. lodash.attempt = attempt;
  17089. lodash.camelCase = camelCase;
  17090. lodash.capitalize = capitalize;
  17091. lodash.ceil = ceil;
  17092. lodash.clamp = clamp;
  17093. lodash.clone = clone;
  17094. lodash.cloneDeep = cloneDeep;
  17095. lodash.cloneDeepWith = cloneDeepWith;
  17096. lodash.cloneWith = cloneWith;
  17097. lodash.conformsTo = conformsTo;
  17098. lodash.deburr = deburr;
  17099. lodash.defaultTo = defaultTo;
  17100. lodash.divide = divide;
  17101. lodash.endsWith = endsWith;
  17102. lodash.eq = eq;
  17103. lodash.escape = escape;
  17104. lodash.escapeRegExp = escapeRegExp;
  17105. lodash.every = every;
  17106. lodash.find = find;
  17107. lodash.findIndex = findIndex;
  17108. lodash.findKey = findKey;
  17109. lodash.findLast = findLast;
  17110. lodash.findLastIndex = findLastIndex;
  17111. lodash.findLastKey = findLastKey;
  17112. lodash.floor = floor;
  17113. lodash.forEach = forEach;
  17114. lodash.forEachRight = forEachRight;
  17115. lodash.forIn = forIn;
  17116. lodash.forInRight = forInRight;
  17117. lodash.forOwn = forOwn;
  17118. lodash.forOwnRight = forOwnRight;
  17119. lodash.get = get;
  17120. lodash.gt = gt;
  17121. lodash.gte = gte;
  17122. lodash.has = has;
  17123. lodash.hasIn = hasIn;
  17124. lodash.head = head;
  17125. lodash.identity = identity;
  17126. lodash.includes = includes;
  17127. lodash.indexOf = indexOf;
  17128. lodash.inRange = inRange;
  17129. lodash.invoke = invoke;
  17130. lodash.isArguments = isArguments;
  17131. lodash.isArray = isArray;
  17132. lodash.isArrayBuffer = isArrayBuffer;
  17133. lodash.isArrayLike = isArrayLike;
  17134. lodash.isArrayLikeObject = isArrayLikeObject;
  17135. lodash.isBoolean = isBoolean;
  17136. lodash.isBuffer = isBuffer;
  17137. lodash.isDate = isDate;
  17138. lodash.isElement = isElement;
  17139. lodash.isEmpty = isEmpty;
  17140. lodash.isEqual = isEqual;
  17141. lodash.isEqualWith = isEqualWith;
  17142. lodash.isError = isError;
  17143. lodash.isFinite = isFinite;
  17144. lodash.isFunction = isFunction;
  17145. lodash.isInteger = isInteger;
  17146. lodash.isLength = isLength;
  17147. lodash.isMap = isMap;
  17148. lodash.isMatch = isMatch;
  17149. lodash.isMatchWith = isMatchWith;
  17150. lodash.isNaN = isNaN;
  17151. lodash.isNative = isNative;
  17152. lodash.isNil = isNil;
  17153. lodash.isNull = isNull;
  17154. lodash.isNumber = isNumber;
  17155. lodash.isObject = isObject;
  17156. lodash.isObjectLike = isObjectLike;
  17157. lodash.isPlainObject = isPlainObject;
  17158. lodash.isRegExp = isRegExp;
  17159. lodash.isSafeInteger = isSafeInteger;
  17160. lodash.isSet = isSet;
  17161. lodash.isString = isString;
  17162. lodash.isSymbol = isSymbol;
  17163. lodash.isTypedArray = isTypedArray;
  17164. lodash.isUndefined = isUndefined;
  17165. lodash.isWeakMap = isWeakMap;
  17166. lodash.isWeakSet = isWeakSet;
  17167. lodash.join = join;
  17168. lodash.kebabCase = kebabCase;
  17169. lodash.last = last;
  17170. lodash.lastIndexOf = lastIndexOf;
  17171. lodash.lowerCase = lowerCase;
  17172. lodash.lowerFirst = lowerFirst;
  17173. lodash.lt = lt;
  17174. lodash.lte = lte;
  17175. lodash.max = max;
  17176. lodash.maxBy = maxBy;
  17177. lodash.mean = mean;
  17178. lodash.meanBy = meanBy;
  17179. lodash.min = min;
  17180. lodash.minBy = minBy;
  17181. lodash.stubArray = stubArray;
  17182. lodash.stubFalse = stubFalse;
  17183. lodash.stubObject = stubObject;
  17184. lodash.stubString = stubString;
  17185. lodash.stubTrue = stubTrue;
  17186. lodash.multiply = multiply;
  17187. lodash.nth = nth;
  17188. lodash.noConflict = noConflict;
  17189. lodash.noop = noop;
  17190. lodash.now = now;
  17191. lodash.pad = pad;
  17192. lodash.padEnd = padEnd;
  17193. lodash.padStart = padStart;
  17194. lodash.parseInt = parseInt;
  17195. lodash.random = random;
  17196. lodash.reduce = reduce;
  17197. lodash.reduceRight = reduceRight;
  17198. lodash.repeat = repeat;
  17199. lodash.replace = replace;
  17200. lodash.result = result;
  17201. lodash.round = round;
  17202. lodash.runInContext = runInContext;
  17203. lodash.sample = sample;
  17204. lodash.size = size;
  17205. lodash.snakeCase = snakeCase;
  17206. lodash.some = some;
  17207. lodash.sortedIndex = sortedIndex;
  17208. lodash.sortedIndexBy = sortedIndexBy;
  17209. lodash.sortedIndexOf = sortedIndexOf;
  17210. lodash.sortedLastIndex = sortedLastIndex;
  17211. lodash.sortedLastIndexBy = sortedLastIndexBy;
  17212. lodash.sortedLastIndexOf = sortedLastIndexOf;
  17213. lodash.startCase = startCase;
  17214. lodash.startsWith = startsWith;
  17215. lodash.subtract = subtract;
  17216. lodash.sum = sum;
  17217. lodash.sumBy = sumBy;
  17218. lodash.template = template;
  17219. lodash.times = times;
  17220. lodash.toFinite = toFinite;
  17221. lodash.toInteger = toInteger;
  17222. lodash.toLength = toLength;
  17223. lodash.toLower = toLower;
  17224. lodash.toNumber = toNumber;
  17225. lodash.toSafeInteger = toSafeInteger;
  17226. lodash.toString = toString;
  17227. lodash.toUpper = toUpper;
  17228. lodash.trim = trim;
  17229. lodash.trimEnd = trimEnd;
  17230. lodash.trimStart = trimStart;
  17231. lodash.truncate = truncate;
  17232. lodash.unescape = unescape;
  17233. lodash.uniqueId = uniqueId;
  17234. lodash.upperCase = upperCase;
  17235. lodash.upperFirst = upperFirst;
  17236. // Add aliases.
  17237. lodash.each = forEach;
  17238. lodash.eachRight = forEachRight;
  17239. lodash.first = head;
  17240. mixin(lodash, (function() {
  17241. var source = {};
  17242. baseForOwn(lodash, function(func, methodName) {
  17243. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  17244. source[methodName] = func;
  17245. }
  17246. });
  17247. return source;
  17248. }()), { 'chain': false });
  17249. /*------------------------------------------------------------------------*/
  17250. /**
  17251. * The semantic version number.
  17252. *
  17253. * @static
  17254. * @memberOf _
  17255. * @type {string}
  17256. */
  17257. lodash.VERSION = VERSION;
  17258. // Assign default placeholders.
  17259. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  17260. lodash[methodName].placeholder = lodash;
  17261. });
  17262. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  17263. arrayEach(['drop', 'take'], function(methodName, index) {
  17264. LazyWrapper.prototype[methodName] = function(n) {
  17265. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  17266. var result = (this.__filtered__ && !index)
  17267. ? new LazyWrapper(this)
  17268. : this.clone();
  17269. if (result.__filtered__) {
  17270. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  17271. } else {
  17272. result.__views__.push({
  17273. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  17274. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  17275. });
  17276. }
  17277. return result;
  17278. };
  17279. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  17280. return this.reverse()[methodName](n).reverse();
  17281. };
  17282. });
  17283. // Add `LazyWrapper` methods that accept an `iteratee` value.
  17284. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  17285. var type = index + 1,
  17286. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  17287. LazyWrapper.prototype[methodName] = function(iteratee) {
  17288. var result = this.clone();
  17289. result.__iteratees__.push({
  17290. 'iteratee': getIteratee(iteratee, 3),
  17291. 'type': type
  17292. });
  17293. result.__filtered__ = result.__filtered__ || isFilter;
  17294. return result;
  17295. };
  17296. });
  17297. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  17298. arrayEach(['head', 'last'], function(methodName, index) {
  17299. var takeName = 'take' + (index ? 'Right' : '');
  17300. LazyWrapper.prototype[methodName] = function() {
  17301. return this[takeName](1).value()[0];
  17302. };
  17303. });
  17304. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  17305. arrayEach(['initial', 'tail'], function(methodName, index) {
  17306. var dropName = 'drop' + (index ? '' : 'Right');
  17307. LazyWrapper.prototype[methodName] = function() {
  17308. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  17309. };
  17310. });
  17311. LazyWrapper.prototype.compact = function() {
  17312. return this.filter(identity);
  17313. };
  17314. LazyWrapper.prototype.find = function(predicate) {
  17315. return this.filter(predicate).head();
  17316. };
  17317. LazyWrapper.prototype.findLast = function(predicate) {
  17318. return this.reverse().find(predicate);
  17319. };
  17320. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  17321. if (typeof path == 'function') {
  17322. return new LazyWrapper(this);
  17323. }
  17324. return this.map(function(value) {
  17325. return baseInvoke(value, path, args);
  17326. });
  17327. });
  17328. LazyWrapper.prototype.reject = function(predicate) {
  17329. return this.filter(negate(getIteratee(predicate)));
  17330. };
  17331. LazyWrapper.prototype.slice = function(start, end) {
  17332. start = toInteger(start);
  17333. var result = this;
  17334. if (result.__filtered__ && (start > 0 || end < 0)) {
  17335. return new LazyWrapper(result);
  17336. }
  17337. if (start < 0) {
  17338. result = result.takeRight(-start);
  17339. } else if (start) {
  17340. result = result.drop(start);
  17341. }
  17342. if (end !== undefined) {
  17343. end = toInteger(end);
  17344. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  17345. }
  17346. return result;
  17347. };
  17348. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  17349. return this.reverse().takeWhile(predicate).reverse();
  17350. };
  17351. LazyWrapper.prototype.toArray = function() {
  17352. return this.take(MAX_ARRAY_LENGTH);
  17353. };
  17354. // Add `LazyWrapper` methods to `lodash.prototype`.
  17355. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17356. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  17357. isTaker = /^(?:head|last)$/.test(methodName),
  17358. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  17359. retUnwrapped = isTaker || /^find/.test(methodName);
  17360. if (!lodashFunc) {
  17361. return;
  17362. }
  17363. lodash.prototype[methodName] = function() {
  17364. var value = this.__wrapped__,
  17365. args = isTaker ? [1] : arguments,
  17366. isLazy = value instanceof LazyWrapper,
  17367. iteratee = args[0],
  17368. useLazy = isLazy || isArray(value);
  17369. var interceptor = function(value) {
  17370. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  17371. return (isTaker && chainAll) ? result[0] : result;
  17372. };
  17373. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  17374. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  17375. isLazy = useLazy = false;
  17376. }
  17377. var chainAll = this.__chain__,
  17378. isHybrid = !!this.__actions__.length,
  17379. isUnwrapped = retUnwrapped && !chainAll,
  17380. onlyLazy = isLazy && !isHybrid;
  17381. if (!retUnwrapped && useLazy) {
  17382. value = onlyLazy ? value : new LazyWrapper(this);
  17383. var result = func.apply(value, args);
  17384. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  17385. return new LodashWrapper(result, chainAll);
  17386. }
  17387. if (isUnwrapped && onlyLazy) {
  17388. return func.apply(this, args);
  17389. }
  17390. result = this.thru(interceptor);
  17391. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  17392. };
  17393. });
  17394. // Add `Array` methods to `lodash.prototype`.
  17395. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  17396. var func = arrayProto[methodName],
  17397. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  17398. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  17399. lodash.prototype[methodName] = function() {
  17400. var args = arguments;
  17401. if (retUnwrapped && !this.__chain__) {
  17402. var value = this.value();
  17403. return func.apply(isArray(value) ? value : [], args);
  17404. }
  17405. return this[chainName](function(value) {
  17406. return func.apply(isArray(value) ? value : [], args);
  17407. });
  17408. };
  17409. });
  17410. // Map minified method names to their real names.
  17411. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17412. var lodashFunc = lodash[methodName];
  17413. if (lodashFunc) {
  17414. var key = lodashFunc.name + '';
  17415. if (!hasOwnProperty.call(realNames, key)) {
  17416. realNames[key] = [];
  17417. }
  17418. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  17419. }
  17420. });
  17421. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  17422. 'name': 'wrapper',
  17423. 'func': undefined
  17424. }];
  17425. // Add methods to `LazyWrapper`.
  17426. LazyWrapper.prototype.clone = lazyClone;
  17427. LazyWrapper.prototype.reverse = lazyReverse;
  17428. LazyWrapper.prototype.value = lazyValue;
  17429. // Add chain sequence methods to the `lodash` wrapper.
  17430. lodash.prototype.at = wrapperAt;
  17431. lodash.prototype.chain = wrapperChain;
  17432. lodash.prototype.commit = wrapperCommit;
  17433. lodash.prototype.next = wrapperNext;
  17434. lodash.prototype.plant = wrapperPlant;
  17435. lodash.prototype.reverse = wrapperReverse;
  17436. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  17437. // Add lazy aliases.
  17438. lodash.prototype.first = lodash.prototype.head;
  17439. if (symIterator) {
  17440. lodash.prototype[symIterator] = wrapperToIterator;
  17441. }
  17442. return lodash;
  17443. });
  17444. /*--------------------------------------------------------------------------*/
  17445. // Export lodash.
  17446. var _ = runInContext();
  17447. // Some AMD build optimizers, like r.js, check for condition patterns like:
  17448. if (true) {
  17449. // Expose Lodash on the global object to prevent errors when Lodash is
  17450. // loaded by a script tag in the presence of an AMD loader.
  17451. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  17452. // Use `_.noConflict` to remove Lodash from the global object.
  17453. root._ = _;
  17454. // Define as an anonymous module so, through path mapping, it can be
  17455. // referenced as the "underscore" module.
  17456. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17457. return _;
  17458. }).call(exports, __webpack_require__, exports, module),
  17459. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17460. }
  17461. // Check for `exports` after `define` in case a build optimizer adds it.
  17462. else {}
  17463. }.call(this));
  17464. /***/ }),
  17465. /***/ "./node_modules/vue-loader/dist/exportHelper.js":
  17466. /*!******************************************************!*\
  17467. !*** ./node_modules/vue-loader/dist/exportHelper.js ***!
  17468. \******************************************************/
  17469. /***/ ((__unused_webpack_module, exports) => {
  17470. "use strict";
  17471. Object.defineProperty(exports, "__esModule", ({ value: true }));
  17472. // runtime helper for setting properties on components
  17473. // in a tree-shakable way
  17474. exports["default"] = (sfc, props) => {
  17475. const target = sfc.__vccOpts || sfc;
  17476. for (const [key, val] of props) {
  17477. target[key] = val;
  17478. }
  17479. return target;
  17480. };
  17481. /***/ }),
  17482. /***/ "./resources/js/components/AppButton.vue":
  17483. /*!***********************************************!*\
  17484. !*** ./resources/js/components/AppButton.vue ***!
  17485. \***********************************************/
  17486. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17487. "use strict";
  17488. __webpack_require__.r(__webpack_exports__);
  17489. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17490. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17491. /* harmony export */ });
  17492. /* harmony import */ var _AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppButton.vue?vue&type=template&id=c9506d50 */ "./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50");
  17493. /* harmony import */ var _AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppButton.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js");
  17494. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17495. ;
  17496. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppButton.vue"]])
  17497. /* hot reload */
  17498. if (false) {}
  17499. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17500. /***/ }),
  17501. /***/ "./resources/js/components/AppFooter.vue":
  17502. /*!***********************************************!*\
  17503. !*** ./resources/js/components/AppFooter.vue ***!
  17504. \***********************************************/
  17505. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17506. "use strict";
  17507. __webpack_require__.r(__webpack_exports__);
  17508. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17509. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17510. /* harmony export */ });
  17511. /* harmony import */ var _AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppFooter.vue?vue&type=template&id=4ab6097e */ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e");
  17512. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17513. const script = {}
  17514. ;
  17515. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__["default"])(script, [['render',_AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppFooter.vue"]])
  17516. /* hot reload */
  17517. if (false) {}
  17518. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17519. /***/ }),
  17520. /***/ "./resources/js/components/AppMessage.vue":
  17521. /*!************************************************!*\
  17522. !*** ./resources/js/components/AppMessage.vue ***!
  17523. \************************************************/
  17524. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17525. "use strict";
  17526. __webpack_require__.r(__webpack_exports__);
  17527. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17528. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17529. /* harmony export */ });
  17530. /* harmony import */ var _AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppMessage.vue?vue&type=template&id=07159051 */ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051");
  17531. /* harmony import */ var _AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppMessage.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js");
  17532. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17533. ;
  17534. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppMessage.vue"]])
  17535. /* hot reload */
  17536. if (false) {}
  17537. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17538. /***/ }),
  17539. /***/ "./resources/js/components/AppPagination.vue":
  17540. /*!***************************************************!*\
  17541. !*** ./resources/js/components/AppPagination.vue ***!
  17542. \***************************************************/
  17543. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17544. "use strict";
  17545. __webpack_require__.r(__webpack_exports__);
  17546. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17547. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17548. /* harmony export */ });
  17549. /* harmony import */ var _AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppPagination.vue?vue&type=template&id=4da56ec0 */ "./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0");
  17550. /* harmony import */ var _AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppPagination.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js");
  17551. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17552. ;
  17553. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppPagination.vue"]])
  17554. /* hot reload */
  17555. if (false) {}
  17556. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17557. /***/ }),
  17558. /***/ "./resources/js/components/AppSidebar.vue":
  17559. /*!************************************************!*\
  17560. !*** ./resources/js/components/AppSidebar.vue ***!
  17561. \************************************************/
  17562. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17563. "use strict";
  17564. __webpack_require__.r(__webpack_exports__);
  17565. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17566. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17567. /* harmony export */ });
  17568. /* harmony import */ var _AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppSidebar.vue?vue&type=template&id=22a4e926 */ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926");
  17569. /* harmony import */ var _AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppSidebar.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js");
  17570. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17571. ;
  17572. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppSidebar.vue"]])
  17573. /* hot reload */
  17574. if (false) {}
  17575. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17576. /***/ }),
  17577. /***/ "./resources/js/components/AppSubSidebar.vue":
  17578. /*!***************************************************!*\
  17579. !*** ./resources/js/components/AppSubSidebar.vue ***!
  17580. \***************************************************/
  17581. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17582. "use strict";
  17583. __webpack_require__.r(__webpack_exports__);
  17584. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17585. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17586. /* harmony export */ });
  17587. /* harmony import */ var _AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppSubSidebar.vue?vue&type=template&id=0addd9bc */ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc");
  17588. /* harmony import */ var _AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppSubSidebar.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js");
  17589. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17590. ;
  17591. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppSubSidebar.vue"]])
  17592. /* hot reload */
  17593. if (false) {}
  17594. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17595. /***/ }),
  17596. /***/ "./resources/js/components/AppTopBar.vue":
  17597. /*!***********************************************!*\
  17598. !*** ./resources/js/components/AppTopBar.vue ***!
  17599. \***********************************************/
  17600. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17601. "use strict";
  17602. __webpack_require__.r(__webpack_exports__);
  17603. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17604. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17605. /* harmony export */ });
  17606. /* harmony import */ var _AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppTopBar.vue?vue&type=template&id=42bf62a4 */ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4");
  17607. /* harmony import */ var _AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppTopBar.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js");
  17608. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17609. ;
  17610. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppTopBar.vue"]])
  17611. /* hot reload */
  17612. if (false) {}
  17613. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17614. /***/ }),
  17615. /***/ "./resources/js/layouts/AppLayout.vue":
  17616. /*!********************************************!*\
  17617. !*** ./resources/js/layouts/AppLayout.vue ***!
  17618. \********************************************/
  17619. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17620. "use strict";
  17621. __webpack_require__.r(__webpack_exports__);
  17622. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17623. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17624. /* harmony export */ });
  17625. /* harmony import */ var _AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppLayout.vue?vue&type=template&id=2cfb4112 */ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112");
  17626. /* harmony import */ var _AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppLayout.vue?vue&type=script&setup=true&lang=js */ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js");
  17627. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17628. ;
  17629. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/layouts/AppLayout.vue"]])
  17630. /* hot reload */
  17631. if (false) {}
  17632. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17633. /***/ }),
  17634. /***/ "./resources/js/pages/mutation/Report.vue":
  17635. /*!************************************************!*\
  17636. !*** ./resources/js/pages/mutation/Report.vue ***!
  17637. \************************************************/
  17638. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17639. "use strict";
  17640. __webpack_require__.r(__webpack_exports__);
  17641. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17642. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17643. /* harmony export */ });
  17644. /* harmony import */ var _Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Report.vue?vue&type=template&id=289c9421 */ "./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421");
  17645. /* harmony import */ var _Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Report.vue?vue&type=script&setup=true&lang=js */ "./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js");
  17646. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17647. ;
  17648. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/pages/mutation/Report.vue"]])
  17649. /* hot reload */
  17650. if (false) {}
  17651. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17652. /***/ }),
  17653. /***/ "./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js":
  17654. /*!**********************************************************************************!*\
  17655. !*** ./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js ***!
  17656. \**********************************************************************************/
  17657. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17658. "use strict";
  17659. __webpack_require__.r(__webpack_exports__);
  17660. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17661. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17662. /* harmony export */ });
  17663. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppButton.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js");
  17664. /***/ }),
  17665. /***/ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  17666. /*!***********************************************************************************!*\
  17667. !*** ./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  17668. \***********************************************************************************/
  17669. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17670. "use strict";
  17671. __webpack_require__.r(__webpack_exports__);
  17672. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17673. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17674. /* harmony export */ });
  17675. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppMessage.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js");
  17676. /***/ }),
  17677. /***/ "./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js":
  17678. /*!**************************************************************************************!*\
  17679. !*** ./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js ***!
  17680. \**************************************************************************************/
  17681. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17682. "use strict";
  17683. __webpack_require__.r(__webpack_exports__);
  17684. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17685. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17686. /* harmony export */ });
  17687. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppPagination.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js");
  17688. /***/ }),
  17689. /***/ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  17690. /*!***********************************************************************************!*\
  17691. !*** ./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  17692. \***********************************************************************************/
  17693. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17694. "use strict";
  17695. __webpack_require__.r(__webpack_exports__);
  17696. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17697. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17698. /* harmony export */ });
  17699. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSidebar.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js");
  17700. /***/ }),
  17701. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  17702. /*!**************************************************************************************!*\
  17703. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  17704. \**************************************************************************************/
  17705. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17706. "use strict";
  17707. __webpack_require__.r(__webpack_exports__);
  17708. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17709. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17710. /* harmony export */ });
  17711. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSubSidebar.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js");
  17712. /***/ }),
  17713. /***/ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  17714. /*!**********************************************************************************!*\
  17715. !*** ./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  17716. \**********************************************************************************/
  17717. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17718. "use strict";
  17719. __webpack_require__.r(__webpack_exports__);
  17720. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17721. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17722. /* harmony export */ });
  17723. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppTopBar.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js");
  17724. /***/ }),
  17725. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  17726. /*!*******************************************************************************!*\
  17727. !*** ./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  17728. \*******************************************************************************/
  17729. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17730. "use strict";
  17731. __webpack_require__.r(__webpack_exports__);
  17732. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17733. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17734. /* harmony export */ });
  17735. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppLayout.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js");
  17736. /***/ }),
  17737. /***/ "./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js":
  17738. /*!***********************************************************************************!*\
  17739. !*** ./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js ***!
  17740. \***********************************************************************************/
  17741. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17742. "use strict";
  17743. __webpack_require__.r(__webpack_exports__);
  17744. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17745. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17746. /* harmony export */ });
  17747. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./Report.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js");
  17748. /***/ }),
  17749. /***/ "./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50":
  17750. /*!*****************************************************************************!*\
  17751. !*** ./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50 ***!
  17752. \*****************************************************************************/
  17753. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17754. "use strict";
  17755. __webpack_require__.r(__webpack_exports__);
  17756. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17757. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__.render)
  17758. /* harmony export */ });
  17759. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppButton.vue?vue&type=template&id=c9506d50 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50");
  17760. /***/ }),
  17761. /***/ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  17762. /*!*****************************************************************************!*\
  17763. !*** ./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  17764. \*****************************************************************************/
  17765. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17766. "use strict";
  17767. __webpack_require__.r(__webpack_exports__);
  17768. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17769. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__.render)
  17770. /* harmony export */ });
  17771. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppFooter.vue?vue&type=template&id=4ab6097e */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e");
  17772. /***/ }),
  17773. /***/ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  17774. /*!******************************************************************************!*\
  17775. !*** ./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  17776. \******************************************************************************/
  17777. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17778. "use strict";
  17779. __webpack_require__.r(__webpack_exports__);
  17780. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17781. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__.render)
  17782. /* harmony export */ });
  17783. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppMessage.vue?vue&type=template&id=07159051 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=template&id=07159051");
  17784. /***/ }),
  17785. /***/ "./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0":
  17786. /*!*********************************************************************************!*\
  17787. !*** ./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0 ***!
  17788. \*********************************************************************************/
  17789. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17790. "use strict";
  17791. __webpack_require__.r(__webpack_exports__);
  17792. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17793. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__.render)
  17794. /* harmony export */ });
  17795. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppPagination.vue?vue&type=template&id=4da56ec0 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0");
  17796. /***/ }),
  17797. /***/ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  17798. /*!******************************************************************************!*\
  17799. !*** ./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  17800. \******************************************************************************/
  17801. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17802. "use strict";
  17803. __webpack_require__.r(__webpack_exports__);
  17804. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17805. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__.render)
  17806. /* harmony export */ });
  17807. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSidebar.vue?vue&type=template&id=22a4e926 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926");
  17808. /***/ }),
  17809. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  17810. /*!*********************************************************************************!*\
  17811. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  17812. \*********************************************************************************/
  17813. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17814. "use strict";
  17815. __webpack_require__.r(__webpack_exports__);
  17816. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17817. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__.render)
  17818. /* harmony export */ });
  17819. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSubSidebar.vue?vue&type=template&id=0addd9bc */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc");
  17820. /***/ }),
  17821. /***/ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  17822. /*!*****************************************************************************!*\
  17823. !*** ./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  17824. \*****************************************************************************/
  17825. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17826. "use strict";
  17827. __webpack_require__.r(__webpack_exports__);
  17828. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17829. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__.render)
  17830. /* harmony export */ });
  17831. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppTopBar.vue?vue&type=template&id=42bf62a4 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4");
  17832. /***/ }),
  17833. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  17834. /*!**************************************************************************!*\
  17835. !*** ./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  17836. \**************************************************************************/
  17837. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17838. "use strict";
  17839. __webpack_require__.r(__webpack_exports__);
  17840. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17841. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__.render)
  17842. /* harmony export */ });
  17843. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppLayout.vue?vue&type=template&id=2cfb4112 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112");
  17844. /***/ }),
  17845. /***/ "./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421":
  17846. /*!******************************************************************************!*\
  17847. !*** ./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421 ***!
  17848. \******************************************************************************/
  17849. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17850. "use strict";
  17851. __webpack_require__.r(__webpack_exports__);
  17852. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17853. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__.render)
  17854. /* harmony export */ });
  17855. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./Report.vue?vue&type=template&id=289c9421 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421");
  17856. /***/ })
  17857. }]);