resources_js_pages_member_Edit_vue.js 658KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608
  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["resources_js_pages_member_Edit_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/AppDropdown.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/AppDropdown.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 vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  13. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  14. props: {
  15. label: {
  16. type: String,
  17. required: true
  18. },
  19. optionLabel: {
  20. type: String,
  21. "default": 'label'
  22. },
  23. optionValue: {
  24. type: String,
  25. "default": 'value'
  26. },
  27. optionDisabled: {
  28. type: String,
  29. "default": 'disabled'
  30. },
  31. options: {
  32. type: Array,
  33. required: true
  34. },
  35. placeholder: {
  36. type: String,
  37. required: true
  38. },
  39. disabled: {
  40. type: Boolean,
  41. "default": false
  42. },
  43. error: {
  44. type: String,
  45. "default": null
  46. },
  47. modelValue: null
  48. },
  49. emits: ['update:modelValue'],
  50. setup: function setup(__props, _ref) {
  51. var expose = _ref.expose;
  52. expose();
  53. var props = __props;
  54. var isError = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  55. return props.error ? true : false;
  56. });
  57. var forLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  58. return props.label ? props.label.toLowerCase().replace(/\s+/g, '-') : null;
  59. });
  60. var ariaDescribedbyLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  61. return props.label ? props.label.toLowerCase().replace(/\s+/g, '-') + '-help' : null;
  62. });
  63. var selectedDropdownLabel = function selectedDropdownLabel(value) {
  64. var result = props.options.find(function (option) {
  65. return option[props.optionValue] == value;
  66. });
  67. if (result) {
  68. return result[props.optionLabel];
  69. }
  70. };
  71. var __returned__ = {
  72. props: props,
  73. isError: isError,
  74. forLabel: forLabel,
  75. ariaDescribedbyLabel: ariaDescribedbyLabel,
  76. selectedDropdownLabel: selectedDropdownLabel,
  77. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed
  78. };
  79. Object.defineProperty(__returned__, '__isScriptSetup', {
  80. enumerable: false,
  81. value: true
  82. });
  83. return __returned__;
  84. }
  85. });
  86. /***/ }),
  87. /***/ "./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/AppInputText.vue?vue&type=script&setup=true&lang=js":
  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/AppInputText.vue?vue&type=script&setup=true&lang=js ***!
  90. \*****************************************************************************************************************************************************************************************************************/
  91. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  92. "use strict";
  93. __webpack_require__.r(__webpack_exports__);
  94. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  95. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  96. /* harmony export */ });
  97. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  98. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  99. props: {
  100. type: {
  101. type: String,
  102. "default": 'text'
  103. },
  104. label: {
  105. type: String,
  106. required: true
  107. },
  108. disabled: {
  109. type: Boolean,
  110. "default": false
  111. },
  112. placeholder: {
  113. type: String,
  114. required: true
  115. },
  116. error: {
  117. type: String,
  118. "default": null
  119. },
  120. modelValue: null
  121. },
  122. emits: ['update:modelValue'],
  123. setup: function setup(__props, _ref) {
  124. var expose = _ref.expose;
  125. expose();
  126. var props = __props;
  127. var isError = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  128. return props.error ? true : false;
  129. });
  130. var forLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  131. return props.label.toLowerCase().replace(/\s+/g, '-');
  132. });
  133. var ariaDescribedbyLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  134. return props.label.toLowerCase().replace(/\s+/g, '-') + '-help';
  135. });
  136. var __returned__ = {
  137. props: props,
  138. isError: isError,
  139. forLabel: forLabel,
  140. ariaDescribedbyLabel: ariaDescribedbyLabel,
  141. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed
  142. };
  143. Object.defineProperty(__returned__, '__isScriptSetup', {
  144. enumerable: false,
  145. value: true
  146. });
  147. return __returned__;
  148. }
  149. });
  150. /***/ }),
  151. /***/ "./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":
  152. /*!***************************************************************************************************************************************************************************************************************!*\
  153. !*** ./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 ***!
  154. \***************************************************************************************************************************************************************************************************************/
  155. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  156. "use strict";
  157. __webpack_require__.r(__webpack_exports__);
  158. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  159. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  160. /* harmony export */ });
  161. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  162. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  163. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  164. setup: function setup(__props, _ref) {
  165. var expose = _ref.expose;
  166. expose();
  167. var flashMessage = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  168. return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash;
  169. });
  170. var messageDisplay = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)({});
  171. var onClose = function onClose() {
  172. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.errors = {};
  173. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.success = null;
  174. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.error = null;
  175. messageDisplay.value = {
  176. display: 'none'
  177. };
  178. };
  179. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(flashMessage, function () {
  180. messageDisplay.value = {
  181. display: ''
  182. };
  183. }, {
  184. deep: true
  185. });
  186. var __returned__ = {
  187. flashMessage: flashMessage,
  188. messageDisplay: messageDisplay,
  189. onClose: onClose,
  190. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  191. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  192. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  193. usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage
  194. };
  195. Object.defineProperty(__returned__, '__isScriptSetup', {
  196. enumerable: false,
  197. value: true
  198. });
  199. return __returned__;
  200. }
  201. });
  202. /***/ }),
  203. /***/ "./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":
  204. /*!***************************************************************************************************************************************************************************************************************!*\
  205. !*** ./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 ***!
  206. \***************************************************************************************************************************************************************************************************************/
  207. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  208. "use strict";
  209. __webpack_require__.r(__webpack_exports__);
  210. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  211. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  212. /* harmony export */ });
  213. /* harmony import */ var _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/AppSubSidebar.vue */ "./resources/js/components/AppSubSidebar.vue");
  214. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  215. props: {
  216. model: Array
  217. },
  218. emits: ['menuitem-click'],
  219. setup: function setup(__props, _ref) {
  220. var expose = _ref.expose,
  221. emits = _ref.emit;
  222. expose();
  223. var onKeyDown = function onKeyDown(event) {
  224. var nodeElement = event.target;
  225. if (event.code === 'Enter' || event.code === 'Space') {
  226. nodeElement.click();
  227. event.preventDefault();
  228. }
  229. };
  230. var onMenuItemClick = function onMenuItemClick(event) {
  231. emits('menuitem-click', event);
  232. };
  233. var __returned__ = {
  234. emits: emits,
  235. onKeyDown: onKeyDown,
  236. onMenuItemClick: onMenuItemClick,
  237. AppSubSidebar: _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  238. };
  239. Object.defineProperty(__returned__, '__isScriptSetup', {
  240. enumerable: false,
  241. value: true
  242. });
  243. return __returned__;
  244. }
  245. });
  246. /***/ }),
  247. /***/ "./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":
  248. /*!******************************************************************************************************************************************************************************************************************!*\
  249. !*** ./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 ***!
  250. \******************************************************************************************************************************************************************************************************************/
  251. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  252. "use strict";
  253. __webpack_require__.r(__webpack_exports__);
  254. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  255. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  256. /* harmony export */ });
  257. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  258. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  259. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  260. props: {
  261. items: Array,
  262. root: {
  263. type: Boolean,
  264. "default": false
  265. }
  266. },
  267. emits: ['menuitem-click'],
  268. setup: function setup(__props, _ref) {
  269. var expose = _ref.expose,
  270. emits = _ref.emit;
  271. expose();
  272. var activeIndex = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(null);
  273. var onMenuItemClick = function onMenuItemClick(event, item, index) {
  274. if (item.disabled) {
  275. event.preventDefault();
  276. return;
  277. }
  278. if (!item.to && !item.url) {
  279. event.preventDefault();
  280. }
  281. if (item.command) {
  282. item.command({
  283. originalEvent: event,
  284. item: item
  285. });
  286. }
  287. activeIndex.value = index === activeIndex.value ? null : index;
  288. emits('menuitem-click', {
  289. originalEvent: event,
  290. item: item
  291. });
  292. };
  293. var visible = function visible(item) {
  294. return typeof item.visible === 'function' ? item.visible() : item.visible !== false;
  295. };
  296. var __returned__ = {
  297. emits: emits,
  298. activeIndex: activeIndex,
  299. onMenuItemClick: onMenuItemClick,
  300. visible: visible,
  301. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  302. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.Link
  303. };
  304. Object.defineProperty(__returned__, '__isScriptSetup', {
  305. enumerable: false,
  306. value: true
  307. });
  308. return __returned__;
  309. }
  310. });
  311. /***/ }),
  312. /***/ "./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":
  313. /*!**************************************************************************************************************************************************************************************************************!*\
  314. !*** ./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 ***!
  315. \**************************************************************************************************************************************************************************************************************/
  316. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  317. "use strict";
  318. __webpack_require__.r(__webpack_exports__);
  319. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  320. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  321. /* harmony export */ });
  322. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  323. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  324. emits: ['menu-toggle'],
  325. setup: function setup(__props, _ref) {
  326. var expose = _ref.expose;
  327. expose();
  328. var __returned__ = {
  329. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  330. };
  331. Object.defineProperty(__returned__, '__isScriptSetup', {
  332. enumerable: false,
  333. value: true
  334. });
  335. return __returned__;
  336. }
  337. });
  338. /***/ }),
  339. /***/ "./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":
  340. /*!***********************************************************************************************************************************************************************************************************!*\
  341. !*** ./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 ***!
  342. \***********************************************************************************************************************************************************************************************************/
  343. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  344. "use strict";
  345. __webpack_require__.r(__webpack_exports__);
  346. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  347. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  348. /* harmony export */ });
  349. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  350. /* harmony import */ var _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppTopBar.vue */ "./resources/js/components/AppTopBar.vue");
  351. /* harmony import */ var _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppSidebar.vue */ "./resources/js/components/AppSidebar.vue");
  352. /* harmony import */ var _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppFooter.vue */ "./resources/js/components/AppFooter.vue");
  353. /* harmony import */ var _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppMessage.vue */ "./resources/js/components/AppMessage.vue");
  354. /* harmony import */ var _utils_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/menu */ "./resources/js/utils/menu.js");
  355. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  356. setup: function setup(__props, _ref) {
  357. var expose = _ref.expose;
  358. expose();
  359. var mobileMenuActive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  360. var staticMenuInactive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  361. var menuClick = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  362. var isDesktop = function isDesktop() {
  363. return window.innerWidth >= 992;
  364. };
  365. var addClass = function addClass(element, className) {
  366. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  367. };
  368. var removeClass = function removeClass(element, className) {
  369. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  370. };
  371. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate)(function () {
  372. if (mobileMenuActive.value) {
  373. addClass(document.body, 'body-overflow-hidden');
  374. } else {
  375. removeClass(document.body, 'body-overflow-hidden');
  376. }
  377. });
  378. var containerClass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  379. return ['layout-wrapper', 'layout-static', {
  380. 'layout-static-sidebar-inactive': staticMenuInactive.value,
  381. 'layout-mobile-sidebar-active': mobileMenuActive.value
  382. }];
  383. });
  384. var onWrapperClick = function onWrapperClick() {
  385. if (!menuClick.value) {
  386. mobileMenuActive.value = false;
  387. }
  388. menuClick.value = false;
  389. };
  390. var onMenuToggle = function onMenuToggle(event) {
  391. menuClick.value = true;
  392. if (isDesktop()) {
  393. staticMenuInactive.value = !staticMenuInactive.value;
  394. } else {
  395. mobileMenuActive.value = !mobileMenuActive.value;
  396. }
  397. event.preventDefault();
  398. };
  399. var onSidebarClick = function onSidebarClick() {
  400. menuClick.value = true;
  401. };
  402. var onMenuItemClick = function onMenuItemClick(event) {
  403. if (event.item && !event.item.items) {
  404. mobileMenuActive.value = false;
  405. }
  406. };
  407. var __returned__ = {
  408. mobileMenuActive: mobileMenuActive,
  409. staticMenuInactive: staticMenuInactive,
  410. menuClick: menuClick,
  411. isDesktop: isDesktop,
  412. addClass: addClass,
  413. removeClass: removeClass,
  414. containerClass: containerClass,
  415. onWrapperClick: onWrapperClick,
  416. onMenuToggle: onMenuToggle,
  417. onSidebarClick: onSidebarClick,
  418. onMenuItemClick: onMenuItemClick,
  419. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  420. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  421. onBeforeUpdate: vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate,
  422. AppTopBar: _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  423. AppSidebar: _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  424. AppFooter: _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  425. AppMessage: _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
  426. menu: _utils_menu__WEBPACK_IMPORTED_MODULE_5__["default"]
  427. };
  428. Object.defineProperty(__returned__, '__isScriptSetup', {
  429. enumerable: false,
  430. value: true
  431. });
  432. return __returned__;
  433. }
  434. });
  435. /***/ }),
  436. /***/ "./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/member/Edit.vue?vue&type=script&setup=true&lang=js":
  437. /*!***********************************************************************************************************************************************************************************************************!*\
  438. !*** ./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/member/Edit.vue?vue&type=script&setup=true&lang=js ***!
  439. \***********************************************************************************************************************************************************************************************************/
  440. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  441. "use strict";
  442. __webpack_require__.r(__webpack_exports__);
  443. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  444. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  445. /* harmony export */ });
  446. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  447. /* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
  448. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  449. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  450. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
  451. /* harmony import */ var primevue_useconfirm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primevue/useconfirm */ "./node_modules/primevue/useconfirm/useconfirm.esm.js");
  452. /* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
  453. /* harmony import */ var _components_AppDropdown_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/components/AppDropdown.vue */ "./resources/js/components/AppDropdown.vue");
  454. /* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
  455. /* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/member/TableHeader.js");
  456. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  457. props: {
  458. member: Object,
  459. typeMembers: Array,
  460. typeMember: Object
  461. },
  462. setup: function setup(__props, _ref) {
  463. var expose = _ref.expose;
  464. expose();
  465. var props = __props;
  466. var errors = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  467. return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage)().props.value.errors;
  468. });
  469. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(errors, function () {
  470. form.clearErrors();
  471. });
  472. var listPlatNumber = (0,vue__WEBPACK_IMPORTED_MODULE_0__.reactive)([]);
  473. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
  474. props.member.vehicles.forEach(function (val) {
  475. return listPlatNumber.push(val);
  476. });
  477. });
  478. var listPlatNumberClear = function listPlatNumberClear() {
  479. listPlatNumber.splice(0);
  480. };
  481. var listPlatNumberOnDelete = function listPlatNumberOnDelete(index) {
  482. listPlatNumber.splice(index, 1);
  483. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage)().props.value.errors = {};
  484. };
  485. var addPlatNumberValidation = function addPlatNumberValidation() {
  486. if (!form.plat_number) {
  487. form.setError('plat_number', 'Plat kendaraan tidak boleh kosong');
  488. return {
  489. error: true
  490. };
  491. }
  492. if (!form.max_vehicle_id) {
  493. form.setError('max_vehicle_id', 'Tidak boleh kosong');
  494. return {
  495. error: true
  496. };
  497. }
  498. var listPlatNumberExist = listPlatNumber.filter(function (val) {
  499. return val.platNumber === form.plat_number.toUpperCase();
  500. });
  501. if (listPlatNumberExist.length) {
  502. form.setError('plat_number', 'Nomor plat kendaraan tidak boleh sama');
  503. return {
  504. error: true
  505. };
  506. }
  507. var maxVehicles = listPlatNumber.filter(function (val) {
  508. return val.maxVehicleId === form.max_vehicle_id;
  509. });
  510. if (maxVehicles.length) {
  511. if (maxVehicles.length + 1 > maxVehicles[0].maxVehicle) {
  512. form.setError('plat_number', 'Melibihi batas maksimal kendaraan');
  513. return {
  514. error: true
  515. };
  516. }
  517. }
  518. return {
  519. error: false
  520. };
  521. };
  522. var addPlatNumber = function addPlatNumber() {
  523. form.clearErrors('plat_number', 'max_vehicle_id');
  524. var validation = addPlatNumberValidation();
  525. if (validation.error) {
  526. return;
  527. }
  528. var typeVehicle = props.typeMember.maxVehicles.filter(function (val) {
  529. return val.value === form.max_vehicle_id;
  530. })[0];
  531. listPlatNumber.push({
  532. platNumber: form.plat_number.toUpperCase(),
  533. typeVehicle: typeVehicle.label,
  534. typeVehicleId: typeVehicle.typeVehicleId,
  535. maxVehicleId: typeVehicle.value,
  536. maxVehicle: typeVehicle.maxVehicle
  537. });
  538. form.reset('plat_number', 'max_vehicle_id');
  539. };
  540. var form = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm)({
  541. name: props.member.name,
  542. phone: props.member.phone,
  543. plat_number: null,
  544. max_vehicle_id: null,
  545. type_member_id: props.member.typeMemberId
  546. });
  547. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(function () {
  548. return form.type_member_id;
  549. }, function () {
  550. listPlatNumberClear();
  551. form.reset('plat_number', 'max_vehicle_id');
  552. _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.reload({
  553. only: ['typeMember'],
  554. data: {
  555. id: form.type_member_id
  556. }
  557. });
  558. });
  559. var errorSubmitVisible = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  560. var errorSubmitText = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)();
  561. var submitValidation = function submitValidation() {
  562. var listPlatNumberGroup = (0,lodash__WEBPACK_IMPORTED_MODULE_3__.groupBy)(listPlatNumber, 'typeVehicleId');
  563. var listVehicles = [];
  564. var error = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  565. for (var key in listPlatNumberGroup) {
  566. listVehicles.push({
  567. typeVehicleId: listPlatNumberGroup[key][0]['typeVehicleId'],
  568. maxVehicle: listPlatNumberGroup[key][0]['maxVehicle'],
  569. count: listPlatNumberGroup[key].length
  570. });
  571. }
  572. listVehicles.forEach(function (val) {
  573. if (val.count > val.maxVehicle) {
  574. errorSubmitVisible.value = true;
  575. errorSubmitText.value = 'Ada perubahan pada batas maksimal kendaraan';
  576. error.value = true;
  577. }
  578. });
  579. if (error.value) {
  580. return {
  581. error: true
  582. };
  583. } else {
  584. return {
  585. error: false
  586. };
  587. }
  588. };
  589. var confirm = (0,primevue_useconfirm__WEBPACK_IMPORTED_MODULE_4__.useConfirm)();
  590. var formSent = function formSent() {
  591. form.transform(function (data) {
  592. return {
  593. name: data.name,
  594. phone: data.phone,
  595. vehicles: listPlatNumber,
  596. type_member_id: data.type_member_id
  597. };
  598. }).put(route('members.update', props.member.id));
  599. };
  600. var submit = function submit() {
  601. var validation = submitValidation();
  602. if (validation.error) {
  603. return;
  604. }
  605. if (props.member.typeMemberId != form.type_member_id) {
  606. confirm.require({
  607. message: "Tagihan dikenakan untuk jenis member yang berbeda sebesar ".concat(props.typeMember.price),
  608. header: 'Tagihan',
  609. acceptLabel: 'Bayar dan simpan',
  610. rejectLabel: 'Batalkan',
  611. accept: function accept() {
  612. formSent();
  613. },
  614. reject: function reject() {
  615. console.info('transaksi digagalkan');
  616. }
  617. });
  618. } else {
  619. formSent();
  620. }
  621. };
  622. var __returned__ = {
  623. props: props,
  624. errors: errors,
  625. listPlatNumber: listPlatNumber,
  626. listPlatNumberClear: listPlatNumberClear,
  627. listPlatNumberOnDelete: listPlatNumberOnDelete,
  628. addPlatNumberValidation: addPlatNumberValidation,
  629. addPlatNumber: addPlatNumber,
  630. form: form,
  631. errorSubmitVisible: errorSubmitVisible,
  632. errorSubmitText: errorSubmitText,
  633. submitValidation: submitValidation,
  634. confirm: confirm,
  635. formSent: formSent,
  636. submit: submit,
  637. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  638. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  639. reactive: vue__WEBPACK_IMPORTED_MODULE_0__.reactive,
  640. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  641. onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
  642. Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
  643. Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
  644. useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
  645. usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage,
  646. groupBy: lodash__WEBPACK_IMPORTED_MODULE_3__.groupBy,
  647. useConfirm: primevue_useconfirm__WEBPACK_IMPORTED_MODULE_4__.useConfirm,
  648. AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
  649. AppDropdown: _components_AppDropdown_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
  650. AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
  651. PlatNumberTable: _TableHeader__WEBPACK_IMPORTED_MODULE_8__.PlatNumberTable
  652. };
  653. Object.defineProperty(__returned__, '__isScriptSetup', {
  654. enumerable: false,
  655. value: true
  656. });
  657. return __returned__;
  658. }
  659. });
  660. /***/ }),
  661. /***/ "./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/AppDropdown.vue?vue&type=template&id=ce0d1992":
  662. /*!*********************************************************************************************************************************************************************************************************************************************************************************!*\
  663. !*** ./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/AppDropdown.vue?vue&type=template&id=ce0d1992 ***!
  664. \*********************************************************************************************************************************************************************************************************************************************************************************/
  665. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  666. "use strict";
  667. __webpack_require__.r(__webpack_exports__);
  668. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  669. /* harmony export */ "render": () => (/* binding */ render)
  670. /* harmony export */ });
  671. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  672. var _hoisted_1 = {
  673. "class": "field"
  674. };
  675. var _hoisted_2 = ["for"];
  676. var _hoisted_3 = {
  677. key: 0
  678. };
  679. var _hoisted_4 = {
  680. key: 1
  681. };
  682. var _hoisted_5 = ["id"];
  683. function render(_ctx, _cache, $props, $setup, $data, $options) {
  684. var _component_Dropdown = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dropdown");
  685. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [$props.label ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("label", {
  686. key: 0,
  687. "for": $setup.forLabel
  688. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 9
  689. /* TEXT, PROPS */
  690. , _hoisted_2)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Dropdown, {
  691. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["w-full", {
  692. 'p-invalid': $setup.isError
  693. }]),
  694. id: $setup.forLabel,
  695. "aria-describedby": $setup.ariaDescribedbyLabel,
  696. "option-disabled": $props.optionDisabled,
  697. "option-label": $props.optionLabel,
  698. "option-value": $props.optionValue,
  699. placeholder: $props.placeholder,
  700. options: $props.options,
  701. "model-value": $props.modelValue,
  702. disabled: $props.disabled,
  703. onChange: _cache[0] || (_cache[0] = function ($event) {
  704. return _ctx.$emit('update:modelValue', $event.value);
  705. })
  706. }, {
  707. value: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (slotProps) {
  708. return [slotProps.value ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_3, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($setup.selectedDropdownLabel(slotProps.value)), 1
  709. /* TEXT */
  710. )) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_4, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(slotProps.placeholder), 1
  711. /* TEXT */
  712. ))];
  713. }),
  714. option: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
  715. var option = _ref.option,
  716. index = _ref.index;
  717. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, "option", {
  718. option: option,
  719. index: index
  720. })];
  721. }),
  722. _: 3
  723. /* FORWARDED */
  724. }, 8
  725. /* PROPS */
  726. , ["class", "id", "aria-describedby", "option-disabled", "option-label", "option-value", "placeholder", "options", "model-value", "disabled"]), $props.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("small", {
  727. key: 1,
  728. id: $setup.ariaDescribedbyLabel,
  729. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)({
  730. 'p-error': $setup.isError
  731. })
  732. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.error), 11
  733. /* TEXT, CLASS, PROPS */
  734. , _hoisted_5)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]);
  735. }
  736. /***/ }),
  737. /***/ "./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":
  738. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  739. !*** ./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 ***!
  740. \*******************************************************************************************************************************************************************************************************************************************************************************/
  741. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  742. "use strict";
  743. __webpack_require__.r(__webpack_exports__);
  744. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  745. /* harmony export */ "render": () => (/* binding */ render)
  746. /* harmony export */ });
  747. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  748. var _hoisted_1 = {
  749. "class": "layout-footer"
  750. };
  751. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Developed by ");
  752. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("a", {
  753. href: "https://dijitalcode.com",
  754. target: "_blank",
  755. "class": "font-medium ml-2"
  756. }, "DijitalCODE", -1
  757. /* HOISTED */
  758. );
  759. var _hoisted_4 = [_hoisted_2, _hoisted_3];
  760. function render(_ctx, _cache) {
  761. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, _hoisted_4);
  762. }
  763. /***/ }),
  764. /***/ "./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/AppInputText.vue?vue&type=template&id=16729fe1":
  765. /*!**********************************************************************************************************************************************************************************************************************************************************************************!*\
  766. !*** ./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/AppInputText.vue?vue&type=template&id=16729fe1 ***!
  767. \**********************************************************************************************************************************************************************************************************************************************************************************/
  768. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  769. "use strict";
  770. __webpack_require__.r(__webpack_exports__);
  771. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  772. /* harmony export */ "render": () => (/* binding */ render)
  773. /* harmony export */ });
  774. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  775. var _hoisted_1 = {
  776. "class": "field"
  777. };
  778. var _hoisted_2 = ["for"];
  779. var _hoisted_3 = ["id"];
  780. function render(_ctx, _cache, $props, $setup, $data, $options) {
  781. var _component_InputText = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("InputText");
  782. 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)("label", {
  783. "for": $setup.forLabel
  784. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 9
  785. /* TEXT, PROPS */
  786. , _hoisted_2), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_InputText, {
  787. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["w-full", {
  788. 'p-invalid': $setup.isError
  789. }]),
  790. id: $setup.forLabel,
  791. "aria-describedby": $setup.ariaDescribedbyLabel,
  792. "model-value": $props.modelValue,
  793. type: $props.type,
  794. placeholder: $props.placeholder,
  795. value: $props.modelValue,
  796. disabled: $props.disabled,
  797. onInput: _cache[0] || (_cache[0] = function ($event) {
  798. return _ctx.$emit('update:modelValue', $event.target.value);
  799. })
  800. }, null, 8
  801. /* PROPS */
  802. , ["class", "id", "aria-describedby", "model-value", "type", "placeholder", "value", "disabled"]), $props.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("small", {
  803. key: 0,
  804. id: $setup.ariaDescribedbyLabel,
  805. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)({
  806. 'p-error': $setup.isError
  807. })
  808. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.error), 11
  809. /* TEXT, CLASS, PROPS */
  810. , _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]);
  811. }
  812. /***/ }),
  813. /***/ "./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":
  814. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  815. !*** ./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 ***!
  816. \********************************************************************************************************************************************************************************************************************************************************************************/
  817. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  818. "use strict";
  819. __webpack_require__.r(__webpack_exports__);
  820. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  821. /* harmony export */ "render": () => (/* binding */ render)
  822. /* harmony export */ });
  823. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  824. var _hoisted_1 = {
  825. "class": "grid"
  826. };
  827. var _hoisted_2 = {
  828. "class": "col-12"
  829. };
  830. var _hoisted_3 = {
  831. key: 0
  832. };
  833. var _hoisted_4 = {
  834. key: 1
  835. };
  836. function render(_ctx, _cache, $props, $setup, $data, $options) {
  837. var _component_Message = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Message");
  838. 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, {
  839. key: 0,
  840. severity: "success",
  841. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  842. onClose: $setup.onClose
  843. }, {
  844. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  845. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.success), 1
  846. /* TEXT */
  847. )];
  848. }),
  849. _: 1
  850. /* STABLE */
  851. }, 8
  852. /* PROPS */
  853. , ["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, {
  854. key: 1
  855. }, [_ctx.$page.props.flash.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  856. key: 0,
  857. severity: "error",
  858. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  859. onClose: $setup.onClose
  860. }, {
  861. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  862. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.error), 1
  863. /* TEXT */
  864. )];
  865. }),
  866. _: 1
  867. /* STABLE */
  868. }, 8
  869. /* PROPS */
  870. , ["style"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  871. key: 1,
  872. severity: "error",
  873. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  874. onClose: $setup.onClose
  875. }, {
  876. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  877. 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
  878. /* TEXT */
  879. ))];
  880. }),
  881. _: 1
  882. /* STABLE */
  883. }, 8
  884. /* PROPS */
  885. , ["style"]))], 2112
  886. /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
  887. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]);
  888. }
  889. /***/ }),
  890. /***/ "./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":
  891. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  892. !*** ./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 ***!
  893. \********************************************************************************************************************************************************************************************************************************************************************************/
  894. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  895. "use strict";
  896. __webpack_require__.r(__webpack_exports__);
  897. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  898. /* harmony export */ "render": () => (/* binding */ render)
  899. /* harmony export */ });
  900. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  901. var _hoisted_1 = {
  902. "class": "layout-menu-container"
  903. };
  904. function render(_ctx, _cache, $props, $setup, $data, $options) {
  905. 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"], {
  906. "class": "layout-menu",
  907. items: $props.model,
  908. root: true,
  909. onKeydown: $setup.onKeyDown,
  910. onMenuitemClick: $setup.onMenuItemClick
  911. }, null, 8
  912. /* PROPS */
  913. , ["items"])]);
  914. }
  915. /***/ }),
  916. /***/ "./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":
  917. /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\
  918. !*** ./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 ***!
  919. \***********************************************************************************************************************************************************************************************************************************************************************************/
  920. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  921. "use strict";
  922. __webpack_require__.r(__webpack_exports__);
  923. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  924. /* harmony export */ "render": () => (/* binding */ render)
  925. /* harmony export */ });
  926. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  927. var _hoisted_1 = {
  928. key: 0
  929. };
  930. var _hoisted_2 = ["aria-label"];
  931. var _hoisted_3 = {
  932. key: 0,
  933. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  934. };
  935. var _hoisted_4 = ["href", "target", "aria-label", "onClick"];
  936. var _hoisted_5 = {
  937. key: 0,
  938. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  939. };
  940. function render(_ctx, _cache, $props, $setup, $data, $options) {
  941. var _component_AppSubSidebar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("AppSubSidebar", true);
  942. var _component_Badge = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Badge");
  943. var _directive_ripple = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("ripple");
  944. 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) {
  945. 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", {
  946. key: item.label || i,
  947. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([{
  948. 'layout-menuitem-category': $props.root,
  949. 'active-menuitem': $setup.activeIndex === i && !item.to && !item.disabled
  950. }]),
  951. role: "none"
  952. }, [$props.root ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  953. key: 0
  954. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  955. "class": "layout-menuitem-root-text",
  956. "aria-label": item.label
  957. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 9
  958. /* TEXT, PROPS */
  959. , _hoisted_2), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  960. items: $setup.visible(item) && item.items,
  961. onMenuitemClick: _cache[0] || (_cache[0] = function ($event) {
  962. return _ctx.$emit('menuitem-click', $event);
  963. })
  964. }, null, 8
  965. /* PROPS */
  966. , ["items"])], 64
  967. /* STABLE_FRAGMENT */
  968. )) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  969. key: 1
  970. }, [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"], {
  971. key: 0,
  972. role: "menuitem",
  973. href: item.to,
  974. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  975. 'p-disabled': item.disabled,
  976. 'router-link-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to),
  977. 'router-link-exact-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to)
  978. }]),
  979. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  980. target: item.target,
  981. "aria-label": item.label,
  982. onClick: function onClick($event) {
  983. return $setup.onMenuItemClick($event, item, i);
  984. }
  985. }, {
  986. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  987. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  988. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  989. }, null, 2
  990. /* CLASS */
  991. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  992. /* TEXT */
  993. ), 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, {
  994. key: 1,
  995. value: item.badge
  996. }, null, 8
  997. /* PROPS */
  998. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  999. }),
  1000. _: 2
  1001. /* DYNAMIC */
  1002. }, 1032
  1003. /* PROPS, DYNAMIC_SLOTS */
  1004. , ["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", {
  1005. key: 1,
  1006. role: "menuitem",
  1007. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  1008. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  1009. 'p-disabled': item.disabled
  1010. }]),
  1011. href: item.url || '#',
  1012. target: item.target,
  1013. "aria-label": item.label,
  1014. onClick: function onClick($event) {
  1015. return $setup.onMenuItemClick($event, item, i);
  1016. }
  1017. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1018. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  1019. }, null, 2
  1020. /* CLASS */
  1021. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  1022. /* TEXT */
  1023. ), 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, {
  1024. key: 1,
  1025. value: item.badge
  1026. }, null, 8
  1027. /* PROPS */
  1028. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 14
  1029. /* CLASS, STYLE, PROPS */
  1030. , _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, {
  1031. name: "layout-submenu-wrapper"
  1032. }, {
  1033. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1034. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  1035. items: $setup.visible(item) && item.items,
  1036. onMenuitemClick: _cache[1] || (_cache[1] = function ($event) {
  1037. return _ctx.$emit('menuitem-click', $event);
  1038. })
  1039. }, null, 8
  1040. /* PROPS */
  1041. , ["items"]), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.activeIndex === i]])];
  1042. }),
  1043. _: 2
  1044. /* DYNAMIC */
  1045. }, 1024
  1046. /* DYNAMIC_SLOTS */
  1047. )], 64
  1048. /* STABLE_FRAGMENT */
  1049. ))], 2
  1050. /* CLASS */
  1051. )) : (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", {
  1052. "class": "p-menu-separator",
  1053. role: "separator",
  1054. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  1055. key: 'separator' + i
  1056. }, null, 4
  1057. /* STYLE */
  1058. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 64
  1059. /* STABLE_FRAGMENT */
  1060. );
  1061. }), 256
  1062. /* UNKEYED_FRAGMENT */
  1063. ))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true);
  1064. }
  1065. /***/ }),
  1066. /***/ "./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":
  1067. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  1068. !*** ./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 ***!
  1069. \*******************************************************************************************************************************************************************************************************************************************************************************/
  1070. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1071. "use strict";
  1072. __webpack_require__.r(__webpack_exports__);
  1073. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1074. /* harmony export */ "render": () => (/* binding */ render)
  1075. /* harmony export */ });
  1076. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1077. var _hoisted_1 = {
  1078. "class": "layout-topbar"
  1079. };
  1080. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("img", {
  1081. alt: "Logo",
  1082. src: "/images/logo.svg",
  1083. "class": "md:mr-3"
  1084. }, null, -1
  1085. /* HOISTED */
  1086. );
  1087. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Parkirin", -1
  1088. /* HOISTED */
  1089. );
  1090. var _hoisted_4 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1091. "class": "pi pi-bars"
  1092. }, null, -1
  1093. /* HOISTED */
  1094. );
  1095. var _hoisted_5 = [_hoisted_4];
  1096. var _hoisted_6 = {
  1097. "class": "p-link layout-topbar-menu-button layout-topbar-button"
  1098. };
  1099. var _hoisted_7 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1100. "class": "pi pi-ellipsis-v"
  1101. }, null, -1
  1102. /* HOISTED */
  1103. );
  1104. var _hoisted_8 = [_hoisted_7];
  1105. var _hoisted_9 = {
  1106. "class": "layout-topbar-menu hidden lg:flex origin-top"
  1107. };
  1108. var _hoisted_10 = {
  1109. "class": "align-self-center"
  1110. };
  1111. var _hoisted_11 = {
  1112. "class": "hidden lg:inline"
  1113. };
  1114. var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1115. "class": "pi pi-user"
  1116. }, null, -1
  1117. /* HOISTED */
  1118. );
  1119. var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Profil Saya", -1
  1120. /* HOISTED */
  1121. );
  1122. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1123. "class": "pi pi-sign-out"
  1124. }, null, -1
  1125. /* HOISTED */
  1126. );
  1127. var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Sign Out", -1
  1128. /* HOISTED */
  1129. );
  1130. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1131. var _directive_styleclass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("styleclass");
  1132. 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"], {
  1133. href: "/",
  1134. "class": "layout-topbar-logo"
  1135. }, {
  1136. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1137. return [_hoisted_2, _hoisted_3];
  1138. }),
  1139. _: 1
  1140. /* STABLE */
  1141. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("button", {
  1142. "class": "p-link layout-menu-button layout-topbar-button",
  1143. onClick: _cache[0] || (_cache[0] = function ($event) {
  1144. return _ctx.$emit('menu-toggle', $event);
  1145. })
  1146. }, _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, {
  1147. selector: '@next',
  1148. enterClass: 'hidden',
  1149. enterActiveClass: 'scalein',
  1150. leaveToClass: 'hidden',
  1151. leaveActiveClass: 'fadeout',
  1152. hideOnOutsideClick: true
  1153. }]]), (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
  1154. /* TEXT */
  1155. )]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  1156. href: _ctx.route('users.show', _ctx.$page.props.auth.user.id),
  1157. "class": "p-link layout-topbar-button"
  1158. }, {
  1159. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1160. return [_hoisted_12, _hoisted_13];
  1161. }),
  1162. _: 1
  1163. /* STABLE */
  1164. }, 8
  1165. /* PROPS */
  1166. , ["href"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  1167. href: _ctx.route('logout'),
  1168. as: "button",
  1169. method: "post",
  1170. "class": "p-link layout-topbar-button"
  1171. }, {
  1172. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1173. return [_hoisted_14, _hoisted_15];
  1174. }),
  1175. _: 1
  1176. /* STABLE */
  1177. }, 8
  1178. /* PROPS */
  1179. , ["href"])])])]);
  1180. }
  1181. /***/ }),
  1182. /***/ "./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":
  1183. /*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  1184. !*** ./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 ***!
  1185. \****************************************************************************************************************************************************************************************************************************************************************************/
  1186. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1187. "use strict";
  1188. __webpack_require__.r(__webpack_exports__);
  1189. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1190. /* harmony export */ "render": () => (/* binding */ render)
  1191. /* harmony export */ });
  1192. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1193. var _hoisted_1 = {
  1194. "class": "layout-main-container"
  1195. };
  1196. var _hoisted_2 = {
  1197. "class": "layout-main"
  1198. };
  1199. var _hoisted_3 = {
  1200. key: 0,
  1201. "class": "layout-mask p-component-overlay"
  1202. };
  1203. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1204. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", {
  1205. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)($setup.containerClass),
  1206. onClick: $setup.onWrapperClick
  1207. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppTopBar"], {
  1208. onMenuToggle: $setup.onMenuToggle
  1209. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  1210. "class": "layout-sidebar",
  1211. onClick: $setup.onSidebarClick
  1212. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppSidebar"], {
  1213. model: $setup.menu[_ctx.$page.props.auth.user.role_id],
  1214. onMenuitemClick: $setup.onMenuItemClick
  1215. }, null, 8
  1216. /* PROPS */
  1217. , ["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, {
  1218. name: "layout-mask"
  1219. }, {
  1220. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1221. 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)];
  1222. }),
  1223. _: 1
  1224. /* STABLE */
  1225. })], 2
  1226. /* CLASS */
  1227. );
  1228. }
  1229. /***/ }),
  1230. /***/ "./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/member/Edit.vue?vue&type=template&id=1a9fb226":
  1231. /*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  1232. !*** ./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/member/Edit.vue?vue&type=template&id=1a9fb226 ***!
  1233. \****************************************************************************************************************************************************************************************************************************************************************************/
  1234. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1235. "use strict";
  1236. __webpack_require__.r(__webpack_exports__);
  1237. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1238. /* harmony export */ "render": () => (/* binding */ render)
  1239. /* harmony export */ });
  1240. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1241. var _hoisted_1 = {
  1242. "class": "grid"
  1243. };
  1244. var _hoisted_2 = {
  1245. "class": "col-12 md:col-8"
  1246. };
  1247. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Ubah Member ");
  1248. var _hoisted_4 = {
  1249. "class": "grid"
  1250. };
  1251. var _hoisted_5 = {
  1252. "class": "col-12 md:col-6"
  1253. };
  1254. var _hoisted_6 = {
  1255. "class": "col-12 md:col-6"
  1256. };
  1257. var _hoisted_7 = {
  1258. "class": "col-12 md:col-6"
  1259. };
  1260. var _hoisted_8 = {
  1261. "class": "grid"
  1262. };
  1263. var _hoisted_9 = {
  1264. "class": "col-12 md:col-8"
  1265. };
  1266. var _hoisted_10 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)("Detail Harga");
  1267. var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1268. "class": "text-base font-bold mb-0"
  1269. }, "Jenis Member", -1
  1270. /* HOISTED */
  1271. );
  1272. var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1273. "class": "text-base font-bold mb-0"
  1274. }, "Batas Maksimal Kendaraan", -1
  1275. /* HOISTED */
  1276. );
  1277. var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1278. "class": "text-base font-bold mb-0"
  1279. }, "Keterangan", -1
  1280. /* HOISTED */
  1281. );
  1282. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1283. "class": "text-base font-bold mb-0"
  1284. }, "Tarif Member", -1
  1285. /* HOISTED */
  1286. );
  1287. var _hoisted_15 = {
  1288. key: 0,
  1289. "class": "grid"
  1290. };
  1291. var _hoisted_16 = {
  1292. "class": "col-12 md:col-8"
  1293. };
  1294. var _hoisted_17 = {
  1295. "class": "grid"
  1296. };
  1297. var _hoisted_18 = {
  1298. "class": "col-12 md:col-6"
  1299. };
  1300. var _hoisted_19 = {
  1301. "class": "col-12 md:col-6"
  1302. };
  1303. var _hoisted_20 = {
  1304. "class": "col-12 mb-3 md:mb-0"
  1305. };
  1306. var _hoisted_21 = {
  1307. "class": "flex flex-column md:flex-row md:align-items-center justify-content-end"
  1308. };
  1309. var _hoisted_22 = {
  1310. "class": "col-12"
  1311. };
  1312. var _hoisted_23 = {
  1313. style: {
  1314. "color": "#b71c1c"
  1315. }
  1316. };
  1317. var _hoisted_24 = {
  1318. "class": "flex justify-content-end"
  1319. };
  1320. var _hoisted_25 = {
  1321. "class": "grid"
  1322. };
  1323. var _hoisted_26 = {
  1324. "class": "col-12 flex flex-column md:flex-row justify-content-center md:justify-content-end"
  1325. };
  1326. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1327. var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
  1328. var _component_Card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Card");
  1329. var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
  1330. var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
  1331. var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
  1332. var _component_Dialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dialog");
  1333. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Head"], {
  1334. title: "Ubah Member"
  1335. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppLayout"], null, {
  1336. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1337. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_ConfirmDialog), (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)(_component_Card, null, {
  1338. title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1339. return [_hoisted_3];
  1340. }),
  1341. content: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1342. return [(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)($setup["AppInputText"], {
  1343. modelValue: $setup.form.name,
  1344. "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
  1345. return $setup.form.name = $event;
  1346. }),
  1347. label: "Nama",
  1348. placeholder: "nama",
  1349. error: $setup.form.errors.name
  1350. }, null, 8
  1351. /* PROPS */
  1352. , ["modelValue", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppInputText"], {
  1353. modelValue: $setup.form.phone,
  1354. "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) {
  1355. return $setup.form.phone = $event;
  1356. }),
  1357. label: "Nomor HP",
  1358. placeholder: "nomor hp",
  1359. error: $setup.form.errors.phone
  1360. }, null, 8
  1361. /* PROPS */
  1362. , ["modelValue", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppDropdown"], {
  1363. label: "Jenis member",
  1364. placeholder: "pilih satu",
  1365. modelValue: $setup.form.type_member_id,
  1366. "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) {
  1367. return $setup.form.type_member_id = $event;
  1368. }),
  1369. options: $props.typeMembers,
  1370. error: $setup.form.errors.type_member_id
  1371. }, null, 8
  1372. /* PROPS */
  1373. , ["modelValue", "options", "error"])])])];
  1374. }),
  1375. _: 1
  1376. /* STABLE */
  1377. })])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, {
  1378. "class": "bg-primary"
  1379. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createSlots)({
  1380. title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1381. return [_hoisted_10];
  1382. }),
  1383. _: 2
  1384. /* DYNAMIC */
  1385. }, [$props.typeMember ? {
  1386. name: "content",
  1387. fn: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1388. return [_hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.type), 1
  1389. /* TEXT */
  1390. ), _hoisted_12, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.max), 1
  1391. /* TEXT */
  1392. ), _hoisted_13, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.description), 1
  1393. /* TEXT */
  1394. ), _hoisted_14, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.price), 1
  1395. /* TEXT */
  1396. )];
  1397. })
  1398. } : undefined]), 1024
  1399. /* DYNAMIC_SLOTS */
  1400. )])]), $props.typeMember ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_15, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_16, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, null, {
  1401. content: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1402. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_17, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_18, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppInputText"], {
  1403. modelValue: $setup.form.plat_number,
  1404. "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) {
  1405. return $setup.form.plat_number = $event;
  1406. }),
  1407. label: "Plat Kendaraan",
  1408. placeholder: "plat kendaraan",
  1409. disabled: !$setup.form.type_member_id,
  1410. error: $setup.form.errors.plat_number
  1411. }, null, 8
  1412. /* PROPS */
  1413. , ["modelValue", "disabled", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_19, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppDropdown"], {
  1414. modelValue: $setup.form.max_vehicle_id,
  1415. "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) {
  1416. return $setup.form.max_vehicle_id = $event;
  1417. }),
  1418. label: "Jenis Kendaraan",
  1419. placeholder: "jenis kendaraan",
  1420. disabled: !$setup.form.type_member_id,
  1421. options: $props.typeMember.maxVehicles,
  1422. error: $setup.form.errors.max_vehicle_id
  1423. }, null, 8
  1424. /* PROPS */
  1425. , ["modelValue", "disabled", "options", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_20, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_21, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1426. label: "Tambah",
  1427. "class": "p-button-outlined",
  1428. icon: "pi pi-car",
  1429. disabled: !$setup.form.type_member_id,
  1430. onClick: $setup.addPlatNumber
  1431. }, null, 8
  1432. /* PROPS */
  1433. , ["disabled"])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_22, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
  1434. "striped-rows": "",
  1435. "row-hover": "",
  1436. "responsive-layout": "scroll",
  1437. "column-resize-mode": "expand",
  1438. "edit-mode": "cell",
  1439. value: $setup.listPlatNumber
  1440. }, {
  1441. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1442. 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.PlatNumberTable, function (platNumberTable) {
  1443. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Column, {
  1444. field: platNumberTable.field,
  1445. header: platNumberTable.header,
  1446. key: platNumberTable.field
  1447. }, null, 8
  1448. /* PROPS */
  1449. , ["field", "header"]);
  1450. }), 128
  1451. /* KEYED_FRAGMENT */
  1452. )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
  1453. body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
  1454. var index = _ref.index;
  1455. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_23, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.errors["vehicles.".concat(index, ".platNumber")]), 1
  1456. /* TEXT */
  1457. )];
  1458. }),
  1459. _: 1
  1460. /* STABLE */
  1461. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
  1462. body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref2) {
  1463. var index = _ref2.index;
  1464. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_24, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1465. icon: "pi pi-trash",
  1466. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-button-rounded p-button-text", {
  1467. 'p-button-danger': _ctx.$page.props.errors["vehicles.".concat(index, ".platNumber")]
  1468. }]),
  1469. onClick: function onClick($event) {
  1470. return $setup.listPlatNumberOnDelete(index);
  1471. }
  1472. }, null, 8
  1473. /* PROPS */
  1474. , ["class", "onClick"])])];
  1475. }),
  1476. _: 1
  1477. /* STABLE */
  1478. })];
  1479. }),
  1480. _: 1
  1481. /* STABLE */
  1482. }, 8
  1483. /* PROPS */
  1484. , ["value"])])])];
  1485. }),
  1486. footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1487. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_25, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_26, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1488. label: "Simpan",
  1489. icon: "pi pi-check",
  1490. "class": "p-button-outlined",
  1491. disabled: $setup.form.processing,
  1492. onClick: $setup.submit
  1493. }, null, 8
  1494. /* PROPS */
  1495. , ["disabled"])])])];
  1496. }),
  1497. _: 1
  1498. /* STABLE */
  1499. })])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Dialog, {
  1500. header: "Error",
  1501. visible: $setup.errorSubmitVisible,
  1502. "onUpdate:visible": _cache[5] || (_cache[5] = function ($event) {
  1503. return $setup.errorSubmitVisible = $event;
  1504. }),
  1505. style: {
  1506. width: '40vw'
  1507. },
  1508. contentStyle: "color: #b71c1c"
  1509. }, {
  1510. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1511. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($setup.errorSubmitText), 1
  1512. /* TEXT */
  1513. )];
  1514. }),
  1515. _: 1
  1516. /* STABLE */
  1517. }, 8
  1518. /* PROPS */
  1519. , ["visible"])];
  1520. }),
  1521. _: 1
  1522. /* STABLE */
  1523. })], 64
  1524. /* STABLE_FRAGMENT */
  1525. );
  1526. }
  1527. /***/ }),
  1528. /***/ "./resources/js/pages/member/TableHeader.js":
  1529. /*!**************************************************!*\
  1530. !*** ./resources/js/pages/member/TableHeader.js ***!
  1531. \**************************************************/
  1532. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1533. "use strict";
  1534. __webpack_require__.r(__webpack_exports__);
  1535. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1536. /* harmony export */ "IndexTable": () => (/* binding */ IndexTable),
  1537. /* harmony export */ "PlatNumberTable": () => (/* binding */ PlatNumberTable)
  1538. /* harmony export */ });
  1539. var IndexTable = [{
  1540. field: 'updatedAt',
  1541. header: 'Diperbaharui'
  1542. }, {
  1543. field: 'name',
  1544. header: 'Nama'
  1545. }, {
  1546. field: 'phone',
  1547. header: 'Nomor HP'
  1548. }, {
  1549. field: 'platNumber',
  1550. header: 'Plat Kendaraan'
  1551. }, {
  1552. field: 'type',
  1553. header: 'Jenis Member'
  1554. }, {
  1555. field: 'price',
  1556. header: 'Tarif Member'
  1557. }, {
  1558. field: 'expDate',
  1559. header: 'Berakhir'
  1560. }];
  1561. var PlatNumberTable = [{
  1562. field: 'platNumber',
  1563. header: 'Plat Kendaraan'
  1564. }, {
  1565. field: 'typeVehicle',
  1566. header: 'Jenis Kendaraan'
  1567. }];
  1568. /***/ }),
  1569. /***/ "./resources/js/utils/menu.js":
  1570. /*!************************************!*\
  1571. !*** ./resources/js/utils/menu.js ***!
  1572. \************************************/
  1573. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1574. "use strict";
  1575. __webpack_require__.r(__webpack_exports__);
  1576. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1577. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  1578. /* harmony export */ });
  1579. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  1580. // Admin
  1581. 1: [{
  1582. label: 'Home',
  1583. items: [{
  1584. label: 'Dashboard',
  1585. icon: 'pi pi-home',
  1586. to: '/dashboards',
  1587. component: 'home/Index'
  1588. }]
  1589. }, {
  1590. label: 'Master',
  1591. items: [{
  1592. label: 'User',
  1593. icon: 'pi pi-user',
  1594. to: '/users',
  1595. component: 'user/Index'
  1596. }]
  1597. }],
  1598. // Supervisor
  1599. 2: [{
  1600. label: 'Home',
  1601. items: [{
  1602. label: 'Dashboard',
  1603. icon: 'pi pi-home',
  1604. to: '/dashboards',
  1605. component: 'home/Index'
  1606. }]
  1607. }, {
  1608. label: 'Menu',
  1609. items: [{
  1610. label: 'Pengeluaran',
  1611. icon: 'pi pi-wallet',
  1612. to: '/expenses',
  1613. component: 'expense/Index'
  1614. }]
  1615. }, {
  1616. label: 'Master',
  1617. items: [{
  1618. label: 'Jenis Kendaraan',
  1619. icon: 'pi pi-car',
  1620. to: '/type-vehicles',
  1621. component: 'typevehicle/Index'
  1622. }, {
  1623. label: 'Jenis Member',
  1624. icon: 'pi pi-id-card',
  1625. to: '/type-members',
  1626. component: 'typemember/Index'
  1627. }]
  1628. }],
  1629. // Operator
  1630. 3: [{
  1631. label: 'Home',
  1632. items: [{
  1633. label: 'Dashboard',
  1634. icon: 'pi pi-home',
  1635. to: '/dashboards',
  1636. component: 'home/Index'
  1637. }]
  1638. }, {
  1639. label: 'Menu',
  1640. items: [{
  1641. label: 'Pengeluaran',
  1642. icon: 'pi pi-wallet',
  1643. to: '/expenses',
  1644. component: 'expense/Index'
  1645. }, {
  1646. label: 'Member',
  1647. icon: 'pi pi-id-card',
  1648. to: '/members',
  1649. component: 'member/Index'
  1650. }, {
  1651. label: 'Top Up',
  1652. icon: 'pi pi-wallet',
  1653. to: '/top-ups',
  1654. component: 'topup/Index'
  1655. }]
  1656. }]
  1657. });
  1658. /***/ }),
  1659. /***/ "./node_modules/lodash/lodash.js":
  1660. /*!***************************************!*\
  1661. !*** ./node_modules/lodash/lodash.js ***!
  1662. \***************************************/
  1663. /***/ (function(module, exports, __webpack_require__) {
  1664. /* module decorator */ module = __webpack_require__.nmd(module);
  1665. var __WEBPACK_AMD_DEFINE_RESULT__;/**
  1666. * @license
  1667. * Lodash <https://lodash.com/>
  1668. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  1669. * Released under MIT license <https://lodash.com/license>
  1670. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1671. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1672. */
  1673. ;(function() {
  1674. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  1675. var undefined;
  1676. /** Used as the semantic version number. */
  1677. var VERSION = '4.17.21';
  1678. /** Used as the size to enable large array optimizations. */
  1679. var LARGE_ARRAY_SIZE = 200;
  1680. /** Error message constants. */
  1681. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  1682. FUNC_ERROR_TEXT = 'Expected a function',
  1683. INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
  1684. /** Used to stand-in for `undefined` hash values. */
  1685. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1686. /** Used as the maximum memoize cache size. */
  1687. var MAX_MEMOIZE_SIZE = 500;
  1688. /** Used as the internal argument placeholder. */
  1689. var PLACEHOLDER = '__lodash_placeholder__';
  1690. /** Used to compose bitmasks for cloning. */
  1691. var CLONE_DEEP_FLAG = 1,
  1692. CLONE_FLAT_FLAG = 2,
  1693. CLONE_SYMBOLS_FLAG = 4;
  1694. /** Used to compose bitmasks for value comparisons. */
  1695. var COMPARE_PARTIAL_FLAG = 1,
  1696. COMPARE_UNORDERED_FLAG = 2;
  1697. /** Used to compose bitmasks for function metadata. */
  1698. var WRAP_BIND_FLAG = 1,
  1699. WRAP_BIND_KEY_FLAG = 2,
  1700. WRAP_CURRY_BOUND_FLAG = 4,
  1701. WRAP_CURRY_FLAG = 8,
  1702. WRAP_CURRY_RIGHT_FLAG = 16,
  1703. WRAP_PARTIAL_FLAG = 32,
  1704. WRAP_PARTIAL_RIGHT_FLAG = 64,
  1705. WRAP_ARY_FLAG = 128,
  1706. WRAP_REARG_FLAG = 256,
  1707. WRAP_FLIP_FLAG = 512;
  1708. /** Used as default options for `_.truncate`. */
  1709. var DEFAULT_TRUNC_LENGTH = 30,
  1710. DEFAULT_TRUNC_OMISSION = '...';
  1711. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  1712. var HOT_COUNT = 800,
  1713. HOT_SPAN = 16;
  1714. /** Used to indicate the type of lazy iteratees. */
  1715. var LAZY_FILTER_FLAG = 1,
  1716. LAZY_MAP_FLAG = 2,
  1717. LAZY_WHILE_FLAG = 3;
  1718. /** Used as references for various `Number` constants. */
  1719. var INFINITY = 1 / 0,
  1720. MAX_SAFE_INTEGER = 9007199254740991,
  1721. MAX_INTEGER = 1.7976931348623157e+308,
  1722. NAN = 0 / 0;
  1723. /** Used as references for the maximum length and index of an array. */
  1724. var MAX_ARRAY_LENGTH = 4294967295,
  1725. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  1726. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  1727. /** Used to associate wrap methods with their bit flags. */
  1728. var wrapFlags = [
  1729. ['ary', WRAP_ARY_FLAG],
  1730. ['bind', WRAP_BIND_FLAG],
  1731. ['bindKey', WRAP_BIND_KEY_FLAG],
  1732. ['curry', WRAP_CURRY_FLAG],
  1733. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  1734. ['flip', WRAP_FLIP_FLAG],
  1735. ['partial', WRAP_PARTIAL_FLAG],
  1736. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  1737. ['rearg', WRAP_REARG_FLAG]
  1738. ];
  1739. /** `Object#toString` result references. */
  1740. var argsTag = '[object Arguments]',
  1741. arrayTag = '[object Array]',
  1742. asyncTag = '[object AsyncFunction]',
  1743. boolTag = '[object Boolean]',
  1744. dateTag = '[object Date]',
  1745. domExcTag = '[object DOMException]',
  1746. errorTag = '[object Error]',
  1747. funcTag = '[object Function]',
  1748. genTag = '[object GeneratorFunction]',
  1749. mapTag = '[object Map]',
  1750. numberTag = '[object Number]',
  1751. nullTag = '[object Null]',
  1752. objectTag = '[object Object]',
  1753. promiseTag = '[object Promise]',
  1754. proxyTag = '[object Proxy]',
  1755. regexpTag = '[object RegExp]',
  1756. setTag = '[object Set]',
  1757. stringTag = '[object String]',
  1758. symbolTag = '[object Symbol]',
  1759. undefinedTag = '[object Undefined]',
  1760. weakMapTag = '[object WeakMap]',
  1761. weakSetTag = '[object WeakSet]';
  1762. var arrayBufferTag = '[object ArrayBuffer]',
  1763. dataViewTag = '[object DataView]',
  1764. float32Tag = '[object Float32Array]',
  1765. float64Tag = '[object Float64Array]',
  1766. int8Tag = '[object Int8Array]',
  1767. int16Tag = '[object Int16Array]',
  1768. int32Tag = '[object Int32Array]',
  1769. uint8Tag = '[object Uint8Array]',
  1770. uint8ClampedTag = '[object Uint8ClampedArray]',
  1771. uint16Tag = '[object Uint16Array]',
  1772. uint32Tag = '[object Uint32Array]';
  1773. /** Used to match empty string literals in compiled template source. */
  1774. var reEmptyStringLeading = /\b__p \+= '';/g,
  1775. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1776. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1777. /** Used to match HTML entities and HTML characters. */
  1778. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1779. reUnescapedHtml = /[&<>"']/g,
  1780. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1781. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1782. /** Used to match template delimiters. */
  1783. var reEscape = /<%-([\s\S]+?)%>/g,
  1784. reEvaluate = /<%([\s\S]+?)%>/g,
  1785. reInterpolate = /<%=([\s\S]+?)%>/g;
  1786. /** Used to match property names within property paths. */
  1787. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1788. reIsPlainProp = /^\w*$/,
  1789. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1790. /**
  1791. * Used to match `RegExp`
  1792. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1793. */
  1794. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1795. reHasRegExpChar = RegExp(reRegExpChar.source);
  1796. /** Used to match leading whitespace. */
  1797. var reTrimStart = /^\s+/;
  1798. /** Used to match a single whitespace character. */
  1799. var reWhitespace = /\s/;
  1800. /** Used to match wrap detail comments. */
  1801. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1802. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1803. reSplitDetails = /,? & /;
  1804. /** Used to match words composed of alphanumeric characters. */
  1805. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1806. /**
  1807. * Used to validate the `validate` option in `_.template` variable.
  1808. *
  1809. * Forbids characters which could potentially change the meaning of the function argument definition:
  1810. * - "()," (modification of function parameters)
  1811. * - "=" (default value)
  1812. * - "[]{}" (destructuring of function parameters)
  1813. * - "/" (beginning of a comment)
  1814. * - whitespace
  1815. */
  1816. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  1817. /** Used to match backslashes in property paths. */
  1818. var reEscapeChar = /\\(\\)?/g;
  1819. /**
  1820. * Used to match
  1821. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1822. */
  1823. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1824. /** Used to match `RegExp` flags from their coerced string values. */
  1825. var reFlags = /\w*$/;
  1826. /** Used to detect bad signed hexadecimal string values. */
  1827. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1828. /** Used to detect binary string values. */
  1829. var reIsBinary = /^0b[01]+$/i;
  1830. /** Used to detect host constructors (Safari). */
  1831. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1832. /** Used to detect octal string values. */
  1833. var reIsOctal = /^0o[0-7]+$/i;
  1834. /** Used to detect unsigned integer values. */
  1835. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1836. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1837. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1838. /** Used to ensure capturing order of template delimiters. */
  1839. var reNoMatch = /($^)/;
  1840. /** Used to match unescaped characters in compiled string literals. */
  1841. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1842. /** Used to compose unicode character classes. */
  1843. var rsAstralRange = '\\ud800-\\udfff',
  1844. rsComboMarksRange = '\\u0300-\\u036f',
  1845. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1846. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1847. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1848. rsDingbatRange = '\\u2700-\\u27bf',
  1849. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1850. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1851. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1852. rsPunctuationRange = '\\u2000-\\u206f',
  1853. 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',
  1854. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1855. rsVarRange = '\\ufe0e\\ufe0f',
  1856. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1857. /** Used to compose unicode capture groups. */
  1858. var rsApos = "['\u2019]",
  1859. rsAstral = '[' + rsAstralRange + ']',
  1860. rsBreak = '[' + rsBreakRange + ']',
  1861. rsCombo = '[' + rsComboRange + ']',
  1862. rsDigits = '\\d+',
  1863. rsDingbat = '[' + rsDingbatRange + ']',
  1864. rsLower = '[' + rsLowerRange + ']',
  1865. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1866. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1867. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1868. rsNonAstral = '[^' + rsAstralRange + ']',
  1869. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1870. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1871. rsUpper = '[' + rsUpperRange + ']',
  1872. rsZWJ = '\\u200d';
  1873. /** Used to compose unicode regexes. */
  1874. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1875. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1876. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1877. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1878. reOptMod = rsModifier + '?',
  1879. rsOptVar = '[' + rsVarRange + ']?',
  1880. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1881. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1882. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1883. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1884. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1885. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1886. /** Used to match apostrophes. */
  1887. var reApos = RegExp(rsApos, 'g');
  1888. /**
  1889. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1890. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1891. */
  1892. var reComboMark = RegExp(rsCombo, 'g');
  1893. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1894. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1895. /** Used to match complex or compound words. */
  1896. var reUnicodeWord = RegExp([
  1897. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1898. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1899. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1900. rsUpper + '+' + rsOptContrUpper,
  1901. rsOrdUpper,
  1902. rsOrdLower,
  1903. rsDigits,
  1904. rsEmoji
  1905. ].join('|'), 'g');
  1906. /** 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/). */
  1907. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1908. /** Used to detect strings that need a more robust regexp to match words. */
  1909. 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 ]/;
  1910. /** Used to assign default `context` object properties. */
  1911. var contextProps = [
  1912. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1913. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1914. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1915. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1916. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1917. ];
  1918. /** Used to make template sourceURLs easier to identify. */
  1919. var templateCounter = -1;
  1920. /** Used to identify `toStringTag` values of typed arrays. */
  1921. var typedArrayTags = {};
  1922. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1923. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1924. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1925. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1926. typedArrayTags[uint32Tag] = true;
  1927. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1928. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1929. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1930. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1931. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1932. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1933. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1934. typedArrayTags[weakMapTag] = false;
  1935. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1936. var cloneableTags = {};
  1937. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1938. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1939. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1940. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1941. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1942. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1943. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1944. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1945. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1946. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1947. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1948. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1949. cloneableTags[weakMapTag] = false;
  1950. /** Used to map Latin Unicode letters to basic Latin letters. */
  1951. var deburredLetters = {
  1952. // Latin-1 Supplement block.
  1953. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1954. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1955. '\xc7': 'C', '\xe7': 'c',
  1956. '\xd0': 'D', '\xf0': 'd',
  1957. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1958. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1959. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1960. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1961. '\xd1': 'N', '\xf1': 'n',
  1962. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1963. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1964. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1965. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1966. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1967. '\xc6': 'Ae', '\xe6': 'ae',
  1968. '\xde': 'Th', '\xfe': 'th',
  1969. '\xdf': 'ss',
  1970. // Latin Extended-A block.
  1971. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1972. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1973. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1974. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1975. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1976. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1977. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1978. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1979. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1980. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1981. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1982. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1983. '\u0134': 'J', '\u0135': 'j',
  1984. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1985. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1986. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1987. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1988. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1989. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1990. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1991. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1992. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1993. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1994. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1995. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1996. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1997. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1998. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1999. '\u0174': 'W', '\u0175': 'w',
  2000. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  2001. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  2002. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  2003. '\u0132': 'IJ', '\u0133': 'ij',
  2004. '\u0152': 'Oe', '\u0153': 'oe',
  2005. '\u0149': "'n", '\u017f': 's'
  2006. };
  2007. /** Used to map characters to HTML entities. */
  2008. var htmlEscapes = {
  2009. '&': '&amp;',
  2010. '<': '&lt;',
  2011. '>': '&gt;',
  2012. '"': '&quot;',
  2013. "'": '&#39;'
  2014. };
  2015. /** Used to map HTML entities to characters. */
  2016. var htmlUnescapes = {
  2017. '&amp;': '&',
  2018. '&lt;': '<',
  2019. '&gt;': '>',
  2020. '&quot;': '"',
  2021. '&#39;': "'"
  2022. };
  2023. /** Used to escape characters for inclusion in compiled string literals. */
  2024. var stringEscapes = {
  2025. '\\': '\\',
  2026. "'": "'",
  2027. '\n': 'n',
  2028. '\r': 'r',
  2029. '\u2028': 'u2028',
  2030. '\u2029': 'u2029'
  2031. };
  2032. /** Built-in method references without a dependency on `root`. */
  2033. var freeParseFloat = parseFloat,
  2034. freeParseInt = parseInt;
  2035. /** Detect free variable `global` from Node.js. */
  2036. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  2037. /** Detect free variable `self`. */
  2038. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  2039. /** Used as a reference to the global object. */
  2040. var root = freeGlobal || freeSelf || Function('return this')();
  2041. /** Detect free variable `exports`. */
  2042. var freeExports = true && exports && !exports.nodeType && exports;
  2043. /** Detect free variable `module`. */
  2044. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  2045. /** Detect the popular CommonJS extension `module.exports`. */
  2046. var moduleExports = freeModule && freeModule.exports === freeExports;
  2047. /** Detect free variable `process` from Node.js. */
  2048. var freeProcess = moduleExports && freeGlobal.process;
  2049. /** Used to access faster Node.js helpers. */
  2050. var nodeUtil = (function() {
  2051. try {
  2052. // Use `util.types` for Node.js 10+.
  2053. var types = freeModule && freeModule.require && freeModule.require('util').types;
  2054. if (types) {
  2055. return types;
  2056. }
  2057. // Legacy `process.binding('util')` for Node.js < 10.
  2058. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  2059. } catch (e) {}
  2060. }());
  2061. /* Node.js helper references. */
  2062. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  2063. nodeIsDate = nodeUtil && nodeUtil.isDate,
  2064. nodeIsMap = nodeUtil && nodeUtil.isMap,
  2065. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  2066. nodeIsSet = nodeUtil && nodeUtil.isSet,
  2067. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  2068. /*--------------------------------------------------------------------------*/
  2069. /**
  2070. * A faster alternative to `Function#apply`, this function invokes `func`
  2071. * with the `this` binding of `thisArg` and the arguments of `args`.
  2072. *
  2073. * @private
  2074. * @param {Function} func The function to invoke.
  2075. * @param {*} thisArg The `this` binding of `func`.
  2076. * @param {Array} args The arguments to invoke `func` with.
  2077. * @returns {*} Returns the result of `func`.
  2078. */
  2079. function apply(func, thisArg, args) {
  2080. switch (args.length) {
  2081. case 0: return func.call(thisArg);
  2082. case 1: return func.call(thisArg, args[0]);
  2083. case 2: return func.call(thisArg, args[0], args[1]);
  2084. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  2085. }
  2086. return func.apply(thisArg, args);
  2087. }
  2088. /**
  2089. * A specialized version of `baseAggregator` for arrays.
  2090. *
  2091. * @private
  2092. * @param {Array} [array] The array to iterate over.
  2093. * @param {Function} setter The function to set `accumulator` values.
  2094. * @param {Function} iteratee The iteratee to transform keys.
  2095. * @param {Object} accumulator The initial aggregated object.
  2096. * @returns {Function} Returns `accumulator`.
  2097. */
  2098. function arrayAggregator(array, setter, iteratee, accumulator) {
  2099. var index = -1,
  2100. length = array == null ? 0 : array.length;
  2101. while (++index < length) {
  2102. var value = array[index];
  2103. setter(accumulator, value, iteratee(value), array);
  2104. }
  2105. return accumulator;
  2106. }
  2107. /**
  2108. * A specialized version of `_.forEach` for arrays without support for
  2109. * iteratee shorthands.
  2110. *
  2111. * @private
  2112. * @param {Array} [array] The array to iterate over.
  2113. * @param {Function} iteratee The function invoked per iteration.
  2114. * @returns {Array} Returns `array`.
  2115. */
  2116. function arrayEach(array, iteratee) {
  2117. var index = -1,
  2118. length = array == null ? 0 : array.length;
  2119. while (++index < length) {
  2120. if (iteratee(array[index], index, array) === false) {
  2121. break;
  2122. }
  2123. }
  2124. return array;
  2125. }
  2126. /**
  2127. * A specialized version of `_.forEachRight` for arrays without support for
  2128. * iteratee shorthands.
  2129. *
  2130. * @private
  2131. * @param {Array} [array] The array to iterate over.
  2132. * @param {Function} iteratee The function invoked per iteration.
  2133. * @returns {Array} Returns `array`.
  2134. */
  2135. function arrayEachRight(array, iteratee) {
  2136. var length = array == null ? 0 : array.length;
  2137. while (length--) {
  2138. if (iteratee(array[length], length, array) === false) {
  2139. break;
  2140. }
  2141. }
  2142. return array;
  2143. }
  2144. /**
  2145. * A specialized version of `_.every` for arrays without support for
  2146. * iteratee shorthands.
  2147. *
  2148. * @private
  2149. * @param {Array} [array] The array to iterate over.
  2150. * @param {Function} predicate The function invoked per iteration.
  2151. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  2152. * else `false`.
  2153. */
  2154. function arrayEvery(array, predicate) {
  2155. var index = -1,
  2156. length = array == null ? 0 : array.length;
  2157. while (++index < length) {
  2158. if (!predicate(array[index], index, array)) {
  2159. return false;
  2160. }
  2161. }
  2162. return true;
  2163. }
  2164. /**
  2165. * A specialized version of `_.filter` for arrays without support for
  2166. * iteratee shorthands.
  2167. *
  2168. * @private
  2169. * @param {Array} [array] The array to iterate over.
  2170. * @param {Function} predicate The function invoked per iteration.
  2171. * @returns {Array} Returns the new filtered array.
  2172. */
  2173. function arrayFilter(array, predicate) {
  2174. var index = -1,
  2175. length = array == null ? 0 : array.length,
  2176. resIndex = 0,
  2177. result = [];
  2178. while (++index < length) {
  2179. var value = array[index];
  2180. if (predicate(value, index, array)) {
  2181. result[resIndex++] = value;
  2182. }
  2183. }
  2184. return result;
  2185. }
  2186. /**
  2187. * A specialized version of `_.includes` for arrays without support for
  2188. * specifying an index to search from.
  2189. *
  2190. * @private
  2191. * @param {Array} [array] The array to inspect.
  2192. * @param {*} target The value to search for.
  2193. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  2194. */
  2195. function arrayIncludes(array, value) {
  2196. var length = array == null ? 0 : array.length;
  2197. return !!length && baseIndexOf(array, value, 0) > -1;
  2198. }
  2199. /**
  2200. * This function is like `arrayIncludes` except that it accepts a comparator.
  2201. *
  2202. * @private
  2203. * @param {Array} [array] The array to inspect.
  2204. * @param {*} target The value to search for.
  2205. * @param {Function} comparator The comparator invoked per element.
  2206. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  2207. */
  2208. function arrayIncludesWith(array, value, comparator) {
  2209. var index = -1,
  2210. length = array == null ? 0 : array.length;
  2211. while (++index < length) {
  2212. if (comparator(value, array[index])) {
  2213. return true;
  2214. }
  2215. }
  2216. return false;
  2217. }
  2218. /**
  2219. * A specialized version of `_.map` for arrays without support for iteratee
  2220. * shorthands.
  2221. *
  2222. * @private
  2223. * @param {Array} [array] The array to iterate over.
  2224. * @param {Function} iteratee The function invoked per iteration.
  2225. * @returns {Array} Returns the new mapped array.
  2226. */
  2227. function arrayMap(array, iteratee) {
  2228. var index = -1,
  2229. length = array == null ? 0 : array.length,
  2230. result = Array(length);
  2231. while (++index < length) {
  2232. result[index] = iteratee(array[index], index, array);
  2233. }
  2234. return result;
  2235. }
  2236. /**
  2237. * Appends the elements of `values` to `array`.
  2238. *
  2239. * @private
  2240. * @param {Array} array The array to modify.
  2241. * @param {Array} values The values to append.
  2242. * @returns {Array} Returns `array`.
  2243. */
  2244. function arrayPush(array, values) {
  2245. var index = -1,
  2246. length = values.length,
  2247. offset = array.length;
  2248. while (++index < length) {
  2249. array[offset + index] = values[index];
  2250. }
  2251. return array;
  2252. }
  2253. /**
  2254. * A specialized version of `_.reduce` for arrays without support for
  2255. * iteratee shorthands.
  2256. *
  2257. * @private
  2258. * @param {Array} [array] The array to iterate over.
  2259. * @param {Function} iteratee The function invoked per iteration.
  2260. * @param {*} [accumulator] The initial value.
  2261. * @param {boolean} [initAccum] Specify using the first element of `array` as
  2262. * the initial value.
  2263. * @returns {*} Returns the accumulated value.
  2264. */
  2265. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2266. var index = -1,
  2267. length = array == null ? 0 : array.length;
  2268. if (initAccum && length) {
  2269. accumulator = array[++index];
  2270. }
  2271. while (++index < length) {
  2272. accumulator = iteratee(accumulator, array[index], index, array);
  2273. }
  2274. return accumulator;
  2275. }
  2276. /**
  2277. * A specialized version of `_.reduceRight` for arrays without support for
  2278. * iteratee shorthands.
  2279. *
  2280. * @private
  2281. * @param {Array} [array] The array to iterate over.
  2282. * @param {Function} iteratee The function invoked per iteration.
  2283. * @param {*} [accumulator] The initial value.
  2284. * @param {boolean} [initAccum] Specify using the last element of `array` as
  2285. * the initial value.
  2286. * @returns {*} Returns the accumulated value.
  2287. */
  2288. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  2289. var length = array == null ? 0 : array.length;
  2290. if (initAccum && length) {
  2291. accumulator = array[--length];
  2292. }
  2293. while (length--) {
  2294. accumulator = iteratee(accumulator, array[length], length, array);
  2295. }
  2296. return accumulator;
  2297. }
  2298. /**
  2299. * A specialized version of `_.some` for arrays without support for iteratee
  2300. * shorthands.
  2301. *
  2302. * @private
  2303. * @param {Array} [array] The array to iterate over.
  2304. * @param {Function} predicate The function invoked per iteration.
  2305. * @returns {boolean} Returns `true` if any element passes the predicate check,
  2306. * else `false`.
  2307. */
  2308. function arraySome(array, predicate) {
  2309. var index = -1,
  2310. length = array == null ? 0 : array.length;
  2311. while (++index < length) {
  2312. if (predicate(array[index], index, array)) {
  2313. return true;
  2314. }
  2315. }
  2316. return false;
  2317. }
  2318. /**
  2319. * Gets the size of an ASCII `string`.
  2320. *
  2321. * @private
  2322. * @param {string} string The string inspect.
  2323. * @returns {number} Returns the string size.
  2324. */
  2325. var asciiSize = baseProperty('length');
  2326. /**
  2327. * Converts an ASCII `string` to an array.
  2328. *
  2329. * @private
  2330. * @param {string} string The string to convert.
  2331. * @returns {Array} Returns the converted array.
  2332. */
  2333. function asciiToArray(string) {
  2334. return string.split('');
  2335. }
  2336. /**
  2337. * Splits an ASCII `string` into an array of its words.
  2338. *
  2339. * @private
  2340. * @param {string} The string to inspect.
  2341. * @returns {Array} Returns the words of `string`.
  2342. */
  2343. function asciiWords(string) {
  2344. return string.match(reAsciiWord) || [];
  2345. }
  2346. /**
  2347. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  2348. * without support for iteratee shorthands, which iterates over `collection`
  2349. * using `eachFunc`.
  2350. *
  2351. * @private
  2352. * @param {Array|Object} collection The collection to inspect.
  2353. * @param {Function} predicate The function invoked per iteration.
  2354. * @param {Function} eachFunc The function to iterate over `collection`.
  2355. * @returns {*} Returns the found element or its key, else `undefined`.
  2356. */
  2357. function baseFindKey(collection, predicate, eachFunc) {
  2358. var result;
  2359. eachFunc(collection, function(value, key, collection) {
  2360. if (predicate(value, key, collection)) {
  2361. result = key;
  2362. return false;
  2363. }
  2364. });
  2365. return result;
  2366. }
  2367. /**
  2368. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  2369. * support for iteratee shorthands.
  2370. *
  2371. * @private
  2372. * @param {Array} array The array to inspect.
  2373. * @param {Function} predicate The function invoked per iteration.
  2374. * @param {number} fromIndex The index to search from.
  2375. * @param {boolean} [fromRight] Specify iterating from right to left.
  2376. * @returns {number} Returns the index of the matched value, else `-1`.
  2377. */
  2378. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  2379. var length = array.length,
  2380. index = fromIndex + (fromRight ? 1 : -1);
  2381. while ((fromRight ? index-- : ++index < length)) {
  2382. if (predicate(array[index], index, array)) {
  2383. return index;
  2384. }
  2385. }
  2386. return -1;
  2387. }
  2388. /**
  2389. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  2390. *
  2391. * @private
  2392. * @param {Array} array The array to inspect.
  2393. * @param {*} value The value to search for.
  2394. * @param {number} fromIndex The index to search from.
  2395. * @returns {number} Returns the index of the matched value, else `-1`.
  2396. */
  2397. function baseIndexOf(array, value, fromIndex) {
  2398. return value === value
  2399. ? strictIndexOf(array, value, fromIndex)
  2400. : baseFindIndex(array, baseIsNaN, fromIndex);
  2401. }
  2402. /**
  2403. * This function is like `baseIndexOf` except that it accepts a comparator.
  2404. *
  2405. * @private
  2406. * @param {Array} array The array to inspect.
  2407. * @param {*} value The value to search for.
  2408. * @param {number} fromIndex The index to search from.
  2409. * @param {Function} comparator The comparator invoked per element.
  2410. * @returns {number} Returns the index of the matched value, else `-1`.
  2411. */
  2412. function baseIndexOfWith(array, value, fromIndex, comparator) {
  2413. var index = fromIndex - 1,
  2414. length = array.length;
  2415. while (++index < length) {
  2416. if (comparator(array[index], value)) {
  2417. return index;
  2418. }
  2419. }
  2420. return -1;
  2421. }
  2422. /**
  2423. * The base implementation of `_.isNaN` without support for number objects.
  2424. *
  2425. * @private
  2426. * @param {*} value The value to check.
  2427. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  2428. */
  2429. function baseIsNaN(value) {
  2430. return value !== value;
  2431. }
  2432. /**
  2433. * The base implementation of `_.mean` and `_.meanBy` without support for
  2434. * iteratee shorthands.
  2435. *
  2436. * @private
  2437. * @param {Array} array The array to iterate over.
  2438. * @param {Function} iteratee The function invoked per iteration.
  2439. * @returns {number} Returns the mean.
  2440. */
  2441. function baseMean(array, iteratee) {
  2442. var length = array == null ? 0 : array.length;
  2443. return length ? (baseSum(array, iteratee) / length) : NAN;
  2444. }
  2445. /**
  2446. * The base implementation of `_.property` without support for deep paths.
  2447. *
  2448. * @private
  2449. * @param {string} key The key of the property to get.
  2450. * @returns {Function} Returns the new accessor function.
  2451. */
  2452. function baseProperty(key) {
  2453. return function(object) {
  2454. return object == null ? undefined : object[key];
  2455. };
  2456. }
  2457. /**
  2458. * The base implementation of `_.propertyOf` without support for deep paths.
  2459. *
  2460. * @private
  2461. * @param {Object} object The object to query.
  2462. * @returns {Function} Returns the new accessor function.
  2463. */
  2464. function basePropertyOf(object) {
  2465. return function(key) {
  2466. return object == null ? undefined : object[key];
  2467. };
  2468. }
  2469. /**
  2470. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  2471. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  2472. *
  2473. * @private
  2474. * @param {Array|Object} collection The collection to iterate over.
  2475. * @param {Function} iteratee The function invoked per iteration.
  2476. * @param {*} accumulator The initial value.
  2477. * @param {boolean} initAccum Specify using the first or last element of
  2478. * `collection` as the initial value.
  2479. * @param {Function} eachFunc The function to iterate over `collection`.
  2480. * @returns {*} Returns the accumulated value.
  2481. */
  2482. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  2483. eachFunc(collection, function(value, index, collection) {
  2484. accumulator = initAccum
  2485. ? (initAccum = false, value)
  2486. : iteratee(accumulator, value, index, collection);
  2487. });
  2488. return accumulator;
  2489. }
  2490. /**
  2491. * The base implementation of `_.sortBy` which uses `comparer` to define the
  2492. * sort order of `array` and replaces criteria objects with their corresponding
  2493. * values.
  2494. *
  2495. * @private
  2496. * @param {Array} array The array to sort.
  2497. * @param {Function} comparer The function to define sort order.
  2498. * @returns {Array} Returns `array`.
  2499. */
  2500. function baseSortBy(array, comparer) {
  2501. var length = array.length;
  2502. array.sort(comparer);
  2503. while (length--) {
  2504. array[length] = array[length].value;
  2505. }
  2506. return array;
  2507. }
  2508. /**
  2509. * The base implementation of `_.sum` and `_.sumBy` without support for
  2510. * iteratee shorthands.
  2511. *
  2512. * @private
  2513. * @param {Array} array The array to iterate over.
  2514. * @param {Function} iteratee The function invoked per iteration.
  2515. * @returns {number} Returns the sum.
  2516. */
  2517. function baseSum(array, iteratee) {
  2518. var result,
  2519. index = -1,
  2520. length = array.length;
  2521. while (++index < length) {
  2522. var current = iteratee(array[index]);
  2523. if (current !== undefined) {
  2524. result = result === undefined ? current : (result + current);
  2525. }
  2526. }
  2527. return result;
  2528. }
  2529. /**
  2530. * The base implementation of `_.times` without support for iteratee shorthands
  2531. * or max array length checks.
  2532. *
  2533. * @private
  2534. * @param {number} n The number of times to invoke `iteratee`.
  2535. * @param {Function} iteratee The function invoked per iteration.
  2536. * @returns {Array} Returns the array of results.
  2537. */
  2538. function baseTimes(n, iteratee) {
  2539. var index = -1,
  2540. result = Array(n);
  2541. while (++index < n) {
  2542. result[index] = iteratee(index);
  2543. }
  2544. return result;
  2545. }
  2546. /**
  2547. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  2548. * of key-value pairs for `object` corresponding to the property names of `props`.
  2549. *
  2550. * @private
  2551. * @param {Object} object The object to query.
  2552. * @param {Array} props The property names to get values for.
  2553. * @returns {Object} Returns the key-value pairs.
  2554. */
  2555. function baseToPairs(object, props) {
  2556. return arrayMap(props, function(key) {
  2557. return [key, object[key]];
  2558. });
  2559. }
  2560. /**
  2561. * The base implementation of `_.trim`.
  2562. *
  2563. * @private
  2564. * @param {string} string The string to trim.
  2565. * @returns {string} Returns the trimmed string.
  2566. */
  2567. function baseTrim(string) {
  2568. return string
  2569. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  2570. : string;
  2571. }
  2572. /**
  2573. * The base implementation of `_.unary` without support for storing metadata.
  2574. *
  2575. * @private
  2576. * @param {Function} func The function to cap arguments for.
  2577. * @returns {Function} Returns the new capped function.
  2578. */
  2579. function baseUnary(func) {
  2580. return function(value) {
  2581. return func(value);
  2582. };
  2583. }
  2584. /**
  2585. * The base implementation of `_.values` and `_.valuesIn` which creates an
  2586. * array of `object` property values corresponding to the property names
  2587. * of `props`.
  2588. *
  2589. * @private
  2590. * @param {Object} object The object to query.
  2591. * @param {Array} props The property names to get values for.
  2592. * @returns {Object} Returns the array of property values.
  2593. */
  2594. function baseValues(object, props) {
  2595. return arrayMap(props, function(key) {
  2596. return object[key];
  2597. });
  2598. }
  2599. /**
  2600. * Checks if a `cache` value for `key` exists.
  2601. *
  2602. * @private
  2603. * @param {Object} cache The cache to query.
  2604. * @param {string} key The key of the entry to check.
  2605. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2606. */
  2607. function cacheHas(cache, key) {
  2608. return cache.has(key);
  2609. }
  2610. /**
  2611. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  2612. * that is not found in the character symbols.
  2613. *
  2614. * @private
  2615. * @param {Array} strSymbols The string symbols to inspect.
  2616. * @param {Array} chrSymbols The character symbols to find.
  2617. * @returns {number} Returns the index of the first unmatched string symbol.
  2618. */
  2619. function charsStartIndex(strSymbols, chrSymbols) {
  2620. var index = -1,
  2621. length = strSymbols.length;
  2622. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2623. return index;
  2624. }
  2625. /**
  2626. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  2627. * that is not found in the character symbols.
  2628. *
  2629. * @private
  2630. * @param {Array} strSymbols The string symbols to inspect.
  2631. * @param {Array} chrSymbols The character symbols to find.
  2632. * @returns {number} Returns the index of the last unmatched string symbol.
  2633. */
  2634. function charsEndIndex(strSymbols, chrSymbols) {
  2635. var index = strSymbols.length;
  2636. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2637. return index;
  2638. }
  2639. /**
  2640. * Gets the number of `placeholder` occurrences in `array`.
  2641. *
  2642. * @private
  2643. * @param {Array} array The array to inspect.
  2644. * @param {*} placeholder The placeholder to search for.
  2645. * @returns {number} Returns the placeholder count.
  2646. */
  2647. function countHolders(array, placeholder) {
  2648. var length = array.length,
  2649. result = 0;
  2650. while (length--) {
  2651. if (array[length] === placeholder) {
  2652. ++result;
  2653. }
  2654. }
  2655. return result;
  2656. }
  2657. /**
  2658. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  2659. * letters to basic Latin letters.
  2660. *
  2661. * @private
  2662. * @param {string} letter The matched letter to deburr.
  2663. * @returns {string} Returns the deburred letter.
  2664. */
  2665. var deburrLetter = basePropertyOf(deburredLetters);
  2666. /**
  2667. * Used by `_.escape` to convert characters to HTML entities.
  2668. *
  2669. * @private
  2670. * @param {string} chr The matched character to escape.
  2671. * @returns {string} Returns the escaped character.
  2672. */
  2673. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  2674. /**
  2675. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  2676. *
  2677. * @private
  2678. * @param {string} chr The matched character to escape.
  2679. * @returns {string} Returns the escaped character.
  2680. */
  2681. function escapeStringChar(chr) {
  2682. return '\\' + stringEscapes[chr];
  2683. }
  2684. /**
  2685. * Gets the value at `key` of `object`.
  2686. *
  2687. * @private
  2688. * @param {Object} [object] The object to query.
  2689. * @param {string} key The key of the property to get.
  2690. * @returns {*} Returns the property value.
  2691. */
  2692. function getValue(object, key) {
  2693. return object == null ? undefined : object[key];
  2694. }
  2695. /**
  2696. * Checks if `string` contains Unicode symbols.
  2697. *
  2698. * @private
  2699. * @param {string} string The string to inspect.
  2700. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  2701. */
  2702. function hasUnicode(string) {
  2703. return reHasUnicode.test(string);
  2704. }
  2705. /**
  2706. * Checks if `string` contains a word composed of Unicode symbols.
  2707. *
  2708. * @private
  2709. * @param {string} string The string to inspect.
  2710. * @returns {boolean} Returns `true` if a word is found, else `false`.
  2711. */
  2712. function hasUnicodeWord(string) {
  2713. return reHasUnicodeWord.test(string);
  2714. }
  2715. /**
  2716. * Converts `iterator` to an array.
  2717. *
  2718. * @private
  2719. * @param {Object} iterator The iterator to convert.
  2720. * @returns {Array} Returns the converted array.
  2721. */
  2722. function iteratorToArray(iterator) {
  2723. var data,
  2724. result = [];
  2725. while (!(data = iterator.next()).done) {
  2726. result.push(data.value);
  2727. }
  2728. return result;
  2729. }
  2730. /**
  2731. * Converts `map` to its key-value pairs.
  2732. *
  2733. * @private
  2734. * @param {Object} map The map to convert.
  2735. * @returns {Array} Returns the key-value pairs.
  2736. */
  2737. function mapToArray(map) {
  2738. var index = -1,
  2739. result = Array(map.size);
  2740. map.forEach(function(value, key) {
  2741. result[++index] = [key, value];
  2742. });
  2743. return result;
  2744. }
  2745. /**
  2746. * Creates a unary function that invokes `func` with its argument transformed.
  2747. *
  2748. * @private
  2749. * @param {Function} func The function to wrap.
  2750. * @param {Function} transform The argument transform.
  2751. * @returns {Function} Returns the new function.
  2752. */
  2753. function overArg(func, transform) {
  2754. return function(arg) {
  2755. return func(transform(arg));
  2756. };
  2757. }
  2758. /**
  2759. * Replaces all `placeholder` elements in `array` with an internal placeholder
  2760. * and returns an array of their indexes.
  2761. *
  2762. * @private
  2763. * @param {Array} array The array to modify.
  2764. * @param {*} placeholder The placeholder to replace.
  2765. * @returns {Array} Returns the new array of placeholder indexes.
  2766. */
  2767. function replaceHolders(array, placeholder) {
  2768. var index = -1,
  2769. length = array.length,
  2770. resIndex = 0,
  2771. result = [];
  2772. while (++index < length) {
  2773. var value = array[index];
  2774. if (value === placeholder || value === PLACEHOLDER) {
  2775. array[index] = PLACEHOLDER;
  2776. result[resIndex++] = index;
  2777. }
  2778. }
  2779. return result;
  2780. }
  2781. /**
  2782. * Converts `set` to an array of its values.
  2783. *
  2784. * @private
  2785. * @param {Object} set The set to convert.
  2786. * @returns {Array} Returns the values.
  2787. */
  2788. function setToArray(set) {
  2789. var index = -1,
  2790. result = Array(set.size);
  2791. set.forEach(function(value) {
  2792. result[++index] = value;
  2793. });
  2794. return result;
  2795. }
  2796. /**
  2797. * Converts `set` to its value-value pairs.
  2798. *
  2799. * @private
  2800. * @param {Object} set The set to convert.
  2801. * @returns {Array} Returns the value-value pairs.
  2802. */
  2803. function setToPairs(set) {
  2804. var index = -1,
  2805. result = Array(set.size);
  2806. set.forEach(function(value) {
  2807. result[++index] = [value, value];
  2808. });
  2809. return result;
  2810. }
  2811. /**
  2812. * A specialized version of `_.indexOf` which performs strict equality
  2813. * comparisons of values, i.e. `===`.
  2814. *
  2815. * @private
  2816. * @param {Array} array The array to inspect.
  2817. * @param {*} value The value to search for.
  2818. * @param {number} fromIndex The index to search from.
  2819. * @returns {number} Returns the index of the matched value, else `-1`.
  2820. */
  2821. function strictIndexOf(array, value, fromIndex) {
  2822. var index = fromIndex - 1,
  2823. length = array.length;
  2824. while (++index < length) {
  2825. if (array[index] === value) {
  2826. return index;
  2827. }
  2828. }
  2829. return -1;
  2830. }
  2831. /**
  2832. * A specialized version of `_.lastIndexOf` which performs strict equality
  2833. * comparisons of values, i.e. `===`.
  2834. *
  2835. * @private
  2836. * @param {Array} array The array to inspect.
  2837. * @param {*} value The value to search for.
  2838. * @param {number} fromIndex The index to search from.
  2839. * @returns {number} Returns the index of the matched value, else `-1`.
  2840. */
  2841. function strictLastIndexOf(array, value, fromIndex) {
  2842. var index = fromIndex + 1;
  2843. while (index--) {
  2844. if (array[index] === value) {
  2845. return index;
  2846. }
  2847. }
  2848. return index;
  2849. }
  2850. /**
  2851. * Gets the number of symbols in `string`.
  2852. *
  2853. * @private
  2854. * @param {string} string The string to inspect.
  2855. * @returns {number} Returns the string size.
  2856. */
  2857. function stringSize(string) {
  2858. return hasUnicode(string)
  2859. ? unicodeSize(string)
  2860. : asciiSize(string);
  2861. }
  2862. /**
  2863. * Converts `string` to an array.
  2864. *
  2865. * @private
  2866. * @param {string} string The string to convert.
  2867. * @returns {Array} Returns the converted array.
  2868. */
  2869. function stringToArray(string) {
  2870. return hasUnicode(string)
  2871. ? unicodeToArray(string)
  2872. : asciiToArray(string);
  2873. }
  2874. /**
  2875. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  2876. * character of `string`.
  2877. *
  2878. * @private
  2879. * @param {string} string The string to inspect.
  2880. * @returns {number} Returns the index of the last non-whitespace character.
  2881. */
  2882. function trimmedEndIndex(string) {
  2883. var index = string.length;
  2884. while (index-- && reWhitespace.test(string.charAt(index))) {}
  2885. return index;
  2886. }
  2887. /**
  2888. * Used by `_.unescape` to convert HTML entities to characters.
  2889. *
  2890. * @private
  2891. * @param {string} chr The matched character to unescape.
  2892. * @returns {string} Returns the unescaped character.
  2893. */
  2894. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2895. /**
  2896. * Gets the size of a Unicode `string`.
  2897. *
  2898. * @private
  2899. * @param {string} string The string inspect.
  2900. * @returns {number} Returns the string size.
  2901. */
  2902. function unicodeSize(string) {
  2903. var result = reUnicode.lastIndex = 0;
  2904. while (reUnicode.test(string)) {
  2905. ++result;
  2906. }
  2907. return result;
  2908. }
  2909. /**
  2910. * Converts a Unicode `string` to an array.
  2911. *
  2912. * @private
  2913. * @param {string} string The string to convert.
  2914. * @returns {Array} Returns the converted array.
  2915. */
  2916. function unicodeToArray(string) {
  2917. return string.match(reUnicode) || [];
  2918. }
  2919. /**
  2920. * Splits a Unicode `string` into an array of its words.
  2921. *
  2922. * @private
  2923. * @param {string} The string to inspect.
  2924. * @returns {Array} Returns the words of `string`.
  2925. */
  2926. function unicodeWords(string) {
  2927. return string.match(reUnicodeWord) || [];
  2928. }
  2929. /*--------------------------------------------------------------------------*/
  2930. /**
  2931. * Create a new pristine `lodash` function using the `context` object.
  2932. *
  2933. * @static
  2934. * @memberOf _
  2935. * @since 1.1.0
  2936. * @category Util
  2937. * @param {Object} [context=root] The context object.
  2938. * @returns {Function} Returns a new `lodash` function.
  2939. * @example
  2940. *
  2941. * _.mixin({ 'foo': _.constant('foo') });
  2942. *
  2943. * var lodash = _.runInContext();
  2944. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2945. *
  2946. * _.isFunction(_.foo);
  2947. * // => true
  2948. * _.isFunction(_.bar);
  2949. * // => false
  2950. *
  2951. * lodash.isFunction(lodash.foo);
  2952. * // => false
  2953. * lodash.isFunction(lodash.bar);
  2954. * // => true
  2955. *
  2956. * // Create a suped-up `defer` in Node.js.
  2957. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2958. */
  2959. var runInContext = (function runInContext(context) {
  2960. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2961. /** Built-in constructor references. */
  2962. var Array = context.Array,
  2963. Date = context.Date,
  2964. Error = context.Error,
  2965. Function = context.Function,
  2966. Math = context.Math,
  2967. Object = context.Object,
  2968. RegExp = context.RegExp,
  2969. String = context.String,
  2970. TypeError = context.TypeError;
  2971. /** Used for built-in method references. */
  2972. var arrayProto = Array.prototype,
  2973. funcProto = Function.prototype,
  2974. objectProto = Object.prototype;
  2975. /** Used to detect overreaching core-js shims. */
  2976. var coreJsData = context['__core-js_shared__'];
  2977. /** Used to resolve the decompiled source of functions. */
  2978. var funcToString = funcProto.toString;
  2979. /** Used to check objects for own properties. */
  2980. var hasOwnProperty = objectProto.hasOwnProperty;
  2981. /** Used to generate unique IDs. */
  2982. var idCounter = 0;
  2983. /** Used to detect methods masquerading as native. */
  2984. var maskSrcKey = (function() {
  2985. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2986. return uid ? ('Symbol(src)_1.' + uid) : '';
  2987. }());
  2988. /**
  2989. * Used to resolve the
  2990. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2991. * of values.
  2992. */
  2993. var nativeObjectToString = objectProto.toString;
  2994. /** Used to infer the `Object` constructor. */
  2995. var objectCtorString = funcToString.call(Object);
  2996. /** Used to restore the original `_` reference in `_.noConflict`. */
  2997. var oldDash = root._;
  2998. /** Used to detect if a method is native. */
  2999. var reIsNative = RegExp('^' +
  3000. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3001. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3002. );
  3003. /** Built-in value references. */
  3004. var Buffer = moduleExports ? context.Buffer : undefined,
  3005. Symbol = context.Symbol,
  3006. Uint8Array = context.Uint8Array,
  3007. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  3008. getPrototype = overArg(Object.getPrototypeOf, Object),
  3009. objectCreate = Object.create,
  3010. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  3011. splice = arrayProto.splice,
  3012. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  3013. symIterator = Symbol ? Symbol.iterator : undefined,
  3014. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3015. var defineProperty = (function() {
  3016. try {
  3017. var func = getNative(Object, 'defineProperty');
  3018. func({}, '', {});
  3019. return func;
  3020. } catch (e) {}
  3021. }());
  3022. /** Mocked built-ins. */
  3023. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  3024. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  3025. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  3026. /* Built-in method references for those with the same name as other `lodash` methods. */
  3027. var nativeCeil = Math.ceil,
  3028. nativeFloor = Math.floor,
  3029. nativeGetSymbols = Object.getOwnPropertySymbols,
  3030. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  3031. nativeIsFinite = context.isFinite,
  3032. nativeJoin = arrayProto.join,
  3033. nativeKeys = overArg(Object.keys, Object),
  3034. nativeMax = Math.max,
  3035. nativeMin = Math.min,
  3036. nativeNow = Date.now,
  3037. nativeParseInt = context.parseInt,
  3038. nativeRandom = Math.random,
  3039. nativeReverse = arrayProto.reverse;
  3040. /* Built-in method references that are verified to be native. */
  3041. var DataView = getNative(context, 'DataView'),
  3042. Map = getNative(context, 'Map'),
  3043. Promise = getNative(context, 'Promise'),
  3044. Set = getNative(context, 'Set'),
  3045. WeakMap = getNative(context, 'WeakMap'),
  3046. nativeCreate = getNative(Object, 'create');
  3047. /** Used to store function metadata. */
  3048. var metaMap = WeakMap && new WeakMap;
  3049. /** Used to lookup unminified function names. */
  3050. var realNames = {};
  3051. /** Used to detect maps, sets, and weakmaps. */
  3052. var dataViewCtorString = toSource(DataView),
  3053. mapCtorString = toSource(Map),
  3054. promiseCtorString = toSource(Promise),
  3055. setCtorString = toSource(Set),
  3056. weakMapCtorString = toSource(WeakMap);
  3057. /** Used to convert symbols to primitives and strings. */
  3058. var symbolProto = Symbol ? Symbol.prototype : undefined,
  3059. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  3060. symbolToString = symbolProto ? symbolProto.toString : undefined;
  3061. /*------------------------------------------------------------------------*/
  3062. /**
  3063. * Creates a `lodash` object which wraps `value` to enable implicit method
  3064. * chain sequences. Methods that operate on and return arrays, collections,
  3065. * and functions can be chained together. Methods that retrieve a single value
  3066. * or may return a primitive value will automatically end the chain sequence
  3067. * and return the unwrapped value. Otherwise, the value must be unwrapped
  3068. * with `_#value`.
  3069. *
  3070. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  3071. * enabled using `_.chain`.
  3072. *
  3073. * The execution of chained methods is lazy, that is, it's deferred until
  3074. * `_#value` is implicitly or explicitly called.
  3075. *
  3076. * Lazy evaluation allows several methods to support shortcut fusion.
  3077. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  3078. * the creation of intermediate arrays and can greatly reduce the number of
  3079. * iteratee executions. Sections of a chain sequence qualify for shortcut
  3080. * fusion if the section is applied to an array and iteratees accept only
  3081. * one argument. The heuristic for whether a section qualifies for shortcut
  3082. * fusion is subject to change.
  3083. *
  3084. * Chaining is supported in custom builds as long as the `_#value` method is
  3085. * directly or indirectly included in the build.
  3086. *
  3087. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  3088. *
  3089. * The wrapper `Array` methods are:
  3090. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  3091. *
  3092. * The wrapper `String` methods are:
  3093. * `replace` and `split`
  3094. *
  3095. * The wrapper methods that support shortcut fusion are:
  3096. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  3097. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  3098. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  3099. *
  3100. * The chainable wrapper methods are:
  3101. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  3102. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  3103. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  3104. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  3105. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  3106. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  3107. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  3108. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  3109. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  3110. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  3111. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  3112. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  3113. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  3114. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  3115. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  3116. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  3117. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  3118. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  3119. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  3120. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  3121. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  3122. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  3123. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  3124. * `zipObject`, `zipObjectDeep`, and `zipWith`
  3125. *
  3126. * The wrapper methods that are **not** chainable by default are:
  3127. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  3128. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  3129. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  3130. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  3131. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  3132. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  3133. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  3134. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  3135. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  3136. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  3137. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  3138. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  3139. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  3140. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  3141. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  3142. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  3143. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  3144. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  3145. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  3146. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  3147. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  3148. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  3149. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  3150. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  3151. * `upperFirst`, `value`, and `words`
  3152. *
  3153. * @name _
  3154. * @constructor
  3155. * @category Seq
  3156. * @param {*} value The value to wrap in a `lodash` instance.
  3157. * @returns {Object} Returns the new `lodash` wrapper instance.
  3158. * @example
  3159. *
  3160. * function square(n) {
  3161. * return n * n;
  3162. * }
  3163. *
  3164. * var wrapped = _([1, 2, 3]);
  3165. *
  3166. * // Returns an unwrapped value.
  3167. * wrapped.reduce(_.add);
  3168. * // => 6
  3169. *
  3170. * // Returns a wrapped value.
  3171. * var squares = wrapped.map(square);
  3172. *
  3173. * _.isArray(squares);
  3174. * // => false
  3175. *
  3176. * _.isArray(squares.value());
  3177. * // => true
  3178. */
  3179. function lodash(value) {
  3180. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  3181. if (value instanceof LodashWrapper) {
  3182. return value;
  3183. }
  3184. if (hasOwnProperty.call(value, '__wrapped__')) {
  3185. return wrapperClone(value);
  3186. }
  3187. }
  3188. return new LodashWrapper(value);
  3189. }
  3190. /**
  3191. * The base implementation of `_.create` without support for assigning
  3192. * properties to the created object.
  3193. *
  3194. * @private
  3195. * @param {Object} proto The object to inherit from.
  3196. * @returns {Object} Returns the new object.
  3197. */
  3198. var baseCreate = (function() {
  3199. function object() {}
  3200. return function(proto) {
  3201. if (!isObject(proto)) {
  3202. return {};
  3203. }
  3204. if (objectCreate) {
  3205. return objectCreate(proto);
  3206. }
  3207. object.prototype = proto;
  3208. var result = new object;
  3209. object.prototype = undefined;
  3210. return result;
  3211. };
  3212. }());
  3213. /**
  3214. * The function whose prototype chain sequence wrappers inherit from.
  3215. *
  3216. * @private
  3217. */
  3218. function baseLodash() {
  3219. // No operation performed.
  3220. }
  3221. /**
  3222. * The base constructor for creating `lodash` wrapper objects.
  3223. *
  3224. * @private
  3225. * @param {*} value The value to wrap.
  3226. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  3227. */
  3228. function LodashWrapper(value, chainAll) {
  3229. this.__wrapped__ = value;
  3230. this.__actions__ = [];
  3231. this.__chain__ = !!chainAll;
  3232. this.__index__ = 0;
  3233. this.__values__ = undefined;
  3234. }
  3235. /**
  3236. * By default, the template delimiters used by lodash are like those in
  3237. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  3238. * following template settings to use alternative delimiters.
  3239. *
  3240. * @static
  3241. * @memberOf _
  3242. * @type {Object}
  3243. */
  3244. lodash.templateSettings = {
  3245. /**
  3246. * Used to detect `data` property values to be HTML-escaped.
  3247. *
  3248. * @memberOf _.templateSettings
  3249. * @type {RegExp}
  3250. */
  3251. 'escape': reEscape,
  3252. /**
  3253. * Used to detect code to be evaluated.
  3254. *
  3255. * @memberOf _.templateSettings
  3256. * @type {RegExp}
  3257. */
  3258. 'evaluate': reEvaluate,
  3259. /**
  3260. * Used to detect `data` property values to inject.
  3261. *
  3262. * @memberOf _.templateSettings
  3263. * @type {RegExp}
  3264. */
  3265. 'interpolate': reInterpolate,
  3266. /**
  3267. * Used to reference the data object in the template text.
  3268. *
  3269. * @memberOf _.templateSettings
  3270. * @type {string}
  3271. */
  3272. 'variable': '',
  3273. /**
  3274. * Used to import variables into the compiled template.
  3275. *
  3276. * @memberOf _.templateSettings
  3277. * @type {Object}
  3278. */
  3279. 'imports': {
  3280. /**
  3281. * A reference to the `lodash` function.
  3282. *
  3283. * @memberOf _.templateSettings.imports
  3284. * @type {Function}
  3285. */
  3286. '_': lodash
  3287. }
  3288. };
  3289. // Ensure wrappers are instances of `baseLodash`.
  3290. lodash.prototype = baseLodash.prototype;
  3291. lodash.prototype.constructor = lodash;
  3292. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  3293. LodashWrapper.prototype.constructor = LodashWrapper;
  3294. /*------------------------------------------------------------------------*/
  3295. /**
  3296. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  3297. *
  3298. * @private
  3299. * @constructor
  3300. * @param {*} value The value to wrap.
  3301. */
  3302. function LazyWrapper(value) {
  3303. this.__wrapped__ = value;
  3304. this.__actions__ = [];
  3305. this.__dir__ = 1;
  3306. this.__filtered__ = false;
  3307. this.__iteratees__ = [];
  3308. this.__takeCount__ = MAX_ARRAY_LENGTH;
  3309. this.__views__ = [];
  3310. }
  3311. /**
  3312. * Creates a clone of the lazy wrapper object.
  3313. *
  3314. * @private
  3315. * @name clone
  3316. * @memberOf LazyWrapper
  3317. * @returns {Object} Returns the cloned `LazyWrapper` object.
  3318. */
  3319. function lazyClone() {
  3320. var result = new LazyWrapper(this.__wrapped__);
  3321. result.__actions__ = copyArray(this.__actions__);
  3322. result.__dir__ = this.__dir__;
  3323. result.__filtered__ = this.__filtered__;
  3324. result.__iteratees__ = copyArray(this.__iteratees__);
  3325. result.__takeCount__ = this.__takeCount__;
  3326. result.__views__ = copyArray(this.__views__);
  3327. return result;
  3328. }
  3329. /**
  3330. * Reverses the direction of lazy iteration.
  3331. *
  3332. * @private
  3333. * @name reverse
  3334. * @memberOf LazyWrapper
  3335. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  3336. */
  3337. function lazyReverse() {
  3338. if (this.__filtered__) {
  3339. var result = new LazyWrapper(this);
  3340. result.__dir__ = -1;
  3341. result.__filtered__ = true;
  3342. } else {
  3343. result = this.clone();
  3344. result.__dir__ *= -1;
  3345. }
  3346. return result;
  3347. }
  3348. /**
  3349. * Extracts the unwrapped value from its lazy wrapper.
  3350. *
  3351. * @private
  3352. * @name value
  3353. * @memberOf LazyWrapper
  3354. * @returns {*} Returns the unwrapped value.
  3355. */
  3356. function lazyValue() {
  3357. var array = this.__wrapped__.value(),
  3358. dir = this.__dir__,
  3359. isArr = isArray(array),
  3360. isRight = dir < 0,
  3361. arrLength = isArr ? array.length : 0,
  3362. view = getView(0, arrLength, this.__views__),
  3363. start = view.start,
  3364. end = view.end,
  3365. length = end - start,
  3366. index = isRight ? end : (start - 1),
  3367. iteratees = this.__iteratees__,
  3368. iterLength = iteratees.length,
  3369. resIndex = 0,
  3370. takeCount = nativeMin(length, this.__takeCount__);
  3371. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  3372. return baseWrapperValue(array, this.__actions__);
  3373. }
  3374. var result = [];
  3375. outer:
  3376. while (length-- && resIndex < takeCount) {
  3377. index += dir;
  3378. var iterIndex = -1,
  3379. value = array[index];
  3380. while (++iterIndex < iterLength) {
  3381. var data = iteratees[iterIndex],
  3382. iteratee = data.iteratee,
  3383. type = data.type,
  3384. computed = iteratee(value);
  3385. if (type == LAZY_MAP_FLAG) {
  3386. value = computed;
  3387. } else if (!computed) {
  3388. if (type == LAZY_FILTER_FLAG) {
  3389. continue outer;
  3390. } else {
  3391. break outer;
  3392. }
  3393. }
  3394. }
  3395. result[resIndex++] = value;
  3396. }
  3397. return result;
  3398. }
  3399. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  3400. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  3401. LazyWrapper.prototype.constructor = LazyWrapper;
  3402. /*------------------------------------------------------------------------*/
  3403. /**
  3404. * Creates a hash object.
  3405. *
  3406. * @private
  3407. * @constructor
  3408. * @param {Array} [entries] The key-value pairs to cache.
  3409. */
  3410. function Hash(entries) {
  3411. var index = -1,
  3412. length = entries == null ? 0 : entries.length;
  3413. this.clear();
  3414. while (++index < length) {
  3415. var entry = entries[index];
  3416. this.set(entry[0], entry[1]);
  3417. }
  3418. }
  3419. /**
  3420. * Removes all key-value entries from the hash.
  3421. *
  3422. * @private
  3423. * @name clear
  3424. * @memberOf Hash
  3425. */
  3426. function hashClear() {
  3427. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3428. this.size = 0;
  3429. }
  3430. /**
  3431. * Removes `key` and its value from the hash.
  3432. *
  3433. * @private
  3434. * @name delete
  3435. * @memberOf Hash
  3436. * @param {Object} hash The hash to modify.
  3437. * @param {string} key The key of the value to remove.
  3438. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3439. */
  3440. function hashDelete(key) {
  3441. var result = this.has(key) && delete this.__data__[key];
  3442. this.size -= result ? 1 : 0;
  3443. return result;
  3444. }
  3445. /**
  3446. * Gets the hash value for `key`.
  3447. *
  3448. * @private
  3449. * @name get
  3450. * @memberOf Hash
  3451. * @param {string} key The key of the value to get.
  3452. * @returns {*} Returns the entry value.
  3453. */
  3454. function hashGet(key) {
  3455. var data = this.__data__;
  3456. if (nativeCreate) {
  3457. var result = data[key];
  3458. return result === HASH_UNDEFINED ? undefined : result;
  3459. }
  3460. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3461. }
  3462. /**
  3463. * Checks if a hash value for `key` exists.
  3464. *
  3465. * @private
  3466. * @name has
  3467. * @memberOf Hash
  3468. * @param {string} key The key of the entry to check.
  3469. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3470. */
  3471. function hashHas(key) {
  3472. var data = this.__data__;
  3473. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  3474. }
  3475. /**
  3476. * Sets the hash `key` to `value`.
  3477. *
  3478. * @private
  3479. * @name set
  3480. * @memberOf Hash
  3481. * @param {string} key The key of the value to set.
  3482. * @param {*} value The value to set.
  3483. * @returns {Object} Returns the hash instance.
  3484. */
  3485. function hashSet(key, value) {
  3486. var data = this.__data__;
  3487. this.size += this.has(key) ? 0 : 1;
  3488. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3489. return this;
  3490. }
  3491. // Add methods to `Hash`.
  3492. Hash.prototype.clear = hashClear;
  3493. Hash.prototype['delete'] = hashDelete;
  3494. Hash.prototype.get = hashGet;
  3495. Hash.prototype.has = hashHas;
  3496. Hash.prototype.set = hashSet;
  3497. /*------------------------------------------------------------------------*/
  3498. /**
  3499. * Creates an list cache object.
  3500. *
  3501. * @private
  3502. * @constructor
  3503. * @param {Array} [entries] The key-value pairs to cache.
  3504. */
  3505. function ListCache(entries) {
  3506. var index = -1,
  3507. length = entries == null ? 0 : entries.length;
  3508. this.clear();
  3509. while (++index < length) {
  3510. var entry = entries[index];
  3511. this.set(entry[0], entry[1]);
  3512. }
  3513. }
  3514. /**
  3515. * Removes all key-value entries from the list cache.
  3516. *
  3517. * @private
  3518. * @name clear
  3519. * @memberOf ListCache
  3520. */
  3521. function listCacheClear() {
  3522. this.__data__ = [];
  3523. this.size = 0;
  3524. }
  3525. /**
  3526. * Removes `key` and its value from the list cache.
  3527. *
  3528. * @private
  3529. * @name delete
  3530. * @memberOf ListCache
  3531. * @param {string} key The key of the value to remove.
  3532. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3533. */
  3534. function listCacheDelete(key) {
  3535. var data = this.__data__,
  3536. index = assocIndexOf(data, key);
  3537. if (index < 0) {
  3538. return false;
  3539. }
  3540. var lastIndex = data.length - 1;
  3541. if (index == lastIndex) {
  3542. data.pop();
  3543. } else {
  3544. splice.call(data, index, 1);
  3545. }
  3546. --this.size;
  3547. return true;
  3548. }
  3549. /**
  3550. * Gets the list cache value for `key`.
  3551. *
  3552. * @private
  3553. * @name get
  3554. * @memberOf ListCache
  3555. * @param {string} key The key of the value to get.
  3556. * @returns {*} Returns the entry value.
  3557. */
  3558. function listCacheGet(key) {
  3559. var data = this.__data__,
  3560. index = assocIndexOf(data, key);
  3561. return index < 0 ? undefined : data[index][1];
  3562. }
  3563. /**
  3564. * Checks if a list cache value for `key` exists.
  3565. *
  3566. * @private
  3567. * @name has
  3568. * @memberOf ListCache
  3569. * @param {string} key The key of the entry to check.
  3570. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3571. */
  3572. function listCacheHas(key) {
  3573. return assocIndexOf(this.__data__, key) > -1;
  3574. }
  3575. /**
  3576. * Sets the list cache `key` to `value`.
  3577. *
  3578. * @private
  3579. * @name set
  3580. * @memberOf ListCache
  3581. * @param {string} key The key of the value to set.
  3582. * @param {*} value The value to set.
  3583. * @returns {Object} Returns the list cache instance.
  3584. */
  3585. function listCacheSet(key, value) {
  3586. var data = this.__data__,
  3587. index = assocIndexOf(data, key);
  3588. if (index < 0) {
  3589. ++this.size;
  3590. data.push([key, value]);
  3591. } else {
  3592. data[index][1] = value;
  3593. }
  3594. return this;
  3595. }
  3596. // Add methods to `ListCache`.
  3597. ListCache.prototype.clear = listCacheClear;
  3598. ListCache.prototype['delete'] = listCacheDelete;
  3599. ListCache.prototype.get = listCacheGet;
  3600. ListCache.prototype.has = listCacheHas;
  3601. ListCache.prototype.set = listCacheSet;
  3602. /*------------------------------------------------------------------------*/
  3603. /**
  3604. * Creates a map cache object to store key-value pairs.
  3605. *
  3606. * @private
  3607. * @constructor
  3608. * @param {Array} [entries] The key-value pairs to cache.
  3609. */
  3610. function MapCache(entries) {
  3611. var index = -1,
  3612. length = entries == null ? 0 : entries.length;
  3613. this.clear();
  3614. while (++index < length) {
  3615. var entry = entries[index];
  3616. this.set(entry[0], entry[1]);
  3617. }
  3618. }
  3619. /**
  3620. * Removes all key-value entries from the map.
  3621. *
  3622. * @private
  3623. * @name clear
  3624. * @memberOf MapCache
  3625. */
  3626. function mapCacheClear() {
  3627. this.size = 0;
  3628. this.__data__ = {
  3629. 'hash': new Hash,
  3630. 'map': new (Map || ListCache),
  3631. 'string': new Hash
  3632. };
  3633. }
  3634. /**
  3635. * Removes `key` and its value from the map.
  3636. *
  3637. * @private
  3638. * @name delete
  3639. * @memberOf MapCache
  3640. * @param {string} key The key of the value to remove.
  3641. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3642. */
  3643. function mapCacheDelete(key) {
  3644. var result = getMapData(this, key)['delete'](key);
  3645. this.size -= result ? 1 : 0;
  3646. return result;
  3647. }
  3648. /**
  3649. * Gets the map value for `key`.
  3650. *
  3651. * @private
  3652. * @name get
  3653. * @memberOf MapCache
  3654. * @param {string} key The key of the value to get.
  3655. * @returns {*} Returns the entry value.
  3656. */
  3657. function mapCacheGet(key) {
  3658. return getMapData(this, key).get(key);
  3659. }
  3660. /**
  3661. * Checks if a map value for `key` exists.
  3662. *
  3663. * @private
  3664. * @name has
  3665. * @memberOf MapCache
  3666. * @param {string} key The key of the entry to check.
  3667. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3668. */
  3669. function mapCacheHas(key) {
  3670. return getMapData(this, key).has(key);
  3671. }
  3672. /**
  3673. * Sets the map `key` to `value`.
  3674. *
  3675. * @private
  3676. * @name set
  3677. * @memberOf MapCache
  3678. * @param {string} key The key of the value to set.
  3679. * @param {*} value The value to set.
  3680. * @returns {Object} Returns the map cache instance.
  3681. */
  3682. function mapCacheSet(key, value) {
  3683. var data = getMapData(this, key),
  3684. size = data.size;
  3685. data.set(key, value);
  3686. this.size += data.size == size ? 0 : 1;
  3687. return this;
  3688. }
  3689. // Add methods to `MapCache`.
  3690. MapCache.prototype.clear = mapCacheClear;
  3691. MapCache.prototype['delete'] = mapCacheDelete;
  3692. MapCache.prototype.get = mapCacheGet;
  3693. MapCache.prototype.has = mapCacheHas;
  3694. MapCache.prototype.set = mapCacheSet;
  3695. /*------------------------------------------------------------------------*/
  3696. /**
  3697. *
  3698. * Creates an array cache object to store unique values.
  3699. *
  3700. * @private
  3701. * @constructor
  3702. * @param {Array} [values] The values to cache.
  3703. */
  3704. function SetCache(values) {
  3705. var index = -1,
  3706. length = values == null ? 0 : values.length;
  3707. this.__data__ = new MapCache;
  3708. while (++index < length) {
  3709. this.add(values[index]);
  3710. }
  3711. }
  3712. /**
  3713. * Adds `value` to the array cache.
  3714. *
  3715. * @private
  3716. * @name add
  3717. * @memberOf SetCache
  3718. * @alias push
  3719. * @param {*} value The value to cache.
  3720. * @returns {Object} Returns the cache instance.
  3721. */
  3722. function setCacheAdd(value) {
  3723. this.__data__.set(value, HASH_UNDEFINED);
  3724. return this;
  3725. }
  3726. /**
  3727. * Checks if `value` is in the array cache.
  3728. *
  3729. * @private
  3730. * @name has
  3731. * @memberOf SetCache
  3732. * @param {*} value The value to search for.
  3733. * @returns {number} Returns `true` if `value` is found, else `false`.
  3734. */
  3735. function setCacheHas(value) {
  3736. return this.__data__.has(value);
  3737. }
  3738. // Add methods to `SetCache`.
  3739. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3740. SetCache.prototype.has = setCacheHas;
  3741. /*------------------------------------------------------------------------*/
  3742. /**
  3743. * Creates a stack cache object to store key-value pairs.
  3744. *
  3745. * @private
  3746. * @constructor
  3747. * @param {Array} [entries] The key-value pairs to cache.
  3748. */
  3749. function Stack(entries) {
  3750. var data = this.__data__ = new ListCache(entries);
  3751. this.size = data.size;
  3752. }
  3753. /**
  3754. * Removes all key-value entries from the stack.
  3755. *
  3756. * @private
  3757. * @name clear
  3758. * @memberOf Stack
  3759. */
  3760. function stackClear() {
  3761. this.__data__ = new ListCache;
  3762. this.size = 0;
  3763. }
  3764. /**
  3765. * Removes `key` and its value from the stack.
  3766. *
  3767. * @private
  3768. * @name delete
  3769. * @memberOf Stack
  3770. * @param {string} key The key of the value to remove.
  3771. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3772. */
  3773. function stackDelete(key) {
  3774. var data = this.__data__,
  3775. result = data['delete'](key);
  3776. this.size = data.size;
  3777. return result;
  3778. }
  3779. /**
  3780. * Gets the stack value for `key`.
  3781. *
  3782. * @private
  3783. * @name get
  3784. * @memberOf Stack
  3785. * @param {string} key The key of the value to get.
  3786. * @returns {*} Returns the entry value.
  3787. */
  3788. function stackGet(key) {
  3789. return this.__data__.get(key);
  3790. }
  3791. /**
  3792. * Checks if a stack value for `key` exists.
  3793. *
  3794. * @private
  3795. * @name has
  3796. * @memberOf Stack
  3797. * @param {string} key The key of the entry to check.
  3798. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3799. */
  3800. function stackHas(key) {
  3801. return this.__data__.has(key);
  3802. }
  3803. /**
  3804. * Sets the stack `key` to `value`.
  3805. *
  3806. * @private
  3807. * @name set
  3808. * @memberOf Stack
  3809. * @param {string} key The key of the value to set.
  3810. * @param {*} value The value to set.
  3811. * @returns {Object} Returns the stack cache instance.
  3812. */
  3813. function stackSet(key, value) {
  3814. var data = this.__data__;
  3815. if (data instanceof ListCache) {
  3816. var pairs = data.__data__;
  3817. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3818. pairs.push([key, value]);
  3819. this.size = ++data.size;
  3820. return this;
  3821. }
  3822. data = this.__data__ = new MapCache(pairs);
  3823. }
  3824. data.set(key, value);
  3825. this.size = data.size;
  3826. return this;
  3827. }
  3828. // Add methods to `Stack`.
  3829. Stack.prototype.clear = stackClear;
  3830. Stack.prototype['delete'] = stackDelete;
  3831. Stack.prototype.get = stackGet;
  3832. Stack.prototype.has = stackHas;
  3833. Stack.prototype.set = stackSet;
  3834. /*------------------------------------------------------------------------*/
  3835. /**
  3836. * Creates an array of the enumerable property names of the array-like `value`.
  3837. *
  3838. * @private
  3839. * @param {*} value The value to query.
  3840. * @param {boolean} inherited Specify returning inherited property names.
  3841. * @returns {Array} Returns the array of property names.
  3842. */
  3843. function arrayLikeKeys(value, inherited) {
  3844. var isArr = isArray(value),
  3845. isArg = !isArr && isArguments(value),
  3846. isBuff = !isArr && !isArg && isBuffer(value),
  3847. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3848. skipIndexes = isArr || isArg || isBuff || isType,
  3849. result = skipIndexes ? baseTimes(value.length, String) : [],
  3850. length = result.length;
  3851. for (var key in value) {
  3852. if ((inherited || hasOwnProperty.call(value, key)) &&
  3853. !(skipIndexes && (
  3854. // Safari 9 has enumerable `arguments.length` in strict mode.
  3855. key == 'length' ||
  3856. // Node.js 0.10 has enumerable non-index properties on buffers.
  3857. (isBuff && (key == 'offset' || key == 'parent')) ||
  3858. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3859. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3860. // Skip index properties.
  3861. isIndex(key, length)
  3862. ))) {
  3863. result.push(key);
  3864. }
  3865. }
  3866. return result;
  3867. }
  3868. /**
  3869. * A specialized version of `_.sample` for arrays.
  3870. *
  3871. * @private
  3872. * @param {Array} array The array to sample.
  3873. * @returns {*} Returns the random element.
  3874. */
  3875. function arraySample(array) {
  3876. var length = array.length;
  3877. return length ? array[baseRandom(0, length - 1)] : undefined;
  3878. }
  3879. /**
  3880. * A specialized version of `_.sampleSize` for arrays.
  3881. *
  3882. * @private
  3883. * @param {Array} array The array to sample.
  3884. * @param {number} n The number of elements to sample.
  3885. * @returns {Array} Returns the random elements.
  3886. */
  3887. function arraySampleSize(array, n) {
  3888. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3889. }
  3890. /**
  3891. * A specialized version of `_.shuffle` for arrays.
  3892. *
  3893. * @private
  3894. * @param {Array} array The array to shuffle.
  3895. * @returns {Array} Returns the new shuffled array.
  3896. */
  3897. function arrayShuffle(array) {
  3898. return shuffleSelf(copyArray(array));
  3899. }
  3900. /**
  3901. * This function is like `assignValue` except that it doesn't assign
  3902. * `undefined` values.
  3903. *
  3904. * @private
  3905. * @param {Object} object The object to modify.
  3906. * @param {string} key The key of the property to assign.
  3907. * @param {*} value The value to assign.
  3908. */
  3909. function assignMergeValue(object, key, value) {
  3910. if ((value !== undefined && !eq(object[key], value)) ||
  3911. (value === undefined && !(key in object))) {
  3912. baseAssignValue(object, key, value);
  3913. }
  3914. }
  3915. /**
  3916. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3917. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3918. * for equality comparisons.
  3919. *
  3920. * @private
  3921. * @param {Object} object The object to modify.
  3922. * @param {string} key The key of the property to assign.
  3923. * @param {*} value The value to assign.
  3924. */
  3925. function assignValue(object, key, value) {
  3926. var objValue = object[key];
  3927. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3928. (value === undefined && !(key in object))) {
  3929. baseAssignValue(object, key, value);
  3930. }
  3931. }
  3932. /**
  3933. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3934. *
  3935. * @private
  3936. * @param {Array} array The array to inspect.
  3937. * @param {*} key The key to search for.
  3938. * @returns {number} Returns the index of the matched value, else `-1`.
  3939. */
  3940. function assocIndexOf(array, key) {
  3941. var length = array.length;
  3942. while (length--) {
  3943. if (eq(array[length][0], key)) {
  3944. return length;
  3945. }
  3946. }
  3947. return -1;
  3948. }
  3949. /**
  3950. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3951. * by `iteratee` and values set by `setter`.
  3952. *
  3953. * @private
  3954. * @param {Array|Object} collection The collection to iterate over.
  3955. * @param {Function} setter The function to set `accumulator` values.
  3956. * @param {Function} iteratee The iteratee to transform keys.
  3957. * @param {Object} accumulator The initial aggregated object.
  3958. * @returns {Function} Returns `accumulator`.
  3959. */
  3960. function baseAggregator(collection, setter, iteratee, accumulator) {
  3961. baseEach(collection, function(value, key, collection) {
  3962. setter(accumulator, value, iteratee(value), collection);
  3963. });
  3964. return accumulator;
  3965. }
  3966. /**
  3967. * The base implementation of `_.assign` without support for multiple sources
  3968. * or `customizer` functions.
  3969. *
  3970. * @private
  3971. * @param {Object} object The destination object.
  3972. * @param {Object} source The source object.
  3973. * @returns {Object} Returns `object`.
  3974. */
  3975. function baseAssign(object, source) {
  3976. return object && copyObject(source, keys(source), object);
  3977. }
  3978. /**
  3979. * The base implementation of `_.assignIn` without support for multiple sources
  3980. * or `customizer` functions.
  3981. *
  3982. * @private
  3983. * @param {Object} object The destination object.
  3984. * @param {Object} source The source object.
  3985. * @returns {Object} Returns `object`.
  3986. */
  3987. function baseAssignIn(object, source) {
  3988. return object && copyObject(source, keysIn(source), object);
  3989. }
  3990. /**
  3991. * The base implementation of `assignValue` and `assignMergeValue` without
  3992. * value checks.
  3993. *
  3994. * @private
  3995. * @param {Object} object The object to modify.
  3996. * @param {string} key The key of the property to assign.
  3997. * @param {*} value The value to assign.
  3998. */
  3999. function baseAssignValue(object, key, value) {
  4000. if (key == '__proto__' && defineProperty) {
  4001. defineProperty(object, key, {
  4002. 'configurable': true,
  4003. 'enumerable': true,
  4004. 'value': value,
  4005. 'writable': true
  4006. });
  4007. } else {
  4008. object[key] = value;
  4009. }
  4010. }
  4011. /**
  4012. * The base implementation of `_.at` without support for individual paths.
  4013. *
  4014. * @private
  4015. * @param {Object} object The object to iterate over.
  4016. * @param {string[]} paths The property paths to pick.
  4017. * @returns {Array} Returns the picked elements.
  4018. */
  4019. function baseAt(object, paths) {
  4020. var index = -1,
  4021. length = paths.length,
  4022. result = Array(length),
  4023. skip = object == null;
  4024. while (++index < length) {
  4025. result[index] = skip ? undefined : get(object, paths[index]);
  4026. }
  4027. return result;
  4028. }
  4029. /**
  4030. * The base implementation of `_.clamp` which doesn't coerce arguments.
  4031. *
  4032. * @private
  4033. * @param {number} number The number to clamp.
  4034. * @param {number} [lower] The lower bound.
  4035. * @param {number} upper The upper bound.
  4036. * @returns {number} Returns the clamped number.
  4037. */
  4038. function baseClamp(number, lower, upper) {
  4039. if (number === number) {
  4040. if (upper !== undefined) {
  4041. number = number <= upper ? number : upper;
  4042. }
  4043. if (lower !== undefined) {
  4044. number = number >= lower ? number : lower;
  4045. }
  4046. }
  4047. return number;
  4048. }
  4049. /**
  4050. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  4051. * traversed objects.
  4052. *
  4053. * @private
  4054. * @param {*} value The value to clone.
  4055. * @param {boolean} bitmask The bitmask flags.
  4056. * 1 - Deep clone
  4057. * 2 - Flatten inherited properties
  4058. * 4 - Clone symbols
  4059. * @param {Function} [customizer] The function to customize cloning.
  4060. * @param {string} [key] The key of `value`.
  4061. * @param {Object} [object] The parent object of `value`.
  4062. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  4063. * @returns {*} Returns the cloned value.
  4064. */
  4065. function baseClone(value, bitmask, customizer, key, object, stack) {
  4066. var result,
  4067. isDeep = bitmask & CLONE_DEEP_FLAG,
  4068. isFlat = bitmask & CLONE_FLAT_FLAG,
  4069. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  4070. if (customizer) {
  4071. result = object ? customizer(value, key, object, stack) : customizer(value);
  4072. }
  4073. if (result !== undefined) {
  4074. return result;
  4075. }
  4076. if (!isObject(value)) {
  4077. return value;
  4078. }
  4079. var isArr = isArray(value);
  4080. if (isArr) {
  4081. result = initCloneArray(value);
  4082. if (!isDeep) {
  4083. return copyArray(value, result);
  4084. }
  4085. } else {
  4086. var tag = getTag(value),
  4087. isFunc = tag == funcTag || tag == genTag;
  4088. if (isBuffer(value)) {
  4089. return cloneBuffer(value, isDeep);
  4090. }
  4091. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  4092. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  4093. if (!isDeep) {
  4094. return isFlat
  4095. ? copySymbolsIn(value, baseAssignIn(result, value))
  4096. : copySymbols(value, baseAssign(result, value));
  4097. }
  4098. } else {
  4099. if (!cloneableTags[tag]) {
  4100. return object ? value : {};
  4101. }
  4102. result = initCloneByTag(value, tag, isDeep);
  4103. }
  4104. }
  4105. // Check for circular references and return its corresponding clone.
  4106. stack || (stack = new Stack);
  4107. var stacked = stack.get(value);
  4108. if (stacked) {
  4109. return stacked;
  4110. }
  4111. stack.set(value, result);
  4112. if (isSet(value)) {
  4113. value.forEach(function(subValue) {
  4114. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  4115. });
  4116. } else if (isMap(value)) {
  4117. value.forEach(function(subValue, key) {
  4118. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  4119. });
  4120. }
  4121. var keysFunc = isFull
  4122. ? (isFlat ? getAllKeysIn : getAllKeys)
  4123. : (isFlat ? keysIn : keys);
  4124. var props = isArr ? undefined : keysFunc(value);
  4125. arrayEach(props || value, function(subValue, key) {
  4126. if (props) {
  4127. key = subValue;
  4128. subValue = value[key];
  4129. }
  4130. // Recursively populate clone (susceptible to call stack limits).
  4131. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  4132. });
  4133. return result;
  4134. }
  4135. /**
  4136. * The base implementation of `_.conforms` which doesn't clone `source`.
  4137. *
  4138. * @private
  4139. * @param {Object} source The object of property predicates to conform to.
  4140. * @returns {Function} Returns the new spec function.
  4141. */
  4142. function baseConforms(source) {
  4143. var props = keys(source);
  4144. return function(object) {
  4145. return baseConformsTo(object, source, props);
  4146. };
  4147. }
  4148. /**
  4149. * The base implementation of `_.conformsTo` which accepts `props` to check.
  4150. *
  4151. * @private
  4152. * @param {Object} object The object to inspect.
  4153. * @param {Object} source The object of property predicates to conform to.
  4154. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  4155. */
  4156. function baseConformsTo(object, source, props) {
  4157. var length = props.length;
  4158. if (object == null) {
  4159. return !length;
  4160. }
  4161. object = Object(object);
  4162. while (length--) {
  4163. var key = props[length],
  4164. predicate = source[key],
  4165. value = object[key];
  4166. if ((value === undefined && !(key in object)) || !predicate(value)) {
  4167. return false;
  4168. }
  4169. }
  4170. return true;
  4171. }
  4172. /**
  4173. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  4174. * to provide to `func`.
  4175. *
  4176. * @private
  4177. * @param {Function} func The function to delay.
  4178. * @param {number} wait The number of milliseconds to delay invocation.
  4179. * @param {Array} args The arguments to provide to `func`.
  4180. * @returns {number|Object} Returns the timer id or timeout object.
  4181. */
  4182. function baseDelay(func, wait, args) {
  4183. if (typeof func != 'function') {
  4184. throw new TypeError(FUNC_ERROR_TEXT);
  4185. }
  4186. return setTimeout(function() { func.apply(undefined, args); }, wait);
  4187. }
  4188. /**
  4189. * The base implementation of methods like `_.difference` without support
  4190. * for excluding multiple arrays or iteratee shorthands.
  4191. *
  4192. * @private
  4193. * @param {Array} array The array to inspect.
  4194. * @param {Array} values The values to exclude.
  4195. * @param {Function} [iteratee] The iteratee invoked per element.
  4196. * @param {Function} [comparator] The comparator invoked per element.
  4197. * @returns {Array} Returns the new array of filtered values.
  4198. */
  4199. function baseDifference(array, values, iteratee, comparator) {
  4200. var index = -1,
  4201. includes = arrayIncludes,
  4202. isCommon = true,
  4203. length = array.length,
  4204. result = [],
  4205. valuesLength = values.length;
  4206. if (!length) {
  4207. return result;
  4208. }
  4209. if (iteratee) {
  4210. values = arrayMap(values, baseUnary(iteratee));
  4211. }
  4212. if (comparator) {
  4213. includes = arrayIncludesWith;
  4214. isCommon = false;
  4215. }
  4216. else if (values.length >= LARGE_ARRAY_SIZE) {
  4217. includes = cacheHas;
  4218. isCommon = false;
  4219. values = new SetCache(values);
  4220. }
  4221. outer:
  4222. while (++index < length) {
  4223. var value = array[index],
  4224. computed = iteratee == null ? value : iteratee(value);
  4225. value = (comparator || value !== 0) ? value : 0;
  4226. if (isCommon && computed === computed) {
  4227. var valuesIndex = valuesLength;
  4228. while (valuesIndex--) {
  4229. if (values[valuesIndex] === computed) {
  4230. continue outer;
  4231. }
  4232. }
  4233. result.push(value);
  4234. }
  4235. else if (!includes(values, computed, comparator)) {
  4236. result.push(value);
  4237. }
  4238. }
  4239. return result;
  4240. }
  4241. /**
  4242. * The base implementation of `_.forEach` without support for iteratee shorthands.
  4243. *
  4244. * @private
  4245. * @param {Array|Object} collection The collection to iterate over.
  4246. * @param {Function} iteratee The function invoked per iteration.
  4247. * @returns {Array|Object} Returns `collection`.
  4248. */
  4249. var baseEach = createBaseEach(baseForOwn);
  4250. /**
  4251. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  4252. *
  4253. * @private
  4254. * @param {Array|Object} collection The collection to iterate over.
  4255. * @param {Function} iteratee The function invoked per iteration.
  4256. * @returns {Array|Object} Returns `collection`.
  4257. */
  4258. var baseEachRight = createBaseEach(baseForOwnRight, true);
  4259. /**
  4260. * The base implementation of `_.every` without support for iteratee shorthands.
  4261. *
  4262. * @private
  4263. * @param {Array|Object} collection The collection to iterate over.
  4264. * @param {Function} predicate The function invoked per iteration.
  4265. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  4266. * else `false`
  4267. */
  4268. function baseEvery(collection, predicate) {
  4269. var result = true;
  4270. baseEach(collection, function(value, index, collection) {
  4271. result = !!predicate(value, index, collection);
  4272. return result;
  4273. });
  4274. return result;
  4275. }
  4276. /**
  4277. * The base implementation of methods like `_.max` and `_.min` which accepts a
  4278. * `comparator` to determine the extremum value.
  4279. *
  4280. * @private
  4281. * @param {Array} array The array to iterate over.
  4282. * @param {Function} iteratee The iteratee invoked per iteration.
  4283. * @param {Function} comparator The comparator used to compare values.
  4284. * @returns {*} Returns the extremum value.
  4285. */
  4286. function baseExtremum(array, iteratee, comparator) {
  4287. var index = -1,
  4288. length = array.length;
  4289. while (++index < length) {
  4290. var value = array[index],
  4291. current = iteratee(value);
  4292. if (current != null && (computed === undefined
  4293. ? (current === current && !isSymbol(current))
  4294. : comparator(current, computed)
  4295. )) {
  4296. var computed = current,
  4297. result = value;
  4298. }
  4299. }
  4300. return result;
  4301. }
  4302. /**
  4303. * The base implementation of `_.fill` without an iteratee call guard.
  4304. *
  4305. * @private
  4306. * @param {Array} array The array to fill.
  4307. * @param {*} value The value to fill `array` with.
  4308. * @param {number} [start=0] The start position.
  4309. * @param {number} [end=array.length] The end position.
  4310. * @returns {Array} Returns `array`.
  4311. */
  4312. function baseFill(array, value, start, end) {
  4313. var length = array.length;
  4314. start = toInteger(start);
  4315. if (start < 0) {
  4316. start = -start > length ? 0 : (length + start);
  4317. }
  4318. end = (end === undefined || end > length) ? length : toInteger(end);
  4319. if (end < 0) {
  4320. end += length;
  4321. }
  4322. end = start > end ? 0 : toLength(end);
  4323. while (start < end) {
  4324. array[start++] = value;
  4325. }
  4326. return array;
  4327. }
  4328. /**
  4329. * The base implementation of `_.filter` without support for iteratee shorthands.
  4330. *
  4331. * @private
  4332. * @param {Array|Object} collection The collection to iterate over.
  4333. * @param {Function} predicate The function invoked per iteration.
  4334. * @returns {Array} Returns the new filtered array.
  4335. */
  4336. function baseFilter(collection, predicate) {
  4337. var result = [];
  4338. baseEach(collection, function(value, index, collection) {
  4339. if (predicate(value, index, collection)) {
  4340. result.push(value);
  4341. }
  4342. });
  4343. return result;
  4344. }
  4345. /**
  4346. * The base implementation of `_.flatten` with support for restricting flattening.
  4347. *
  4348. * @private
  4349. * @param {Array} array The array to flatten.
  4350. * @param {number} depth The maximum recursion depth.
  4351. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  4352. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  4353. * @param {Array} [result=[]] The initial result value.
  4354. * @returns {Array} Returns the new flattened array.
  4355. */
  4356. function baseFlatten(array, depth, predicate, isStrict, result) {
  4357. var index = -1,
  4358. length = array.length;
  4359. predicate || (predicate = isFlattenable);
  4360. result || (result = []);
  4361. while (++index < length) {
  4362. var value = array[index];
  4363. if (depth > 0 && predicate(value)) {
  4364. if (depth > 1) {
  4365. // Recursively flatten arrays (susceptible to call stack limits).
  4366. baseFlatten(value, depth - 1, predicate, isStrict, result);
  4367. } else {
  4368. arrayPush(result, value);
  4369. }
  4370. } else if (!isStrict) {
  4371. result[result.length] = value;
  4372. }
  4373. }
  4374. return result;
  4375. }
  4376. /**
  4377. * The base implementation of `baseForOwn` which iterates over `object`
  4378. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  4379. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4380. *
  4381. * @private
  4382. * @param {Object} object The object to iterate over.
  4383. * @param {Function} iteratee The function invoked per iteration.
  4384. * @param {Function} keysFunc The function to get the keys of `object`.
  4385. * @returns {Object} Returns `object`.
  4386. */
  4387. var baseFor = createBaseFor();
  4388. /**
  4389. * This function is like `baseFor` except that it iterates over properties
  4390. * in the opposite order.
  4391. *
  4392. * @private
  4393. * @param {Object} object The object to iterate over.
  4394. * @param {Function} iteratee The function invoked per iteration.
  4395. * @param {Function} keysFunc The function to get the keys of `object`.
  4396. * @returns {Object} Returns `object`.
  4397. */
  4398. var baseForRight = createBaseFor(true);
  4399. /**
  4400. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  4401. *
  4402. * @private
  4403. * @param {Object} object The object to iterate over.
  4404. * @param {Function} iteratee The function invoked per iteration.
  4405. * @returns {Object} Returns `object`.
  4406. */
  4407. function baseForOwn(object, iteratee) {
  4408. return object && baseFor(object, iteratee, keys);
  4409. }
  4410. /**
  4411. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  4412. *
  4413. * @private
  4414. * @param {Object} object The object to iterate over.
  4415. * @param {Function} iteratee The function invoked per iteration.
  4416. * @returns {Object} Returns `object`.
  4417. */
  4418. function baseForOwnRight(object, iteratee) {
  4419. return object && baseForRight(object, iteratee, keys);
  4420. }
  4421. /**
  4422. * The base implementation of `_.functions` which creates an array of
  4423. * `object` function property names filtered from `props`.
  4424. *
  4425. * @private
  4426. * @param {Object} object The object to inspect.
  4427. * @param {Array} props The property names to filter.
  4428. * @returns {Array} Returns the function names.
  4429. */
  4430. function baseFunctions(object, props) {
  4431. return arrayFilter(props, function(key) {
  4432. return isFunction(object[key]);
  4433. });
  4434. }
  4435. /**
  4436. * The base implementation of `_.get` without support for default values.
  4437. *
  4438. * @private
  4439. * @param {Object} object The object to query.
  4440. * @param {Array|string} path The path of the property to get.
  4441. * @returns {*} Returns the resolved value.
  4442. */
  4443. function baseGet(object, path) {
  4444. path = castPath(path, object);
  4445. var index = 0,
  4446. length = path.length;
  4447. while (object != null && index < length) {
  4448. object = object[toKey(path[index++])];
  4449. }
  4450. return (index && index == length) ? object : undefined;
  4451. }
  4452. /**
  4453. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  4454. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  4455. * symbols of `object`.
  4456. *
  4457. * @private
  4458. * @param {Object} object The object to query.
  4459. * @param {Function} keysFunc The function to get the keys of `object`.
  4460. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  4461. * @returns {Array} Returns the array of property names and symbols.
  4462. */
  4463. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  4464. var result = keysFunc(object);
  4465. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  4466. }
  4467. /**
  4468. * The base implementation of `getTag` without fallbacks for buggy environments.
  4469. *
  4470. * @private
  4471. * @param {*} value The value to query.
  4472. * @returns {string} Returns the `toStringTag`.
  4473. */
  4474. function baseGetTag(value) {
  4475. if (value == null) {
  4476. return value === undefined ? undefinedTag : nullTag;
  4477. }
  4478. return (symToStringTag && symToStringTag in Object(value))
  4479. ? getRawTag(value)
  4480. : objectToString(value);
  4481. }
  4482. /**
  4483. * The base implementation of `_.gt` which doesn't coerce arguments.
  4484. *
  4485. * @private
  4486. * @param {*} value The value to compare.
  4487. * @param {*} other The other value to compare.
  4488. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  4489. * else `false`.
  4490. */
  4491. function baseGt(value, other) {
  4492. return value > other;
  4493. }
  4494. /**
  4495. * The base implementation of `_.has` without support for deep paths.
  4496. *
  4497. * @private
  4498. * @param {Object} [object] The object to query.
  4499. * @param {Array|string} key The key to check.
  4500. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4501. */
  4502. function baseHas(object, key) {
  4503. return object != null && hasOwnProperty.call(object, key);
  4504. }
  4505. /**
  4506. * The base implementation of `_.hasIn` without support for deep paths.
  4507. *
  4508. * @private
  4509. * @param {Object} [object] The object to query.
  4510. * @param {Array|string} key The key to check.
  4511. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4512. */
  4513. function baseHasIn(object, key) {
  4514. return object != null && key in Object(object);
  4515. }
  4516. /**
  4517. * The base implementation of `_.inRange` which doesn't coerce arguments.
  4518. *
  4519. * @private
  4520. * @param {number} number The number to check.
  4521. * @param {number} start The start of the range.
  4522. * @param {number} end The end of the range.
  4523. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  4524. */
  4525. function baseInRange(number, start, end) {
  4526. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  4527. }
  4528. /**
  4529. * The base implementation of methods like `_.intersection`, without support
  4530. * for iteratee shorthands, that accepts an array of arrays to inspect.
  4531. *
  4532. * @private
  4533. * @param {Array} arrays The arrays to inspect.
  4534. * @param {Function} [iteratee] The iteratee invoked per element.
  4535. * @param {Function} [comparator] The comparator invoked per element.
  4536. * @returns {Array} Returns the new array of shared values.
  4537. */
  4538. function baseIntersection(arrays, iteratee, comparator) {
  4539. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  4540. length = arrays[0].length,
  4541. othLength = arrays.length,
  4542. othIndex = othLength,
  4543. caches = Array(othLength),
  4544. maxLength = Infinity,
  4545. result = [];
  4546. while (othIndex--) {
  4547. var array = arrays[othIndex];
  4548. if (othIndex && iteratee) {
  4549. array = arrayMap(array, baseUnary(iteratee));
  4550. }
  4551. maxLength = nativeMin(array.length, maxLength);
  4552. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  4553. ? new SetCache(othIndex && array)
  4554. : undefined;
  4555. }
  4556. array = arrays[0];
  4557. var index = -1,
  4558. seen = caches[0];
  4559. outer:
  4560. while (++index < length && result.length < maxLength) {
  4561. var value = array[index],
  4562. computed = iteratee ? iteratee(value) : value;
  4563. value = (comparator || value !== 0) ? value : 0;
  4564. if (!(seen
  4565. ? cacheHas(seen, computed)
  4566. : includes(result, computed, comparator)
  4567. )) {
  4568. othIndex = othLength;
  4569. while (--othIndex) {
  4570. var cache = caches[othIndex];
  4571. if (!(cache
  4572. ? cacheHas(cache, computed)
  4573. : includes(arrays[othIndex], computed, comparator))
  4574. ) {
  4575. continue outer;
  4576. }
  4577. }
  4578. if (seen) {
  4579. seen.push(computed);
  4580. }
  4581. result.push(value);
  4582. }
  4583. }
  4584. return result;
  4585. }
  4586. /**
  4587. * The base implementation of `_.invert` and `_.invertBy` which inverts
  4588. * `object` with values transformed by `iteratee` and set by `setter`.
  4589. *
  4590. * @private
  4591. * @param {Object} object The object to iterate over.
  4592. * @param {Function} setter The function to set `accumulator` values.
  4593. * @param {Function} iteratee The iteratee to transform values.
  4594. * @param {Object} accumulator The initial inverted object.
  4595. * @returns {Function} Returns `accumulator`.
  4596. */
  4597. function baseInverter(object, setter, iteratee, accumulator) {
  4598. baseForOwn(object, function(value, key, object) {
  4599. setter(accumulator, iteratee(value), key, object);
  4600. });
  4601. return accumulator;
  4602. }
  4603. /**
  4604. * The base implementation of `_.invoke` without support for individual
  4605. * method arguments.
  4606. *
  4607. * @private
  4608. * @param {Object} object The object to query.
  4609. * @param {Array|string} path The path of the method to invoke.
  4610. * @param {Array} args The arguments to invoke the method with.
  4611. * @returns {*} Returns the result of the invoked method.
  4612. */
  4613. function baseInvoke(object, path, args) {
  4614. path = castPath(path, object);
  4615. object = parent(object, path);
  4616. var func = object == null ? object : object[toKey(last(path))];
  4617. return func == null ? undefined : apply(func, object, args);
  4618. }
  4619. /**
  4620. * The base implementation of `_.isArguments`.
  4621. *
  4622. * @private
  4623. * @param {*} value The value to check.
  4624. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4625. */
  4626. function baseIsArguments(value) {
  4627. return isObjectLike(value) && baseGetTag(value) == argsTag;
  4628. }
  4629. /**
  4630. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  4631. *
  4632. * @private
  4633. * @param {*} value The value to check.
  4634. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  4635. */
  4636. function baseIsArrayBuffer(value) {
  4637. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4638. }
  4639. /**
  4640. * The base implementation of `_.isDate` without Node.js optimizations.
  4641. *
  4642. * @private
  4643. * @param {*} value The value to check.
  4644. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  4645. */
  4646. function baseIsDate(value) {
  4647. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4648. }
  4649. /**
  4650. * The base implementation of `_.isEqual` which supports partial comparisons
  4651. * and tracks traversed objects.
  4652. *
  4653. * @private
  4654. * @param {*} value The value to compare.
  4655. * @param {*} other The other value to compare.
  4656. * @param {boolean} bitmask The bitmask flags.
  4657. * 1 - Unordered comparison
  4658. * 2 - Partial comparison
  4659. * @param {Function} [customizer] The function to customize comparisons.
  4660. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4661. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4662. */
  4663. function baseIsEqual(value, other, bitmask, customizer, stack) {
  4664. if (value === other) {
  4665. return true;
  4666. }
  4667. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  4668. return value !== value && other !== other;
  4669. }
  4670. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  4671. }
  4672. /**
  4673. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4674. * deep comparisons and tracks traversed objects enabling objects with circular
  4675. * references to be compared.
  4676. *
  4677. * @private
  4678. * @param {Object} object The object to compare.
  4679. * @param {Object} other The other object to compare.
  4680. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4681. * @param {Function} customizer The function to customize comparisons.
  4682. * @param {Function} equalFunc The function to determine equivalents of values.
  4683. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4684. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4685. */
  4686. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  4687. var objIsArr = isArray(object),
  4688. othIsArr = isArray(other),
  4689. objTag = objIsArr ? arrayTag : getTag(object),
  4690. othTag = othIsArr ? arrayTag : getTag(other);
  4691. objTag = objTag == argsTag ? objectTag : objTag;
  4692. othTag = othTag == argsTag ? objectTag : othTag;
  4693. var objIsObj = objTag == objectTag,
  4694. othIsObj = othTag == objectTag,
  4695. isSameTag = objTag == othTag;
  4696. if (isSameTag && isBuffer(object)) {
  4697. if (!isBuffer(other)) {
  4698. return false;
  4699. }
  4700. objIsArr = true;
  4701. objIsObj = false;
  4702. }
  4703. if (isSameTag && !objIsObj) {
  4704. stack || (stack = new Stack);
  4705. return (objIsArr || isTypedArray(object))
  4706. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  4707. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  4708. }
  4709. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  4710. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4711. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4712. if (objIsWrapped || othIsWrapped) {
  4713. var objUnwrapped = objIsWrapped ? object.value() : object,
  4714. othUnwrapped = othIsWrapped ? other.value() : other;
  4715. stack || (stack = new Stack);
  4716. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  4717. }
  4718. }
  4719. if (!isSameTag) {
  4720. return false;
  4721. }
  4722. stack || (stack = new Stack);
  4723. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  4724. }
  4725. /**
  4726. * The base implementation of `_.isMap` without Node.js optimizations.
  4727. *
  4728. * @private
  4729. * @param {*} value The value to check.
  4730. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  4731. */
  4732. function baseIsMap(value) {
  4733. return isObjectLike(value) && getTag(value) == mapTag;
  4734. }
  4735. /**
  4736. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4737. *
  4738. * @private
  4739. * @param {Object} object The object to inspect.
  4740. * @param {Object} source The object of property values to match.
  4741. * @param {Array} matchData The property names, values, and compare flags to match.
  4742. * @param {Function} [customizer] The function to customize comparisons.
  4743. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4744. */
  4745. function baseIsMatch(object, source, matchData, customizer) {
  4746. var index = matchData.length,
  4747. length = index,
  4748. noCustomizer = !customizer;
  4749. if (object == null) {
  4750. return !length;
  4751. }
  4752. object = Object(object);
  4753. while (index--) {
  4754. var data = matchData[index];
  4755. if ((noCustomizer && data[2])
  4756. ? data[1] !== object[data[0]]
  4757. : !(data[0] in object)
  4758. ) {
  4759. return false;
  4760. }
  4761. }
  4762. while (++index < length) {
  4763. data = matchData[index];
  4764. var key = data[0],
  4765. objValue = object[key],
  4766. srcValue = data[1];
  4767. if (noCustomizer && data[2]) {
  4768. if (objValue === undefined && !(key in object)) {
  4769. return false;
  4770. }
  4771. } else {
  4772. var stack = new Stack;
  4773. if (customizer) {
  4774. var result = customizer(objValue, srcValue, key, object, source, stack);
  4775. }
  4776. if (!(result === undefined
  4777. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  4778. : result
  4779. )) {
  4780. return false;
  4781. }
  4782. }
  4783. }
  4784. return true;
  4785. }
  4786. /**
  4787. * The base implementation of `_.isNative` without bad shim checks.
  4788. *
  4789. * @private
  4790. * @param {*} value The value to check.
  4791. * @returns {boolean} Returns `true` if `value` is a native function,
  4792. * else `false`.
  4793. */
  4794. function baseIsNative(value) {
  4795. if (!isObject(value) || isMasked(value)) {
  4796. return false;
  4797. }
  4798. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4799. return pattern.test(toSource(value));
  4800. }
  4801. /**
  4802. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4803. *
  4804. * @private
  4805. * @param {*} value The value to check.
  4806. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4807. */
  4808. function baseIsRegExp(value) {
  4809. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4810. }
  4811. /**
  4812. * The base implementation of `_.isSet` without Node.js optimizations.
  4813. *
  4814. * @private
  4815. * @param {*} value The value to check.
  4816. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4817. */
  4818. function baseIsSet(value) {
  4819. return isObjectLike(value) && getTag(value) == setTag;
  4820. }
  4821. /**
  4822. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4823. *
  4824. * @private
  4825. * @param {*} value The value to check.
  4826. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4827. */
  4828. function baseIsTypedArray(value) {
  4829. return isObjectLike(value) &&
  4830. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4831. }
  4832. /**
  4833. * The base implementation of `_.iteratee`.
  4834. *
  4835. * @private
  4836. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4837. * @returns {Function} Returns the iteratee.
  4838. */
  4839. function baseIteratee(value) {
  4840. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4841. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4842. if (typeof value == 'function') {
  4843. return value;
  4844. }
  4845. if (value == null) {
  4846. return identity;
  4847. }
  4848. if (typeof value == 'object') {
  4849. return isArray(value)
  4850. ? baseMatchesProperty(value[0], value[1])
  4851. : baseMatches(value);
  4852. }
  4853. return property(value);
  4854. }
  4855. /**
  4856. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4857. *
  4858. * @private
  4859. * @param {Object} object The object to query.
  4860. * @returns {Array} Returns the array of property names.
  4861. */
  4862. function baseKeys(object) {
  4863. if (!isPrototype(object)) {
  4864. return nativeKeys(object);
  4865. }
  4866. var result = [];
  4867. for (var key in Object(object)) {
  4868. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4869. result.push(key);
  4870. }
  4871. }
  4872. return result;
  4873. }
  4874. /**
  4875. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4876. *
  4877. * @private
  4878. * @param {Object} object The object to query.
  4879. * @returns {Array} Returns the array of property names.
  4880. */
  4881. function baseKeysIn(object) {
  4882. if (!isObject(object)) {
  4883. return nativeKeysIn(object);
  4884. }
  4885. var isProto = isPrototype(object),
  4886. result = [];
  4887. for (var key in object) {
  4888. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4889. result.push(key);
  4890. }
  4891. }
  4892. return result;
  4893. }
  4894. /**
  4895. * The base implementation of `_.lt` which doesn't coerce arguments.
  4896. *
  4897. * @private
  4898. * @param {*} value The value to compare.
  4899. * @param {*} other The other value to compare.
  4900. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4901. * else `false`.
  4902. */
  4903. function baseLt(value, other) {
  4904. return value < other;
  4905. }
  4906. /**
  4907. * The base implementation of `_.map` without support for iteratee shorthands.
  4908. *
  4909. * @private
  4910. * @param {Array|Object} collection The collection to iterate over.
  4911. * @param {Function} iteratee The function invoked per iteration.
  4912. * @returns {Array} Returns the new mapped array.
  4913. */
  4914. function baseMap(collection, iteratee) {
  4915. var index = -1,
  4916. result = isArrayLike(collection) ? Array(collection.length) : [];
  4917. baseEach(collection, function(value, key, collection) {
  4918. result[++index] = iteratee(value, key, collection);
  4919. });
  4920. return result;
  4921. }
  4922. /**
  4923. * The base implementation of `_.matches` which doesn't clone `source`.
  4924. *
  4925. * @private
  4926. * @param {Object} source The object of property values to match.
  4927. * @returns {Function} Returns the new spec function.
  4928. */
  4929. function baseMatches(source) {
  4930. var matchData = getMatchData(source);
  4931. if (matchData.length == 1 && matchData[0][2]) {
  4932. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4933. }
  4934. return function(object) {
  4935. return object === source || baseIsMatch(object, source, matchData);
  4936. };
  4937. }
  4938. /**
  4939. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4940. *
  4941. * @private
  4942. * @param {string} path The path of the property to get.
  4943. * @param {*} srcValue The value to match.
  4944. * @returns {Function} Returns the new spec function.
  4945. */
  4946. function baseMatchesProperty(path, srcValue) {
  4947. if (isKey(path) && isStrictComparable(srcValue)) {
  4948. return matchesStrictComparable(toKey(path), srcValue);
  4949. }
  4950. return function(object) {
  4951. var objValue = get(object, path);
  4952. return (objValue === undefined && objValue === srcValue)
  4953. ? hasIn(object, path)
  4954. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4955. };
  4956. }
  4957. /**
  4958. * The base implementation of `_.merge` without support for multiple sources.
  4959. *
  4960. * @private
  4961. * @param {Object} object The destination object.
  4962. * @param {Object} source The source object.
  4963. * @param {number} srcIndex The index of `source`.
  4964. * @param {Function} [customizer] The function to customize merged values.
  4965. * @param {Object} [stack] Tracks traversed source values and their merged
  4966. * counterparts.
  4967. */
  4968. function baseMerge(object, source, srcIndex, customizer, stack) {
  4969. if (object === source) {
  4970. return;
  4971. }
  4972. baseFor(source, function(srcValue, key) {
  4973. stack || (stack = new Stack);
  4974. if (isObject(srcValue)) {
  4975. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4976. }
  4977. else {
  4978. var newValue = customizer
  4979. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4980. : undefined;
  4981. if (newValue === undefined) {
  4982. newValue = srcValue;
  4983. }
  4984. assignMergeValue(object, key, newValue);
  4985. }
  4986. }, keysIn);
  4987. }
  4988. /**
  4989. * A specialized version of `baseMerge` for arrays and objects which performs
  4990. * deep merges and tracks traversed objects enabling objects with circular
  4991. * references to be merged.
  4992. *
  4993. * @private
  4994. * @param {Object} object The destination object.
  4995. * @param {Object} source The source object.
  4996. * @param {string} key The key of the value to merge.
  4997. * @param {number} srcIndex The index of `source`.
  4998. * @param {Function} mergeFunc The function to merge values.
  4999. * @param {Function} [customizer] The function to customize assigned values.
  5000. * @param {Object} [stack] Tracks traversed source values and their merged
  5001. * counterparts.
  5002. */
  5003. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  5004. var objValue = safeGet(object, key),
  5005. srcValue = safeGet(source, key),
  5006. stacked = stack.get(srcValue);
  5007. if (stacked) {
  5008. assignMergeValue(object, key, stacked);
  5009. return;
  5010. }
  5011. var newValue = customizer
  5012. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  5013. : undefined;
  5014. var isCommon = newValue === undefined;
  5015. if (isCommon) {
  5016. var isArr = isArray(srcValue),
  5017. isBuff = !isArr && isBuffer(srcValue),
  5018. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  5019. newValue = srcValue;
  5020. if (isArr || isBuff || isTyped) {
  5021. if (isArray(objValue)) {
  5022. newValue = objValue;
  5023. }
  5024. else if (isArrayLikeObject(objValue)) {
  5025. newValue = copyArray(objValue);
  5026. }
  5027. else if (isBuff) {
  5028. isCommon = false;
  5029. newValue = cloneBuffer(srcValue, true);
  5030. }
  5031. else if (isTyped) {
  5032. isCommon = false;
  5033. newValue = cloneTypedArray(srcValue, true);
  5034. }
  5035. else {
  5036. newValue = [];
  5037. }
  5038. }
  5039. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  5040. newValue = objValue;
  5041. if (isArguments(objValue)) {
  5042. newValue = toPlainObject(objValue);
  5043. }
  5044. else if (!isObject(objValue) || isFunction(objValue)) {
  5045. newValue = initCloneObject(srcValue);
  5046. }
  5047. }
  5048. else {
  5049. isCommon = false;
  5050. }
  5051. }
  5052. if (isCommon) {
  5053. // Recursively merge objects and arrays (susceptible to call stack limits).
  5054. stack.set(srcValue, newValue);
  5055. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  5056. stack['delete'](srcValue);
  5057. }
  5058. assignMergeValue(object, key, newValue);
  5059. }
  5060. /**
  5061. * The base implementation of `_.nth` which doesn't coerce arguments.
  5062. *
  5063. * @private
  5064. * @param {Array} array The array to query.
  5065. * @param {number} n The index of the element to return.
  5066. * @returns {*} Returns the nth element of `array`.
  5067. */
  5068. function baseNth(array, n) {
  5069. var length = array.length;
  5070. if (!length) {
  5071. return;
  5072. }
  5073. n += n < 0 ? length : 0;
  5074. return isIndex(n, length) ? array[n] : undefined;
  5075. }
  5076. /**
  5077. * The base implementation of `_.orderBy` without param guards.
  5078. *
  5079. * @private
  5080. * @param {Array|Object} collection The collection to iterate over.
  5081. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  5082. * @param {string[]} orders The sort orders of `iteratees`.
  5083. * @returns {Array} Returns the new sorted array.
  5084. */
  5085. function baseOrderBy(collection, iteratees, orders) {
  5086. if (iteratees.length) {
  5087. iteratees = arrayMap(iteratees, function(iteratee) {
  5088. if (isArray(iteratee)) {
  5089. return function(value) {
  5090. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  5091. }
  5092. }
  5093. return iteratee;
  5094. });
  5095. } else {
  5096. iteratees = [identity];
  5097. }
  5098. var index = -1;
  5099. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5100. var result = baseMap(collection, function(value, key, collection) {
  5101. var criteria = arrayMap(iteratees, function(iteratee) {
  5102. return iteratee(value);
  5103. });
  5104. return { 'criteria': criteria, 'index': ++index, 'value': value };
  5105. });
  5106. return baseSortBy(result, function(object, other) {
  5107. return compareMultiple(object, other, orders);
  5108. });
  5109. }
  5110. /**
  5111. * The base implementation of `_.pick` without support for individual
  5112. * property identifiers.
  5113. *
  5114. * @private
  5115. * @param {Object} object The source object.
  5116. * @param {string[]} paths The property paths to pick.
  5117. * @returns {Object} Returns the new object.
  5118. */
  5119. function basePick(object, paths) {
  5120. return basePickBy(object, paths, function(value, path) {
  5121. return hasIn(object, path);
  5122. });
  5123. }
  5124. /**
  5125. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  5126. *
  5127. * @private
  5128. * @param {Object} object The source object.
  5129. * @param {string[]} paths The property paths to pick.
  5130. * @param {Function} predicate The function invoked per property.
  5131. * @returns {Object} Returns the new object.
  5132. */
  5133. function basePickBy(object, paths, predicate) {
  5134. var index = -1,
  5135. length = paths.length,
  5136. result = {};
  5137. while (++index < length) {
  5138. var path = paths[index],
  5139. value = baseGet(object, path);
  5140. if (predicate(value, path)) {
  5141. baseSet(result, castPath(path, object), value);
  5142. }
  5143. }
  5144. return result;
  5145. }
  5146. /**
  5147. * A specialized version of `baseProperty` which supports deep paths.
  5148. *
  5149. * @private
  5150. * @param {Array|string} path The path of the property to get.
  5151. * @returns {Function} Returns the new accessor function.
  5152. */
  5153. function basePropertyDeep(path) {
  5154. return function(object) {
  5155. return baseGet(object, path);
  5156. };
  5157. }
  5158. /**
  5159. * The base implementation of `_.pullAllBy` without support for iteratee
  5160. * shorthands.
  5161. *
  5162. * @private
  5163. * @param {Array} array The array to modify.
  5164. * @param {Array} values The values to remove.
  5165. * @param {Function} [iteratee] The iteratee invoked per element.
  5166. * @param {Function} [comparator] The comparator invoked per element.
  5167. * @returns {Array} Returns `array`.
  5168. */
  5169. function basePullAll(array, values, iteratee, comparator) {
  5170. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  5171. index = -1,
  5172. length = values.length,
  5173. seen = array;
  5174. if (array === values) {
  5175. values = copyArray(values);
  5176. }
  5177. if (iteratee) {
  5178. seen = arrayMap(array, baseUnary(iteratee));
  5179. }
  5180. while (++index < length) {
  5181. var fromIndex = 0,
  5182. value = values[index],
  5183. computed = iteratee ? iteratee(value) : value;
  5184. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5185. if (seen !== array) {
  5186. splice.call(seen, fromIndex, 1);
  5187. }
  5188. splice.call(array, fromIndex, 1);
  5189. }
  5190. }
  5191. return array;
  5192. }
  5193. /**
  5194. * The base implementation of `_.pullAt` without support for individual
  5195. * indexes or capturing the removed elements.
  5196. *
  5197. * @private
  5198. * @param {Array} array The array to modify.
  5199. * @param {number[]} indexes The indexes of elements to remove.
  5200. * @returns {Array} Returns `array`.
  5201. */
  5202. function basePullAt(array, indexes) {
  5203. var length = array ? indexes.length : 0,
  5204. lastIndex = length - 1;
  5205. while (length--) {
  5206. var index = indexes[length];
  5207. if (length == lastIndex || index !== previous) {
  5208. var previous = index;
  5209. if (isIndex(index)) {
  5210. splice.call(array, index, 1);
  5211. } else {
  5212. baseUnset(array, index);
  5213. }
  5214. }
  5215. }
  5216. return array;
  5217. }
  5218. /**
  5219. * The base implementation of `_.random` without support for returning
  5220. * floating-point numbers.
  5221. *
  5222. * @private
  5223. * @param {number} lower The lower bound.
  5224. * @param {number} upper The upper bound.
  5225. * @returns {number} Returns the random number.
  5226. */
  5227. function baseRandom(lower, upper) {
  5228. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  5229. }
  5230. /**
  5231. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  5232. * coerce arguments.
  5233. *
  5234. * @private
  5235. * @param {number} start The start of the range.
  5236. * @param {number} end The end of the range.
  5237. * @param {number} step The value to increment or decrement by.
  5238. * @param {boolean} [fromRight] Specify iterating from right to left.
  5239. * @returns {Array} Returns the range of numbers.
  5240. */
  5241. function baseRange(start, end, step, fromRight) {
  5242. var index = -1,
  5243. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  5244. result = Array(length);
  5245. while (length--) {
  5246. result[fromRight ? length : ++index] = start;
  5247. start += step;
  5248. }
  5249. return result;
  5250. }
  5251. /**
  5252. * The base implementation of `_.repeat` which doesn't coerce arguments.
  5253. *
  5254. * @private
  5255. * @param {string} string The string to repeat.
  5256. * @param {number} n The number of times to repeat the string.
  5257. * @returns {string} Returns the repeated string.
  5258. */
  5259. function baseRepeat(string, n) {
  5260. var result = '';
  5261. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  5262. return result;
  5263. }
  5264. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  5265. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  5266. do {
  5267. if (n % 2) {
  5268. result += string;
  5269. }
  5270. n = nativeFloor(n / 2);
  5271. if (n) {
  5272. string += string;
  5273. }
  5274. } while (n);
  5275. return result;
  5276. }
  5277. /**
  5278. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  5279. *
  5280. * @private
  5281. * @param {Function} func The function to apply a rest parameter to.
  5282. * @param {number} [start=func.length-1] The start position of the rest parameter.
  5283. * @returns {Function} Returns the new function.
  5284. */
  5285. function baseRest(func, start) {
  5286. return setToString(overRest(func, start, identity), func + '');
  5287. }
  5288. /**
  5289. * The base implementation of `_.sample`.
  5290. *
  5291. * @private
  5292. * @param {Array|Object} collection The collection to sample.
  5293. * @returns {*} Returns the random element.
  5294. */
  5295. function baseSample(collection) {
  5296. return arraySample(values(collection));
  5297. }
  5298. /**
  5299. * The base implementation of `_.sampleSize` without param guards.
  5300. *
  5301. * @private
  5302. * @param {Array|Object} collection The collection to sample.
  5303. * @param {number} n The number of elements to sample.
  5304. * @returns {Array} Returns the random elements.
  5305. */
  5306. function baseSampleSize(collection, n) {
  5307. var array = values(collection);
  5308. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5309. }
  5310. /**
  5311. * The base implementation of `_.set`.
  5312. *
  5313. * @private
  5314. * @param {Object} object The object to modify.
  5315. * @param {Array|string} path The path of the property to set.
  5316. * @param {*} value The value to set.
  5317. * @param {Function} [customizer] The function to customize path creation.
  5318. * @returns {Object} Returns `object`.
  5319. */
  5320. function baseSet(object, path, value, customizer) {
  5321. if (!isObject(object)) {
  5322. return object;
  5323. }
  5324. path = castPath(path, object);
  5325. var index = -1,
  5326. length = path.length,
  5327. lastIndex = length - 1,
  5328. nested = object;
  5329. while (nested != null && ++index < length) {
  5330. var key = toKey(path[index]),
  5331. newValue = value;
  5332. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  5333. return object;
  5334. }
  5335. if (index != lastIndex) {
  5336. var objValue = nested[key];
  5337. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  5338. if (newValue === undefined) {
  5339. newValue = isObject(objValue)
  5340. ? objValue
  5341. : (isIndex(path[index + 1]) ? [] : {});
  5342. }
  5343. }
  5344. assignValue(nested, key, newValue);
  5345. nested = nested[key];
  5346. }
  5347. return object;
  5348. }
  5349. /**
  5350. * The base implementation of `setData` without support for hot loop shorting.
  5351. *
  5352. * @private
  5353. * @param {Function} func The function to associate metadata with.
  5354. * @param {*} data The metadata.
  5355. * @returns {Function} Returns `func`.
  5356. */
  5357. var baseSetData = !metaMap ? identity : function(func, data) {
  5358. metaMap.set(func, data);
  5359. return func;
  5360. };
  5361. /**
  5362. * The base implementation of `setToString` without support for hot loop shorting.
  5363. *
  5364. * @private
  5365. * @param {Function} func The function to modify.
  5366. * @param {Function} string The `toString` result.
  5367. * @returns {Function} Returns `func`.
  5368. */
  5369. var baseSetToString = !defineProperty ? identity : function(func, string) {
  5370. return defineProperty(func, 'toString', {
  5371. 'configurable': true,
  5372. 'enumerable': false,
  5373. 'value': constant(string),
  5374. 'writable': true
  5375. });
  5376. };
  5377. /**
  5378. * The base implementation of `_.shuffle`.
  5379. *
  5380. * @private
  5381. * @param {Array|Object} collection The collection to shuffle.
  5382. * @returns {Array} Returns the new shuffled array.
  5383. */
  5384. function baseShuffle(collection) {
  5385. return shuffleSelf(values(collection));
  5386. }
  5387. /**
  5388. * The base implementation of `_.slice` without an iteratee call guard.
  5389. *
  5390. * @private
  5391. * @param {Array} array The array to slice.
  5392. * @param {number} [start=0] The start position.
  5393. * @param {number} [end=array.length] The end position.
  5394. * @returns {Array} Returns the slice of `array`.
  5395. */
  5396. function baseSlice(array, start, end) {
  5397. var index = -1,
  5398. length = array.length;
  5399. if (start < 0) {
  5400. start = -start > length ? 0 : (length + start);
  5401. }
  5402. end = end > length ? length : end;
  5403. if (end < 0) {
  5404. end += length;
  5405. }
  5406. length = start > end ? 0 : ((end - start) >>> 0);
  5407. start >>>= 0;
  5408. var result = Array(length);
  5409. while (++index < length) {
  5410. result[index] = array[index + start];
  5411. }
  5412. return result;
  5413. }
  5414. /**
  5415. * The base implementation of `_.some` without support for iteratee shorthands.
  5416. *
  5417. * @private
  5418. * @param {Array|Object} collection The collection to iterate over.
  5419. * @param {Function} predicate The function invoked per iteration.
  5420. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5421. * else `false`.
  5422. */
  5423. function baseSome(collection, predicate) {
  5424. var result;
  5425. baseEach(collection, function(value, index, collection) {
  5426. result = predicate(value, index, collection);
  5427. return !result;
  5428. });
  5429. return !!result;
  5430. }
  5431. /**
  5432. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  5433. * performs a binary search of `array` to determine the index at which `value`
  5434. * should be inserted into `array` in order to maintain its sort order.
  5435. *
  5436. * @private
  5437. * @param {Array} array The sorted array to inspect.
  5438. * @param {*} value The value to evaluate.
  5439. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5440. * @returns {number} Returns the index at which `value` should be inserted
  5441. * into `array`.
  5442. */
  5443. function baseSortedIndex(array, value, retHighest) {
  5444. var low = 0,
  5445. high = array == null ? low : array.length;
  5446. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5447. while (low < high) {
  5448. var mid = (low + high) >>> 1,
  5449. computed = array[mid];
  5450. if (computed !== null && !isSymbol(computed) &&
  5451. (retHighest ? (computed <= value) : (computed < value))) {
  5452. low = mid + 1;
  5453. } else {
  5454. high = mid;
  5455. }
  5456. }
  5457. return high;
  5458. }
  5459. return baseSortedIndexBy(array, value, identity, retHighest);
  5460. }
  5461. /**
  5462. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  5463. * which invokes `iteratee` for `value` and each element of `array` to compute
  5464. * their sort ranking. The iteratee is invoked with one argument; (value).
  5465. *
  5466. * @private
  5467. * @param {Array} array The sorted array to inspect.
  5468. * @param {*} value The value to evaluate.
  5469. * @param {Function} iteratee The iteratee invoked per element.
  5470. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5471. * @returns {number} Returns the index at which `value` should be inserted
  5472. * into `array`.
  5473. */
  5474. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5475. var low = 0,
  5476. high = array == null ? 0 : array.length;
  5477. if (high === 0) {
  5478. return 0;
  5479. }
  5480. value = iteratee(value);
  5481. var valIsNaN = value !== value,
  5482. valIsNull = value === null,
  5483. valIsSymbol = isSymbol(value),
  5484. valIsUndefined = value === undefined;
  5485. while (low < high) {
  5486. var mid = nativeFloor((low + high) / 2),
  5487. computed = iteratee(array[mid]),
  5488. othIsDefined = computed !== undefined,
  5489. othIsNull = computed === null,
  5490. othIsReflexive = computed === computed,
  5491. othIsSymbol = isSymbol(computed);
  5492. if (valIsNaN) {
  5493. var setLow = retHighest || othIsReflexive;
  5494. } else if (valIsUndefined) {
  5495. setLow = othIsReflexive && (retHighest || othIsDefined);
  5496. } else if (valIsNull) {
  5497. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5498. } else if (valIsSymbol) {
  5499. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5500. } else if (othIsNull || othIsSymbol) {
  5501. setLow = false;
  5502. } else {
  5503. setLow = retHighest ? (computed <= value) : (computed < value);
  5504. }
  5505. if (setLow) {
  5506. low = mid + 1;
  5507. } else {
  5508. high = mid;
  5509. }
  5510. }
  5511. return nativeMin(high, MAX_ARRAY_INDEX);
  5512. }
  5513. /**
  5514. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  5515. * support for iteratee shorthands.
  5516. *
  5517. * @private
  5518. * @param {Array} array The array to inspect.
  5519. * @param {Function} [iteratee] The iteratee invoked per element.
  5520. * @returns {Array} Returns the new duplicate free array.
  5521. */
  5522. function baseSortedUniq(array, iteratee) {
  5523. var index = -1,
  5524. length = array.length,
  5525. resIndex = 0,
  5526. result = [];
  5527. while (++index < length) {
  5528. var value = array[index],
  5529. computed = iteratee ? iteratee(value) : value;
  5530. if (!index || !eq(computed, seen)) {
  5531. var seen = computed;
  5532. result[resIndex++] = value === 0 ? 0 : value;
  5533. }
  5534. }
  5535. return result;
  5536. }
  5537. /**
  5538. * The base implementation of `_.toNumber` which doesn't ensure correct
  5539. * conversions of binary, hexadecimal, or octal string values.
  5540. *
  5541. * @private
  5542. * @param {*} value The value to process.
  5543. * @returns {number} Returns the number.
  5544. */
  5545. function baseToNumber(value) {
  5546. if (typeof value == 'number') {
  5547. return value;
  5548. }
  5549. if (isSymbol(value)) {
  5550. return NAN;
  5551. }
  5552. return +value;
  5553. }
  5554. /**
  5555. * The base implementation of `_.toString` which doesn't convert nullish
  5556. * values to empty strings.
  5557. *
  5558. * @private
  5559. * @param {*} value The value to process.
  5560. * @returns {string} Returns the string.
  5561. */
  5562. function baseToString(value) {
  5563. // Exit early for strings to avoid a performance hit in some environments.
  5564. if (typeof value == 'string') {
  5565. return value;
  5566. }
  5567. if (isArray(value)) {
  5568. // Recursively convert values (susceptible to call stack limits).
  5569. return arrayMap(value, baseToString) + '';
  5570. }
  5571. if (isSymbol(value)) {
  5572. return symbolToString ? symbolToString.call(value) : '';
  5573. }
  5574. var result = (value + '');
  5575. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5576. }
  5577. /**
  5578. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5579. *
  5580. * @private
  5581. * @param {Array} array The array to inspect.
  5582. * @param {Function} [iteratee] The iteratee invoked per element.
  5583. * @param {Function} [comparator] The comparator invoked per element.
  5584. * @returns {Array} Returns the new duplicate free array.
  5585. */
  5586. function baseUniq(array, iteratee, comparator) {
  5587. var index = -1,
  5588. includes = arrayIncludes,
  5589. length = array.length,
  5590. isCommon = true,
  5591. result = [],
  5592. seen = result;
  5593. if (comparator) {
  5594. isCommon = false;
  5595. includes = arrayIncludesWith;
  5596. }
  5597. else if (length >= LARGE_ARRAY_SIZE) {
  5598. var set = iteratee ? null : createSet(array);
  5599. if (set) {
  5600. return setToArray(set);
  5601. }
  5602. isCommon = false;
  5603. includes = cacheHas;
  5604. seen = new SetCache;
  5605. }
  5606. else {
  5607. seen = iteratee ? [] : result;
  5608. }
  5609. outer:
  5610. while (++index < length) {
  5611. var value = array[index],
  5612. computed = iteratee ? iteratee(value) : value;
  5613. value = (comparator || value !== 0) ? value : 0;
  5614. if (isCommon && computed === computed) {
  5615. var seenIndex = seen.length;
  5616. while (seenIndex--) {
  5617. if (seen[seenIndex] === computed) {
  5618. continue outer;
  5619. }
  5620. }
  5621. if (iteratee) {
  5622. seen.push(computed);
  5623. }
  5624. result.push(value);
  5625. }
  5626. else if (!includes(seen, computed, comparator)) {
  5627. if (seen !== result) {
  5628. seen.push(computed);
  5629. }
  5630. result.push(value);
  5631. }
  5632. }
  5633. return result;
  5634. }
  5635. /**
  5636. * The base implementation of `_.unset`.
  5637. *
  5638. * @private
  5639. * @param {Object} object The object to modify.
  5640. * @param {Array|string} path The property path to unset.
  5641. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  5642. */
  5643. function baseUnset(object, path) {
  5644. path = castPath(path, object);
  5645. object = parent(object, path);
  5646. return object == null || delete object[toKey(last(path))];
  5647. }
  5648. /**
  5649. * The base implementation of `_.update`.
  5650. *
  5651. * @private
  5652. * @param {Object} object The object to modify.
  5653. * @param {Array|string} path The path of the property to update.
  5654. * @param {Function} updater The function to produce the updated value.
  5655. * @param {Function} [customizer] The function to customize path creation.
  5656. * @returns {Object} Returns `object`.
  5657. */
  5658. function baseUpdate(object, path, updater, customizer) {
  5659. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5660. }
  5661. /**
  5662. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  5663. * without support for iteratee shorthands.
  5664. *
  5665. * @private
  5666. * @param {Array} array The array to query.
  5667. * @param {Function} predicate The function invoked per iteration.
  5668. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  5669. * @param {boolean} [fromRight] Specify iterating from right to left.
  5670. * @returns {Array} Returns the slice of `array`.
  5671. */
  5672. function baseWhile(array, predicate, isDrop, fromRight) {
  5673. var length = array.length,
  5674. index = fromRight ? length : -1;
  5675. while ((fromRight ? index-- : ++index < length) &&
  5676. predicate(array[index], index, array)) {}
  5677. return isDrop
  5678. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  5679. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  5680. }
  5681. /**
  5682. * The base implementation of `wrapperValue` which returns the result of
  5683. * performing a sequence of actions on the unwrapped `value`, where each
  5684. * successive action is supplied the return value of the previous.
  5685. *
  5686. * @private
  5687. * @param {*} value The unwrapped value.
  5688. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  5689. * @returns {*} Returns the resolved value.
  5690. */
  5691. function baseWrapperValue(value, actions) {
  5692. var result = value;
  5693. if (result instanceof LazyWrapper) {
  5694. result = result.value();
  5695. }
  5696. return arrayReduce(actions, function(result, action) {
  5697. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  5698. }, result);
  5699. }
  5700. /**
  5701. * The base implementation of methods like `_.xor`, without support for
  5702. * iteratee shorthands, that accepts an array of arrays to inspect.
  5703. *
  5704. * @private
  5705. * @param {Array} arrays The arrays to inspect.
  5706. * @param {Function} [iteratee] The iteratee invoked per element.
  5707. * @param {Function} [comparator] The comparator invoked per element.
  5708. * @returns {Array} Returns the new array of values.
  5709. */
  5710. function baseXor(arrays, iteratee, comparator) {
  5711. var length = arrays.length;
  5712. if (length < 2) {
  5713. return length ? baseUniq(arrays[0]) : [];
  5714. }
  5715. var index = -1,
  5716. result = Array(length);
  5717. while (++index < length) {
  5718. var array = arrays[index],
  5719. othIndex = -1;
  5720. while (++othIndex < length) {
  5721. if (othIndex != index) {
  5722. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5723. }
  5724. }
  5725. }
  5726. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5727. }
  5728. /**
  5729. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  5730. *
  5731. * @private
  5732. * @param {Array} props The property identifiers.
  5733. * @param {Array} values The property values.
  5734. * @param {Function} assignFunc The function to assign values.
  5735. * @returns {Object} Returns the new object.
  5736. */
  5737. function baseZipObject(props, values, assignFunc) {
  5738. var index = -1,
  5739. length = props.length,
  5740. valsLength = values.length,
  5741. result = {};
  5742. while (++index < length) {
  5743. var value = index < valsLength ? values[index] : undefined;
  5744. assignFunc(result, props[index], value);
  5745. }
  5746. return result;
  5747. }
  5748. /**
  5749. * Casts `value` to an empty array if it's not an array like object.
  5750. *
  5751. * @private
  5752. * @param {*} value The value to inspect.
  5753. * @returns {Array|Object} Returns the cast array-like object.
  5754. */
  5755. function castArrayLikeObject(value) {
  5756. return isArrayLikeObject(value) ? value : [];
  5757. }
  5758. /**
  5759. * Casts `value` to `identity` if it's not a function.
  5760. *
  5761. * @private
  5762. * @param {*} value The value to inspect.
  5763. * @returns {Function} Returns cast function.
  5764. */
  5765. function castFunction(value) {
  5766. return typeof value == 'function' ? value : identity;
  5767. }
  5768. /**
  5769. * Casts `value` to a path array if it's not one.
  5770. *
  5771. * @private
  5772. * @param {*} value The value to inspect.
  5773. * @param {Object} [object] The object to query keys on.
  5774. * @returns {Array} Returns the cast property path array.
  5775. */
  5776. function castPath(value, object) {
  5777. if (isArray(value)) {
  5778. return value;
  5779. }
  5780. return isKey(value, object) ? [value] : stringToPath(toString(value));
  5781. }
  5782. /**
  5783. * A `baseRest` alias which can be replaced with `identity` by module
  5784. * replacement plugins.
  5785. *
  5786. * @private
  5787. * @type {Function}
  5788. * @param {Function} func The function to apply a rest parameter to.
  5789. * @returns {Function} Returns the new function.
  5790. */
  5791. var castRest = baseRest;
  5792. /**
  5793. * Casts `array` to a slice if it's needed.
  5794. *
  5795. * @private
  5796. * @param {Array} array The array to inspect.
  5797. * @param {number} start The start position.
  5798. * @param {number} [end=array.length] The end position.
  5799. * @returns {Array} Returns the cast slice.
  5800. */
  5801. function castSlice(array, start, end) {
  5802. var length = array.length;
  5803. end = end === undefined ? length : end;
  5804. return (!start && end >= length) ? array : baseSlice(array, start, end);
  5805. }
  5806. /**
  5807. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  5808. *
  5809. * @private
  5810. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  5811. */
  5812. var clearTimeout = ctxClearTimeout || function(id) {
  5813. return root.clearTimeout(id);
  5814. };
  5815. /**
  5816. * Creates a clone of `buffer`.
  5817. *
  5818. * @private
  5819. * @param {Buffer} buffer The buffer to clone.
  5820. * @param {boolean} [isDeep] Specify a deep clone.
  5821. * @returns {Buffer} Returns the cloned buffer.
  5822. */
  5823. function cloneBuffer(buffer, isDeep) {
  5824. if (isDeep) {
  5825. return buffer.slice();
  5826. }
  5827. var length = buffer.length,
  5828. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5829. buffer.copy(result);
  5830. return result;
  5831. }
  5832. /**
  5833. * Creates a clone of `arrayBuffer`.
  5834. *
  5835. * @private
  5836. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5837. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5838. */
  5839. function cloneArrayBuffer(arrayBuffer) {
  5840. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5841. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5842. return result;
  5843. }
  5844. /**
  5845. * Creates a clone of `dataView`.
  5846. *
  5847. * @private
  5848. * @param {Object} dataView The data view to clone.
  5849. * @param {boolean} [isDeep] Specify a deep clone.
  5850. * @returns {Object} Returns the cloned data view.
  5851. */
  5852. function cloneDataView(dataView, isDeep) {
  5853. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5854. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5855. }
  5856. /**
  5857. * Creates a clone of `regexp`.
  5858. *
  5859. * @private
  5860. * @param {Object} regexp The regexp to clone.
  5861. * @returns {Object} Returns the cloned regexp.
  5862. */
  5863. function cloneRegExp(regexp) {
  5864. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5865. result.lastIndex = regexp.lastIndex;
  5866. return result;
  5867. }
  5868. /**
  5869. * Creates a clone of the `symbol` object.
  5870. *
  5871. * @private
  5872. * @param {Object} symbol The symbol object to clone.
  5873. * @returns {Object} Returns the cloned symbol object.
  5874. */
  5875. function cloneSymbol(symbol) {
  5876. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5877. }
  5878. /**
  5879. * Creates a clone of `typedArray`.
  5880. *
  5881. * @private
  5882. * @param {Object} typedArray The typed array to clone.
  5883. * @param {boolean} [isDeep] Specify a deep clone.
  5884. * @returns {Object} Returns the cloned typed array.
  5885. */
  5886. function cloneTypedArray(typedArray, isDeep) {
  5887. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5888. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5889. }
  5890. /**
  5891. * Compares values to sort them in ascending order.
  5892. *
  5893. * @private
  5894. * @param {*} value The value to compare.
  5895. * @param {*} other The other value to compare.
  5896. * @returns {number} Returns the sort order indicator for `value`.
  5897. */
  5898. function compareAscending(value, other) {
  5899. if (value !== other) {
  5900. var valIsDefined = value !== undefined,
  5901. valIsNull = value === null,
  5902. valIsReflexive = value === value,
  5903. valIsSymbol = isSymbol(value);
  5904. var othIsDefined = other !== undefined,
  5905. othIsNull = other === null,
  5906. othIsReflexive = other === other,
  5907. othIsSymbol = isSymbol(other);
  5908. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5909. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5910. (valIsNull && othIsDefined && othIsReflexive) ||
  5911. (!valIsDefined && othIsReflexive) ||
  5912. !valIsReflexive) {
  5913. return 1;
  5914. }
  5915. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5916. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5917. (othIsNull && valIsDefined && valIsReflexive) ||
  5918. (!othIsDefined && valIsReflexive) ||
  5919. !othIsReflexive) {
  5920. return -1;
  5921. }
  5922. }
  5923. return 0;
  5924. }
  5925. /**
  5926. * Used by `_.orderBy` to compare multiple properties of a value to another
  5927. * and stable sort them.
  5928. *
  5929. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5930. * specify an order of "desc" for descending or "asc" for ascending sort order
  5931. * of corresponding values.
  5932. *
  5933. * @private
  5934. * @param {Object} object The object to compare.
  5935. * @param {Object} other The other object to compare.
  5936. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5937. * @returns {number} Returns the sort order indicator for `object`.
  5938. */
  5939. function compareMultiple(object, other, orders) {
  5940. var index = -1,
  5941. objCriteria = object.criteria,
  5942. othCriteria = other.criteria,
  5943. length = objCriteria.length,
  5944. ordersLength = orders.length;
  5945. while (++index < length) {
  5946. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5947. if (result) {
  5948. if (index >= ordersLength) {
  5949. return result;
  5950. }
  5951. var order = orders[index];
  5952. return result * (order == 'desc' ? -1 : 1);
  5953. }
  5954. }
  5955. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5956. // that causes it, under certain circumstances, to provide the same value for
  5957. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5958. // for more details.
  5959. //
  5960. // This also ensures a stable sort in V8 and other engines.
  5961. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5962. return object.index - other.index;
  5963. }
  5964. /**
  5965. * Creates an array that is the composition of partially applied arguments,
  5966. * placeholders, and provided arguments into a single array of arguments.
  5967. *
  5968. * @private
  5969. * @param {Array} args The provided arguments.
  5970. * @param {Array} partials The arguments to prepend to those provided.
  5971. * @param {Array} holders The `partials` placeholder indexes.
  5972. * @params {boolean} [isCurried] Specify composing for a curried function.
  5973. * @returns {Array} Returns the new array of composed arguments.
  5974. */
  5975. function composeArgs(args, partials, holders, isCurried) {
  5976. var argsIndex = -1,
  5977. argsLength = args.length,
  5978. holdersLength = holders.length,
  5979. leftIndex = -1,
  5980. leftLength = partials.length,
  5981. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5982. result = Array(leftLength + rangeLength),
  5983. isUncurried = !isCurried;
  5984. while (++leftIndex < leftLength) {
  5985. result[leftIndex] = partials[leftIndex];
  5986. }
  5987. while (++argsIndex < holdersLength) {
  5988. if (isUncurried || argsIndex < argsLength) {
  5989. result[holders[argsIndex]] = args[argsIndex];
  5990. }
  5991. }
  5992. while (rangeLength--) {
  5993. result[leftIndex++] = args[argsIndex++];
  5994. }
  5995. return result;
  5996. }
  5997. /**
  5998. * This function is like `composeArgs` except that the arguments composition
  5999. * is tailored for `_.partialRight`.
  6000. *
  6001. * @private
  6002. * @param {Array} args The provided arguments.
  6003. * @param {Array} partials The arguments to append to those provided.
  6004. * @param {Array} holders The `partials` placeholder indexes.
  6005. * @params {boolean} [isCurried] Specify composing for a curried function.
  6006. * @returns {Array} Returns the new array of composed arguments.
  6007. */
  6008. function composeArgsRight(args, partials, holders, isCurried) {
  6009. var argsIndex = -1,
  6010. argsLength = args.length,
  6011. holdersIndex = -1,
  6012. holdersLength = holders.length,
  6013. rightIndex = -1,
  6014. rightLength = partials.length,
  6015. rangeLength = nativeMax(argsLength - holdersLength, 0),
  6016. result = Array(rangeLength + rightLength),
  6017. isUncurried = !isCurried;
  6018. while (++argsIndex < rangeLength) {
  6019. result[argsIndex] = args[argsIndex];
  6020. }
  6021. var offset = argsIndex;
  6022. while (++rightIndex < rightLength) {
  6023. result[offset + rightIndex] = partials[rightIndex];
  6024. }
  6025. while (++holdersIndex < holdersLength) {
  6026. if (isUncurried || argsIndex < argsLength) {
  6027. result[offset + holders[holdersIndex]] = args[argsIndex++];
  6028. }
  6029. }
  6030. return result;
  6031. }
  6032. /**
  6033. * Copies the values of `source` to `array`.
  6034. *
  6035. * @private
  6036. * @param {Array} source The array to copy values from.
  6037. * @param {Array} [array=[]] The array to copy values to.
  6038. * @returns {Array} Returns `array`.
  6039. */
  6040. function copyArray(source, array) {
  6041. var index = -1,
  6042. length = source.length;
  6043. array || (array = Array(length));
  6044. while (++index < length) {
  6045. array[index] = source[index];
  6046. }
  6047. return array;
  6048. }
  6049. /**
  6050. * Copies properties of `source` to `object`.
  6051. *
  6052. * @private
  6053. * @param {Object} source The object to copy properties from.
  6054. * @param {Array} props The property identifiers to copy.
  6055. * @param {Object} [object={}] The object to copy properties to.
  6056. * @param {Function} [customizer] The function to customize copied values.
  6057. * @returns {Object} Returns `object`.
  6058. */
  6059. function copyObject(source, props, object, customizer) {
  6060. var isNew = !object;
  6061. object || (object = {});
  6062. var index = -1,
  6063. length = props.length;
  6064. while (++index < length) {
  6065. var key = props[index];
  6066. var newValue = customizer
  6067. ? customizer(object[key], source[key], key, object, source)
  6068. : undefined;
  6069. if (newValue === undefined) {
  6070. newValue = source[key];
  6071. }
  6072. if (isNew) {
  6073. baseAssignValue(object, key, newValue);
  6074. } else {
  6075. assignValue(object, key, newValue);
  6076. }
  6077. }
  6078. return object;
  6079. }
  6080. /**
  6081. * Copies own symbols of `source` to `object`.
  6082. *
  6083. * @private
  6084. * @param {Object} source The object to copy symbols from.
  6085. * @param {Object} [object={}] The object to copy symbols to.
  6086. * @returns {Object} Returns `object`.
  6087. */
  6088. function copySymbols(source, object) {
  6089. return copyObject(source, getSymbols(source), object);
  6090. }
  6091. /**
  6092. * Copies own and inherited symbols of `source` to `object`.
  6093. *
  6094. * @private
  6095. * @param {Object} source The object to copy symbols from.
  6096. * @param {Object} [object={}] The object to copy symbols to.
  6097. * @returns {Object} Returns `object`.
  6098. */
  6099. function copySymbolsIn(source, object) {
  6100. return copyObject(source, getSymbolsIn(source), object);
  6101. }
  6102. /**
  6103. * Creates a function like `_.groupBy`.
  6104. *
  6105. * @private
  6106. * @param {Function} setter The function to set accumulator values.
  6107. * @param {Function} [initializer] The accumulator object initializer.
  6108. * @returns {Function} Returns the new aggregator function.
  6109. */
  6110. function createAggregator(setter, initializer) {
  6111. return function(collection, iteratee) {
  6112. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  6113. accumulator = initializer ? initializer() : {};
  6114. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  6115. };
  6116. }
  6117. /**
  6118. * Creates a function like `_.assign`.
  6119. *
  6120. * @private
  6121. * @param {Function} assigner The function to assign values.
  6122. * @returns {Function} Returns the new assigner function.
  6123. */
  6124. function createAssigner(assigner) {
  6125. return baseRest(function(object, sources) {
  6126. var index = -1,
  6127. length = sources.length,
  6128. customizer = length > 1 ? sources[length - 1] : undefined,
  6129. guard = length > 2 ? sources[2] : undefined;
  6130. customizer = (assigner.length > 3 && typeof customizer == 'function')
  6131. ? (length--, customizer)
  6132. : undefined;
  6133. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  6134. customizer = length < 3 ? undefined : customizer;
  6135. length = 1;
  6136. }
  6137. object = Object(object);
  6138. while (++index < length) {
  6139. var source = sources[index];
  6140. if (source) {
  6141. assigner(object, source, index, customizer);
  6142. }
  6143. }
  6144. return object;
  6145. });
  6146. }
  6147. /**
  6148. * Creates a `baseEach` or `baseEachRight` function.
  6149. *
  6150. * @private
  6151. * @param {Function} eachFunc The function to iterate over a collection.
  6152. * @param {boolean} [fromRight] Specify iterating from right to left.
  6153. * @returns {Function} Returns the new base function.
  6154. */
  6155. function createBaseEach(eachFunc, fromRight) {
  6156. return function(collection, iteratee) {
  6157. if (collection == null) {
  6158. return collection;
  6159. }
  6160. if (!isArrayLike(collection)) {
  6161. return eachFunc(collection, iteratee);
  6162. }
  6163. var length = collection.length,
  6164. index = fromRight ? length : -1,
  6165. iterable = Object(collection);
  6166. while ((fromRight ? index-- : ++index < length)) {
  6167. if (iteratee(iterable[index], index, iterable) === false) {
  6168. break;
  6169. }
  6170. }
  6171. return collection;
  6172. };
  6173. }
  6174. /**
  6175. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  6176. *
  6177. * @private
  6178. * @param {boolean} [fromRight] Specify iterating from right to left.
  6179. * @returns {Function} Returns the new base function.
  6180. */
  6181. function createBaseFor(fromRight) {
  6182. return function(object, iteratee, keysFunc) {
  6183. var index = -1,
  6184. iterable = Object(object),
  6185. props = keysFunc(object),
  6186. length = props.length;
  6187. while (length--) {
  6188. var key = props[fromRight ? length : ++index];
  6189. if (iteratee(iterable[key], key, iterable) === false) {
  6190. break;
  6191. }
  6192. }
  6193. return object;
  6194. };
  6195. }
  6196. /**
  6197. * Creates a function that wraps `func` to invoke it with the optional `this`
  6198. * binding of `thisArg`.
  6199. *
  6200. * @private
  6201. * @param {Function} func The function to wrap.
  6202. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6203. * @param {*} [thisArg] The `this` binding of `func`.
  6204. * @returns {Function} Returns the new wrapped function.
  6205. */
  6206. function createBind(func, bitmask, thisArg) {
  6207. var isBind = bitmask & WRAP_BIND_FLAG,
  6208. Ctor = createCtor(func);
  6209. function wrapper() {
  6210. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6211. return fn.apply(isBind ? thisArg : this, arguments);
  6212. }
  6213. return wrapper;
  6214. }
  6215. /**
  6216. * Creates a function like `_.lowerFirst`.
  6217. *
  6218. * @private
  6219. * @param {string} methodName The name of the `String` case method to use.
  6220. * @returns {Function} Returns the new case function.
  6221. */
  6222. function createCaseFirst(methodName) {
  6223. return function(string) {
  6224. string = toString(string);
  6225. var strSymbols = hasUnicode(string)
  6226. ? stringToArray(string)
  6227. : undefined;
  6228. var chr = strSymbols
  6229. ? strSymbols[0]
  6230. : string.charAt(0);
  6231. var trailing = strSymbols
  6232. ? castSlice(strSymbols, 1).join('')
  6233. : string.slice(1);
  6234. return chr[methodName]() + trailing;
  6235. };
  6236. }
  6237. /**
  6238. * Creates a function like `_.camelCase`.
  6239. *
  6240. * @private
  6241. * @param {Function} callback The function to combine each word.
  6242. * @returns {Function} Returns the new compounder function.
  6243. */
  6244. function createCompounder(callback) {
  6245. return function(string) {
  6246. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  6247. };
  6248. }
  6249. /**
  6250. * Creates a function that produces an instance of `Ctor` regardless of
  6251. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  6252. *
  6253. * @private
  6254. * @param {Function} Ctor The constructor to wrap.
  6255. * @returns {Function} Returns the new wrapped function.
  6256. */
  6257. function createCtor(Ctor) {
  6258. return function() {
  6259. // Use a `switch` statement to work with class constructors. See
  6260. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  6261. // for more details.
  6262. var args = arguments;
  6263. switch (args.length) {
  6264. case 0: return new Ctor;
  6265. case 1: return new Ctor(args[0]);
  6266. case 2: return new Ctor(args[0], args[1]);
  6267. case 3: return new Ctor(args[0], args[1], args[2]);
  6268. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  6269. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  6270. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  6271. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  6272. }
  6273. var thisBinding = baseCreate(Ctor.prototype),
  6274. result = Ctor.apply(thisBinding, args);
  6275. // Mimic the constructor's `return` behavior.
  6276. // See https://es5.github.io/#x13.2.2 for more details.
  6277. return isObject(result) ? result : thisBinding;
  6278. };
  6279. }
  6280. /**
  6281. * Creates a function that wraps `func` to enable currying.
  6282. *
  6283. * @private
  6284. * @param {Function} func The function to wrap.
  6285. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6286. * @param {number} arity The arity of `func`.
  6287. * @returns {Function} Returns the new wrapped function.
  6288. */
  6289. function createCurry(func, bitmask, arity) {
  6290. var Ctor = createCtor(func);
  6291. function wrapper() {
  6292. var length = arguments.length,
  6293. args = Array(length),
  6294. index = length,
  6295. placeholder = getHolder(wrapper);
  6296. while (index--) {
  6297. args[index] = arguments[index];
  6298. }
  6299. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  6300. ? []
  6301. : replaceHolders(args, placeholder);
  6302. length -= holders.length;
  6303. if (length < arity) {
  6304. return createRecurry(
  6305. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  6306. args, holders, undefined, undefined, arity - length);
  6307. }
  6308. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6309. return apply(fn, this, args);
  6310. }
  6311. return wrapper;
  6312. }
  6313. /**
  6314. * Creates a `_.find` or `_.findLast` function.
  6315. *
  6316. * @private
  6317. * @param {Function} findIndexFunc The function to find the collection index.
  6318. * @returns {Function} Returns the new find function.
  6319. */
  6320. function createFind(findIndexFunc) {
  6321. return function(collection, predicate, fromIndex) {
  6322. var iterable = Object(collection);
  6323. if (!isArrayLike(collection)) {
  6324. var iteratee = getIteratee(predicate, 3);
  6325. collection = keys(collection);
  6326. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  6327. }
  6328. var index = findIndexFunc(collection, predicate, fromIndex);
  6329. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  6330. };
  6331. }
  6332. /**
  6333. * Creates a `_.flow` or `_.flowRight` function.
  6334. *
  6335. * @private
  6336. * @param {boolean} [fromRight] Specify iterating from right to left.
  6337. * @returns {Function} Returns the new flow function.
  6338. */
  6339. function createFlow(fromRight) {
  6340. return flatRest(function(funcs) {
  6341. var length = funcs.length,
  6342. index = length,
  6343. prereq = LodashWrapper.prototype.thru;
  6344. if (fromRight) {
  6345. funcs.reverse();
  6346. }
  6347. while (index--) {
  6348. var func = funcs[index];
  6349. if (typeof func != 'function') {
  6350. throw new TypeError(FUNC_ERROR_TEXT);
  6351. }
  6352. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  6353. var wrapper = new LodashWrapper([], true);
  6354. }
  6355. }
  6356. index = wrapper ? index : length;
  6357. while (++index < length) {
  6358. func = funcs[index];
  6359. var funcName = getFuncName(func),
  6360. data = funcName == 'wrapper' ? getData(func) : undefined;
  6361. if (data && isLaziable(data[0]) &&
  6362. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  6363. !data[4].length && data[9] == 1
  6364. ) {
  6365. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  6366. } else {
  6367. wrapper = (func.length == 1 && isLaziable(func))
  6368. ? wrapper[funcName]()
  6369. : wrapper.thru(func);
  6370. }
  6371. }
  6372. return function() {
  6373. var args = arguments,
  6374. value = args[0];
  6375. if (wrapper && args.length == 1 && isArray(value)) {
  6376. return wrapper.plant(value).value();
  6377. }
  6378. var index = 0,
  6379. result = length ? funcs[index].apply(this, args) : value;
  6380. while (++index < length) {
  6381. result = funcs[index].call(this, result);
  6382. }
  6383. return result;
  6384. };
  6385. });
  6386. }
  6387. /**
  6388. * Creates a function that wraps `func` to invoke it with optional `this`
  6389. * binding of `thisArg`, partial application, and currying.
  6390. *
  6391. * @private
  6392. * @param {Function|string} func The function or method name to wrap.
  6393. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6394. * @param {*} [thisArg] The `this` binding of `func`.
  6395. * @param {Array} [partials] The arguments to prepend to those provided to
  6396. * the new function.
  6397. * @param {Array} [holders] The `partials` placeholder indexes.
  6398. * @param {Array} [partialsRight] The arguments to append to those provided
  6399. * to the new function.
  6400. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  6401. * @param {Array} [argPos] The argument positions of the new function.
  6402. * @param {number} [ary] The arity cap of `func`.
  6403. * @param {number} [arity] The arity of `func`.
  6404. * @returns {Function} Returns the new wrapped function.
  6405. */
  6406. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  6407. var isAry = bitmask & WRAP_ARY_FLAG,
  6408. isBind = bitmask & WRAP_BIND_FLAG,
  6409. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  6410. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  6411. isFlip = bitmask & WRAP_FLIP_FLAG,
  6412. Ctor = isBindKey ? undefined : createCtor(func);
  6413. function wrapper() {
  6414. var length = arguments.length,
  6415. args = Array(length),
  6416. index = length;
  6417. while (index--) {
  6418. args[index] = arguments[index];
  6419. }
  6420. if (isCurried) {
  6421. var placeholder = getHolder(wrapper),
  6422. holdersCount = countHolders(args, placeholder);
  6423. }
  6424. if (partials) {
  6425. args = composeArgs(args, partials, holders, isCurried);
  6426. }
  6427. if (partialsRight) {
  6428. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  6429. }
  6430. length -= holdersCount;
  6431. if (isCurried && length < arity) {
  6432. var newHolders = replaceHolders(args, placeholder);
  6433. return createRecurry(
  6434. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  6435. args, newHolders, argPos, ary, arity - length
  6436. );
  6437. }
  6438. var thisBinding = isBind ? thisArg : this,
  6439. fn = isBindKey ? thisBinding[func] : func;
  6440. length = args.length;
  6441. if (argPos) {
  6442. args = reorder(args, argPos);
  6443. } else if (isFlip && length > 1) {
  6444. args.reverse();
  6445. }
  6446. if (isAry && ary < length) {
  6447. args.length = ary;
  6448. }
  6449. if (this && this !== root && this instanceof wrapper) {
  6450. fn = Ctor || createCtor(fn);
  6451. }
  6452. return fn.apply(thisBinding, args);
  6453. }
  6454. return wrapper;
  6455. }
  6456. /**
  6457. * Creates a function like `_.invertBy`.
  6458. *
  6459. * @private
  6460. * @param {Function} setter The function to set accumulator values.
  6461. * @param {Function} toIteratee The function to resolve iteratees.
  6462. * @returns {Function} Returns the new inverter function.
  6463. */
  6464. function createInverter(setter, toIteratee) {
  6465. return function(object, iteratee) {
  6466. return baseInverter(object, setter, toIteratee(iteratee), {});
  6467. };
  6468. }
  6469. /**
  6470. * Creates a function that performs a mathematical operation on two values.
  6471. *
  6472. * @private
  6473. * @param {Function} operator The function to perform the operation.
  6474. * @param {number} [defaultValue] The value used for `undefined` arguments.
  6475. * @returns {Function} Returns the new mathematical operation function.
  6476. */
  6477. function createMathOperation(operator, defaultValue) {
  6478. return function(value, other) {
  6479. var result;
  6480. if (value === undefined && other === undefined) {
  6481. return defaultValue;
  6482. }
  6483. if (value !== undefined) {
  6484. result = value;
  6485. }
  6486. if (other !== undefined) {
  6487. if (result === undefined) {
  6488. return other;
  6489. }
  6490. if (typeof value == 'string' || typeof other == 'string') {
  6491. value = baseToString(value);
  6492. other = baseToString(other);
  6493. } else {
  6494. value = baseToNumber(value);
  6495. other = baseToNumber(other);
  6496. }
  6497. result = operator(value, other);
  6498. }
  6499. return result;
  6500. };
  6501. }
  6502. /**
  6503. * Creates a function like `_.over`.
  6504. *
  6505. * @private
  6506. * @param {Function} arrayFunc The function to iterate over iteratees.
  6507. * @returns {Function} Returns the new over function.
  6508. */
  6509. function createOver(arrayFunc) {
  6510. return flatRest(function(iteratees) {
  6511. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  6512. return baseRest(function(args) {
  6513. var thisArg = this;
  6514. return arrayFunc(iteratees, function(iteratee) {
  6515. return apply(iteratee, thisArg, args);
  6516. });
  6517. });
  6518. });
  6519. }
  6520. /**
  6521. * Creates the padding for `string` based on `length`. The `chars` string
  6522. * is truncated if the number of characters exceeds `length`.
  6523. *
  6524. * @private
  6525. * @param {number} length The padding length.
  6526. * @param {string} [chars=' '] The string used as padding.
  6527. * @returns {string} Returns the padding for `string`.
  6528. */
  6529. function createPadding(length, chars) {
  6530. chars = chars === undefined ? ' ' : baseToString(chars);
  6531. var charsLength = chars.length;
  6532. if (charsLength < 2) {
  6533. return charsLength ? baseRepeat(chars, length) : chars;
  6534. }
  6535. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  6536. return hasUnicode(chars)
  6537. ? castSlice(stringToArray(result), 0, length).join('')
  6538. : result.slice(0, length);
  6539. }
  6540. /**
  6541. * Creates a function that wraps `func` to invoke it with the `this` binding
  6542. * of `thisArg` and `partials` prepended to the arguments it receives.
  6543. *
  6544. * @private
  6545. * @param {Function} func The function to wrap.
  6546. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6547. * @param {*} thisArg The `this` binding of `func`.
  6548. * @param {Array} partials The arguments to prepend to those provided to
  6549. * the new function.
  6550. * @returns {Function} Returns the new wrapped function.
  6551. */
  6552. function createPartial(func, bitmask, thisArg, partials) {
  6553. var isBind = bitmask & WRAP_BIND_FLAG,
  6554. Ctor = createCtor(func);
  6555. function wrapper() {
  6556. var argsIndex = -1,
  6557. argsLength = arguments.length,
  6558. leftIndex = -1,
  6559. leftLength = partials.length,
  6560. args = Array(leftLength + argsLength),
  6561. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6562. while (++leftIndex < leftLength) {
  6563. args[leftIndex] = partials[leftIndex];
  6564. }
  6565. while (argsLength--) {
  6566. args[leftIndex++] = arguments[++argsIndex];
  6567. }
  6568. return apply(fn, isBind ? thisArg : this, args);
  6569. }
  6570. return wrapper;
  6571. }
  6572. /**
  6573. * Creates a `_.range` or `_.rangeRight` function.
  6574. *
  6575. * @private
  6576. * @param {boolean} [fromRight] Specify iterating from right to left.
  6577. * @returns {Function} Returns the new range function.
  6578. */
  6579. function createRange(fromRight) {
  6580. return function(start, end, step) {
  6581. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  6582. end = step = undefined;
  6583. }
  6584. // Ensure the sign of `-0` is preserved.
  6585. start = toFinite(start);
  6586. if (end === undefined) {
  6587. end = start;
  6588. start = 0;
  6589. } else {
  6590. end = toFinite(end);
  6591. }
  6592. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  6593. return baseRange(start, end, step, fromRight);
  6594. };
  6595. }
  6596. /**
  6597. * Creates a function that performs a relational operation on two values.
  6598. *
  6599. * @private
  6600. * @param {Function} operator The function to perform the operation.
  6601. * @returns {Function} Returns the new relational operation function.
  6602. */
  6603. function createRelationalOperation(operator) {
  6604. return function(value, other) {
  6605. if (!(typeof value == 'string' && typeof other == 'string')) {
  6606. value = toNumber(value);
  6607. other = toNumber(other);
  6608. }
  6609. return operator(value, other);
  6610. };
  6611. }
  6612. /**
  6613. * Creates a function that wraps `func` to continue currying.
  6614. *
  6615. * @private
  6616. * @param {Function} func The function to wrap.
  6617. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6618. * @param {Function} wrapFunc The function to create the `func` wrapper.
  6619. * @param {*} placeholder The placeholder value.
  6620. * @param {*} [thisArg] The `this` binding of `func`.
  6621. * @param {Array} [partials] The arguments to prepend to those provided to
  6622. * the new function.
  6623. * @param {Array} [holders] The `partials` placeholder indexes.
  6624. * @param {Array} [argPos] The argument positions of the new function.
  6625. * @param {number} [ary] The arity cap of `func`.
  6626. * @param {number} [arity] The arity of `func`.
  6627. * @returns {Function} Returns the new wrapped function.
  6628. */
  6629. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  6630. var isCurry = bitmask & WRAP_CURRY_FLAG,
  6631. newHolders = isCurry ? holders : undefined,
  6632. newHoldersRight = isCurry ? undefined : holders,
  6633. newPartials = isCurry ? partials : undefined,
  6634. newPartialsRight = isCurry ? undefined : partials;
  6635. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  6636. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  6637. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  6638. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  6639. }
  6640. var newData = [
  6641. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  6642. newHoldersRight, argPos, ary, arity
  6643. ];
  6644. var result = wrapFunc.apply(undefined, newData);
  6645. if (isLaziable(func)) {
  6646. setData(result, newData);
  6647. }
  6648. result.placeholder = placeholder;
  6649. return setWrapToString(result, func, bitmask);
  6650. }
  6651. /**
  6652. * Creates a function like `_.round`.
  6653. *
  6654. * @private
  6655. * @param {string} methodName The name of the `Math` method to use when rounding.
  6656. * @returns {Function} Returns the new round function.
  6657. */
  6658. function createRound(methodName) {
  6659. var func = Math[methodName];
  6660. return function(number, precision) {
  6661. number = toNumber(number);
  6662. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  6663. if (precision && nativeIsFinite(number)) {
  6664. // Shift with exponential notation to avoid floating-point issues.
  6665. // See [MDN](https://mdn.io/round#Examples) for more details.
  6666. var pair = (toString(number) + 'e').split('e'),
  6667. value = func(pair[0] + 'e' + (+pair[1] + precision));
  6668. pair = (toString(value) + 'e').split('e');
  6669. return +(pair[0] + 'e' + (+pair[1] - precision));
  6670. }
  6671. return func(number);
  6672. };
  6673. }
  6674. /**
  6675. * Creates a set object of `values`.
  6676. *
  6677. * @private
  6678. * @param {Array} values The values to add to the set.
  6679. * @returns {Object} Returns the new set.
  6680. */
  6681. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  6682. return new Set(values);
  6683. };
  6684. /**
  6685. * Creates a `_.toPairs` or `_.toPairsIn` function.
  6686. *
  6687. * @private
  6688. * @param {Function} keysFunc The function to get the keys of a given object.
  6689. * @returns {Function} Returns the new pairs function.
  6690. */
  6691. function createToPairs(keysFunc) {
  6692. return function(object) {
  6693. var tag = getTag(object);
  6694. if (tag == mapTag) {
  6695. return mapToArray(object);
  6696. }
  6697. if (tag == setTag) {
  6698. return setToPairs(object);
  6699. }
  6700. return baseToPairs(object, keysFunc(object));
  6701. };
  6702. }
  6703. /**
  6704. * Creates a function that either curries or invokes `func` with optional
  6705. * `this` binding and partially applied arguments.
  6706. *
  6707. * @private
  6708. * @param {Function|string} func The function or method name to wrap.
  6709. * @param {number} bitmask The bitmask flags.
  6710. * 1 - `_.bind`
  6711. * 2 - `_.bindKey`
  6712. * 4 - `_.curry` or `_.curryRight` of a bound function
  6713. * 8 - `_.curry`
  6714. * 16 - `_.curryRight`
  6715. * 32 - `_.partial`
  6716. * 64 - `_.partialRight`
  6717. * 128 - `_.rearg`
  6718. * 256 - `_.ary`
  6719. * 512 - `_.flip`
  6720. * @param {*} [thisArg] The `this` binding of `func`.
  6721. * @param {Array} [partials] The arguments to be partially applied.
  6722. * @param {Array} [holders] The `partials` placeholder indexes.
  6723. * @param {Array} [argPos] The argument positions of the new function.
  6724. * @param {number} [ary] The arity cap of `func`.
  6725. * @param {number} [arity] The arity of `func`.
  6726. * @returns {Function} Returns the new wrapped function.
  6727. */
  6728. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  6729. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  6730. if (!isBindKey && typeof func != 'function') {
  6731. throw new TypeError(FUNC_ERROR_TEXT);
  6732. }
  6733. var length = partials ? partials.length : 0;
  6734. if (!length) {
  6735. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  6736. partials = holders = undefined;
  6737. }
  6738. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  6739. arity = arity === undefined ? arity : toInteger(arity);
  6740. length -= holders ? holders.length : 0;
  6741. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  6742. var partialsRight = partials,
  6743. holdersRight = holders;
  6744. partials = holders = undefined;
  6745. }
  6746. var data = isBindKey ? undefined : getData(func);
  6747. var newData = [
  6748. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  6749. argPos, ary, arity
  6750. ];
  6751. if (data) {
  6752. mergeData(newData, data);
  6753. }
  6754. func = newData[0];
  6755. bitmask = newData[1];
  6756. thisArg = newData[2];
  6757. partials = newData[3];
  6758. holders = newData[4];
  6759. arity = newData[9] = newData[9] === undefined
  6760. ? (isBindKey ? 0 : func.length)
  6761. : nativeMax(newData[9] - length, 0);
  6762. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  6763. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  6764. }
  6765. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  6766. var result = createBind(func, bitmask, thisArg);
  6767. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  6768. result = createCurry(func, bitmask, arity);
  6769. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  6770. result = createPartial(func, bitmask, thisArg, partials);
  6771. } else {
  6772. result = createHybrid.apply(undefined, newData);
  6773. }
  6774. var setter = data ? baseSetData : setData;
  6775. return setWrapToString(setter(result, newData), func, bitmask);
  6776. }
  6777. /**
  6778. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  6779. * of source objects to the destination object for all destination properties
  6780. * that resolve to `undefined`.
  6781. *
  6782. * @private
  6783. * @param {*} objValue The destination value.
  6784. * @param {*} srcValue The source value.
  6785. * @param {string} key The key of the property to assign.
  6786. * @param {Object} object The parent object of `objValue`.
  6787. * @returns {*} Returns the value to assign.
  6788. */
  6789. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  6790. if (objValue === undefined ||
  6791. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  6792. return srcValue;
  6793. }
  6794. return objValue;
  6795. }
  6796. /**
  6797. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  6798. * objects into destination objects that are passed thru.
  6799. *
  6800. * @private
  6801. * @param {*} objValue The destination value.
  6802. * @param {*} srcValue The source value.
  6803. * @param {string} key The key of the property to merge.
  6804. * @param {Object} object The parent object of `objValue`.
  6805. * @param {Object} source The parent object of `srcValue`.
  6806. * @param {Object} [stack] Tracks traversed source values and their merged
  6807. * counterparts.
  6808. * @returns {*} Returns the value to assign.
  6809. */
  6810. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  6811. if (isObject(objValue) && isObject(srcValue)) {
  6812. // Recursively merge objects and arrays (susceptible to call stack limits).
  6813. stack.set(srcValue, objValue);
  6814. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6815. stack['delete'](srcValue);
  6816. }
  6817. return objValue;
  6818. }
  6819. /**
  6820. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6821. * objects.
  6822. *
  6823. * @private
  6824. * @param {*} value The value to inspect.
  6825. * @param {string} key The key of the property to inspect.
  6826. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6827. */
  6828. function customOmitClone(value) {
  6829. return isPlainObject(value) ? undefined : value;
  6830. }
  6831. /**
  6832. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6833. * partial deep comparisons.
  6834. *
  6835. * @private
  6836. * @param {Array} array The array to compare.
  6837. * @param {Array} other The other array to compare.
  6838. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6839. * @param {Function} customizer The function to customize comparisons.
  6840. * @param {Function} equalFunc The function to determine equivalents of values.
  6841. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6842. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6843. */
  6844. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6845. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6846. arrLength = array.length,
  6847. othLength = other.length;
  6848. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6849. return false;
  6850. }
  6851. // Check that cyclic values are equal.
  6852. var arrStacked = stack.get(array);
  6853. var othStacked = stack.get(other);
  6854. if (arrStacked && othStacked) {
  6855. return arrStacked == other && othStacked == array;
  6856. }
  6857. var index = -1,
  6858. result = true,
  6859. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6860. stack.set(array, other);
  6861. stack.set(other, array);
  6862. // Ignore non-index properties.
  6863. while (++index < arrLength) {
  6864. var arrValue = array[index],
  6865. othValue = other[index];
  6866. if (customizer) {
  6867. var compared = isPartial
  6868. ? customizer(othValue, arrValue, index, other, array, stack)
  6869. : customizer(arrValue, othValue, index, array, other, stack);
  6870. }
  6871. if (compared !== undefined) {
  6872. if (compared) {
  6873. continue;
  6874. }
  6875. result = false;
  6876. break;
  6877. }
  6878. // Recursively compare arrays (susceptible to call stack limits).
  6879. if (seen) {
  6880. if (!arraySome(other, function(othValue, othIndex) {
  6881. if (!cacheHas(seen, othIndex) &&
  6882. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6883. return seen.push(othIndex);
  6884. }
  6885. })) {
  6886. result = false;
  6887. break;
  6888. }
  6889. } else if (!(
  6890. arrValue === othValue ||
  6891. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6892. )) {
  6893. result = false;
  6894. break;
  6895. }
  6896. }
  6897. stack['delete'](array);
  6898. stack['delete'](other);
  6899. return result;
  6900. }
  6901. /**
  6902. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6903. * the same `toStringTag`.
  6904. *
  6905. * **Note:** This function only supports comparing values with tags of
  6906. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6907. *
  6908. * @private
  6909. * @param {Object} object The object to compare.
  6910. * @param {Object} other The other object to compare.
  6911. * @param {string} tag The `toStringTag` of the objects to compare.
  6912. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6913. * @param {Function} customizer The function to customize comparisons.
  6914. * @param {Function} equalFunc The function to determine equivalents of values.
  6915. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6916. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6917. */
  6918. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6919. switch (tag) {
  6920. case dataViewTag:
  6921. if ((object.byteLength != other.byteLength) ||
  6922. (object.byteOffset != other.byteOffset)) {
  6923. return false;
  6924. }
  6925. object = object.buffer;
  6926. other = other.buffer;
  6927. case arrayBufferTag:
  6928. if ((object.byteLength != other.byteLength) ||
  6929. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6930. return false;
  6931. }
  6932. return true;
  6933. case boolTag:
  6934. case dateTag:
  6935. case numberTag:
  6936. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6937. // Invalid dates are coerced to `NaN`.
  6938. return eq(+object, +other);
  6939. case errorTag:
  6940. return object.name == other.name && object.message == other.message;
  6941. case regexpTag:
  6942. case stringTag:
  6943. // Coerce regexes to strings and treat strings, primitives and objects,
  6944. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6945. // for more details.
  6946. return object == (other + '');
  6947. case mapTag:
  6948. var convert = mapToArray;
  6949. case setTag:
  6950. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6951. convert || (convert = setToArray);
  6952. if (object.size != other.size && !isPartial) {
  6953. return false;
  6954. }
  6955. // Assume cyclic values are equal.
  6956. var stacked = stack.get(object);
  6957. if (stacked) {
  6958. return stacked == other;
  6959. }
  6960. bitmask |= COMPARE_UNORDERED_FLAG;
  6961. // Recursively compare objects (susceptible to call stack limits).
  6962. stack.set(object, other);
  6963. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6964. stack['delete'](object);
  6965. return result;
  6966. case symbolTag:
  6967. if (symbolValueOf) {
  6968. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6969. }
  6970. }
  6971. return false;
  6972. }
  6973. /**
  6974. * A specialized version of `baseIsEqualDeep` for objects with support for
  6975. * partial deep comparisons.
  6976. *
  6977. * @private
  6978. * @param {Object} object The object to compare.
  6979. * @param {Object} other The other object to compare.
  6980. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6981. * @param {Function} customizer The function to customize comparisons.
  6982. * @param {Function} equalFunc The function to determine equivalents of values.
  6983. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6984. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6985. */
  6986. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6987. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6988. objProps = getAllKeys(object),
  6989. objLength = objProps.length,
  6990. othProps = getAllKeys(other),
  6991. othLength = othProps.length;
  6992. if (objLength != othLength && !isPartial) {
  6993. return false;
  6994. }
  6995. var index = objLength;
  6996. while (index--) {
  6997. var key = objProps[index];
  6998. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6999. return false;
  7000. }
  7001. }
  7002. // Check that cyclic values are equal.
  7003. var objStacked = stack.get(object);
  7004. var othStacked = stack.get(other);
  7005. if (objStacked && othStacked) {
  7006. return objStacked == other && othStacked == object;
  7007. }
  7008. var result = true;
  7009. stack.set(object, other);
  7010. stack.set(other, object);
  7011. var skipCtor = isPartial;
  7012. while (++index < objLength) {
  7013. key = objProps[index];
  7014. var objValue = object[key],
  7015. othValue = other[key];
  7016. if (customizer) {
  7017. var compared = isPartial
  7018. ? customizer(othValue, objValue, key, other, object, stack)
  7019. : customizer(objValue, othValue, key, object, other, stack);
  7020. }
  7021. // Recursively compare objects (susceptible to call stack limits).
  7022. if (!(compared === undefined
  7023. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  7024. : compared
  7025. )) {
  7026. result = false;
  7027. break;
  7028. }
  7029. skipCtor || (skipCtor = key == 'constructor');
  7030. }
  7031. if (result && !skipCtor) {
  7032. var objCtor = object.constructor,
  7033. othCtor = other.constructor;
  7034. // Non `Object` object instances with different constructors are not equal.
  7035. if (objCtor != othCtor &&
  7036. ('constructor' in object && 'constructor' in other) &&
  7037. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  7038. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  7039. result = false;
  7040. }
  7041. }
  7042. stack['delete'](object);
  7043. stack['delete'](other);
  7044. return result;
  7045. }
  7046. /**
  7047. * A specialized version of `baseRest` which flattens the rest array.
  7048. *
  7049. * @private
  7050. * @param {Function} func The function to apply a rest parameter to.
  7051. * @returns {Function} Returns the new function.
  7052. */
  7053. function flatRest(func) {
  7054. return setToString(overRest(func, undefined, flatten), func + '');
  7055. }
  7056. /**
  7057. * Creates an array of own enumerable property names and symbols of `object`.
  7058. *
  7059. * @private
  7060. * @param {Object} object The object to query.
  7061. * @returns {Array} Returns the array of property names and symbols.
  7062. */
  7063. function getAllKeys(object) {
  7064. return baseGetAllKeys(object, keys, getSymbols);
  7065. }
  7066. /**
  7067. * Creates an array of own and inherited enumerable property names and
  7068. * symbols of `object`.
  7069. *
  7070. * @private
  7071. * @param {Object} object The object to query.
  7072. * @returns {Array} Returns the array of property names and symbols.
  7073. */
  7074. function getAllKeysIn(object) {
  7075. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  7076. }
  7077. /**
  7078. * Gets metadata for `func`.
  7079. *
  7080. * @private
  7081. * @param {Function} func The function to query.
  7082. * @returns {*} Returns the metadata for `func`.
  7083. */
  7084. var getData = !metaMap ? noop : function(func) {
  7085. return metaMap.get(func);
  7086. };
  7087. /**
  7088. * Gets the name of `func`.
  7089. *
  7090. * @private
  7091. * @param {Function} func The function to query.
  7092. * @returns {string} Returns the function name.
  7093. */
  7094. function getFuncName(func) {
  7095. var result = (func.name + ''),
  7096. array = realNames[result],
  7097. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  7098. while (length--) {
  7099. var data = array[length],
  7100. otherFunc = data.func;
  7101. if (otherFunc == null || otherFunc == func) {
  7102. return data.name;
  7103. }
  7104. }
  7105. return result;
  7106. }
  7107. /**
  7108. * Gets the argument placeholder value for `func`.
  7109. *
  7110. * @private
  7111. * @param {Function} func The function to inspect.
  7112. * @returns {*} Returns the placeholder value.
  7113. */
  7114. function getHolder(func) {
  7115. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  7116. return object.placeholder;
  7117. }
  7118. /**
  7119. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  7120. * this function returns the custom method, otherwise it returns `baseIteratee`.
  7121. * If arguments are provided, the chosen function is invoked with them and
  7122. * its result is returned.
  7123. *
  7124. * @private
  7125. * @param {*} [value] The value to convert to an iteratee.
  7126. * @param {number} [arity] The arity of the created iteratee.
  7127. * @returns {Function} Returns the chosen function or its result.
  7128. */
  7129. function getIteratee() {
  7130. var result = lodash.iteratee || iteratee;
  7131. result = result === iteratee ? baseIteratee : result;
  7132. return arguments.length ? result(arguments[0], arguments[1]) : result;
  7133. }
  7134. /**
  7135. * Gets the data for `map`.
  7136. *
  7137. * @private
  7138. * @param {Object} map The map to query.
  7139. * @param {string} key The reference key.
  7140. * @returns {*} Returns the map data.
  7141. */
  7142. function getMapData(map, key) {
  7143. var data = map.__data__;
  7144. return isKeyable(key)
  7145. ? data[typeof key == 'string' ? 'string' : 'hash']
  7146. : data.map;
  7147. }
  7148. /**
  7149. * Gets the property names, values, and compare flags of `object`.
  7150. *
  7151. * @private
  7152. * @param {Object} object The object to query.
  7153. * @returns {Array} Returns the match data of `object`.
  7154. */
  7155. function getMatchData(object) {
  7156. var result = keys(object),
  7157. length = result.length;
  7158. while (length--) {
  7159. var key = result[length],
  7160. value = object[key];
  7161. result[length] = [key, value, isStrictComparable(value)];
  7162. }
  7163. return result;
  7164. }
  7165. /**
  7166. * Gets the native function at `key` of `object`.
  7167. *
  7168. * @private
  7169. * @param {Object} object The object to query.
  7170. * @param {string} key The key of the method to get.
  7171. * @returns {*} Returns the function if it's native, else `undefined`.
  7172. */
  7173. function getNative(object, key) {
  7174. var value = getValue(object, key);
  7175. return baseIsNative(value) ? value : undefined;
  7176. }
  7177. /**
  7178. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  7179. *
  7180. * @private
  7181. * @param {*} value The value to query.
  7182. * @returns {string} Returns the raw `toStringTag`.
  7183. */
  7184. function getRawTag(value) {
  7185. var isOwn = hasOwnProperty.call(value, symToStringTag),
  7186. tag = value[symToStringTag];
  7187. try {
  7188. value[symToStringTag] = undefined;
  7189. var unmasked = true;
  7190. } catch (e) {}
  7191. var result = nativeObjectToString.call(value);
  7192. if (unmasked) {
  7193. if (isOwn) {
  7194. value[symToStringTag] = tag;
  7195. } else {
  7196. delete value[symToStringTag];
  7197. }
  7198. }
  7199. return result;
  7200. }
  7201. /**
  7202. * Creates an array of the own enumerable symbols of `object`.
  7203. *
  7204. * @private
  7205. * @param {Object} object The object to query.
  7206. * @returns {Array} Returns the array of symbols.
  7207. */
  7208. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  7209. if (object == null) {
  7210. return [];
  7211. }
  7212. object = Object(object);
  7213. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  7214. return propertyIsEnumerable.call(object, symbol);
  7215. });
  7216. };
  7217. /**
  7218. * Creates an array of the own and inherited enumerable symbols of `object`.
  7219. *
  7220. * @private
  7221. * @param {Object} object The object to query.
  7222. * @returns {Array} Returns the array of symbols.
  7223. */
  7224. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  7225. var result = [];
  7226. while (object) {
  7227. arrayPush(result, getSymbols(object));
  7228. object = getPrototype(object);
  7229. }
  7230. return result;
  7231. };
  7232. /**
  7233. * Gets the `toStringTag` of `value`.
  7234. *
  7235. * @private
  7236. * @param {*} value The value to query.
  7237. * @returns {string} Returns the `toStringTag`.
  7238. */
  7239. var getTag = baseGetTag;
  7240. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  7241. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  7242. (Map && getTag(new Map) != mapTag) ||
  7243. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  7244. (Set && getTag(new Set) != setTag) ||
  7245. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  7246. getTag = function(value) {
  7247. var result = baseGetTag(value),
  7248. Ctor = result == objectTag ? value.constructor : undefined,
  7249. ctorString = Ctor ? toSource(Ctor) : '';
  7250. if (ctorString) {
  7251. switch (ctorString) {
  7252. case dataViewCtorString: return dataViewTag;
  7253. case mapCtorString: return mapTag;
  7254. case promiseCtorString: return promiseTag;
  7255. case setCtorString: return setTag;
  7256. case weakMapCtorString: return weakMapTag;
  7257. }
  7258. }
  7259. return result;
  7260. };
  7261. }
  7262. /**
  7263. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  7264. *
  7265. * @private
  7266. * @param {number} start The start of the view.
  7267. * @param {number} end The end of the view.
  7268. * @param {Array} transforms The transformations to apply to the view.
  7269. * @returns {Object} Returns an object containing the `start` and `end`
  7270. * positions of the view.
  7271. */
  7272. function getView(start, end, transforms) {
  7273. var index = -1,
  7274. length = transforms.length;
  7275. while (++index < length) {
  7276. var data = transforms[index],
  7277. size = data.size;
  7278. switch (data.type) {
  7279. case 'drop': start += size; break;
  7280. case 'dropRight': end -= size; break;
  7281. case 'take': end = nativeMin(end, start + size); break;
  7282. case 'takeRight': start = nativeMax(start, end - size); break;
  7283. }
  7284. }
  7285. return { 'start': start, 'end': end };
  7286. }
  7287. /**
  7288. * Extracts wrapper details from the `source` body comment.
  7289. *
  7290. * @private
  7291. * @param {string} source The source to inspect.
  7292. * @returns {Array} Returns the wrapper details.
  7293. */
  7294. function getWrapDetails(source) {
  7295. var match = source.match(reWrapDetails);
  7296. return match ? match[1].split(reSplitDetails) : [];
  7297. }
  7298. /**
  7299. * Checks if `path` exists on `object`.
  7300. *
  7301. * @private
  7302. * @param {Object} object The object to query.
  7303. * @param {Array|string} path The path to check.
  7304. * @param {Function} hasFunc The function to check properties.
  7305. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7306. */
  7307. function hasPath(object, path, hasFunc) {
  7308. path = castPath(path, object);
  7309. var index = -1,
  7310. length = path.length,
  7311. result = false;
  7312. while (++index < length) {
  7313. var key = toKey(path[index]);
  7314. if (!(result = object != null && hasFunc(object, key))) {
  7315. break;
  7316. }
  7317. object = object[key];
  7318. }
  7319. if (result || ++index != length) {
  7320. return result;
  7321. }
  7322. length = object == null ? 0 : object.length;
  7323. return !!length && isLength(length) && isIndex(key, length) &&
  7324. (isArray(object) || isArguments(object));
  7325. }
  7326. /**
  7327. * Initializes an array clone.
  7328. *
  7329. * @private
  7330. * @param {Array} array The array to clone.
  7331. * @returns {Array} Returns the initialized clone.
  7332. */
  7333. function initCloneArray(array) {
  7334. var length = array.length,
  7335. result = new array.constructor(length);
  7336. // Add properties assigned by `RegExp#exec`.
  7337. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  7338. result.index = array.index;
  7339. result.input = array.input;
  7340. }
  7341. return result;
  7342. }
  7343. /**
  7344. * Initializes an object clone.
  7345. *
  7346. * @private
  7347. * @param {Object} object The object to clone.
  7348. * @returns {Object} Returns the initialized clone.
  7349. */
  7350. function initCloneObject(object) {
  7351. return (typeof object.constructor == 'function' && !isPrototype(object))
  7352. ? baseCreate(getPrototype(object))
  7353. : {};
  7354. }
  7355. /**
  7356. * Initializes an object clone based on its `toStringTag`.
  7357. *
  7358. * **Note:** This function only supports cloning values with tags of
  7359. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  7360. *
  7361. * @private
  7362. * @param {Object} object The object to clone.
  7363. * @param {string} tag The `toStringTag` of the object to clone.
  7364. * @param {boolean} [isDeep] Specify a deep clone.
  7365. * @returns {Object} Returns the initialized clone.
  7366. */
  7367. function initCloneByTag(object, tag, isDeep) {
  7368. var Ctor = object.constructor;
  7369. switch (tag) {
  7370. case arrayBufferTag:
  7371. return cloneArrayBuffer(object);
  7372. case boolTag:
  7373. case dateTag:
  7374. return new Ctor(+object);
  7375. case dataViewTag:
  7376. return cloneDataView(object, isDeep);
  7377. case float32Tag: case float64Tag:
  7378. case int8Tag: case int16Tag: case int32Tag:
  7379. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  7380. return cloneTypedArray(object, isDeep);
  7381. case mapTag:
  7382. return new Ctor;
  7383. case numberTag:
  7384. case stringTag:
  7385. return new Ctor(object);
  7386. case regexpTag:
  7387. return cloneRegExp(object);
  7388. case setTag:
  7389. return new Ctor;
  7390. case symbolTag:
  7391. return cloneSymbol(object);
  7392. }
  7393. }
  7394. /**
  7395. * Inserts wrapper `details` in a comment at the top of the `source` body.
  7396. *
  7397. * @private
  7398. * @param {string} source The source to modify.
  7399. * @returns {Array} details The details to insert.
  7400. * @returns {string} Returns the modified source.
  7401. */
  7402. function insertWrapDetails(source, details) {
  7403. var length = details.length;
  7404. if (!length) {
  7405. return source;
  7406. }
  7407. var lastIndex = length - 1;
  7408. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  7409. details = details.join(length > 2 ? ', ' : ' ');
  7410. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  7411. }
  7412. /**
  7413. * Checks if `value` is a flattenable `arguments` object or array.
  7414. *
  7415. * @private
  7416. * @param {*} value The value to check.
  7417. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  7418. */
  7419. function isFlattenable(value) {
  7420. return isArray(value) || isArguments(value) ||
  7421. !!(spreadableSymbol && value && value[spreadableSymbol]);
  7422. }
  7423. /**
  7424. * Checks if `value` is a valid array-like index.
  7425. *
  7426. * @private
  7427. * @param {*} value The value to check.
  7428. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7429. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7430. */
  7431. function isIndex(value, length) {
  7432. var type = typeof value;
  7433. length = length == null ? MAX_SAFE_INTEGER : length;
  7434. return !!length &&
  7435. (type == 'number' ||
  7436. (type != 'symbol' && reIsUint.test(value))) &&
  7437. (value > -1 && value % 1 == 0 && value < length);
  7438. }
  7439. /**
  7440. * Checks if the given arguments are from an iteratee call.
  7441. *
  7442. * @private
  7443. * @param {*} value The potential iteratee value argument.
  7444. * @param {*} index The potential iteratee index or key argument.
  7445. * @param {*} object The potential iteratee object argument.
  7446. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  7447. * else `false`.
  7448. */
  7449. function isIterateeCall(value, index, object) {
  7450. if (!isObject(object)) {
  7451. return false;
  7452. }
  7453. var type = typeof index;
  7454. if (type == 'number'
  7455. ? (isArrayLike(object) && isIndex(index, object.length))
  7456. : (type == 'string' && index in object)
  7457. ) {
  7458. return eq(object[index], value);
  7459. }
  7460. return false;
  7461. }
  7462. /**
  7463. * Checks if `value` is a property name and not a property path.
  7464. *
  7465. * @private
  7466. * @param {*} value The value to check.
  7467. * @param {Object} [object] The object to query keys on.
  7468. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  7469. */
  7470. function isKey(value, object) {
  7471. if (isArray(value)) {
  7472. return false;
  7473. }
  7474. var type = typeof value;
  7475. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  7476. value == null || isSymbol(value)) {
  7477. return true;
  7478. }
  7479. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  7480. (object != null && value in Object(object));
  7481. }
  7482. /**
  7483. * Checks if `value` is suitable for use as unique object key.
  7484. *
  7485. * @private
  7486. * @param {*} value The value to check.
  7487. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  7488. */
  7489. function isKeyable(value) {
  7490. var type = typeof value;
  7491. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  7492. ? (value !== '__proto__')
  7493. : (value === null);
  7494. }
  7495. /**
  7496. * Checks if `func` has a lazy counterpart.
  7497. *
  7498. * @private
  7499. * @param {Function} func The function to check.
  7500. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  7501. * else `false`.
  7502. */
  7503. function isLaziable(func) {
  7504. var funcName = getFuncName(func),
  7505. other = lodash[funcName];
  7506. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  7507. return false;
  7508. }
  7509. if (func === other) {
  7510. return true;
  7511. }
  7512. var data = getData(other);
  7513. return !!data && func === data[0];
  7514. }
  7515. /**
  7516. * Checks if `func` has its source masked.
  7517. *
  7518. * @private
  7519. * @param {Function} func The function to check.
  7520. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  7521. */
  7522. function isMasked(func) {
  7523. return !!maskSrcKey && (maskSrcKey in func);
  7524. }
  7525. /**
  7526. * Checks if `func` is capable of being masked.
  7527. *
  7528. * @private
  7529. * @param {*} value The value to check.
  7530. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  7531. */
  7532. var isMaskable = coreJsData ? isFunction : stubFalse;
  7533. /**
  7534. * Checks if `value` is likely a prototype object.
  7535. *
  7536. * @private
  7537. * @param {*} value The value to check.
  7538. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7539. */
  7540. function isPrototype(value) {
  7541. var Ctor = value && value.constructor,
  7542. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  7543. return value === proto;
  7544. }
  7545. /**
  7546. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  7547. *
  7548. * @private
  7549. * @param {*} value The value to check.
  7550. * @returns {boolean} Returns `true` if `value` if suitable for strict
  7551. * equality comparisons, else `false`.
  7552. */
  7553. function isStrictComparable(value) {
  7554. return value === value && !isObject(value);
  7555. }
  7556. /**
  7557. * A specialized version of `matchesProperty` for source values suitable
  7558. * for strict equality comparisons, i.e. `===`.
  7559. *
  7560. * @private
  7561. * @param {string} key The key of the property to get.
  7562. * @param {*} srcValue The value to match.
  7563. * @returns {Function} Returns the new spec function.
  7564. */
  7565. function matchesStrictComparable(key, srcValue) {
  7566. return function(object) {
  7567. if (object == null) {
  7568. return false;
  7569. }
  7570. return object[key] === srcValue &&
  7571. (srcValue !== undefined || (key in Object(object)));
  7572. };
  7573. }
  7574. /**
  7575. * A specialized version of `_.memoize` which clears the memoized function's
  7576. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  7577. *
  7578. * @private
  7579. * @param {Function} func The function to have its output memoized.
  7580. * @returns {Function} Returns the new memoized function.
  7581. */
  7582. function memoizeCapped(func) {
  7583. var result = memoize(func, function(key) {
  7584. if (cache.size === MAX_MEMOIZE_SIZE) {
  7585. cache.clear();
  7586. }
  7587. return key;
  7588. });
  7589. var cache = result.cache;
  7590. return result;
  7591. }
  7592. /**
  7593. * Merges the function metadata of `source` into `data`.
  7594. *
  7595. * Merging metadata reduces the number of wrappers used to invoke a function.
  7596. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  7597. * may be applied regardless of execution order. Methods like `_.ary` and
  7598. * `_.rearg` modify function arguments, making the order in which they are
  7599. * executed important, preventing the merging of metadata. However, we make
  7600. * an exception for a safe combined case where curried functions have `_.ary`
  7601. * and or `_.rearg` applied.
  7602. *
  7603. * @private
  7604. * @param {Array} data The destination metadata.
  7605. * @param {Array} source The source metadata.
  7606. * @returns {Array} Returns `data`.
  7607. */
  7608. function mergeData(data, source) {
  7609. var bitmask = data[1],
  7610. srcBitmask = source[1],
  7611. newBitmask = bitmask | srcBitmask,
  7612. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  7613. var isCombo =
  7614. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  7615. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  7616. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  7617. // Exit early if metadata can't be merged.
  7618. if (!(isCommon || isCombo)) {
  7619. return data;
  7620. }
  7621. // Use source `thisArg` if available.
  7622. if (srcBitmask & WRAP_BIND_FLAG) {
  7623. data[2] = source[2];
  7624. // Set when currying a bound function.
  7625. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  7626. }
  7627. // Compose partial arguments.
  7628. var value = source[3];
  7629. if (value) {
  7630. var partials = data[3];
  7631. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  7632. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  7633. }
  7634. // Compose partial right arguments.
  7635. value = source[5];
  7636. if (value) {
  7637. partials = data[5];
  7638. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  7639. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  7640. }
  7641. // Use source `argPos` if available.
  7642. value = source[7];
  7643. if (value) {
  7644. data[7] = value;
  7645. }
  7646. // Use source `ary` if it's smaller.
  7647. if (srcBitmask & WRAP_ARY_FLAG) {
  7648. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  7649. }
  7650. // Use source `arity` if one is not provided.
  7651. if (data[9] == null) {
  7652. data[9] = source[9];
  7653. }
  7654. // Use source `func` and merge bitmasks.
  7655. data[0] = source[0];
  7656. data[1] = newBitmask;
  7657. return data;
  7658. }
  7659. /**
  7660. * This function is like
  7661. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7662. * except that it includes inherited enumerable properties.
  7663. *
  7664. * @private
  7665. * @param {Object} object The object to query.
  7666. * @returns {Array} Returns the array of property names.
  7667. */
  7668. function nativeKeysIn(object) {
  7669. var result = [];
  7670. if (object != null) {
  7671. for (var key in Object(object)) {
  7672. result.push(key);
  7673. }
  7674. }
  7675. return result;
  7676. }
  7677. /**
  7678. * Converts `value` to a string using `Object.prototype.toString`.
  7679. *
  7680. * @private
  7681. * @param {*} value The value to convert.
  7682. * @returns {string} Returns the converted string.
  7683. */
  7684. function objectToString(value) {
  7685. return nativeObjectToString.call(value);
  7686. }
  7687. /**
  7688. * A specialized version of `baseRest` which transforms the rest array.
  7689. *
  7690. * @private
  7691. * @param {Function} func The function to apply a rest parameter to.
  7692. * @param {number} [start=func.length-1] The start position of the rest parameter.
  7693. * @param {Function} transform The rest array transform.
  7694. * @returns {Function} Returns the new function.
  7695. */
  7696. function overRest(func, start, transform) {
  7697. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  7698. return function() {
  7699. var args = arguments,
  7700. index = -1,
  7701. length = nativeMax(args.length - start, 0),
  7702. array = Array(length);
  7703. while (++index < length) {
  7704. array[index] = args[start + index];
  7705. }
  7706. index = -1;
  7707. var otherArgs = Array(start + 1);
  7708. while (++index < start) {
  7709. otherArgs[index] = args[index];
  7710. }
  7711. otherArgs[start] = transform(array);
  7712. return apply(func, this, otherArgs);
  7713. };
  7714. }
  7715. /**
  7716. * Gets the parent value at `path` of `object`.
  7717. *
  7718. * @private
  7719. * @param {Object} object The object to query.
  7720. * @param {Array} path The path to get the parent value of.
  7721. * @returns {*} Returns the parent value.
  7722. */
  7723. function parent(object, path) {
  7724. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  7725. }
  7726. /**
  7727. * Reorder `array` according to the specified indexes where the element at
  7728. * the first index is assigned as the first element, the element at
  7729. * the second index is assigned as the second element, and so on.
  7730. *
  7731. * @private
  7732. * @param {Array} array The array to reorder.
  7733. * @param {Array} indexes The arranged array indexes.
  7734. * @returns {Array} Returns `array`.
  7735. */
  7736. function reorder(array, indexes) {
  7737. var arrLength = array.length,
  7738. length = nativeMin(indexes.length, arrLength),
  7739. oldArray = copyArray(array);
  7740. while (length--) {
  7741. var index = indexes[length];
  7742. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  7743. }
  7744. return array;
  7745. }
  7746. /**
  7747. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  7748. *
  7749. * @private
  7750. * @param {Object} object The object to query.
  7751. * @param {string} key The key of the property to get.
  7752. * @returns {*} Returns the property value.
  7753. */
  7754. function safeGet(object, key) {
  7755. if (key === 'constructor' && typeof object[key] === 'function') {
  7756. return;
  7757. }
  7758. if (key == '__proto__') {
  7759. return;
  7760. }
  7761. return object[key];
  7762. }
  7763. /**
  7764. * Sets metadata for `func`.
  7765. *
  7766. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  7767. * period of time, it will trip its breaker and transition to an identity
  7768. * function to avoid garbage collection pauses in V8. See
  7769. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  7770. * for more details.
  7771. *
  7772. * @private
  7773. * @param {Function} func The function to associate metadata with.
  7774. * @param {*} data The metadata.
  7775. * @returns {Function} Returns `func`.
  7776. */
  7777. var setData = shortOut(baseSetData);
  7778. /**
  7779. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  7780. *
  7781. * @private
  7782. * @param {Function} func The function to delay.
  7783. * @param {number} wait The number of milliseconds to delay invocation.
  7784. * @returns {number|Object} Returns the timer id or timeout object.
  7785. */
  7786. var setTimeout = ctxSetTimeout || function(func, wait) {
  7787. return root.setTimeout(func, wait);
  7788. };
  7789. /**
  7790. * Sets the `toString` method of `func` to return `string`.
  7791. *
  7792. * @private
  7793. * @param {Function} func The function to modify.
  7794. * @param {Function} string The `toString` result.
  7795. * @returns {Function} Returns `func`.
  7796. */
  7797. var setToString = shortOut(baseSetToString);
  7798. /**
  7799. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  7800. * with wrapper details in a comment at the top of the source body.
  7801. *
  7802. * @private
  7803. * @param {Function} wrapper The function to modify.
  7804. * @param {Function} reference The reference function.
  7805. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7806. * @returns {Function} Returns `wrapper`.
  7807. */
  7808. function setWrapToString(wrapper, reference, bitmask) {
  7809. var source = (reference + '');
  7810. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  7811. }
  7812. /**
  7813. * Creates a function that'll short out and invoke `identity` instead
  7814. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  7815. * milliseconds.
  7816. *
  7817. * @private
  7818. * @param {Function} func The function to restrict.
  7819. * @returns {Function} Returns the new shortable function.
  7820. */
  7821. function shortOut(func) {
  7822. var count = 0,
  7823. lastCalled = 0;
  7824. return function() {
  7825. var stamp = nativeNow(),
  7826. remaining = HOT_SPAN - (stamp - lastCalled);
  7827. lastCalled = stamp;
  7828. if (remaining > 0) {
  7829. if (++count >= HOT_COUNT) {
  7830. return arguments[0];
  7831. }
  7832. } else {
  7833. count = 0;
  7834. }
  7835. return func.apply(undefined, arguments);
  7836. };
  7837. }
  7838. /**
  7839. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7840. *
  7841. * @private
  7842. * @param {Array} array The array to shuffle.
  7843. * @param {number} [size=array.length] The size of `array`.
  7844. * @returns {Array} Returns `array`.
  7845. */
  7846. function shuffleSelf(array, size) {
  7847. var index = -1,
  7848. length = array.length,
  7849. lastIndex = length - 1;
  7850. size = size === undefined ? length : size;
  7851. while (++index < size) {
  7852. var rand = baseRandom(index, lastIndex),
  7853. value = array[rand];
  7854. array[rand] = array[index];
  7855. array[index] = value;
  7856. }
  7857. array.length = size;
  7858. return array;
  7859. }
  7860. /**
  7861. * Converts `string` to a property path array.
  7862. *
  7863. * @private
  7864. * @param {string} string The string to convert.
  7865. * @returns {Array} Returns the property path array.
  7866. */
  7867. var stringToPath = memoizeCapped(function(string) {
  7868. var result = [];
  7869. if (string.charCodeAt(0) === 46 /* . */) {
  7870. result.push('');
  7871. }
  7872. string.replace(rePropName, function(match, number, quote, subString) {
  7873. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7874. });
  7875. return result;
  7876. });
  7877. /**
  7878. * Converts `value` to a string key if it's not a string or symbol.
  7879. *
  7880. * @private
  7881. * @param {*} value The value to inspect.
  7882. * @returns {string|symbol} Returns the key.
  7883. */
  7884. function toKey(value) {
  7885. if (typeof value == 'string' || isSymbol(value)) {
  7886. return value;
  7887. }
  7888. var result = (value + '');
  7889. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7890. }
  7891. /**
  7892. * Converts `func` to its source code.
  7893. *
  7894. * @private
  7895. * @param {Function} func The function to convert.
  7896. * @returns {string} Returns the source code.
  7897. */
  7898. function toSource(func) {
  7899. if (func != null) {
  7900. try {
  7901. return funcToString.call(func);
  7902. } catch (e) {}
  7903. try {
  7904. return (func + '');
  7905. } catch (e) {}
  7906. }
  7907. return '';
  7908. }
  7909. /**
  7910. * Updates wrapper `details` based on `bitmask` flags.
  7911. *
  7912. * @private
  7913. * @returns {Array} details The details to modify.
  7914. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7915. * @returns {Array} Returns `details`.
  7916. */
  7917. function updateWrapDetails(details, bitmask) {
  7918. arrayEach(wrapFlags, function(pair) {
  7919. var value = '_.' + pair[0];
  7920. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7921. details.push(value);
  7922. }
  7923. });
  7924. return details.sort();
  7925. }
  7926. /**
  7927. * Creates a clone of `wrapper`.
  7928. *
  7929. * @private
  7930. * @param {Object} wrapper The wrapper to clone.
  7931. * @returns {Object} Returns the cloned wrapper.
  7932. */
  7933. function wrapperClone(wrapper) {
  7934. if (wrapper instanceof LazyWrapper) {
  7935. return wrapper.clone();
  7936. }
  7937. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7938. result.__actions__ = copyArray(wrapper.__actions__);
  7939. result.__index__ = wrapper.__index__;
  7940. result.__values__ = wrapper.__values__;
  7941. return result;
  7942. }
  7943. /*------------------------------------------------------------------------*/
  7944. /**
  7945. * Creates an array of elements split into groups the length of `size`.
  7946. * If `array` can't be split evenly, the final chunk will be the remaining
  7947. * elements.
  7948. *
  7949. * @static
  7950. * @memberOf _
  7951. * @since 3.0.0
  7952. * @category Array
  7953. * @param {Array} array The array to process.
  7954. * @param {number} [size=1] The length of each chunk
  7955. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7956. * @returns {Array} Returns the new array of chunks.
  7957. * @example
  7958. *
  7959. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7960. * // => [['a', 'b'], ['c', 'd']]
  7961. *
  7962. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7963. * // => [['a', 'b', 'c'], ['d']]
  7964. */
  7965. function chunk(array, size, guard) {
  7966. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7967. size = 1;
  7968. } else {
  7969. size = nativeMax(toInteger(size), 0);
  7970. }
  7971. var length = array == null ? 0 : array.length;
  7972. if (!length || size < 1) {
  7973. return [];
  7974. }
  7975. var index = 0,
  7976. resIndex = 0,
  7977. result = Array(nativeCeil(length / size));
  7978. while (index < length) {
  7979. result[resIndex++] = baseSlice(array, index, (index += size));
  7980. }
  7981. return result;
  7982. }
  7983. /**
  7984. * Creates an array with all falsey values removed. The values `false`, `null`,
  7985. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7986. *
  7987. * @static
  7988. * @memberOf _
  7989. * @since 0.1.0
  7990. * @category Array
  7991. * @param {Array} array The array to compact.
  7992. * @returns {Array} Returns the new array of filtered values.
  7993. * @example
  7994. *
  7995. * _.compact([0, 1, false, 2, '', 3]);
  7996. * // => [1, 2, 3]
  7997. */
  7998. function compact(array) {
  7999. var index = -1,
  8000. length = array == null ? 0 : array.length,
  8001. resIndex = 0,
  8002. result = [];
  8003. while (++index < length) {
  8004. var value = array[index];
  8005. if (value) {
  8006. result[resIndex++] = value;
  8007. }
  8008. }
  8009. return result;
  8010. }
  8011. /**
  8012. * Creates a new array concatenating `array` with any additional arrays
  8013. * and/or values.
  8014. *
  8015. * @static
  8016. * @memberOf _
  8017. * @since 4.0.0
  8018. * @category Array
  8019. * @param {Array} array The array to concatenate.
  8020. * @param {...*} [values] The values to concatenate.
  8021. * @returns {Array} Returns the new concatenated array.
  8022. * @example
  8023. *
  8024. * var array = [1];
  8025. * var other = _.concat(array, 2, [3], [[4]]);
  8026. *
  8027. * console.log(other);
  8028. * // => [1, 2, 3, [4]]
  8029. *
  8030. * console.log(array);
  8031. * // => [1]
  8032. */
  8033. function concat() {
  8034. var length = arguments.length;
  8035. if (!length) {
  8036. return [];
  8037. }
  8038. var args = Array(length - 1),
  8039. array = arguments[0],
  8040. index = length;
  8041. while (index--) {
  8042. args[index - 1] = arguments[index];
  8043. }
  8044. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  8045. }
  8046. /**
  8047. * Creates an array of `array` values not included in the other given arrays
  8048. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8049. * for equality comparisons. The order and references of result values are
  8050. * determined by the first array.
  8051. *
  8052. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  8053. *
  8054. * @static
  8055. * @memberOf _
  8056. * @since 0.1.0
  8057. * @category Array
  8058. * @param {Array} array The array to inspect.
  8059. * @param {...Array} [values] The values to exclude.
  8060. * @returns {Array} Returns the new array of filtered values.
  8061. * @see _.without, _.xor
  8062. * @example
  8063. *
  8064. * _.difference([2, 1], [2, 3]);
  8065. * // => [1]
  8066. */
  8067. var difference = baseRest(function(array, values) {
  8068. return isArrayLikeObject(array)
  8069. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  8070. : [];
  8071. });
  8072. /**
  8073. * This method is like `_.difference` except that it accepts `iteratee` which
  8074. * is invoked for each element of `array` and `values` to generate the criterion
  8075. * by which they're compared. The order and references of result values are
  8076. * determined by the first array. The iteratee is invoked with one argument:
  8077. * (value).
  8078. *
  8079. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  8080. *
  8081. * @static
  8082. * @memberOf _
  8083. * @since 4.0.0
  8084. * @category Array
  8085. * @param {Array} array The array to inspect.
  8086. * @param {...Array} [values] The values to exclude.
  8087. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8088. * @returns {Array} Returns the new array of filtered values.
  8089. * @example
  8090. *
  8091. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8092. * // => [1.2]
  8093. *
  8094. * // The `_.property` iteratee shorthand.
  8095. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  8096. * // => [{ 'x': 2 }]
  8097. */
  8098. var differenceBy = baseRest(function(array, values) {
  8099. var iteratee = last(values);
  8100. if (isArrayLikeObject(iteratee)) {
  8101. iteratee = undefined;
  8102. }
  8103. return isArrayLikeObject(array)
  8104. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  8105. : [];
  8106. });
  8107. /**
  8108. * This method is like `_.difference` except that it accepts `comparator`
  8109. * which is invoked to compare elements of `array` to `values`. The order and
  8110. * references of result values are determined by the first array. The comparator
  8111. * is invoked with two arguments: (arrVal, othVal).
  8112. *
  8113. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  8114. *
  8115. * @static
  8116. * @memberOf _
  8117. * @since 4.0.0
  8118. * @category Array
  8119. * @param {Array} array The array to inspect.
  8120. * @param {...Array} [values] The values to exclude.
  8121. * @param {Function} [comparator] The comparator invoked per element.
  8122. * @returns {Array} Returns the new array of filtered values.
  8123. * @example
  8124. *
  8125. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8126. *
  8127. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  8128. * // => [{ 'x': 2, 'y': 1 }]
  8129. */
  8130. var differenceWith = baseRest(function(array, values) {
  8131. var comparator = last(values);
  8132. if (isArrayLikeObject(comparator)) {
  8133. comparator = undefined;
  8134. }
  8135. return isArrayLikeObject(array)
  8136. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  8137. : [];
  8138. });
  8139. /**
  8140. * Creates a slice of `array` with `n` elements dropped from the beginning.
  8141. *
  8142. * @static
  8143. * @memberOf _
  8144. * @since 0.5.0
  8145. * @category Array
  8146. * @param {Array} array The array to query.
  8147. * @param {number} [n=1] The number of elements to drop.
  8148. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8149. * @returns {Array} Returns the slice of `array`.
  8150. * @example
  8151. *
  8152. * _.drop([1, 2, 3]);
  8153. * // => [2, 3]
  8154. *
  8155. * _.drop([1, 2, 3], 2);
  8156. * // => [3]
  8157. *
  8158. * _.drop([1, 2, 3], 5);
  8159. * // => []
  8160. *
  8161. * _.drop([1, 2, 3], 0);
  8162. * // => [1, 2, 3]
  8163. */
  8164. function drop(array, n, guard) {
  8165. var length = array == null ? 0 : array.length;
  8166. if (!length) {
  8167. return [];
  8168. }
  8169. n = (guard || n === undefined) ? 1 : toInteger(n);
  8170. return baseSlice(array, n < 0 ? 0 : n, length);
  8171. }
  8172. /**
  8173. * Creates a slice of `array` with `n` elements dropped from the end.
  8174. *
  8175. * @static
  8176. * @memberOf _
  8177. * @since 3.0.0
  8178. * @category Array
  8179. * @param {Array} array The array to query.
  8180. * @param {number} [n=1] The number of elements to drop.
  8181. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8182. * @returns {Array} Returns the slice of `array`.
  8183. * @example
  8184. *
  8185. * _.dropRight([1, 2, 3]);
  8186. * // => [1, 2]
  8187. *
  8188. * _.dropRight([1, 2, 3], 2);
  8189. * // => [1]
  8190. *
  8191. * _.dropRight([1, 2, 3], 5);
  8192. * // => []
  8193. *
  8194. * _.dropRight([1, 2, 3], 0);
  8195. * // => [1, 2, 3]
  8196. */
  8197. function dropRight(array, n, guard) {
  8198. var length = array == null ? 0 : array.length;
  8199. if (!length) {
  8200. return [];
  8201. }
  8202. n = (guard || n === undefined) ? 1 : toInteger(n);
  8203. n = length - n;
  8204. return baseSlice(array, 0, n < 0 ? 0 : n);
  8205. }
  8206. /**
  8207. * Creates a slice of `array` excluding elements dropped from the end.
  8208. * Elements are dropped until `predicate` returns falsey. The predicate is
  8209. * invoked with three arguments: (value, index, array).
  8210. *
  8211. * @static
  8212. * @memberOf _
  8213. * @since 3.0.0
  8214. * @category Array
  8215. * @param {Array} array The array to query.
  8216. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8217. * @returns {Array} Returns the slice of `array`.
  8218. * @example
  8219. *
  8220. * var users = [
  8221. * { 'user': 'barney', 'active': true },
  8222. * { 'user': 'fred', 'active': false },
  8223. * { 'user': 'pebbles', 'active': false }
  8224. * ];
  8225. *
  8226. * _.dropRightWhile(users, function(o) { return !o.active; });
  8227. * // => objects for ['barney']
  8228. *
  8229. * // The `_.matches` iteratee shorthand.
  8230. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  8231. * // => objects for ['barney', 'fred']
  8232. *
  8233. * // The `_.matchesProperty` iteratee shorthand.
  8234. * _.dropRightWhile(users, ['active', false]);
  8235. * // => objects for ['barney']
  8236. *
  8237. * // The `_.property` iteratee shorthand.
  8238. * _.dropRightWhile(users, 'active');
  8239. * // => objects for ['barney', 'fred', 'pebbles']
  8240. */
  8241. function dropRightWhile(array, predicate) {
  8242. return (array && array.length)
  8243. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  8244. : [];
  8245. }
  8246. /**
  8247. * Creates a slice of `array` excluding elements dropped from the beginning.
  8248. * Elements are dropped until `predicate` returns falsey. The predicate is
  8249. * invoked with three arguments: (value, index, array).
  8250. *
  8251. * @static
  8252. * @memberOf _
  8253. * @since 3.0.0
  8254. * @category Array
  8255. * @param {Array} array The array to query.
  8256. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8257. * @returns {Array} Returns the slice of `array`.
  8258. * @example
  8259. *
  8260. * var users = [
  8261. * { 'user': 'barney', 'active': false },
  8262. * { 'user': 'fred', 'active': false },
  8263. * { 'user': 'pebbles', 'active': true }
  8264. * ];
  8265. *
  8266. * _.dropWhile(users, function(o) { return !o.active; });
  8267. * // => objects for ['pebbles']
  8268. *
  8269. * // The `_.matches` iteratee shorthand.
  8270. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  8271. * // => objects for ['fred', 'pebbles']
  8272. *
  8273. * // The `_.matchesProperty` iteratee shorthand.
  8274. * _.dropWhile(users, ['active', false]);
  8275. * // => objects for ['pebbles']
  8276. *
  8277. * // The `_.property` iteratee shorthand.
  8278. * _.dropWhile(users, 'active');
  8279. * // => objects for ['barney', 'fred', 'pebbles']
  8280. */
  8281. function dropWhile(array, predicate) {
  8282. return (array && array.length)
  8283. ? baseWhile(array, getIteratee(predicate, 3), true)
  8284. : [];
  8285. }
  8286. /**
  8287. * Fills elements of `array` with `value` from `start` up to, but not
  8288. * including, `end`.
  8289. *
  8290. * **Note:** This method mutates `array`.
  8291. *
  8292. * @static
  8293. * @memberOf _
  8294. * @since 3.2.0
  8295. * @category Array
  8296. * @param {Array} array The array to fill.
  8297. * @param {*} value The value to fill `array` with.
  8298. * @param {number} [start=0] The start position.
  8299. * @param {number} [end=array.length] The end position.
  8300. * @returns {Array} Returns `array`.
  8301. * @example
  8302. *
  8303. * var array = [1, 2, 3];
  8304. *
  8305. * _.fill(array, 'a');
  8306. * console.log(array);
  8307. * // => ['a', 'a', 'a']
  8308. *
  8309. * _.fill(Array(3), 2);
  8310. * // => [2, 2, 2]
  8311. *
  8312. * _.fill([4, 6, 8, 10], '*', 1, 3);
  8313. * // => [4, '*', '*', 10]
  8314. */
  8315. function fill(array, value, start, end) {
  8316. var length = array == null ? 0 : array.length;
  8317. if (!length) {
  8318. return [];
  8319. }
  8320. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  8321. start = 0;
  8322. end = length;
  8323. }
  8324. return baseFill(array, value, start, end);
  8325. }
  8326. /**
  8327. * This method is like `_.find` except that it returns the index of the first
  8328. * element `predicate` returns truthy for instead of the element itself.
  8329. *
  8330. * @static
  8331. * @memberOf _
  8332. * @since 1.1.0
  8333. * @category Array
  8334. * @param {Array} array The array to inspect.
  8335. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8336. * @param {number} [fromIndex=0] The index to search from.
  8337. * @returns {number} Returns the index of the found element, else `-1`.
  8338. * @example
  8339. *
  8340. * var users = [
  8341. * { 'user': 'barney', 'active': false },
  8342. * { 'user': 'fred', 'active': false },
  8343. * { 'user': 'pebbles', 'active': true }
  8344. * ];
  8345. *
  8346. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  8347. * // => 0
  8348. *
  8349. * // The `_.matches` iteratee shorthand.
  8350. * _.findIndex(users, { 'user': 'fred', 'active': false });
  8351. * // => 1
  8352. *
  8353. * // The `_.matchesProperty` iteratee shorthand.
  8354. * _.findIndex(users, ['active', false]);
  8355. * // => 0
  8356. *
  8357. * // The `_.property` iteratee shorthand.
  8358. * _.findIndex(users, 'active');
  8359. * // => 2
  8360. */
  8361. function findIndex(array, predicate, fromIndex) {
  8362. var length = array == null ? 0 : array.length;
  8363. if (!length) {
  8364. return -1;
  8365. }
  8366. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8367. if (index < 0) {
  8368. index = nativeMax(length + index, 0);
  8369. }
  8370. return baseFindIndex(array, getIteratee(predicate, 3), index);
  8371. }
  8372. /**
  8373. * This method is like `_.findIndex` except that it iterates over elements
  8374. * of `collection` from right to left.
  8375. *
  8376. * @static
  8377. * @memberOf _
  8378. * @since 2.0.0
  8379. * @category Array
  8380. * @param {Array} array The array to inspect.
  8381. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8382. * @param {number} [fromIndex=array.length-1] The index to search from.
  8383. * @returns {number} Returns the index of the found element, else `-1`.
  8384. * @example
  8385. *
  8386. * var users = [
  8387. * { 'user': 'barney', 'active': true },
  8388. * { 'user': 'fred', 'active': false },
  8389. * { 'user': 'pebbles', 'active': false }
  8390. * ];
  8391. *
  8392. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  8393. * // => 2
  8394. *
  8395. * // The `_.matches` iteratee shorthand.
  8396. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  8397. * // => 0
  8398. *
  8399. * // The `_.matchesProperty` iteratee shorthand.
  8400. * _.findLastIndex(users, ['active', false]);
  8401. * // => 2
  8402. *
  8403. * // The `_.property` iteratee shorthand.
  8404. * _.findLastIndex(users, 'active');
  8405. * // => 0
  8406. */
  8407. function findLastIndex(array, predicate, fromIndex) {
  8408. var length = array == null ? 0 : array.length;
  8409. if (!length) {
  8410. return -1;
  8411. }
  8412. var index = length - 1;
  8413. if (fromIndex !== undefined) {
  8414. index = toInteger(fromIndex);
  8415. index = fromIndex < 0
  8416. ? nativeMax(length + index, 0)
  8417. : nativeMin(index, length - 1);
  8418. }
  8419. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  8420. }
  8421. /**
  8422. * Flattens `array` a single level deep.
  8423. *
  8424. * @static
  8425. * @memberOf _
  8426. * @since 0.1.0
  8427. * @category Array
  8428. * @param {Array} array The array to flatten.
  8429. * @returns {Array} Returns the new flattened array.
  8430. * @example
  8431. *
  8432. * _.flatten([1, [2, [3, [4]], 5]]);
  8433. * // => [1, 2, [3, [4]], 5]
  8434. */
  8435. function flatten(array) {
  8436. var length = array == null ? 0 : array.length;
  8437. return length ? baseFlatten(array, 1) : [];
  8438. }
  8439. /**
  8440. * Recursively flattens `array`.
  8441. *
  8442. * @static
  8443. * @memberOf _
  8444. * @since 3.0.0
  8445. * @category Array
  8446. * @param {Array} array The array to flatten.
  8447. * @returns {Array} Returns the new flattened array.
  8448. * @example
  8449. *
  8450. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  8451. * // => [1, 2, 3, 4, 5]
  8452. */
  8453. function flattenDeep(array) {
  8454. var length = array == null ? 0 : array.length;
  8455. return length ? baseFlatten(array, INFINITY) : [];
  8456. }
  8457. /**
  8458. * Recursively flatten `array` up to `depth` times.
  8459. *
  8460. * @static
  8461. * @memberOf _
  8462. * @since 4.4.0
  8463. * @category Array
  8464. * @param {Array} array The array to flatten.
  8465. * @param {number} [depth=1] The maximum recursion depth.
  8466. * @returns {Array} Returns the new flattened array.
  8467. * @example
  8468. *
  8469. * var array = [1, [2, [3, [4]], 5]];
  8470. *
  8471. * _.flattenDepth(array, 1);
  8472. * // => [1, 2, [3, [4]], 5]
  8473. *
  8474. * _.flattenDepth(array, 2);
  8475. * // => [1, 2, 3, [4], 5]
  8476. */
  8477. function flattenDepth(array, depth) {
  8478. var length = array == null ? 0 : array.length;
  8479. if (!length) {
  8480. return [];
  8481. }
  8482. depth = depth === undefined ? 1 : toInteger(depth);
  8483. return baseFlatten(array, depth);
  8484. }
  8485. /**
  8486. * The inverse of `_.toPairs`; this method returns an object composed
  8487. * from key-value `pairs`.
  8488. *
  8489. * @static
  8490. * @memberOf _
  8491. * @since 4.0.0
  8492. * @category Array
  8493. * @param {Array} pairs The key-value pairs.
  8494. * @returns {Object} Returns the new object.
  8495. * @example
  8496. *
  8497. * _.fromPairs([['a', 1], ['b', 2]]);
  8498. * // => { 'a': 1, 'b': 2 }
  8499. */
  8500. function fromPairs(pairs) {
  8501. var index = -1,
  8502. length = pairs == null ? 0 : pairs.length,
  8503. result = {};
  8504. while (++index < length) {
  8505. var pair = pairs[index];
  8506. result[pair[0]] = pair[1];
  8507. }
  8508. return result;
  8509. }
  8510. /**
  8511. * Gets the first element of `array`.
  8512. *
  8513. * @static
  8514. * @memberOf _
  8515. * @since 0.1.0
  8516. * @alias first
  8517. * @category Array
  8518. * @param {Array} array The array to query.
  8519. * @returns {*} Returns the first element of `array`.
  8520. * @example
  8521. *
  8522. * _.head([1, 2, 3]);
  8523. * // => 1
  8524. *
  8525. * _.head([]);
  8526. * // => undefined
  8527. */
  8528. function head(array) {
  8529. return (array && array.length) ? array[0] : undefined;
  8530. }
  8531. /**
  8532. * Gets the index at which the first occurrence of `value` is found in `array`
  8533. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8534. * for equality comparisons. If `fromIndex` is negative, it's used as the
  8535. * offset from the end of `array`.
  8536. *
  8537. * @static
  8538. * @memberOf _
  8539. * @since 0.1.0
  8540. * @category Array
  8541. * @param {Array} array The array to inspect.
  8542. * @param {*} value The value to search for.
  8543. * @param {number} [fromIndex=0] The index to search from.
  8544. * @returns {number} Returns the index of the matched value, else `-1`.
  8545. * @example
  8546. *
  8547. * _.indexOf([1, 2, 1, 2], 2);
  8548. * // => 1
  8549. *
  8550. * // Search from the `fromIndex`.
  8551. * _.indexOf([1, 2, 1, 2], 2, 2);
  8552. * // => 3
  8553. */
  8554. function indexOf(array, value, fromIndex) {
  8555. var length = array == null ? 0 : array.length;
  8556. if (!length) {
  8557. return -1;
  8558. }
  8559. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8560. if (index < 0) {
  8561. index = nativeMax(length + index, 0);
  8562. }
  8563. return baseIndexOf(array, value, index);
  8564. }
  8565. /**
  8566. * Gets all but the last element of `array`.
  8567. *
  8568. * @static
  8569. * @memberOf _
  8570. * @since 0.1.0
  8571. * @category Array
  8572. * @param {Array} array The array to query.
  8573. * @returns {Array} Returns the slice of `array`.
  8574. * @example
  8575. *
  8576. * _.initial([1, 2, 3]);
  8577. * // => [1, 2]
  8578. */
  8579. function initial(array) {
  8580. var length = array == null ? 0 : array.length;
  8581. return length ? baseSlice(array, 0, -1) : [];
  8582. }
  8583. /**
  8584. * Creates an array of unique values that are included in all given arrays
  8585. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8586. * for equality comparisons. The order and references of result values are
  8587. * determined by the first array.
  8588. *
  8589. * @static
  8590. * @memberOf _
  8591. * @since 0.1.0
  8592. * @category Array
  8593. * @param {...Array} [arrays] The arrays to inspect.
  8594. * @returns {Array} Returns the new array of intersecting values.
  8595. * @example
  8596. *
  8597. * _.intersection([2, 1], [2, 3]);
  8598. * // => [2]
  8599. */
  8600. var intersection = baseRest(function(arrays) {
  8601. var mapped = arrayMap(arrays, castArrayLikeObject);
  8602. return (mapped.length && mapped[0] === arrays[0])
  8603. ? baseIntersection(mapped)
  8604. : [];
  8605. });
  8606. /**
  8607. * This method is like `_.intersection` except that it accepts `iteratee`
  8608. * which is invoked for each element of each `arrays` to generate the criterion
  8609. * by which they're compared. The order and references of result values are
  8610. * determined by the first array. The iteratee is invoked with one argument:
  8611. * (value).
  8612. *
  8613. * @static
  8614. * @memberOf _
  8615. * @since 4.0.0
  8616. * @category Array
  8617. * @param {...Array} [arrays] The arrays to inspect.
  8618. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8619. * @returns {Array} Returns the new array of intersecting values.
  8620. * @example
  8621. *
  8622. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8623. * // => [2.1]
  8624. *
  8625. * // The `_.property` iteratee shorthand.
  8626. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8627. * // => [{ 'x': 1 }]
  8628. */
  8629. var intersectionBy = baseRest(function(arrays) {
  8630. var iteratee = last(arrays),
  8631. mapped = arrayMap(arrays, castArrayLikeObject);
  8632. if (iteratee === last(mapped)) {
  8633. iteratee = undefined;
  8634. } else {
  8635. mapped.pop();
  8636. }
  8637. return (mapped.length && mapped[0] === arrays[0])
  8638. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  8639. : [];
  8640. });
  8641. /**
  8642. * This method is like `_.intersection` except that it accepts `comparator`
  8643. * which is invoked to compare elements of `arrays`. The order and references
  8644. * of result values are determined by the first array. The comparator is
  8645. * invoked with two arguments: (arrVal, othVal).
  8646. *
  8647. * @static
  8648. * @memberOf _
  8649. * @since 4.0.0
  8650. * @category Array
  8651. * @param {...Array} [arrays] The arrays to inspect.
  8652. * @param {Function} [comparator] The comparator invoked per element.
  8653. * @returns {Array} Returns the new array of intersecting values.
  8654. * @example
  8655. *
  8656. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8657. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8658. *
  8659. * _.intersectionWith(objects, others, _.isEqual);
  8660. * // => [{ 'x': 1, 'y': 2 }]
  8661. */
  8662. var intersectionWith = baseRest(function(arrays) {
  8663. var comparator = last(arrays),
  8664. mapped = arrayMap(arrays, castArrayLikeObject);
  8665. comparator = typeof comparator == 'function' ? comparator : undefined;
  8666. if (comparator) {
  8667. mapped.pop();
  8668. }
  8669. return (mapped.length && mapped[0] === arrays[0])
  8670. ? baseIntersection(mapped, undefined, comparator)
  8671. : [];
  8672. });
  8673. /**
  8674. * Converts all elements in `array` into a string separated by `separator`.
  8675. *
  8676. * @static
  8677. * @memberOf _
  8678. * @since 4.0.0
  8679. * @category Array
  8680. * @param {Array} array The array to convert.
  8681. * @param {string} [separator=','] The element separator.
  8682. * @returns {string} Returns the joined string.
  8683. * @example
  8684. *
  8685. * _.join(['a', 'b', 'c'], '~');
  8686. * // => 'a~b~c'
  8687. */
  8688. function join(array, separator) {
  8689. return array == null ? '' : nativeJoin.call(array, separator);
  8690. }
  8691. /**
  8692. * Gets the last element of `array`.
  8693. *
  8694. * @static
  8695. * @memberOf _
  8696. * @since 0.1.0
  8697. * @category Array
  8698. * @param {Array} array The array to query.
  8699. * @returns {*} Returns the last element of `array`.
  8700. * @example
  8701. *
  8702. * _.last([1, 2, 3]);
  8703. * // => 3
  8704. */
  8705. function last(array) {
  8706. var length = array == null ? 0 : array.length;
  8707. return length ? array[length - 1] : undefined;
  8708. }
  8709. /**
  8710. * This method is like `_.indexOf` except that it iterates over elements of
  8711. * `array` from right to left.
  8712. *
  8713. * @static
  8714. * @memberOf _
  8715. * @since 0.1.0
  8716. * @category Array
  8717. * @param {Array} array The array to inspect.
  8718. * @param {*} value The value to search for.
  8719. * @param {number} [fromIndex=array.length-1] The index to search from.
  8720. * @returns {number} Returns the index of the matched value, else `-1`.
  8721. * @example
  8722. *
  8723. * _.lastIndexOf([1, 2, 1, 2], 2);
  8724. * // => 3
  8725. *
  8726. * // Search from the `fromIndex`.
  8727. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  8728. * // => 1
  8729. */
  8730. function lastIndexOf(array, value, fromIndex) {
  8731. var length = array == null ? 0 : array.length;
  8732. if (!length) {
  8733. return -1;
  8734. }
  8735. var index = length;
  8736. if (fromIndex !== undefined) {
  8737. index = toInteger(fromIndex);
  8738. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  8739. }
  8740. return value === value
  8741. ? strictLastIndexOf(array, value, index)
  8742. : baseFindIndex(array, baseIsNaN, index, true);
  8743. }
  8744. /**
  8745. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  8746. * element from the end is returned.
  8747. *
  8748. * @static
  8749. * @memberOf _
  8750. * @since 4.11.0
  8751. * @category Array
  8752. * @param {Array} array The array to query.
  8753. * @param {number} [n=0] The index of the element to return.
  8754. * @returns {*} Returns the nth element of `array`.
  8755. * @example
  8756. *
  8757. * var array = ['a', 'b', 'c', 'd'];
  8758. *
  8759. * _.nth(array, 1);
  8760. * // => 'b'
  8761. *
  8762. * _.nth(array, -2);
  8763. * // => 'c';
  8764. */
  8765. function nth(array, n) {
  8766. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  8767. }
  8768. /**
  8769. * Removes all given values from `array` using
  8770. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8771. * for equality comparisons.
  8772. *
  8773. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  8774. * to remove elements from an array by predicate.
  8775. *
  8776. * @static
  8777. * @memberOf _
  8778. * @since 2.0.0
  8779. * @category Array
  8780. * @param {Array} array The array to modify.
  8781. * @param {...*} [values] The values to remove.
  8782. * @returns {Array} Returns `array`.
  8783. * @example
  8784. *
  8785. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8786. *
  8787. * _.pull(array, 'a', 'c');
  8788. * console.log(array);
  8789. * // => ['b', 'b']
  8790. */
  8791. var pull = baseRest(pullAll);
  8792. /**
  8793. * This method is like `_.pull` except that it accepts an array of values to remove.
  8794. *
  8795. * **Note:** Unlike `_.difference`, this method mutates `array`.
  8796. *
  8797. * @static
  8798. * @memberOf _
  8799. * @since 4.0.0
  8800. * @category Array
  8801. * @param {Array} array The array to modify.
  8802. * @param {Array} values The values to remove.
  8803. * @returns {Array} Returns `array`.
  8804. * @example
  8805. *
  8806. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8807. *
  8808. * _.pullAll(array, ['a', 'c']);
  8809. * console.log(array);
  8810. * // => ['b', 'b']
  8811. */
  8812. function pullAll(array, values) {
  8813. return (array && array.length && values && values.length)
  8814. ? basePullAll(array, values)
  8815. : array;
  8816. }
  8817. /**
  8818. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  8819. * invoked for each element of `array` and `values` to generate the criterion
  8820. * by which they're compared. The iteratee is invoked with one argument: (value).
  8821. *
  8822. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  8823. *
  8824. * @static
  8825. * @memberOf _
  8826. * @since 4.0.0
  8827. * @category Array
  8828. * @param {Array} array The array to modify.
  8829. * @param {Array} values The values to remove.
  8830. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8831. * @returns {Array} Returns `array`.
  8832. * @example
  8833. *
  8834. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8835. *
  8836. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8837. * console.log(array);
  8838. * // => [{ 'x': 2 }]
  8839. */
  8840. function pullAllBy(array, values, iteratee) {
  8841. return (array && array.length && values && values.length)
  8842. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8843. : array;
  8844. }
  8845. /**
  8846. * This method is like `_.pullAll` except that it accepts `comparator` which
  8847. * is invoked to compare elements of `array` to `values`. The comparator is
  8848. * invoked with two arguments: (arrVal, othVal).
  8849. *
  8850. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8851. *
  8852. * @static
  8853. * @memberOf _
  8854. * @since 4.6.0
  8855. * @category Array
  8856. * @param {Array} array The array to modify.
  8857. * @param {Array} values The values to remove.
  8858. * @param {Function} [comparator] The comparator invoked per element.
  8859. * @returns {Array} Returns `array`.
  8860. * @example
  8861. *
  8862. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8863. *
  8864. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8865. * console.log(array);
  8866. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8867. */
  8868. function pullAllWith(array, values, comparator) {
  8869. return (array && array.length && values && values.length)
  8870. ? basePullAll(array, values, undefined, comparator)
  8871. : array;
  8872. }
  8873. /**
  8874. * Removes elements from `array` corresponding to `indexes` and returns an
  8875. * array of removed elements.
  8876. *
  8877. * **Note:** Unlike `_.at`, this method mutates `array`.
  8878. *
  8879. * @static
  8880. * @memberOf _
  8881. * @since 3.0.0
  8882. * @category Array
  8883. * @param {Array} array The array to modify.
  8884. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8885. * @returns {Array} Returns the new array of removed elements.
  8886. * @example
  8887. *
  8888. * var array = ['a', 'b', 'c', 'd'];
  8889. * var pulled = _.pullAt(array, [1, 3]);
  8890. *
  8891. * console.log(array);
  8892. * // => ['a', 'c']
  8893. *
  8894. * console.log(pulled);
  8895. * // => ['b', 'd']
  8896. */
  8897. var pullAt = flatRest(function(array, indexes) {
  8898. var length = array == null ? 0 : array.length,
  8899. result = baseAt(array, indexes);
  8900. basePullAt(array, arrayMap(indexes, function(index) {
  8901. return isIndex(index, length) ? +index : index;
  8902. }).sort(compareAscending));
  8903. return result;
  8904. });
  8905. /**
  8906. * Removes all elements from `array` that `predicate` returns truthy for
  8907. * and returns an array of the removed elements. The predicate is invoked
  8908. * with three arguments: (value, index, array).
  8909. *
  8910. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8911. * to pull elements from an array by value.
  8912. *
  8913. * @static
  8914. * @memberOf _
  8915. * @since 2.0.0
  8916. * @category Array
  8917. * @param {Array} array The array to modify.
  8918. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8919. * @returns {Array} Returns the new array of removed elements.
  8920. * @example
  8921. *
  8922. * var array = [1, 2, 3, 4];
  8923. * var evens = _.remove(array, function(n) {
  8924. * return n % 2 == 0;
  8925. * });
  8926. *
  8927. * console.log(array);
  8928. * // => [1, 3]
  8929. *
  8930. * console.log(evens);
  8931. * // => [2, 4]
  8932. */
  8933. function remove(array, predicate) {
  8934. var result = [];
  8935. if (!(array && array.length)) {
  8936. return result;
  8937. }
  8938. var index = -1,
  8939. indexes = [],
  8940. length = array.length;
  8941. predicate = getIteratee(predicate, 3);
  8942. while (++index < length) {
  8943. var value = array[index];
  8944. if (predicate(value, index, array)) {
  8945. result.push(value);
  8946. indexes.push(index);
  8947. }
  8948. }
  8949. basePullAt(array, indexes);
  8950. return result;
  8951. }
  8952. /**
  8953. * Reverses `array` so that the first element becomes the last, the second
  8954. * element becomes the second to last, and so on.
  8955. *
  8956. * **Note:** This method mutates `array` and is based on
  8957. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8958. *
  8959. * @static
  8960. * @memberOf _
  8961. * @since 4.0.0
  8962. * @category Array
  8963. * @param {Array} array The array to modify.
  8964. * @returns {Array} Returns `array`.
  8965. * @example
  8966. *
  8967. * var array = [1, 2, 3];
  8968. *
  8969. * _.reverse(array);
  8970. * // => [3, 2, 1]
  8971. *
  8972. * console.log(array);
  8973. * // => [3, 2, 1]
  8974. */
  8975. function reverse(array) {
  8976. return array == null ? array : nativeReverse.call(array);
  8977. }
  8978. /**
  8979. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8980. *
  8981. * **Note:** This method is used instead of
  8982. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8983. * returned.
  8984. *
  8985. * @static
  8986. * @memberOf _
  8987. * @since 3.0.0
  8988. * @category Array
  8989. * @param {Array} array The array to slice.
  8990. * @param {number} [start=0] The start position.
  8991. * @param {number} [end=array.length] The end position.
  8992. * @returns {Array} Returns the slice of `array`.
  8993. */
  8994. function slice(array, start, end) {
  8995. var length = array == null ? 0 : array.length;
  8996. if (!length) {
  8997. return [];
  8998. }
  8999. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  9000. start = 0;
  9001. end = length;
  9002. }
  9003. else {
  9004. start = start == null ? 0 : toInteger(start);
  9005. end = end === undefined ? length : toInteger(end);
  9006. }
  9007. return baseSlice(array, start, end);
  9008. }
  9009. /**
  9010. * Uses a binary search to determine the lowest index at which `value`
  9011. * should be inserted into `array` in order to maintain its sort order.
  9012. *
  9013. * @static
  9014. * @memberOf _
  9015. * @since 0.1.0
  9016. * @category Array
  9017. * @param {Array} array The sorted array to inspect.
  9018. * @param {*} value The value to evaluate.
  9019. * @returns {number} Returns the index at which `value` should be inserted
  9020. * into `array`.
  9021. * @example
  9022. *
  9023. * _.sortedIndex([30, 50], 40);
  9024. * // => 1
  9025. */
  9026. function sortedIndex(array, value) {
  9027. return baseSortedIndex(array, value);
  9028. }
  9029. /**
  9030. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  9031. * which is invoked for `value` and each element of `array` to compute their
  9032. * sort ranking. The iteratee is invoked with one argument: (value).
  9033. *
  9034. * @static
  9035. * @memberOf _
  9036. * @since 4.0.0
  9037. * @category Array
  9038. * @param {Array} array The sorted array to inspect.
  9039. * @param {*} value The value to evaluate.
  9040. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9041. * @returns {number} Returns the index at which `value` should be inserted
  9042. * into `array`.
  9043. * @example
  9044. *
  9045. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  9046. *
  9047. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  9048. * // => 0
  9049. *
  9050. * // The `_.property` iteratee shorthand.
  9051. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  9052. * // => 0
  9053. */
  9054. function sortedIndexBy(array, value, iteratee) {
  9055. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  9056. }
  9057. /**
  9058. * This method is like `_.indexOf` except that it performs a binary
  9059. * search on a sorted `array`.
  9060. *
  9061. * @static
  9062. * @memberOf _
  9063. * @since 4.0.0
  9064. * @category Array
  9065. * @param {Array} array The array to inspect.
  9066. * @param {*} value The value to search for.
  9067. * @returns {number} Returns the index of the matched value, else `-1`.
  9068. * @example
  9069. *
  9070. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  9071. * // => 1
  9072. */
  9073. function sortedIndexOf(array, value) {
  9074. var length = array == null ? 0 : array.length;
  9075. if (length) {
  9076. var index = baseSortedIndex(array, value);
  9077. if (index < length && eq(array[index], value)) {
  9078. return index;
  9079. }
  9080. }
  9081. return -1;
  9082. }
  9083. /**
  9084. * This method is like `_.sortedIndex` except that it returns the highest
  9085. * index at which `value` should be inserted into `array` in order to
  9086. * maintain its sort order.
  9087. *
  9088. * @static
  9089. * @memberOf _
  9090. * @since 3.0.0
  9091. * @category Array
  9092. * @param {Array} array The sorted array to inspect.
  9093. * @param {*} value The value to evaluate.
  9094. * @returns {number} Returns the index at which `value` should be inserted
  9095. * into `array`.
  9096. * @example
  9097. *
  9098. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  9099. * // => 4
  9100. */
  9101. function sortedLastIndex(array, value) {
  9102. return baseSortedIndex(array, value, true);
  9103. }
  9104. /**
  9105. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  9106. * which is invoked for `value` and each element of `array` to compute their
  9107. * sort ranking. The iteratee is invoked with one argument: (value).
  9108. *
  9109. * @static
  9110. * @memberOf _
  9111. * @since 4.0.0
  9112. * @category Array
  9113. * @param {Array} array The sorted array to inspect.
  9114. * @param {*} value The value to evaluate.
  9115. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9116. * @returns {number} Returns the index at which `value` should be inserted
  9117. * into `array`.
  9118. * @example
  9119. *
  9120. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  9121. *
  9122. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  9123. * // => 1
  9124. *
  9125. * // The `_.property` iteratee shorthand.
  9126. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  9127. * // => 1
  9128. */
  9129. function sortedLastIndexBy(array, value, iteratee) {
  9130. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  9131. }
  9132. /**
  9133. * This method is like `_.lastIndexOf` except that it performs a binary
  9134. * search on a sorted `array`.
  9135. *
  9136. * @static
  9137. * @memberOf _
  9138. * @since 4.0.0
  9139. * @category Array
  9140. * @param {Array} array The array to inspect.
  9141. * @param {*} value The value to search for.
  9142. * @returns {number} Returns the index of the matched value, else `-1`.
  9143. * @example
  9144. *
  9145. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  9146. * // => 3
  9147. */
  9148. function sortedLastIndexOf(array, value) {
  9149. var length = array == null ? 0 : array.length;
  9150. if (length) {
  9151. var index = baseSortedIndex(array, value, true) - 1;
  9152. if (eq(array[index], value)) {
  9153. return index;
  9154. }
  9155. }
  9156. return -1;
  9157. }
  9158. /**
  9159. * This method is like `_.uniq` except that it's designed and optimized
  9160. * for sorted arrays.
  9161. *
  9162. * @static
  9163. * @memberOf _
  9164. * @since 4.0.0
  9165. * @category Array
  9166. * @param {Array} array The array to inspect.
  9167. * @returns {Array} Returns the new duplicate free array.
  9168. * @example
  9169. *
  9170. * _.sortedUniq([1, 1, 2]);
  9171. * // => [1, 2]
  9172. */
  9173. function sortedUniq(array) {
  9174. return (array && array.length)
  9175. ? baseSortedUniq(array)
  9176. : [];
  9177. }
  9178. /**
  9179. * This method is like `_.uniqBy` except that it's designed and optimized
  9180. * for sorted arrays.
  9181. *
  9182. * @static
  9183. * @memberOf _
  9184. * @since 4.0.0
  9185. * @category Array
  9186. * @param {Array} array The array to inspect.
  9187. * @param {Function} [iteratee] The iteratee invoked per element.
  9188. * @returns {Array} Returns the new duplicate free array.
  9189. * @example
  9190. *
  9191. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  9192. * // => [1.1, 2.3]
  9193. */
  9194. function sortedUniqBy(array, iteratee) {
  9195. return (array && array.length)
  9196. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  9197. : [];
  9198. }
  9199. /**
  9200. * Gets all but the first element of `array`.
  9201. *
  9202. * @static
  9203. * @memberOf _
  9204. * @since 4.0.0
  9205. * @category Array
  9206. * @param {Array} array The array to query.
  9207. * @returns {Array} Returns the slice of `array`.
  9208. * @example
  9209. *
  9210. * _.tail([1, 2, 3]);
  9211. * // => [2, 3]
  9212. */
  9213. function tail(array) {
  9214. var length = array == null ? 0 : array.length;
  9215. return length ? baseSlice(array, 1, length) : [];
  9216. }
  9217. /**
  9218. * Creates a slice of `array` with `n` elements taken from the beginning.
  9219. *
  9220. * @static
  9221. * @memberOf _
  9222. * @since 0.1.0
  9223. * @category Array
  9224. * @param {Array} array The array to query.
  9225. * @param {number} [n=1] The number of elements to take.
  9226. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9227. * @returns {Array} Returns the slice of `array`.
  9228. * @example
  9229. *
  9230. * _.take([1, 2, 3]);
  9231. * // => [1]
  9232. *
  9233. * _.take([1, 2, 3], 2);
  9234. * // => [1, 2]
  9235. *
  9236. * _.take([1, 2, 3], 5);
  9237. * // => [1, 2, 3]
  9238. *
  9239. * _.take([1, 2, 3], 0);
  9240. * // => []
  9241. */
  9242. function take(array, n, guard) {
  9243. if (!(array && array.length)) {
  9244. return [];
  9245. }
  9246. n = (guard || n === undefined) ? 1 : toInteger(n);
  9247. return baseSlice(array, 0, n < 0 ? 0 : n);
  9248. }
  9249. /**
  9250. * Creates a slice of `array` with `n` elements taken from the end.
  9251. *
  9252. * @static
  9253. * @memberOf _
  9254. * @since 3.0.0
  9255. * @category Array
  9256. * @param {Array} array The array to query.
  9257. * @param {number} [n=1] The number of elements to take.
  9258. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9259. * @returns {Array} Returns the slice of `array`.
  9260. * @example
  9261. *
  9262. * _.takeRight([1, 2, 3]);
  9263. * // => [3]
  9264. *
  9265. * _.takeRight([1, 2, 3], 2);
  9266. * // => [2, 3]
  9267. *
  9268. * _.takeRight([1, 2, 3], 5);
  9269. * // => [1, 2, 3]
  9270. *
  9271. * _.takeRight([1, 2, 3], 0);
  9272. * // => []
  9273. */
  9274. function takeRight(array, n, guard) {
  9275. var length = array == null ? 0 : array.length;
  9276. if (!length) {
  9277. return [];
  9278. }
  9279. n = (guard || n === undefined) ? 1 : toInteger(n);
  9280. n = length - n;
  9281. return baseSlice(array, n < 0 ? 0 : n, length);
  9282. }
  9283. /**
  9284. * Creates a slice of `array` with elements taken from the end. Elements are
  9285. * taken until `predicate` returns falsey. The predicate is invoked with
  9286. * three arguments: (value, index, array).
  9287. *
  9288. * @static
  9289. * @memberOf _
  9290. * @since 3.0.0
  9291. * @category Array
  9292. * @param {Array} array The array to query.
  9293. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9294. * @returns {Array} Returns the slice of `array`.
  9295. * @example
  9296. *
  9297. * var users = [
  9298. * { 'user': 'barney', 'active': true },
  9299. * { 'user': 'fred', 'active': false },
  9300. * { 'user': 'pebbles', 'active': false }
  9301. * ];
  9302. *
  9303. * _.takeRightWhile(users, function(o) { return !o.active; });
  9304. * // => objects for ['fred', 'pebbles']
  9305. *
  9306. * // The `_.matches` iteratee shorthand.
  9307. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  9308. * // => objects for ['pebbles']
  9309. *
  9310. * // The `_.matchesProperty` iteratee shorthand.
  9311. * _.takeRightWhile(users, ['active', false]);
  9312. * // => objects for ['fred', 'pebbles']
  9313. *
  9314. * // The `_.property` iteratee shorthand.
  9315. * _.takeRightWhile(users, 'active');
  9316. * // => []
  9317. */
  9318. function takeRightWhile(array, predicate) {
  9319. return (array && array.length)
  9320. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  9321. : [];
  9322. }
  9323. /**
  9324. * Creates a slice of `array` with elements taken from the beginning. Elements
  9325. * are taken until `predicate` returns falsey. The predicate is invoked with
  9326. * three arguments: (value, index, array).
  9327. *
  9328. * @static
  9329. * @memberOf _
  9330. * @since 3.0.0
  9331. * @category Array
  9332. * @param {Array} array The array to query.
  9333. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9334. * @returns {Array} Returns the slice of `array`.
  9335. * @example
  9336. *
  9337. * var users = [
  9338. * { 'user': 'barney', 'active': false },
  9339. * { 'user': 'fred', 'active': false },
  9340. * { 'user': 'pebbles', 'active': true }
  9341. * ];
  9342. *
  9343. * _.takeWhile(users, function(o) { return !o.active; });
  9344. * // => objects for ['barney', 'fred']
  9345. *
  9346. * // The `_.matches` iteratee shorthand.
  9347. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  9348. * // => objects for ['barney']
  9349. *
  9350. * // The `_.matchesProperty` iteratee shorthand.
  9351. * _.takeWhile(users, ['active', false]);
  9352. * // => objects for ['barney', 'fred']
  9353. *
  9354. * // The `_.property` iteratee shorthand.
  9355. * _.takeWhile(users, 'active');
  9356. * // => []
  9357. */
  9358. function takeWhile(array, predicate) {
  9359. return (array && array.length)
  9360. ? baseWhile(array, getIteratee(predicate, 3))
  9361. : [];
  9362. }
  9363. /**
  9364. * Creates an array of unique values, in order, from all given arrays using
  9365. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9366. * for equality comparisons.
  9367. *
  9368. * @static
  9369. * @memberOf _
  9370. * @since 0.1.0
  9371. * @category Array
  9372. * @param {...Array} [arrays] The arrays to inspect.
  9373. * @returns {Array} Returns the new array of combined values.
  9374. * @example
  9375. *
  9376. * _.union([2], [1, 2]);
  9377. * // => [2, 1]
  9378. */
  9379. var union = baseRest(function(arrays) {
  9380. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  9381. });
  9382. /**
  9383. * This method is like `_.union` except that it accepts `iteratee` which is
  9384. * invoked for each element of each `arrays` to generate the criterion by
  9385. * which uniqueness is computed. Result values are chosen from the first
  9386. * array in which the value occurs. The iteratee is invoked with one argument:
  9387. * (value).
  9388. *
  9389. * @static
  9390. * @memberOf _
  9391. * @since 4.0.0
  9392. * @category Array
  9393. * @param {...Array} [arrays] The arrays to inspect.
  9394. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9395. * @returns {Array} Returns the new array of combined values.
  9396. * @example
  9397. *
  9398. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  9399. * // => [2.1, 1.2]
  9400. *
  9401. * // The `_.property` iteratee shorthand.
  9402. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9403. * // => [{ 'x': 1 }, { 'x': 2 }]
  9404. */
  9405. var unionBy = baseRest(function(arrays) {
  9406. var iteratee = last(arrays);
  9407. if (isArrayLikeObject(iteratee)) {
  9408. iteratee = undefined;
  9409. }
  9410. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  9411. });
  9412. /**
  9413. * This method is like `_.union` except that it accepts `comparator` which
  9414. * is invoked to compare elements of `arrays`. Result values are chosen from
  9415. * the first array in which the value occurs. The comparator is invoked
  9416. * with two arguments: (arrVal, othVal).
  9417. *
  9418. * @static
  9419. * @memberOf _
  9420. * @since 4.0.0
  9421. * @category Array
  9422. * @param {...Array} [arrays] The arrays to inspect.
  9423. * @param {Function} [comparator] The comparator invoked per element.
  9424. * @returns {Array} Returns the new array of combined values.
  9425. * @example
  9426. *
  9427. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9428. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9429. *
  9430. * _.unionWith(objects, others, _.isEqual);
  9431. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9432. */
  9433. var unionWith = baseRest(function(arrays) {
  9434. var comparator = last(arrays);
  9435. comparator = typeof comparator == 'function' ? comparator : undefined;
  9436. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  9437. });
  9438. /**
  9439. * Creates a duplicate-free version of an array, using
  9440. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9441. * for equality comparisons, in which only the first occurrence of each element
  9442. * is kept. The order of result values is determined by the order they occur
  9443. * in the array.
  9444. *
  9445. * @static
  9446. * @memberOf _
  9447. * @since 0.1.0
  9448. * @category Array
  9449. * @param {Array} array The array to inspect.
  9450. * @returns {Array} Returns the new duplicate free array.
  9451. * @example
  9452. *
  9453. * _.uniq([2, 1, 2]);
  9454. * // => [2, 1]
  9455. */
  9456. function uniq(array) {
  9457. return (array && array.length) ? baseUniq(array) : [];
  9458. }
  9459. /**
  9460. * This method is like `_.uniq` except that it accepts `iteratee` which is
  9461. * invoked for each element in `array` to generate the criterion by which
  9462. * uniqueness is computed. The order of result values is determined by the
  9463. * order they occur in the array. The iteratee is invoked with one argument:
  9464. * (value).
  9465. *
  9466. * @static
  9467. * @memberOf _
  9468. * @since 4.0.0
  9469. * @category Array
  9470. * @param {Array} array The array to inspect.
  9471. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9472. * @returns {Array} Returns the new duplicate free array.
  9473. * @example
  9474. *
  9475. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  9476. * // => [2.1, 1.2]
  9477. *
  9478. * // The `_.property` iteratee shorthand.
  9479. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  9480. * // => [{ 'x': 1 }, { 'x': 2 }]
  9481. */
  9482. function uniqBy(array, iteratee) {
  9483. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  9484. }
  9485. /**
  9486. * This method is like `_.uniq` except that it accepts `comparator` which
  9487. * is invoked to compare elements of `array`. The order of result values is
  9488. * determined by the order they occur in the array.The comparator is invoked
  9489. * with two arguments: (arrVal, othVal).
  9490. *
  9491. * @static
  9492. * @memberOf _
  9493. * @since 4.0.0
  9494. * @category Array
  9495. * @param {Array} array The array to inspect.
  9496. * @param {Function} [comparator] The comparator invoked per element.
  9497. * @returns {Array} Returns the new duplicate free array.
  9498. * @example
  9499. *
  9500. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9501. *
  9502. * _.uniqWith(objects, _.isEqual);
  9503. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  9504. */
  9505. function uniqWith(array, comparator) {
  9506. comparator = typeof comparator == 'function' ? comparator : undefined;
  9507. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  9508. }
  9509. /**
  9510. * This method is like `_.zip` except that it accepts an array of grouped
  9511. * elements and creates an array regrouping the elements to their pre-zip
  9512. * configuration.
  9513. *
  9514. * @static
  9515. * @memberOf _
  9516. * @since 1.2.0
  9517. * @category Array
  9518. * @param {Array} array The array of grouped elements to process.
  9519. * @returns {Array} Returns the new array of regrouped elements.
  9520. * @example
  9521. *
  9522. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  9523. * // => [['a', 1, true], ['b', 2, false]]
  9524. *
  9525. * _.unzip(zipped);
  9526. * // => [['a', 'b'], [1, 2], [true, false]]
  9527. */
  9528. function unzip(array) {
  9529. if (!(array && array.length)) {
  9530. return [];
  9531. }
  9532. var length = 0;
  9533. array = arrayFilter(array, function(group) {
  9534. if (isArrayLikeObject(group)) {
  9535. length = nativeMax(group.length, length);
  9536. return true;
  9537. }
  9538. });
  9539. return baseTimes(length, function(index) {
  9540. return arrayMap(array, baseProperty(index));
  9541. });
  9542. }
  9543. /**
  9544. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  9545. * how regrouped values should be combined. The iteratee is invoked with the
  9546. * elements of each group: (...group).
  9547. *
  9548. * @static
  9549. * @memberOf _
  9550. * @since 3.8.0
  9551. * @category Array
  9552. * @param {Array} array The array of grouped elements to process.
  9553. * @param {Function} [iteratee=_.identity] The function to combine
  9554. * regrouped values.
  9555. * @returns {Array} Returns the new array of regrouped elements.
  9556. * @example
  9557. *
  9558. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  9559. * // => [[1, 10, 100], [2, 20, 200]]
  9560. *
  9561. * _.unzipWith(zipped, _.add);
  9562. * // => [3, 30, 300]
  9563. */
  9564. function unzipWith(array, iteratee) {
  9565. if (!(array && array.length)) {
  9566. return [];
  9567. }
  9568. var result = unzip(array);
  9569. if (iteratee == null) {
  9570. return result;
  9571. }
  9572. return arrayMap(result, function(group) {
  9573. return apply(iteratee, undefined, group);
  9574. });
  9575. }
  9576. /**
  9577. * Creates an array excluding all given values using
  9578. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9579. * for equality comparisons.
  9580. *
  9581. * **Note:** Unlike `_.pull`, this method returns a new array.
  9582. *
  9583. * @static
  9584. * @memberOf _
  9585. * @since 0.1.0
  9586. * @category Array
  9587. * @param {Array} array The array to inspect.
  9588. * @param {...*} [values] The values to exclude.
  9589. * @returns {Array} Returns the new array of filtered values.
  9590. * @see _.difference, _.xor
  9591. * @example
  9592. *
  9593. * _.without([2, 1, 2, 3], 1, 2);
  9594. * // => [3]
  9595. */
  9596. var without = baseRest(function(array, values) {
  9597. return isArrayLikeObject(array)
  9598. ? baseDifference(array, values)
  9599. : [];
  9600. });
  9601. /**
  9602. * Creates an array of unique values that is the
  9603. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  9604. * of the given arrays. The order of result values is determined by the order
  9605. * they occur in the arrays.
  9606. *
  9607. * @static
  9608. * @memberOf _
  9609. * @since 2.4.0
  9610. * @category Array
  9611. * @param {...Array} [arrays] The arrays to inspect.
  9612. * @returns {Array} Returns the new array of filtered values.
  9613. * @see _.difference, _.without
  9614. * @example
  9615. *
  9616. * _.xor([2, 1], [2, 3]);
  9617. * // => [1, 3]
  9618. */
  9619. var xor = baseRest(function(arrays) {
  9620. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  9621. });
  9622. /**
  9623. * This method is like `_.xor` except that it accepts `iteratee` which is
  9624. * invoked for each element of each `arrays` to generate the criterion by
  9625. * which by which they're compared. The order of result values is determined
  9626. * by the order they occur in the arrays. The iteratee is invoked with one
  9627. * argument: (value).
  9628. *
  9629. * @static
  9630. * @memberOf _
  9631. * @since 4.0.0
  9632. * @category Array
  9633. * @param {...Array} [arrays] The arrays to inspect.
  9634. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9635. * @returns {Array} Returns the new array of filtered values.
  9636. * @example
  9637. *
  9638. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  9639. * // => [1.2, 3.4]
  9640. *
  9641. * // The `_.property` iteratee shorthand.
  9642. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9643. * // => [{ 'x': 2 }]
  9644. */
  9645. var xorBy = baseRest(function(arrays) {
  9646. var iteratee = last(arrays);
  9647. if (isArrayLikeObject(iteratee)) {
  9648. iteratee = undefined;
  9649. }
  9650. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  9651. });
  9652. /**
  9653. * This method is like `_.xor` except that it accepts `comparator` which is
  9654. * invoked to compare elements of `arrays`. The order of result values is
  9655. * determined by the order they occur in the arrays. The comparator is invoked
  9656. * with two arguments: (arrVal, othVal).
  9657. *
  9658. * @static
  9659. * @memberOf _
  9660. * @since 4.0.0
  9661. * @category Array
  9662. * @param {...Array} [arrays] The arrays to inspect.
  9663. * @param {Function} [comparator] The comparator invoked per element.
  9664. * @returns {Array} Returns the new array of filtered values.
  9665. * @example
  9666. *
  9667. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9668. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9669. *
  9670. * _.xorWith(objects, others, _.isEqual);
  9671. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9672. */
  9673. var xorWith = baseRest(function(arrays) {
  9674. var comparator = last(arrays);
  9675. comparator = typeof comparator == 'function' ? comparator : undefined;
  9676. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  9677. });
  9678. /**
  9679. * Creates an array of grouped elements, the first of which contains the
  9680. * first elements of the given arrays, the second of which contains the
  9681. * second elements of the given arrays, and so on.
  9682. *
  9683. * @static
  9684. * @memberOf _
  9685. * @since 0.1.0
  9686. * @category Array
  9687. * @param {...Array} [arrays] The arrays to process.
  9688. * @returns {Array} Returns the new array of grouped elements.
  9689. * @example
  9690. *
  9691. * _.zip(['a', 'b'], [1, 2], [true, false]);
  9692. * // => [['a', 1, true], ['b', 2, false]]
  9693. */
  9694. var zip = baseRest(unzip);
  9695. /**
  9696. * This method is like `_.fromPairs` except that it accepts two arrays,
  9697. * one of property identifiers and one of corresponding values.
  9698. *
  9699. * @static
  9700. * @memberOf _
  9701. * @since 0.4.0
  9702. * @category Array
  9703. * @param {Array} [props=[]] The property identifiers.
  9704. * @param {Array} [values=[]] The property values.
  9705. * @returns {Object} Returns the new object.
  9706. * @example
  9707. *
  9708. * _.zipObject(['a', 'b'], [1, 2]);
  9709. * // => { 'a': 1, 'b': 2 }
  9710. */
  9711. function zipObject(props, values) {
  9712. return baseZipObject(props || [], values || [], assignValue);
  9713. }
  9714. /**
  9715. * This method is like `_.zipObject` except that it supports property paths.
  9716. *
  9717. * @static
  9718. * @memberOf _
  9719. * @since 4.1.0
  9720. * @category Array
  9721. * @param {Array} [props=[]] The property identifiers.
  9722. * @param {Array} [values=[]] The property values.
  9723. * @returns {Object} Returns the new object.
  9724. * @example
  9725. *
  9726. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  9727. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  9728. */
  9729. function zipObjectDeep(props, values) {
  9730. return baseZipObject(props || [], values || [], baseSet);
  9731. }
  9732. /**
  9733. * This method is like `_.zip` except that it accepts `iteratee` to specify
  9734. * how grouped values should be combined. The iteratee is invoked with the
  9735. * elements of each group: (...group).
  9736. *
  9737. * @static
  9738. * @memberOf _
  9739. * @since 3.8.0
  9740. * @category Array
  9741. * @param {...Array} [arrays] The arrays to process.
  9742. * @param {Function} [iteratee=_.identity] The function to combine
  9743. * grouped values.
  9744. * @returns {Array} Returns the new array of grouped elements.
  9745. * @example
  9746. *
  9747. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  9748. * return a + b + c;
  9749. * });
  9750. * // => [111, 222]
  9751. */
  9752. var zipWith = baseRest(function(arrays) {
  9753. var length = arrays.length,
  9754. iteratee = length > 1 ? arrays[length - 1] : undefined;
  9755. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  9756. return unzipWith(arrays, iteratee);
  9757. });
  9758. /*------------------------------------------------------------------------*/
  9759. /**
  9760. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  9761. * chain sequences enabled. The result of such sequences must be unwrapped
  9762. * with `_#value`.
  9763. *
  9764. * @static
  9765. * @memberOf _
  9766. * @since 1.3.0
  9767. * @category Seq
  9768. * @param {*} value The value to wrap.
  9769. * @returns {Object} Returns the new `lodash` wrapper instance.
  9770. * @example
  9771. *
  9772. * var users = [
  9773. * { 'user': 'barney', 'age': 36 },
  9774. * { 'user': 'fred', 'age': 40 },
  9775. * { 'user': 'pebbles', 'age': 1 }
  9776. * ];
  9777. *
  9778. * var youngest = _
  9779. * .chain(users)
  9780. * .sortBy('age')
  9781. * .map(function(o) {
  9782. * return o.user + ' is ' + o.age;
  9783. * })
  9784. * .head()
  9785. * .value();
  9786. * // => 'pebbles is 1'
  9787. */
  9788. function chain(value) {
  9789. var result = lodash(value);
  9790. result.__chain__ = true;
  9791. return result;
  9792. }
  9793. /**
  9794. * This method invokes `interceptor` and returns `value`. The interceptor
  9795. * is invoked with one argument; (value). The purpose of this method is to
  9796. * "tap into" a method chain sequence in order to modify intermediate results.
  9797. *
  9798. * @static
  9799. * @memberOf _
  9800. * @since 0.1.0
  9801. * @category Seq
  9802. * @param {*} value The value to provide to `interceptor`.
  9803. * @param {Function} interceptor The function to invoke.
  9804. * @returns {*} Returns `value`.
  9805. * @example
  9806. *
  9807. * _([1, 2, 3])
  9808. * .tap(function(array) {
  9809. * // Mutate input array.
  9810. * array.pop();
  9811. * })
  9812. * .reverse()
  9813. * .value();
  9814. * // => [2, 1]
  9815. */
  9816. function tap(value, interceptor) {
  9817. interceptor(value);
  9818. return value;
  9819. }
  9820. /**
  9821. * This method is like `_.tap` except that it returns the result of `interceptor`.
  9822. * The purpose of this method is to "pass thru" values replacing intermediate
  9823. * results in a method chain sequence.
  9824. *
  9825. * @static
  9826. * @memberOf _
  9827. * @since 3.0.0
  9828. * @category Seq
  9829. * @param {*} value The value to provide to `interceptor`.
  9830. * @param {Function} interceptor The function to invoke.
  9831. * @returns {*} Returns the result of `interceptor`.
  9832. * @example
  9833. *
  9834. * _(' abc ')
  9835. * .chain()
  9836. * .trim()
  9837. * .thru(function(value) {
  9838. * return [value];
  9839. * })
  9840. * .value();
  9841. * // => ['abc']
  9842. */
  9843. function thru(value, interceptor) {
  9844. return interceptor(value);
  9845. }
  9846. /**
  9847. * This method is the wrapper version of `_.at`.
  9848. *
  9849. * @name at
  9850. * @memberOf _
  9851. * @since 1.0.0
  9852. * @category Seq
  9853. * @param {...(string|string[])} [paths] The property paths to pick.
  9854. * @returns {Object} Returns the new `lodash` wrapper instance.
  9855. * @example
  9856. *
  9857. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9858. *
  9859. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9860. * // => [3, 4]
  9861. */
  9862. var wrapperAt = flatRest(function(paths) {
  9863. var length = paths.length,
  9864. start = length ? paths[0] : 0,
  9865. value = this.__wrapped__,
  9866. interceptor = function(object) { return baseAt(object, paths); };
  9867. if (length > 1 || this.__actions__.length ||
  9868. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9869. return this.thru(interceptor);
  9870. }
  9871. value = value.slice(start, +start + (length ? 1 : 0));
  9872. value.__actions__.push({
  9873. 'func': thru,
  9874. 'args': [interceptor],
  9875. 'thisArg': undefined
  9876. });
  9877. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9878. if (length && !array.length) {
  9879. array.push(undefined);
  9880. }
  9881. return array;
  9882. });
  9883. });
  9884. /**
  9885. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9886. *
  9887. * @name chain
  9888. * @memberOf _
  9889. * @since 0.1.0
  9890. * @category Seq
  9891. * @returns {Object} Returns the new `lodash` wrapper instance.
  9892. * @example
  9893. *
  9894. * var users = [
  9895. * { 'user': 'barney', 'age': 36 },
  9896. * { 'user': 'fred', 'age': 40 }
  9897. * ];
  9898. *
  9899. * // A sequence without explicit chaining.
  9900. * _(users).head();
  9901. * // => { 'user': 'barney', 'age': 36 }
  9902. *
  9903. * // A sequence with explicit chaining.
  9904. * _(users)
  9905. * .chain()
  9906. * .head()
  9907. * .pick('user')
  9908. * .value();
  9909. * // => { 'user': 'barney' }
  9910. */
  9911. function wrapperChain() {
  9912. return chain(this);
  9913. }
  9914. /**
  9915. * Executes the chain sequence and returns the wrapped result.
  9916. *
  9917. * @name commit
  9918. * @memberOf _
  9919. * @since 3.2.0
  9920. * @category Seq
  9921. * @returns {Object} Returns the new `lodash` wrapper instance.
  9922. * @example
  9923. *
  9924. * var array = [1, 2];
  9925. * var wrapped = _(array).push(3);
  9926. *
  9927. * console.log(array);
  9928. * // => [1, 2]
  9929. *
  9930. * wrapped = wrapped.commit();
  9931. * console.log(array);
  9932. * // => [1, 2, 3]
  9933. *
  9934. * wrapped.last();
  9935. * // => 3
  9936. *
  9937. * console.log(array);
  9938. * // => [1, 2, 3]
  9939. */
  9940. function wrapperCommit() {
  9941. return new LodashWrapper(this.value(), this.__chain__);
  9942. }
  9943. /**
  9944. * Gets the next value on a wrapped object following the
  9945. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9946. *
  9947. * @name next
  9948. * @memberOf _
  9949. * @since 4.0.0
  9950. * @category Seq
  9951. * @returns {Object} Returns the next iterator value.
  9952. * @example
  9953. *
  9954. * var wrapped = _([1, 2]);
  9955. *
  9956. * wrapped.next();
  9957. * // => { 'done': false, 'value': 1 }
  9958. *
  9959. * wrapped.next();
  9960. * // => { 'done': false, 'value': 2 }
  9961. *
  9962. * wrapped.next();
  9963. * // => { 'done': true, 'value': undefined }
  9964. */
  9965. function wrapperNext() {
  9966. if (this.__values__ === undefined) {
  9967. this.__values__ = toArray(this.value());
  9968. }
  9969. var done = this.__index__ >= this.__values__.length,
  9970. value = done ? undefined : this.__values__[this.__index__++];
  9971. return { 'done': done, 'value': value };
  9972. }
  9973. /**
  9974. * Enables the wrapper to be iterable.
  9975. *
  9976. * @name Symbol.iterator
  9977. * @memberOf _
  9978. * @since 4.0.0
  9979. * @category Seq
  9980. * @returns {Object} Returns the wrapper object.
  9981. * @example
  9982. *
  9983. * var wrapped = _([1, 2]);
  9984. *
  9985. * wrapped[Symbol.iterator]() === wrapped;
  9986. * // => true
  9987. *
  9988. * Array.from(wrapped);
  9989. * // => [1, 2]
  9990. */
  9991. function wrapperToIterator() {
  9992. return this;
  9993. }
  9994. /**
  9995. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9996. *
  9997. * @name plant
  9998. * @memberOf _
  9999. * @since 3.2.0
  10000. * @category Seq
  10001. * @param {*} value The value to plant.
  10002. * @returns {Object} Returns the new `lodash` wrapper instance.
  10003. * @example
  10004. *
  10005. * function square(n) {
  10006. * return n * n;
  10007. * }
  10008. *
  10009. * var wrapped = _([1, 2]).map(square);
  10010. * var other = wrapped.plant([3, 4]);
  10011. *
  10012. * other.value();
  10013. * // => [9, 16]
  10014. *
  10015. * wrapped.value();
  10016. * // => [1, 4]
  10017. */
  10018. function wrapperPlant(value) {
  10019. var result,
  10020. parent = this;
  10021. while (parent instanceof baseLodash) {
  10022. var clone = wrapperClone(parent);
  10023. clone.__index__ = 0;
  10024. clone.__values__ = undefined;
  10025. if (result) {
  10026. previous.__wrapped__ = clone;
  10027. } else {
  10028. result = clone;
  10029. }
  10030. var previous = clone;
  10031. parent = parent.__wrapped__;
  10032. }
  10033. previous.__wrapped__ = value;
  10034. return result;
  10035. }
  10036. /**
  10037. * This method is the wrapper version of `_.reverse`.
  10038. *
  10039. * **Note:** This method mutates the wrapped array.
  10040. *
  10041. * @name reverse
  10042. * @memberOf _
  10043. * @since 0.1.0
  10044. * @category Seq
  10045. * @returns {Object} Returns the new `lodash` wrapper instance.
  10046. * @example
  10047. *
  10048. * var array = [1, 2, 3];
  10049. *
  10050. * _(array).reverse().value()
  10051. * // => [3, 2, 1]
  10052. *
  10053. * console.log(array);
  10054. * // => [3, 2, 1]
  10055. */
  10056. function wrapperReverse() {
  10057. var value = this.__wrapped__;
  10058. if (value instanceof LazyWrapper) {
  10059. var wrapped = value;
  10060. if (this.__actions__.length) {
  10061. wrapped = new LazyWrapper(this);
  10062. }
  10063. wrapped = wrapped.reverse();
  10064. wrapped.__actions__.push({
  10065. 'func': thru,
  10066. 'args': [reverse],
  10067. 'thisArg': undefined
  10068. });
  10069. return new LodashWrapper(wrapped, this.__chain__);
  10070. }
  10071. return this.thru(reverse);
  10072. }
  10073. /**
  10074. * Executes the chain sequence to resolve the unwrapped value.
  10075. *
  10076. * @name value
  10077. * @memberOf _
  10078. * @since 0.1.0
  10079. * @alias toJSON, valueOf
  10080. * @category Seq
  10081. * @returns {*} Returns the resolved unwrapped value.
  10082. * @example
  10083. *
  10084. * _([1, 2, 3]).value();
  10085. * // => [1, 2, 3]
  10086. */
  10087. function wrapperValue() {
  10088. return baseWrapperValue(this.__wrapped__, this.__actions__);
  10089. }
  10090. /*------------------------------------------------------------------------*/
  10091. /**
  10092. * Creates an object composed of keys generated from the results of running
  10093. * each element of `collection` thru `iteratee`. The corresponding value of
  10094. * each key is the number of times the key was returned by `iteratee`. The
  10095. * iteratee is invoked with one argument: (value).
  10096. *
  10097. * @static
  10098. * @memberOf _
  10099. * @since 0.5.0
  10100. * @category Collection
  10101. * @param {Array|Object} collection The collection to iterate over.
  10102. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10103. * @returns {Object} Returns the composed aggregate object.
  10104. * @example
  10105. *
  10106. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  10107. * // => { '4': 1, '6': 2 }
  10108. *
  10109. * // The `_.property` iteratee shorthand.
  10110. * _.countBy(['one', 'two', 'three'], 'length');
  10111. * // => { '3': 2, '5': 1 }
  10112. */
  10113. var countBy = createAggregator(function(result, value, key) {
  10114. if (hasOwnProperty.call(result, key)) {
  10115. ++result[key];
  10116. } else {
  10117. baseAssignValue(result, key, 1);
  10118. }
  10119. });
  10120. /**
  10121. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  10122. * Iteration is stopped once `predicate` returns falsey. The predicate is
  10123. * invoked with three arguments: (value, index|key, collection).
  10124. *
  10125. * **Note:** This method returns `true` for
  10126. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  10127. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  10128. * elements of empty collections.
  10129. *
  10130. * @static
  10131. * @memberOf _
  10132. * @since 0.1.0
  10133. * @category Collection
  10134. * @param {Array|Object} collection The collection to iterate over.
  10135. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10136. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10137. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  10138. * else `false`.
  10139. * @example
  10140. *
  10141. * _.every([true, 1, null, 'yes'], Boolean);
  10142. * // => false
  10143. *
  10144. * var users = [
  10145. * { 'user': 'barney', 'age': 36, 'active': false },
  10146. * { 'user': 'fred', 'age': 40, 'active': false }
  10147. * ];
  10148. *
  10149. * // The `_.matches` iteratee shorthand.
  10150. * _.every(users, { 'user': 'barney', 'active': false });
  10151. * // => false
  10152. *
  10153. * // The `_.matchesProperty` iteratee shorthand.
  10154. * _.every(users, ['active', false]);
  10155. * // => true
  10156. *
  10157. * // The `_.property` iteratee shorthand.
  10158. * _.every(users, 'active');
  10159. * // => false
  10160. */
  10161. function every(collection, predicate, guard) {
  10162. var func = isArray(collection) ? arrayEvery : baseEvery;
  10163. if (guard && isIterateeCall(collection, predicate, guard)) {
  10164. predicate = undefined;
  10165. }
  10166. return func(collection, getIteratee(predicate, 3));
  10167. }
  10168. /**
  10169. * Iterates over elements of `collection`, returning an array of all elements
  10170. * `predicate` returns truthy for. The predicate is invoked with three
  10171. * arguments: (value, index|key, collection).
  10172. *
  10173. * **Note:** Unlike `_.remove`, this method returns a new array.
  10174. *
  10175. * @static
  10176. * @memberOf _
  10177. * @since 0.1.0
  10178. * @category Collection
  10179. * @param {Array|Object} collection The collection to iterate over.
  10180. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10181. * @returns {Array} Returns the new filtered array.
  10182. * @see _.reject
  10183. * @example
  10184. *
  10185. * var users = [
  10186. * { 'user': 'barney', 'age': 36, 'active': true },
  10187. * { 'user': 'fred', 'age': 40, 'active': false }
  10188. * ];
  10189. *
  10190. * _.filter(users, function(o) { return !o.active; });
  10191. * // => objects for ['fred']
  10192. *
  10193. * // The `_.matches` iteratee shorthand.
  10194. * _.filter(users, { 'age': 36, 'active': true });
  10195. * // => objects for ['barney']
  10196. *
  10197. * // The `_.matchesProperty` iteratee shorthand.
  10198. * _.filter(users, ['active', false]);
  10199. * // => objects for ['fred']
  10200. *
  10201. * // The `_.property` iteratee shorthand.
  10202. * _.filter(users, 'active');
  10203. * // => objects for ['barney']
  10204. *
  10205. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  10206. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  10207. * // => objects for ['fred', 'barney']
  10208. */
  10209. function filter(collection, predicate) {
  10210. var func = isArray(collection) ? arrayFilter : baseFilter;
  10211. return func(collection, getIteratee(predicate, 3));
  10212. }
  10213. /**
  10214. * Iterates over elements of `collection`, returning the first element
  10215. * `predicate` returns truthy for. The predicate is invoked with three
  10216. * arguments: (value, index|key, collection).
  10217. *
  10218. * @static
  10219. * @memberOf _
  10220. * @since 0.1.0
  10221. * @category Collection
  10222. * @param {Array|Object} collection The collection to inspect.
  10223. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10224. * @param {number} [fromIndex=0] The index to search from.
  10225. * @returns {*} Returns the matched element, else `undefined`.
  10226. * @example
  10227. *
  10228. * var users = [
  10229. * { 'user': 'barney', 'age': 36, 'active': true },
  10230. * { 'user': 'fred', 'age': 40, 'active': false },
  10231. * { 'user': 'pebbles', 'age': 1, 'active': true }
  10232. * ];
  10233. *
  10234. * _.find(users, function(o) { return o.age < 40; });
  10235. * // => object for 'barney'
  10236. *
  10237. * // The `_.matches` iteratee shorthand.
  10238. * _.find(users, { 'age': 1, 'active': true });
  10239. * // => object for 'pebbles'
  10240. *
  10241. * // The `_.matchesProperty` iteratee shorthand.
  10242. * _.find(users, ['active', false]);
  10243. * // => object for 'fred'
  10244. *
  10245. * // The `_.property` iteratee shorthand.
  10246. * _.find(users, 'active');
  10247. * // => object for 'barney'
  10248. */
  10249. var find = createFind(findIndex);
  10250. /**
  10251. * This method is like `_.find` except that it iterates over elements of
  10252. * `collection` from right to left.
  10253. *
  10254. * @static
  10255. * @memberOf _
  10256. * @since 2.0.0
  10257. * @category Collection
  10258. * @param {Array|Object} collection The collection to inspect.
  10259. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10260. * @param {number} [fromIndex=collection.length-1] The index to search from.
  10261. * @returns {*} Returns the matched element, else `undefined`.
  10262. * @example
  10263. *
  10264. * _.findLast([1, 2, 3, 4], function(n) {
  10265. * return n % 2 == 1;
  10266. * });
  10267. * // => 3
  10268. */
  10269. var findLast = createFind(findLastIndex);
  10270. /**
  10271. * Creates a flattened array of values by running each element in `collection`
  10272. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  10273. * with three arguments: (value, index|key, collection).
  10274. *
  10275. * @static
  10276. * @memberOf _
  10277. * @since 4.0.0
  10278. * @category Collection
  10279. * @param {Array|Object} collection The collection to iterate over.
  10280. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10281. * @returns {Array} Returns the new flattened array.
  10282. * @example
  10283. *
  10284. * function duplicate(n) {
  10285. * return [n, n];
  10286. * }
  10287. *
  10288. * _.flatMap([1, 2], duplicate);
  10289. * // => [1, 1, 2, 2]
  10290. */
  10291. function flatMap(collection, iteratee) {
  10292. return baseFlatten(map(collection, iteratee), 1);
  10293. }
  10294. /**
  10295. * This method is like `_.flatMap` except that it recursively flattens the
  10296. * mapped results.
  10297. *
  10298. * @static
  10299. * @memberOf _
  10300. * @since 4.7.0
  10301. * @category Collection
  10302. * @param {Array|Object} collection The collection to iterate over.
  10303. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10304. * @returns {Array} Returns the new flattened array.
  10305. * @example
  10306. *
  10307. * function duplicate(n) {
  10308. * return [[[n, n]]];
  10309. * }
  10310. *
  10311. * _.flatMapDeep([1, 2], duplicate);
  10312. * // => [1, 1, 2, 2]
  10313. */
  10314. function flatMapDeep(collection, iteratee) {
  10315. return baseFlatten(map(collection, iteratee), INFINITY);
  10316. }
  10317. /**
  10318. * This method is like `_.flatMap` except that it recursively flattens the
  10319. * mapped results up to `depth` times.
  10320. *
  10321. * @static
  10322. * @memberOf _
  10323. * @since 4.7.0
  10324. * @category Collection
  10325. * @param {Array|Object} collection The collection to iterate over.
  10326. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10327. * @param {number} [depth=1] The maximum recursion depth.
  10328. * @returns {Array} Returns the new flattened array.
  10329. * @example
  10330. *
  10331. * function duplicate(n) {
  10332. * return [[[n, n]]];
  10333. * }
  10334. *
  10335. * _.flatMapDepth([1, 2], duplicate, 2);
  10336. * // => [[1, 1], [2, 2]]
  10337. */
  10338. function flatMapDepth(collection, iteratee, depth) {
  10339. depth = depth === undefined ? 1 : toInteger(depth);
  10340. return baseFlatten(map(collection, iteratee), depth);
  10341. }
  10342. /**
  10343. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  10344. * The iteratee is invoked with three arguments: (value, index|key, collection).
  10345. * Iteratee functions may exit iteration early by explicitly returning `false`.
  10346. *
  10347. * **Note:** As with other "Collections" methods, objects with a "length"
  10348. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  10349. * or `_.forOwn` for object iteration.
  10350. *
  10351. * @static
  10352. * @memberOf _
  10353. * @since 0.1.0
  10354. * @alias each
  10355. * @category Collection
  10356. * @param {Array|Object} collection The collection to iterate over.
  10357. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10358. * @returns {Array|Object} Returns `collection`.
  10359. * @see _.forEachRight
  10360. * @example
  10361. *
  10362. * _.forEach([1, 2], function(value) {
  10363. * console.log(value);
  10364. * });
  10365. * // => Logs `1` then `2`.
  10366. *
  10367. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  10368. * console.log(key);
  10369. * });
  10370. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  10371. */
  10372. function forEach(collection, iteratee) {
  10373. var func = isArray(collection) ? arrayEach : baseEach;
  10374. return func(collection, getIteratee(iteratee, 3));
  10375. }
  10376. /**
  10377. * This method is like `_.forEach` except that it iterates over elements of
  10378. * `collection` from right to left.
  10379. *
  10380. * @static
  10381. * @memberOf _
  10382. * @since 2.0.0
  10383. * @alias eachRight
  10384. * @category Collection
  10385. * @param {Array|Object} collection The collection to iterate over.
  10386. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10387. * @returns {Array|Object} Returns `collection`.
  10388. * @see _.forEach
  10389. * @example
  10390. *
  10391. * _.forEachRight([1, 2], function(value) {
  10392. * console.log(value);
  10393. * });
  10394. * // => Logs `2` then `1`.
  10395. */
  10396. function forEachRight(collection, iteratee) {
  10397. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  10398. return func(collection, getIteratee(iteratee, 3));
  10399. }
  10400. /**
  10401. * Creates an object composed of keys generated from the results of running
  10402. * each element of `collection` thru `iteratee`. The order of grouped values
  10403. * is determined by the order they occur in `collection`. The corresponding
  10404. * value of each key is an array of elements responsible for generating the
  10405. * key. The iteratee is invoked with one argument: (value).
  10406. *
  10407. * @static
  10408. * @memberOf _
  10409. * @since 0.1.0
  10410. * @category Collection
  10411. * @param {Array|Object} collection The collection to iterate over.
  10412. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10413. * @returns {Object} Returns the composed aggregate object.
  10414. * @example
  10415. *
  10416. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  10417. * // => { '4': [4.2], '6': [6.1, 6.3] }
  10418. *
  10419. * // The `_.property` iteratee shorthand.
  10420. * _.groupBy(['one', 'two', 'three'], 'length');
  10421. * // => { '3': ['one', 'two'], '5': ['three'] }
  10422. */
  10423. var groupBy = createAggregator(function(result, value, key) {
  10424. if (hasOwnProperty.call(result, key)) {
  10425. result[key].push(value);
  10426. } else {
  10427. baseAssignValue(result, key, [value]);
  10428. }
  10429. });
  10430. /**
  10431. * Checks if `value` is in `collection`. If `collection` is a string, it's
  10432. * checked for a substring of `value`, otherwise
  10433. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  10434. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  10435. * the offset from the end of `collection`.
  10436. *
  10437. * @static
  10438. * @memberOf _
  10439. * @since 0.1.0
  10440. * @category Collection
  10441. * @param {Array|Object|string} collection The collection to inspect.
  10442. * @param {*} value The value to search for.
  10443. * @param {number} [fromIndex=0] The index to search from.
  10444. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10445. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  10446. * @example
  10447. *
  10448. * _.includes([1, 2, 3], 1);
  10449. * // => true
  10450. *
  10451. * _.includes([1, 2, 3], 1, 2);
  10452. * // => false
  10453. *
  10454. * _.includes({ 'a': 1, 'b': 2 }, 1);
  10455. * // => true
  10456. *
  10457. * _.includes('abcd', 'bc');
  10458. * // => true
  10459. */
  10460. function includes(collection, value, fromIndex, guard) {
  10461. collection = isArrayLike(collection) ? collection : values(collection);
  10462. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  10463. var length = collection.length;
  10464. if (fromIndex < 0) {
  10465. fromIndex = nativeMax(length + fromIndex, 0);
  10466. }
  10467. return isString(collection)
  10468. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  10469. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  10470. }
  10471. /**
  10472. * Invokes the method at `path` of each element in `collection`, returning
  10473. * an array of the results of each invoked method. Any additional arguments
  10474. * are provided to each invoked method. If `path` is a function, it's invoked
  10475. * for, and `this` bound to, each element in `collection`.
  10476. *
  10477. * @static
  10478. * @memberOf _
  10479. * @since 4.0.0
  10480. * @category Collection
  10481. * @param {Array|Object} collection The collection to iterate over.
  10482. * @param {Array|Function|string} path The path of the method to invoke or
  10483. * the function invoked per iteration.
  10484. * @param {...*} [args] The arguments to invoke each method with.
  10485. * @returns {Array} Returns the array of results.
  10486. * @example
  10487. *
  10488. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  10489. * // => [[1, 5, 7], [1, 2, 3]]
  10490. *
  10491. * _.invokeMap([123, 456], String.prototype.split, '');
  10492. * // => [['1', '2', '3'], ['4', '5', '6']]
  10493. */
  10494. var invokeMap = baseRest(function(collection, path, args) {
  10495. var index = -1,
  10496. isFunc = typeof path == 'function',
  10497. result = isArrayLike(collection) ? Array(collection.length) : [];
  10498. baseEach(collection, function(value) {
  10499. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  10500. });
  10501. return result;
  10502. });
  10503. /**
  10504. * Creates an object composed of keys generated from the results of running
  10505. * each element of `collection` thru `iteratee`. The corresponding value of
  10506. * each key is the last element responsible for generating the key. The
  10507. * iteratee is invoked with one argument: (value).
  10508. *
  10509. * @static
  10510. * @memberOf _
  10511. * @since 4.0.0
  10512. * @category Collection
  10513. * @param {Array|Object} collection The collection to iterate over.
  10514. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10515. * @returns {Object} Returns the composed aggregate object.
  10516. * @example
  10517. *
  10518. * var array = [
  10519. * { 'dir': 'left', 'code': 97 },
  10520. * { 'dir': 'right', 'code': 100 }
  10521. * ];
  10522. *
  10523. * _.keyBy(array, function(o) {
  10524. * return String.fromCharCode(o.code);
  10525. * });
  10526. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  10527. *
  10528. * _.keyBy(array, 'dir');
  10529. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  10530. */
  10531. var keyBy = createAggregator(function(result, value, key) {
  10532. baseAssignValue(result, key, value);
  10533. });
  10534. /**
  10535. * Creates an array of values by running each element in `collection` thru
  10536. * `iteratee`. The iteratee is invoked with three arguments:
  10537. * (value, index|key, collection).
  10538. *
  10539. * Many lodash methods are guarded to work as iteratees for methods like
  10540. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  10541. *
  10542. * The guarded methods are:
  10543. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  10544. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  10545. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  10546. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  10547. *
  10548. * @static
  10549. * @memberOf _
  10550. * @since 0.1.0
  10551. * @category Collection
  10552. * @param {Array|Object} collection The collection to iterate over.
  10553. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10554. * @returns {Array} Returns the new mapped array.
  10555. * @example
  10556. *
  10557. * function square(n) {
  10558. * return n * n;
  10559. * }
  10560. *
  10561. * _.map([4, 8], square);
  10562. * // => [16, 64]
  10563. *
  10564. * _.map({ 'a': 4, 'b': 8 }, square);
  10565. * // => [16, 64] (iteration order is not guaranteed)
  10566. *
  10567. * var users = [
  10568. * { 'user': 'barney' },
  10569. * { 'user': 'fred' }
  10570. * ];
  10571. *
  10572. * // The `_.property` iteratee shorthand.
  10573. * _.map(users, 'user');
  10574. * // => ['barney', 'fred']
  10575. */
  10576. function map(collection, iteratee) {
  10577. var func = isArray(collection) ? arrayMap : baseMap;
  10578. return func(collection, getIteratee(iteratee, 3));
  10579. }
  10580. /**
  10581. * This method is like `_.sortBy` except that it allows specifying the sort
  10582. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  10583. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  10584. * descending or "asc" for ascending sort order of corresponding values.
  10585. *
  10586. * @static
  10587. * @memberOf _
  10588. * @since 4.0.0
  10589. * @category Collection
  10590. * @param {Array|Object} collection The collection to iterate over.
  10591. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  10592. * The iteratees to sort by.
  10593. * @param {string[]} [orders] The sort orders of `iteratees`.
  10594. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10595. * @returns {Array} Returns the new sorted array.
  10596. * @example
  10597. *
  10598. * var users = [
  10599. * { 'user': 'fred', 'age': 48 },
  10600. * { 'user': 'barney', 'age': 34 },
  10601. * { 'user': 'fred', 'age': 40 },
  10602. * { 'user': 'barney', 'age': 36 }
  10603. * ];
  10604. *
  10605. * // Sort by `user` in ascending order and by `age` in descending order.
  10606. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  10607. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10608. */
  10609. function orderBy(collection, iteratees, orders, guard) {
  10610. if (collection == null) {
  10611. return [];
  10612. }
  10613. if (!isArray(iteratees)) {
  10614. iteratees = iteratees == null ? [] : [iteratees];
  10615. }
  10616. orders = guard ? undefined : orders;
  10617. if (!isArray(orders)) {
  10618. orders = orders == null ? [] : [orders];
  10619. }
  10620. return baseOrderBy(collection, iteratees, orders);
  10621. }
  10622. /**
  10623. * Creates an array of elements split into two groups, the first of which
  10624. * contains elements `predicate` returns truthy for, the second of which
  10625. * contains elements `predicate` returns falsey for. The predicate is
  10626. * invoked with one argument: (value).
  10627. *
  10628. * @static
  10629. * @memberOf _
  10630. * @since 3.0.0
  10631. * @category Collection
  10632. * @param {Array|Object} collection The collection to iterate over.
  10633. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10634. * @returns {Array} Returns the array of grouped elements.
  10635. * @example
  10636. *
  10637. * var users = [
  10638. * { 'user': 'barney', 'age': 36, 'active': false },
  10639. * { 'user': 'fred', 'age': 40, 'active': true },
  10640. * { 'user': 'pebbles', 'age': 1, 'active': false }
  10641. * ];
  10642. *
  10643. * _.partition(users, function(o) { return o.active; });
  10644. * // => objects for [['fred'], ['barney', 'pebbles']]
  10645. *
  10646. * // The `_.matches` iteratee shorthand.
  10647. * _.partition(users, { 'age': 1, 'active': false });
  10648. * // => objects for [['pebbles'], ['barney', 'fred']]
  10649. *
  10650. * // The `_.matchesProperty` iteratee shorthand.
  10651. * _.partition(users, ['active', false]);
  10652. * // => objects for [['barney', 'pebbles'], ['fred']]
  10653. *
  10654. * // The `_.property` iteratee shorthand.
  10655. * _.partition(users, 'active');
  10656. * // => objects for [['fred'], ['barney', 'pebbles']]
  10657. */
  10658. var partition = createAggregator(function(result, value, key) {
  10659. result[key ? 0 : 1].push(value);
  10660. }, function() { return [[], []]; });
  10661. /**
  10662. * Reduces `collection` to a value which is the accumulated result of running
  10663. * each element in `collection` thru `iteratee`, where each successive
  10664. * invocation is supplied the return value of the previous. If `accumulator`
  10665. * is not given, the first element of `collection` is used as the initial
  10666. * value. The iteratee is invoked with four arguments:
  10667. * (accumulator, value, index|key, collection).
  10668. *
  10669. * Many lodash methods are guarded to work as iteratees for methods like
  10670. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  10671. *
  10672. * The guarded methods are:
  10673. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  10674. * and `sortBy`
  10675. *
  10676. * @static
  10677. * @memberOf _
  10678. * @since 0.1.0
  10679. * @category Collection
  10680. * @param {Array|Object} collection The collection to iterate over.
  10681. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10682. * @param {*} [accumulator] The initial value.
  10683. * @returns {*} Returns the accumulated value.
  10684. * @see _.reduceRight
  10685. * @example
  10686. *
  10687. * _.reduce([1, 2], function(sum, n) {
  10688. * return sum + n;
  10689. * }, 0);
  10690. * // => 3
  10691. *
  10692. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  10693. * (result[value] || (result[value] = [])).push(key);
  10694. * return result;
  10695. * }, {});
  10696. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  10697. */
  10698. function reduce(collection, iteratee, accumulator) {
  10699. var func = isArray(collection) ? arrayReduce : baseReduce,
  10700. initAccum = arguments.length < 3;
  10701. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  10702. }
  10703. /**
  10704. * This method is like `_.reduce` except that it iterates over elements of
  10705. * `collection` from right to left.
  10706. *
  10707. * @static
  10708. * @memberOf _
  10709. * @since 0.1.0
  10710. * @category Collection
  10711. * @param {Array|Object} collection The collection to iterate over.
  10712. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10713. * @param {*} [accumulator] The initial value.
  10714. * @returns {*} Returns the accumulated value.
  10715. * @see _.reduce
  10716. * @example
  10717. *
  10718. * var array = [[0, 1], [2, 3], [4, 5]];
  10719. *
  10720. * _.reduceRight(array, function(flattened, other) {
  10721. * return flattened.concat(other);
  10722. * }, []);
  10723. * // => [4, 5, 2, 3, 0, 1]
  10724. */
  10725. function reduceRight(collection, iteratee, accumulator) {
  10726. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  10727. initAccum = arguments.length < 3;
  10728. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  10729. }
  10730. /**
  10731. * The opposite of `_.filter`; this method returns the elements of `collection`
  10732. * that `predicate` does **not** return truthy for.
  10733. *
  10734. * @static
  10735. * @memberOf _
  10736. * @since 0.1.0
  10737. * @category Collection
  10738. * @param {Array|Object} collection The collection to iterate over.
  10739. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10740. * @returns {Array} Returns the new filtered array.
  10741. * @see _.filter
  10742. * @example
  10743. *
  10744. * var users = [
  10745. * { 'user': 'barney', 'age': 36, 'active': false },
  10746. * { 'user': 'fred', 'age': 40, 'active': true }
  10747. * ];
  10748. *
  10749. * _.reject(users, function(o) { return !o.active; });
  10750. * // => objects for ['fred']
  10751. *
  10752. * // The `_.matches` iteratee shorthand.
  10753. * _.reject(users, { 'age': 40, 'active': true });
  10754. * // => objects for ['barney']
  10755. *
  10756. * // The `_.matchesProperty` iteratee shorthand.
  10757. * _.reject(users, ['active', false]);
  10758. * // => objects for ['fred']
  10759. *
  10760. * // The `_.property` iteratee shorthand.
  10761. * _.reject(users, 'active');
  10762. * // => objects for ['barney']
  10763. */
  10764. function reject(collection, predicate) {
  10765. var func = isArray(collection) ? arrayFilter : baseFilter;
  10766. return func(collection, negate(getIteratee(predicate, 3)));
  10767. }
  10768. /**
  10769. * Gets a random element from `collection`.
  10770. *
  10771. * @static
  10772. * @memberOf _
  10773. * @since 2.0.0
  10774. * @category Collection
  10775. * @param {Array|Object} collection The collection to sample.
  10776. * @returns {*} Returns the random element.
  10777. * @example
  10778. *
  10779. * _.sample([1, 2, 3, 4]);
  10780. * // => 2
  10781. */
  10782. function sample(collection) {
  10783. var func = isArray(collection) ? arraySample : baseSample;
  10784. return func(collection);
  10785. }
  10786. /**
  10787. * Gets `n` random elements at unique keys from `collection` up to the
  10788. * size of `collection`.
  10789. *
  10790. * @static
  10791. * @memberOf _
  10792. * @since 4.0.0
  10793. * @category Collection
  10794. * @param {Array|Object} collection The collection to sample.
  10795. * @param {number} [n=1] The number of elements to sample.
  10796. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10797. * @returns {Array} Returns the random elements.
  10798. * @example
  10799. *
  10800. * _.sampleSize([1, 2, 3], 2);
  10801. * // => [3, 1]
  10802. *
  10803. * _.sampleSize([1, 2, 3], 4);
  10804. * // => [2, 3, 1]
  10805. */
  10806. function sampleSize(collection, n, guard) {
  10807. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  10808. n = 1;
  10809. } else {
  10810. n = toInteger(n);
  10811. }
  10812. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  10813. return func(collection, n);
  10814. }
  10815. /**
  10816. * Creates an array of shuffled values, using a version of the
  10817. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  10818. *
  10819. * @static
  10820. * @memberOf _
  10821. * @since 0.1.0
  10822. * @category Collection
  10823. * @param {Array|Object} collection The collection to shuffle.
  10824. * @returns {Array} Returns the new shuffled array.
  10825. * @example
  10826. *
  10827. * _.shuffle([1, 2, 3, 4]);
  10828. * // => [4, 1, 3, 2]
  10829. */
  10830. function shuffle(collection) {
  10831. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  10832. return func(collection);
  10833. }
  10834. /**
  10835. * Gets the size of `collection` by returning its length for array-like
  10836. * values or the number of own enumerable string keyed properties for objects.
  10837. *
  10838. * @static
  10839. * @memberOf _
  10840. * @since 0.1.0
  10841. * @category Collection
  10842. * @param {Array|Object|string} collection The collection to inspect.
  10843. * @returns {number} Returns the collection size.
  10844. * @example
  10845. *
  10846. * _.size([1, 2, 3]);
  10847. * // => 3
  10848. *
  10849. * _.size({ 'a': 1, 'b': 2 });
  10850. * // => 2
  10851. *
  10852. * _.size('pebbles');
  10853. * // => 7
  10854. */
  10855. function size(collection) {
  10856. if (collection == null) {
  10857. return 0;
  10858. }
  10859. if (isArrayLike(collection)) {
  10860. return isString(collection) ? stringSize(collection) : collection.length;
  10861. }
  10862. var tag = getTag(collection);
  10863. if (tag == mapTag || tag == setTag) {
  10864. return collection.size;
  10865. }
  10866. return baseKeys(collection).length;
  10867. }
  10868. /**
  10869. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10870. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10871. * invoked with three arguments: (value, index|key, collection).
  10872. *
  10873. * @static
  10874. * @memberOf _
  10875. * @since 0.1.0
  10876. * @category Collection
  10877. * @param {Array|Object} collection The collection to iterate over.
  10878. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10879. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10880. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10881. * else `false`.
  10882. * @example
  10883. *
  10884. * _.some([null, 0, 'yes', false], Boolean);
  10885. * // => true
  10886. *
  10887. * var users = [
  10888. * { 'user': 'barney', 'active': true },
  10889. * { 'user': 'fred', 'active': false }
  10890. * ];
  10891. *
  10892. * // The `_.matches` iteratee shorthand.
  10893. * _.some(users, { 'user': 'barney', 'active': false });
  10894. * // => false
  10895. *
  10896. * // The `_.matchesProperty` iteratee shorthand.
  10897. * _.some(users, ['active', false]);
  10898. * // => true
  10899. *
  10900. * // The `_.property` iteratee shorthand.
  10901. * _.some(users, 'active');
  10902. * // => true
  10903. */
  10904. function some(collection, predicate, guard) {
  10905. var func = isArray(collection) ? arraySome : baseSome;
  10906. if (guard && isIterateeCall(collection, predicate, guard)) {
  10907. predicate = undefined;
  10908. }
  10909. return func(collection, getIteratee(predicate, 3));
  10910. }
  10911. /**
  10912. * Creates an array of elements, sorted in ascending order by the results of
  10913. * running each element in a collection thru each iteratee. This method
  10914. * performs a stable sort, that is, it preserves the original sort order of
  10915. * equal elements. The iteratees are invoked with one argument: (value).
  10916. *
  10917. * @static
  10918. * @memberOf _
  10919. * @since 0.1.0
  10920. * @category Collection
  10921. * @param {Array|Object} collection The collection to iterate over.
  10922. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10923. * The iteratees to sort by.
  10924. * @returns {Array} Returns the new sorted array.
  10925. * @example
  10926. *
  10927. * var users = [
  10928. * { 'user': 'fred', 'age': 48 },
  10929. * { 'user': 'barney', 'age': 36 },
  10930. * { 'user': 'fred', 'age': 30 },
  10931. * { 'user': 'barney', 'age': 34 }
  10932. * ];
  10933. *
  10934. * _.sortBy(users, [function(o) { return o.user; }]);
  10935. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  10936. *
  10937. * _.sortBy(users, ['user', 'age']);
  10938. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  10939. */
  10940. var sortBy = baseRest(function(collection, iteratees) {
  10941. if (collection == null) {
  10942. return [];
  10943. }
  10944. var length = iteratees.length;
  10945. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10946. iteratees = [];
  10947. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10948. iteratees = [iteratees[0]];
  10949. }
  10950. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10951. });
  10952. /*------------------------------------------------------------------------*/
  10953. /**
  10954. * Gets the timestamp of the number of milliseconds that have elapsed since
  10955. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10956. *
  10957. * @static
  10958. * @memberOf _
  10959. * @since 2.4.0
  10960. * @category Date
  10961. * @returns {number} Returns the timestamp.
  10962. * @example
  10963. *
  10964. * _.defer(function(stamp) {
  10965. * console.log(_.now() - stamp);
  10966. * }, _.now());
  10967. * // => Logs the number of milliseconds it took for the deferred invocation.
  10968. */
  10969. var now = ctxNow || function() {
  10970. return root.Date.now();
  10971. };
  10972. /*------------------------------------------------------------------------*/
  10973. /**
  10974. * The opposite of `_.before`; this method creates a function that invokes
  10975. * `func` once it's called `n` or more times.
  10976. *
  10977. * @static
  10978. * @memberOf _
  10979. * @since 0.1.0
  10980. * @category Function
  10981. * @param {number} n The number of calls before `func` is invoked.
  10982. * @param {Function} func The function to restrict.
  10983. * @returns {Function} Returns the new restricted function.
  10984. * @example
  10985. *
  10986. * var saves = ['profile', 'settings'];
  10987. *
  10988. * var done = _.after(saves.length, function() {
  10989. * console.log('done saving!');
  10990. * });
  10991. *
  10992. * _.forEach(saves, function(type) {
  10993. * asyncSave({ 'type': type, 'complete': done });
  10994. * });
  10995. * // => Logs 'done saving!' after the two async saves have completed.
  10996. */
  10997. function after(n, func) {
  10998. if (typeof func != 'function') {
  10999. throw new TypeError(FUNC_ERROR_TEXT);
  11000. }
  11001. n = toInteger(n);
  11002. return function() {
  11003. if (--n < 1) {
  11004. return func.apply(this, arguments);
  11005. }
  11006. };
  11007. }
  11008. /**
  11009. * Creates a function that invokes `func`, with up to `n` arguments,
  11010. * ignoring any additional arguments.
  11011. *
  11012. * @static
  11013. * @memberOf _
  11014. * @since 3.0.0
  11015. * @category Function
  11016. * @param {Function} func The function to cap arguments for.
  11017. * @param {number} [n=func.length] The arity cap.
  11018. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11019. * @returns {Function} Returns the new capped function.
  11020. * @example
  11021. *
  11022. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  11023. * // => [6, 8, 10]
  11024. */
  11025. function ary(func, n, guard) {
  11026. n = guard ? undefined : n;
  11027. n = (func && n == null) ? func.length : n;
  11028. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  11029. }
  11030. /**
  11031. * Creates a function that invokes `func`, with the `this` binding and arguments
  11032. * of the created function, while it's called less than `n` times. Subsequent
  11033. * calls to the created function return the result of the last `func` invocation.
  11034. *
  11035. * @static
  11036. * @memberOf _
  11037. * @since 3.0.0
  11038. * @category Function
  11039. * @param {number} n The number of calls at which `func` is no longer invoked.
  11040. * @param {Function} func The function to restrict.
  11041. * @returns {Function} Returns the new restricted function.
  11042. * @example
  11043. *
  11044. * jQuery(element).on('click', _.before(5, addContactToList));
  11045. * // => Allows adding up to 4 contacts to the list.
  11046. */
  11047. function before(n, func) {
  11048. var result;
  11049. if (typeof func != 'function') {
  11050. throw new TypeError(FUNC_ERROR_TEXT);
  11051. }
  11052. n = toInteger(n);
  11053. return function() {
  11054. if (--n > 0) {
  11055. result = func.apply(this, arguments);
  11056. }
  11057. if (n <= 1) {
  11058. func = undefined;
  11059. }
  11060. return result;
  11061. };
  11062. }
  11063. /**
  11064. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  11065. * and `partials` prepended to the arguments it receives.
  11066. *
  11067. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  11068. * may be used as a placeholder for partially applied arguments.
  11069. *
  11070. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  11071. * property of bound functions.
  11072. *
  11073. * @static
  11074. * @memberOf _
  11075. * @since 0.1.0
  11076. * @category Function
  11077. * @param {Function} func The function to bind.
  11078. * @param {*} thisArg The `this` binding of `func`.
  11079. * @param {...*} [partials] The arguments to be partially applied.
  11080. * @returns {Function} Returns the new bound function.
  11081. * @example
  11082. *
  11083. * function greet(greeting, punctuation) {
  11084. * return greeting + ' ' + this.user + punctuation;
  11085. * }
  11086. *
  11087. * var object = { 'user': 'fred' };
  11088. *
  11089. * var bound = _.bind(greet, object, 'hi');
  11090. * bound('!');
  11091. * // => 'hi fred!'
  11092. *
  11093. * // Bound with placeholders.
  11094. * var bound = _.bind(greet, object, _, '!');
  11095. * bound('hi');
  11096. * // => 'hi fred!'
  11097. */
  11098. var bind = baseRest(function(func, thisArg, partials) {
  11099. var bitmask = WRAP_BIND_FLAG;
  11100. if (partials.length) {
  11101. var holders = replaceHolders(partials, getHolder(bind));
  11102. bitmask |= WRAP_PARTIAL_FLAG;
  11103. }
  11104. return createWrap(func, bitmask, thisArg, partials, holders);
  11105. });
  11106. /**
  11107. * Creates a function that invokes the method at `object[key]` with `partials`
  11108. * prepended to the arguments it receives.
  11109. *
  11110. * This method differs from `_.bind` by allowing bound functions to reference
  11111. * methods that may be redefined or don't yet exist. See
  11112. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  11113. * for more details.
  11114. *
  11115. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  11116. * builds, may be used as a placeholder for partially applied arguments.
  11117. *
  11118. * @static
  11119. * @memberOf _
  11120. * @since 0.10.0
  11121. * @category Function
  11122. * @param {Object} object The object to invoke the method on.
  11123. * @param {string} key The key of the method.
  11124. * @param {...*} [partials] The arguments to be partially applied.
  11125. * @returns {Function} Returns the new bound function.
  11126. * @example
  11127. *
  11128. * var object = {
  11129. * 'user': 'fred',
  11130. * 'greet': function(greeting, punctuation) {
  11131. * return greeting + ' ' + this.user + punctuation;
  11132. * }
  11133. * };
  11134. *
  11135. * var bound = _.bindKey(object, 'greet', 'hi');
  11136. * bound('!');
  11137. * // => 'hi fred!'
  11138. *
  11139. * object.greet = function(greeting, punctuation) {
  11140. * return greeting + 'ya ' + this.user + punctuation;
  11141. * };
  11142. *
  11143. * bound('!');
  11144. * // => 'hiya fred!'
  11145. *
  11146. * // Bound with placeholders.
  11147. * var bound = _.bindKey(object, 'greet', _, '!');
  11148. * bound('hi');
  11149. * // => 'hiya fred!'
  11150. */
  11151. var bindKey = baseRest(function(object, key, partials) {
  11152. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  11153. if (partials.length) {
  11154. var holders = replaceHolders(partials, getHolder(bindKey));
  11155. bitmask |= WRAP_PARTIAL_FLAG;
  11156. }
  11157. return createWrap(key, bitmask, object, partials, holders);
  11158. });
  11159. /**
  11160. * Creates a function that accepts arguments of `func` and either invokes
  11161. * `func` returning its result, if at least `arity` number of arguments have
  11162. * been provided, or returns a function that accepts the remaining `func`
  11163. * arguments, and so on. The arity of `func` may be specified if `func.length`
  11164. * is not sufficient.
  11165. *
  11166. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  11167. * may be used as a placeholder for provided arguments.
  11168. *
  11169. * **Note:** This method doesn't set the "length" property of curried functions.
  11170. *
  11171. * @static
  11172. * @memberOf _
  11173. * @since 2.0.0
  11174. * @category Function
  11175. * @param {Function} func The function to curry.
  11176. * @param {number} [arity=func.length] The arity of `func`.
  11177. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11178. * @returns {Function} Returns the new curried function.
  11179. * @example
  11180. *
  11181. * var abc = function(a, b, c) {
  11182. * return [a, b, c];
  11183. * };
  11184. *
  11185. * var curried = _.curry(abc);
  11186. *
  11187. * curried(1)(2)(3);
  11188. * // => [1, 2, 3]
  11189. *
  11190. * curried(1, 2)(3);
  11191. * // => [1, 2, 3]
  11192. *
  11193. * curried(1, 2, 3);
  11194. * // => [1, 2, 3]
  11195. *
  11196. * // Curried with placeholders.
  11197. * curried(1)(_, 3)(2);
  11198. * // => [1, 2, 3]
  11199. */
  11200. function curry(func, arity, guard) {
  11201. arity = guard ? undefined : arity;
  11202. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  11203. result.placeholder = curry.placeholder;
  11204. return result;
  11205. }
  11206. /**
  11207. * This method is like `_.curry` except that arguments are applied to `func`
  11208. * in the manner of `_.partialRight` instead of `_.partial`.
  11209. *
  11210. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  11211. * builds, may be used as a placeholder for provided arguments.
  11212. *
  11213. * **Note:** This method doesn't set the "length" property of curried functions.
  11214. *
  11215. * @static
  11216. * @memberOf _
  11217. * @since 3.0.0
  11218. * @category Function
  11219. * @param {Function} func The function to curry.
  11220. * @param {number} [arity=func.length] The arity of `func`.
  11221. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11222. * @returns {Function} Returns the new curried function.
  11223. * @example
  11224. *
  11225. * var abc = function(a, b, c) {
  11226. * return [a, b, c];
  11227. * };
  11228. *
  11229. * var curried = _.curryRight(abc);
  11230. *
  11231. * curried(3)(2)(1);
  11232. * // => [1, 2, 3]
  11233. *
  11234. * curried(2, 3)(1);
  11235. * // => [1, 2, 3]
  11236. *
  11237. * curried(1, 2, 3);
  11238. * // => [1, 2, 3]
  11239. *
  11240. * // Curried with placeholders.
  11241. * curried(3)(1, _)(2);
  11242. * // => [1, 2, 3]
  11243. */
  11244. function curryRight(func, arity, guard) {
  11245. arity = guard ? undefined : arity;
  11246. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  11247. result.placeholder = curryRight.placeholder;
  11248. return result;
  11249. }
  11250. /**
  11251. * Creates a debounced function that delays invoking `func` until after `wait`
  11252. * milliseconds have elapsed since the last time the debounced function was
  11253. * invoked. The debounced function comes with a `cancel` method to cancel
  11254. * delayed `func` invocations and a `flush` method to immediately invoke them.
  11255. * Provide `options` to indicate whether `func` should be invoked on the
  11256. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  11257. * with the last arguments provided to the debounced function. Subsequent
  11258. * calls to the debounced function return the result of the last `func`
  11259. * invocation.
  11260. *
  11261. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11262. * invoked on the trailing edge of the timeout only if the debounced function
  11263. * is invoked more than once during the `wait` timeout.
  11264. *
  11265. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11266. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11267. *
  11268. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11269. * for details over the differences between `_.debounce` and `_.throttle`.
  11270. *
  11271. * @static
  11272. * @memberOf _
  11273. * @since 0.1.0
  11274. * @category Function
  11275. * @param {Function} func The function to debounce.
  11276. * @param {number} [wait=0] The number of milliseconds to delay.
  11277. * @param {Object} [options={}] The options object.
  11278. * @param {boolean} [options.leading=false]
  11279. * Specify invoking on the leading edge of the timeout.
  11280. * @param {number} [options.maxWait]
  11281. * The maximum time `func` is allowed to be delayed before it's invoked.
  11282. * @param {boolean} [options.trailing=true]
  11283. * Specify invoking on the trailing edge of the timeout.
  11284. * @returns {Function} Returns the new debounced function.
  11285. * @example
  11286. *
  11287. * // Avoid costly calculations while the window size is in flux.
  11288. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  11289. *
  11290. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  11291. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  11292. * 'leading': true,
  11293. * 'trailing': false
  11294. * }));
  11295. *
  11296. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  11297. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  11298. * var source = new EventSource('/stream');
  11299. * jQuery(source).on('message', debounced);
  11300. *
  11301. * // Cancel the trailing debounced invocation.
  11302. * jQuery(window).on('popstate', debounced.cancel);
  11303. */
  11304. function debounce(func, wait, options) {
  11305. var lastArgs,
  11306. lastThis,
  11307. maxWait,
  11308. result,
  11309. timerId,
  11310. lastCallTime,
  11311. lastInvokeTime = 0,
  11312. leading = false,
  11313. maxing = false,
  11314. trailing = true;
  11315. if (typeof func != 'function') {
  11316. throw new TypeError(FUNC_ERROR_TEXT);
  11317. }
  11318. wait = toNumber(wait) || 0;
  11319. if (isObject(options)) {
  11320. leading = !!options.leading;
  11321. maxing = 'maxWait' in options;
  11322. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  11323. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11324. }
  11325. function invokeFunc(time) {
  11326. var args = lastArgs,
  11327. thisArg = lastThis;
  11328. lastArgs = lastThis = undefined;
  11329. lastInvokeTime = time;
  11330. result = func.apply(thisArg, args);
  11331. return result;
  11332. }
  11333. function leadingEdge(time) {
  11334. // Reset any `maxWait` timer.
  11335. lastInvokeTime = time;
  11336. // Start the timer for the trailing edge.
  11337. timerId = setTimeout(timerExpired, wait);
  11338. // Invoke the leading edge.
  11339. return leading ? invokeFunc(time) : result;
  11340. }
  11341. function remainingWait(time) {
  11342. var timeSinceLastCall = time - lastCallTime,
  11343. timeSinceLastInvoke = time - lastInvokeTime,
  11344. timeWaiting = wait - timeSinceLastCall;
  11345. return maxing
  11346. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  11347. : timeWaiting;
  11348. }
  11349. function shouldInvoke(time) {
  11350. var timeSinceLastCall = time - lastCallTime,
  11351. timeSinceLastInvoke = time - lastInvokeTime;
  11352. // Either this is the first call, activity has stopped and we're at the
  11353. // trailing edge, the system time has gone backwards and we're treating
  11354. // it as the trailing edge, or we've hit the `maxWait` limit.
  11355. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  11356. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  11357. }
  11358. function timerExpired() {
  11359. var time = now();
  11360. if (shouldInvoke(time)) {
  11361. return trailingEdge(time);
  11362. }
  11363. // Restart the timer.
  11364. timerId = setTimeout(timerExpired, remainingWait(time));
  11365. }
  11366. function trailingEdge(time) {
  11367. timerId = undefined;
  11368. // Only invoke if we have `lastArgs` which means `func` has been
  11369. // debounced at least once.
  11370. if (trailing && lastArgs) {
  11371. return invokeFunc(time);
  11372. }
  11373. lastArgs = lastThis = undefined;
  11374. return result;
  11375. }
  11376. function cancel() {
  11377. if (timerId !== undefined) {
  11378. clearTimeout(timerId);
  11379. }
  11380. lastInvokeTime = 0;
  11381. lastArgs = lastCallTime = lastThis = timerId = undefined;
  11382. }
  11383. function flush() {
  11384. return timerId === undefined ? result : trailingEdge(now());
  11385. }
  11386. function debounced() {
  11387. var time = now(),
  11388. isInvoking = shouldInvoke(time);
  11389. lastArgs = arguments;
  11390. lastThis = this;
  11391. lastCallTime = time;
  11392. if (isInvoking) {
  11393. if (timerId === undefined) {
  11394. return leadingEdge(lastCallTime);
  11395. }
  11396. if (maxing) {
  11397. // Handle invocations in a tight loop.
  11398. clearTimeout(timerId);
  11399. timerId = setTimeout(timerExpired, wait);
  11400. return invokeFunc(lastCallTime);
  11401. }
  11402. }
  11403. if (timerId === undefined) {
  11404. timerId = setTimeout(timerExpired, wait);
  11405. }
  11406. return result;
  11407. }
  11408. debounced.cancel = cancel;
  11409. debounced.flush = flush;
  11410. return debounced;
  11411. }
  11412. /**
  11413. * Defers invoking the `func` until the current call stack has cleared. Any
  11414. * additional arguments are provided to `func` when it's invoked.
  11415. *
  11416. * @static
  11417. * @memberOf _
  11418. * @since 0.1.0
  11419. * @category Function
  11420. * @param {Function} func The function to defer.
  11421. * @param {...*} [args] The arguments to invoke `func` with.
  11422. * @returns {number} Returns the timer id.
  11423. * @example
  11424. *
  11425. * _.defer(function(text) {
  11426. * console.log(text);
  11427. * }, 'deferred');
  11428. * // => Logs 'deferred' after one millisecond.
  11429. */
  11430. var defer = baseRest(function(func, args) {
  11431. return baseDelay(func, 1, args);
  11432. });
  11433. /**
  11434. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  11435. * provided to `func` when it's invoked.
  11436. *
  11437. * @static
  11438. * @memberOf _
  11439. * @since 0.1.0
  11440. * @category Function
  11441. * @param {Function} func The function to delay.
  11442. * @param {number} wait The number of milliseconds to delay invocation.
  11443. * @param {...*} [args] The arguments to invoke `func` with.
  11444. * @returns {number} Returns the timer id.
  11445. * @example
  11446. *
  11447. * _.delay(function(text) {
  11448. * console.log(text);
  11449. * }, 1000, 'later');
  11450. * // => Logs 'later' after one second.
  11451. */
  11452. var delay = baseRest(function(func, wait, args) {
  11453. return baseDelay(func, toNumber(wait) || 0, args);
  11454. });
  11455. /**
  11456. * Creates a function that invokes `func` with arguments reversed.
  11457. *
  11458. * @static
  11459. * @memberOf _
  11460. * @since 4.0.0
  11461. * @category Function
  11462. * @param {Function} func The function to flip arguments for.
  11463. * @returns {Function} Returns the new flipped function.
  11464. * @example
  11465. *
  11466. * var flipped = _.flip(function() {
  11467. * return _.toArray(arguments);
  11468. * });
  11469. *
  11470. * flipped('a', 'b', 'c', 'd');
  11471. * // => ['d', 'c', 'b', 'a']
  11472. */
  11473. function flip(func) {
  11474. return createWrap(func, WRAP_FLIP_FLAG);
  11475. }
  11476. /**
  11477. * Creates a function that memoizes the result of `func`. If `resolver` is
  11478. * provided, it determines the cache key for storing the result based on the
  11479. * arguments provided to the memoized function. By default, the first argument
  11480. * provided to the memoized function is used as the map cache key. The `func`
  11481. * is invoked with the `this` binding of the memoized function.
  11482. *
  11483. * **Note:** The cache is exposed as the `cache` property on the memoized
  11484. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  11485. * constructor with one whose instances implement the
  11486. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  11487. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  11488. *
  11489. * @static
  11490. * @memberOf _
  11491. * @since 0.1.0
  11492. * @category Function
  11493. * @param {Function} func The function to have its output memoized.
  11494. * @param {Function} [resolver] The function to resolve the cache key.
  11495. * @returns {Function} Returns the new memoized function.
  11496. * @example
  11497. *
  11498. * var object = { 'a': 1, 'b': 2 };
  11499. * var other = { 'c': 3, 'd': 4 };
  11500. *
  11501. * var values = _.memoize(_.values);
  11502. * values(object);
  11503. * // => [1, 2]
  11504. *
  11505. * values(other);
  11506. * // => [3, 4]
  11507. *
  11508. * object.a = 2;
  11509. * values(object);
  11510. * // => [1, 2]
  11511. *
  11512. * // Modify the result cache.
  11513. * values.cache.set(object, ['a', 'b']);
  11514. * values(object);
  11515. * // => ['a', 'b']
  11516. *
  11517. * // Replace `_.memoize.Cache`.
  11518. * _.memoize.Cache = WeakMap;
  11519. */
  11520. function memoize(func, resolver) {
  11521. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  11522. throw new TypeError(FUNC_ERROR_TEXT);
  11523. }
  11524. var memoized = function() {
  11525. var args = arguments,
  11526. key = resolver ? resolver.apply(this, args) : args[0],
  11527. cache = memoized.cache;
  11528. if (cache.has(key)) {
  11529. return cache.get(key);
  11530. }
  11531. var result = func.apply(this, args);
  11532. memoized.cache = cache.set(key, result) || cache;
  11533. return result;
  11534. };
  11535. memoized.cache = new (memoize.Cache || MapCache);
  11536. return memoized;
  11537. }
  11538. // Expose `MapCache`.
  11539. memoize.Cache = MapCache;
  11540. /**
  11541. * Creates a function that negates the result of the predicate `func`. The
  11542. * `func` predicate is invoked with the `this` binding and arguments of the
  11543. * created function.
  11544. *
  11545. * @static
  11546. * @memberOf _
  11547. * @since 3.0.0
  11548. * @category Function
  11549. * @param {Function} predicate The predicate to negate.
  11550. * @returns {Function} Returns the new negated function.
  11551. * @example
  11552. *
  11553. * function isEven(n) {
  11554. * return n % 2 == 0;
  11555. * }
  11556. *
  11557. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  11558. * // => [1, 3, 5]
  11559. */
  11560. function negate(predicate) {
  11561. if (typeof predicate != 'function') {
  11562. throw new TypeError(FUNC_ERROR_TEXT);
  11563. }
  11564. return function() {
  11565. var args = arguments;
  11566. switch (args.length) {
  11567. case 0: return !predicate.call(this);
  11568. case 1: return !predicate.call(this, args[0]);
  11569. case 2: return !predicate.call(this, args[0], args[1]);
  11570. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  11571. }
  11572. return !predicate.apply(this, args);
  11573. };
  11574. }
  11575. /**
  11576. * Creates a function that is restricted to invoking `func` once. Repeat calls
  11577. * to the function return the value of the first invocation. The `func` is
  11578. * invoked with the `this` binding and arguments of the created function.
  11579. *
  11580. * @static
  11581. * @memberOf _
  11582. * @since 0.1.0
  11583. * @category Function
  11584. * @param {Function} func The function to restrict.
  11585. * @returns {Function} Returns the new restricted function.
  11586. * @example
  11587. *
  11588. * var initialize = _.once(createApplication);
  11589. * initialize();
  11590. * initialize();
  11591. * // => `createApplication` is invoked once
  11592. */
  11593. function once(func) {
  11594. return before(2, func);
  11595. }
  11596. /**
  11597. * Creates a function that invokes `func` with its arguments transformed.
  11598. *
  11599. * @static
  11600. * @since 4.0.0
  11601. * @memberOf _
  11602. * @category Function
  11603. * @param {Function} func The function to wrap.
  11604. * @param {...(Function|Function[])} [transforms=[_.identity]]
  11605. * The argument transforms.
  11606. * @returns {Function} Returns the new function.
  11607. * @example
  11608. *
  11609. * function doubled(n) {
  11610. * return n * 2;
  11611. * }
  11612. *
  11613. * function square(n) {
  11614. * return n * n;
  11615. * }
  11616. *
  11617. * var func = _.overArgs(function(x, y) {
  11618. * return [x, y];
  11619. * }, [square, doubled]);
  11620. *
  11621. * func(9, 3);
  11622. * // => [81, 6]
  11623. *
  11624. * func(10, 5);
  11625. * // => [100, 10]
  11626. */
  11627. var overArgs = castRest(function(func, transforms) {
  11628. transforms = (transforms.length == 1 && isArray(transforms[0]))
  11629. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  11630. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  11631. var funcsLength = transforms.length;
  11632. return baseRest(function(args) {
  11633. var index = -1,
  11634. length = nativeMin(args.length, funcsLength);
  11635. while (++index < length) {
  11636. args[index] = transforms[index].call(this, args[index]);
  11637. }
  11638. return apply(func, this, args);
  11639. });
  11640. });
  11641. /**
  11642. * Creates a function that invokes `func` with `partials` prepended to the
  11643. * arguments it receives. This method is like `_.bind` except it does **not**
  11644. * alter the `this` binding.
  11645. *
  11646. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  11647. * builds, may be used as a placeholder for partially applied arguments.
  11648. *
  11649. * **Note:** This method doesn't set the "length" property of partially
  11650. * applied functions.
  11651. *
  11652. * @static
  11653. * @memberOf _
  11654. * @since 0.2.0
  11655. * @category Function
  11656. * @param {Function} func The function to partially apply arguments to.
  11657. * @param {...*} [partials] The arguments to be partially applied.
  11658. * @returns {Function} Returns the new partially applied function.
  11659. * @example
  11660. *
  11661. * function greet(greeting, name) {
  11662. * return greeting + ' ' + name;
  11663. * }
  11664. *
  11665. * var sayHelloTo = _.partial(greet, 'hello');
  11666. * sayHelloTo('fred');
  11667. * // => 'hello fred'
  11668. *
  11669. * // Partially applied with placeholders.
  11670. * var greetFred = _.partial(greet, _, 'fred');
  11671. * greetFred('hi');
  11672. * // => 'hi fred'
  11673. */
  11674. var partial = baseRest(function(func, partials) {
  11675. var holders = replaceHolders(partials, getHolder(partial));
  11676. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  11677. });
  11678. /**
  11679. * This method is like `_.partial` except that partially applied arguments
  11680. * are appended to the arguments it receives.
  11681. *
  11682. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  11683. * builds, may be used as a placeholder for partially applied arguments.
  11684. *
  11685. * **Note:** This method doesn't set the "length" property of partially
  11686. * applied functions.
  11687. *
  11688. * @static
  11689. * @memberOf _
  11690. * @since 1.0.0
  11691. * @category Function
  11692. * @param {Function} func The function to partially apply arguments to.
  11693. * @param {...*} [partials] The arguments to be partially applied.
  11694. * @returns {Function} Returns the new partially applied function.
  11695. * @example
  11696. *
  11697. * function greet(greeting, name) {
  11698. * return greeting + ' ' + name;
  11699. * }
  11700. *
  11701. * var greetFred = _.partialRight(greet, 'fred');
  11702. * greetFred('hi');
  11703. * // => 'hi fred'
  11704. *
  11705. * // Partially applied with placeholders.
  11706. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  11707. * sayHelloTo('fred');
  11708. * // => 'hello fred'
  11709. */
  11710. var partialRight = baseRest(function(func, partials) {
  11711. var holders = replaceHolders(partials, getHolder(partialRight));
  11712. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  11713. });
  11714. /**
  11715. * Creates a function that invokes `func` with arguments arranged according
  11716. * to the specified `indexes` where the argument value at the first index is
  11717. * provided as the first argument, the argument value at the second index is
  11718. * provided as the second argument, and so on.
  11719. *
  11720. * @static
  11721. * @memberOf _
  11722. * @since 3.0.0
  11723. * @category Function
  11724. * @param {Function} func The function to rearrange arguments for.
  11725. * @param {...(number|number[])} indexes The arranged argument indexes.
  11726. * @returns {Function} Returns the new function.
  11727. * @example
  11728. *
  11729. * var rearged = _.rearg(function(a, b, c) {
  11730. * return [a, b, c];
  11731. * }, [2, 0, 1]);
  11732. *
  11733. * rearged('b', 'c', 'a')
  11734. * // => ['a', 'b', 'c']
  11735. */
  11736. var rearg = flatRest(function(func, indexes) {
  11737. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  11738. });
  11739. /**
  11740. * Creates a function that invokes `func` with the `this` binding of the
  11741. * created function and arguments from `start` and beyond provided as
  11742. * an array.
  11743. *
  11744. * **Note:** This method is based on the
  11745. * [rest parameter](https://mdn.io/rest_parameters).
  11746. *
  11747. * @static
  11748. * @memberOf _
  11749. * @since 4.0.0
  11750. * @category Function
  11751. * @param {Function} func The function to apply a rest parameter to.
  11752. * @param {number} [start=func.length-1] The start position of the rest parameter.
  11753. * @returns {Function} Returns the new function.
  11754. * @example
  11755. *
  11756. * var say = _.rest(function(what, names) {
  11757. * return what + ' ' + _.initial(names).join(', ') +
  11758. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  11759. * });
  11760. *
  11761. * say('hello', 'fred', 'barney', 'pebbles');
  11762. * // => 'hello fred, barney, & pebbles'
  11763. */
  11764. function rest(func, start) {
  11765. if (typeof func != 'function') {
  11766. throw new TypeError(FUNC_ERROR_TEXT);
  11767. }
  11768. start = start === undefined ? start : toInteger(start);
  11769. return baseRest(func, start);
  11770. }
  11771. /**
  11772. * Creates a function that invokes `func` with the `this` binding of the
  11773. * create function and an array of arguments much like
  11774. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  11775. *
  11776. * **Note:** This method is based on the
  11777. * [spread operator](https://mdn.io/spread_operator).
  11778. *
  11779. * @static
  11780. * @memberOf _
  11781. * @since 3.2.0
  11782. * @category Function
  11783. * @param {Function} func The function to spread arguments over.
  11784. * @param {number} [start=0] The start position of the spread.
  11785. * @returns {Function} Returns the new function.
  11786. * @example
  11787. *
  11788. * var say = _.spread(function(who, what) {
  11789. * return who + ' says ' + what;
  11790. * });
  11791. *
  11792. * say(['fred', 'hello']);
  11793. * // => 'fred says hello'
  11794. *
  11795. * var numbers = Promise.all([
  11796. * Promise.resolve(40),
  11797. * Promise.resolve(36)
  11798. * ]);
  11799. *
  11800. * numbers.then(_.spread(function(x, y) {
  11801. * return x + y;
  11802. * }));
  11803. * // => a Promise of 76
  11804. */
  11805. function spread(func, start) {
  11806. if (typeof func != 'function') {
  11807. throw new TypeError(FUNC_ERROR_TEXT);
  11808. }
  11809. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  11810. return baseRest(function(args) {
  11811. var array = args[start],
  11812. otherArgs = castSlice(args, 0, start);
  11813. if (array) {
  11814. arrayPush(otherArgs, array);
  11815. }
  11816. return apply(func, this, otherArgs);
  11817. });
  11818. }
  11819. /**
  11820. * Creates a throttled function that only invokes `func` at most once per
  11821. * every `wait` milliseconds. The throttled function comes with a `cancel`
  11822. * method to cancel delayed `func` invocations and a `flush` method to
  11823. * immediately invoke them. Provide `options` to indicate whether `func`
  11824. * should be invoked on the leading and/or trailing edge of the `wait`
  11825. * timeout. The `func` is invoked with the last arguments provided to the
  11826. * throttled function. Subsequent calls to the throttled function return the
  11827. * result of the last `func` invocation.
  11828. *
  11829. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11830. * invoked on the trailing edge of the timeout only if the throttled function
  11831. * is invoked more than once during the `wait` timeout.
  11832. *
  11833. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11834. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11835. *
  11836. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11837. * for details over the differences between `_.throttle` and `_.debounce`.
  11838. *
  11839. * @static
  11840. * @memberOf _
  11841. * @since 0.1.0
  11842. * @category Function
  11843. * @param {Function} func The function to throttle.
  11844. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11845. * @param {Object} [options={}] The options object.
  11846. * @param {boolean} [options.leading=true]
  11847. * Specify invoking on the leading edge of the timeout.
  11848. * @param {boolean} [options.trailing=true]
  11849. * Specify invoking on the trailing edge of the timeout.
  11850. * @returns {Function} Returns the new throttled function.
  11851. * @example
  11852. *
  11853. * // Avoid excessively updating the position while scrolling.
  11854. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11855. *
  11856. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11857. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11858. * jQuery(element).on('click', throttled);
  11859. *
  11860. * // Cancel the trailing throttled invocation.
  11861. * jQuery(window).on('popstate', throttled.cancel);
  11862. */
  11863. function throttle(func, wait, options) {
  11864. var leading = true,
  11865. trailing = true;
  11866. if (typeof func != 'function') {
  11867. throw new TypeError(FUNC_ERROR_TEXT);
  11868. }
  11869. if (isObject(options)) {
  11870. leading = 'leading' in options ? !!options.leading : leading;
  11871. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11872. }
  11873. return debounce(func, wait, {
  11874. 'leading': leading,
  11875. 'maxWait': wait,
  11876. 'trailing': trailing
  11877. });
  11878. }
  11879. /**
  11880. * Creates a function that accepts up to one argument, ignoring any
  11881. * additional arguments.
  11882. *
  11883. * @static
  11884. * @memberOf _
  11885. * @since 4.0.0
  11886. * @category Function
  11887. * @param {Function} func The function to cap arguments for.
  11888. * @returns {Function} Returns the new capped function.
  11889. * @example
  11890. *
  11891. * _.map(['6', '8', '10'], _.unary(parseInt));
  11892. * // => [6, 8, 10]
  11893. */
  11894. function unary(func) {
  11895. return ary(func, 1);
  11896. }
  11897. /**
  11898. * Creates a function that provides `value` to `wrapper` as its first
  11899. * argument. Any additional arguments provided to the function are appended
  11900. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11901. * binding of the created function.
  11902. *
  11903. * @static
  11904. * @memberOf _
  11905. * @since 0.1.0
  11906. * @category Function
  11907. * @param {*} value The value to wrap.
  11908. * @param {Function} [wrapper=identity] The wrapper function.
  11909. * @returns {Function} Returns the new function.
  11910. * @example
  11911. *
  11912. * var p = _.wrap(_.escape, function(func, text) {
  11913. * return '<p>' + func(text) + '</p>';
  11914. * });
  11915. *
  11916. * p('fred, barney, & pebbles');
  11917. * // => '<p>fred, barney, &amp; pebbles</p>'
  11918. */
  11919. function wrap(value, wrapper) {
  11920. return partial(castFunction(wrapper), value);
  11921. }
  11922. /*------------------------------------------------------------------------*/
  11923. /**
  11924. * Casts `value` as an array if it's not one.
  11925. *
  11926. * @static
  11927. * @memberOf _
  11928. * @since 4.4.0
  11929. * @category Lang
  11930. * @param {*} value The value to inspect.
  11931. * @returns {Array} Returns the cast array.
  11932. * @example
  11933. *
  11934. * _.castArray(1);
  11935. * // => [1]
  11936. *
  11937. * _.castArray({ 'a': 1 });
  11938. * // => [{ 'a': 1 }]
  11939. *
  11940. * _.castArray('abc');
  11941. * // => ['abc']
  11942. *
  11943. * _.castArray(null);
  11944. * // => [null]
  11945. *
  11946. * _.castArray(undefined);
  11947. * // => [undefined]
  11948. *
  11949. * _.castArray();
  11950. * // => []
  11951. *
  11952. * var array = [1, 2, 3];
  11953. * console.log(_.castArray(array) === array);
  11954. * // => true
  11955. */
  11956. function castArray() {
  11957. if (!arguments.length) {
  11958. return [];
  11959. }
  11960. var value = arguments[0];
  11961. return isArray(value) ? value : [value];
  11962. }
  11963. /**
  11964. * Creates a shallow clone of `value`.
  11965. *
  11966. * **Note:** This method is loosely based on the
  11967. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11968. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11969. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11970. * arrays. The own enumerable properties of `arguments` objects are cloned
  11971. * as plain objects. An empty object is returned for uncloneable values such
  11972. * as error objects, functions, DOM nodes, and WeakMaps.
  11973. *
  11974. * @static
  11975. * @memberOf _
  11976. * @since 0.1.0
  11977. * @category Lang
  11978. * @param {*} value The value to clone.
  11979. * @returns {*} Returns the cloned value.
  11980. * @see _.cloneDeep
  11981. * @example
  11982. *
  11983. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11984. *
  11985. * var shallow = _.clone(objects);
  11986. * console.log(shallow[0] === objects[0]);
  11987. * // => true
  11988. */
  11989. function clone(value) {
  11990. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11991. }
  11992. /**
  11993. * This method is like `_.clone` except that it accepts `customizer` which
  11994. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11995. * cloning is handled by the method instead. The `customizer` is invoked with
  11996. * up to four arguments; (value [, index|key, object, stack]).
  11997. *
  11998. * @static
  11999. * @memberOf _
  12000. * @since 4.0.0
  12001. * @category Lang
  12002. * @param {*} value The value to clone.
  12003. * @param {Function} [customizer] The function to customize cloning.
  12004. * @returns {*} Returns the cloned value.
  12005. * @see _.cloneDeepWith
  12006. * @example
  12007. *
  12008. * function customizer(value) {
  12009. * if (_.isElement(value)) {
  12010. * return value.cloneNode(false);
  12011. * }
  12012. * }
  12013. *
  12014. * var el = _.cloneWith(document.body, customizer);
  12015. *
  12016. * console.log(el === document.body);
  12017. * // => false
  12018. * console.log(el.nodeName);
  12019. * // => 'BODY'
  12020. * console.log(el.childNodes.length);
  12021. * // => 0
  12022. */
  12023. function cloneWith(value, customizer) {
  12024. customizer = typeof customizer == 'function' ? customizer : undefined;
  12025. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  12026. }
  12027. /**
  12028. * This method is like `_.clone` except that it recursively clones `value`.
  12029. *
  12030. * @static
  12031. * @memberOf _
  12032. * @since 1.0.0
  12033. * @category Lang
  12034. * @param {*} value The value to recursively clone.
  12035. * @returns {*} Returns the deep cloned value.
  12036. * @see _.clone
  12037. * @example
  12038. *
  12039. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  12040. *
  12041. * var deep = _.cloneDeep(objects);
  12042. * console.log(deep[0] === objects[0]);
  12043. * // => false
  12044. */
  12045. function cloneDeep(value) {
  12046. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  12047. }
  12048. /**
  12049. * This method is like `_.cloneWith` except that it recursively clones `value`.
  12050. *
  12051. * @static
  12052. * @memberOf _
  12053. * @since 4.0.0
  12054. * @category Lang
  12055. * @param {*} value The value to recursively clone.
  12056. * @param {Function} [customizer] The function to customize cloning.
  12057. * @returns {*} Returns the deep cloned value.
  12058. * @see _.cloneWith
  12059. * @example
  12060. *
  12061. * function customizer(value) {
  12062. * if (_.isElement(value)) {
  12063. * return value.cloneNode(true);
  12064. * }
  12065. * }
  12066. *
  12067. * var el = _.cloneDeepWith(document.body, customizer);
  12068. *
  12069. * console.log(el === document.body);
  12070. * // => false
  12071. * console.log(el.nodeName);
  12072. * // => 'BODY'
  12073. * console.log(el.childNodes.length);
  12074. * // => 20
  12075. */
  12076. function cloneDeepWith(value, customizer) {
  12077. customizer = typeof customizer == 'function' ? customizer : undefined;
  12078. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  12079. }
  12080. /**
  12081. * Checks if `object` conforms to `source` by invoking the predicate
  12082. * properties of `source` with the corresponding property values of `object`.
  12083. *
  12084. * **Note:** This method is equivalent to `_.conforms` when `source` is
  12085. * partially applied.
  12086. *
  12087. * @static
  12088. * @memberOf _
  12089. * @since 4.14.0
  12090. * @category Lang
  12091. * @param {Object} object The object to inspect.
  12092. * @param {Object} source The object of property predicates to conform to.
  12093. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  12094. * @example
  12095. *
  12096. * var object = { 'a': 1, 'b': 2 };
  12097. *
  12098. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  12099. * // => true
  12100. *
  12101. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  12102. * // => false
  12103. */
  12104. function conformsTo(object, source) {
  12105. return source == null || baseConformsTo(object, source, keys(source));
  12106. }
  12107. /**
  12108. * Performs a
  12109. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  12110. * comparison between two values to determine if they are equivalent.
  12111. *
  12112. * @static
  12113. * @memberOf _
  12114. * @since 4.0.0
  12115. * @category Lang
  12116. * @param {*} value The value to compare.
  12117. * @param {*} other The other value to compare.
  12118. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12119. * @example
  12120. *
  12121. * var object = { 'a': 1 };
  12122. * var other = { 'a': 1 };
  12123. *
  12124. * _.eq(object, object);
  12125. * // => true
  12126. *
  12127. * _.eq(object, other);
  12128. * // => false
  12129. *
  12130. * _.eq('a', 'a');
  12131. * // => true
  12132. *
  12133. * _.eq('a', Object('a'));
  12134. * // => false
  12135. *
  12136. * _.eq(NaN, NaN);
  12137. * // => true
  12138. */
  12139. function eq(value, other) {
  12140. return value === other || (value !== value && other !== other);
  12141. }
  12142. /**
  12143. * Checks if `value` is greater than `other`.
  12144. *
  12145. * @static
  12146. * @memberOf _
  12147. * @since 3.9.0
  12148. * @category Lang
  12149. * @param {*} value The value to compare.
  12150. * @param {*} other The other value to compare.
  12151. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  12152. * else `false`.
  12153. * @see _.lt
  12154. * @example
  12155. *
  12156. * _.gt(3, 1);
  12157. * // => true
  12158. *
  12159. * _.gt(3, 3);
  12160. * // => false
  12161. *
  12162. * _.gt(1, 3);
  12163. * // => false
  12164. */
  12165. var gt = createRelationalOperation(baseGt);
  12166. /**
  12167. * Checks if `value` is greater than or equal to `other`.
  12168. *
  12169. * @static
  12170. * @memberOf _
  12171. * @since 3.9.0
  12172. * @category Lang
  12173. * @param {*} value The value to compare.
  12174. * @param {*} other The other value to compare.
  12175. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  12176. * `other`, else `false`.
  12177. * @see _.lte
  12178. * @example
  12179. *
  12180. * _.gte(3, 1);
  12181. * // => true
  12182. *
  12183. * _.gte(3, 3);
  12184. * // => true
  12185. *
  12186. * _.gte(1, 3);
  12187. * // => false
  12188. */
  12189. var gte = createRelationalOperation(function(value, other) {
  12190. return value >= other;
  12191. });
  12192. /**
  12193. * Checks if `value` is likely an `arguments` object.
  12194. *
  12195. * @static
  12196. * @memberOf _
  12197. * @since 0.1.0
  12198. * @category Lang
  12199. * @param {*} value The value to check.
  12200. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  12201. * else `false`.
  12202. * @example
  12203. *
  12204. * _.isArguments(function() { return arguments; }());
  12205. * // => true
  12206. *
  12207. * _.isArguments([1, 2, 3]);
  12208. * // => false
  12209. */
  12210. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  12211. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  12212. !propertyIsEnumerable.call(value, 'callee');
  12213. };
  12214. /**
  12215. * Checks if `value` is classified as an `Array` object.
  12216. *
  12217. * @static
  12218. * @memberOf _
  12219. * @since 0.1.0
  12220. * @category Lang
  12221. * @param {*} value The value to check.
  12222. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  12223. * @example
  12224. *
  12225. * _.isArray([1, 2, 3]);
  12226. * // => true
  12227. *
  12228. * _.isArray(document.body.children);
  12229. * // => false
  12230. *
  12231. * _.isArray('abc');
  12232. * // => false
  12233. *
  12234. * _.isArray(_.noop);
  12235. * // => false
  12236. */
  12237. var isArray = Array.isArray;
  12238. /**
  12239. * Checks if `value` is classified as an `ArrayBuffer` object.
  12240. *
  12241. * @static
  12242. * @memberOf _
  12243. * @since 4.3.0
  12244. * @category Lang
  12245. * @param {*} value The value to check.
  12246. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  12247. * @example
  12248. *
  12249. * _.isArrayBuffer(new ArrayBuffer(2));
  12250. * // => true
  12251. *
  12252. * _.isArrayBuffer(new Array(2));
  12253. * // => false
  12254. */
  12255. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  12256. /**
  12257. * Checks if `value` is array-like. A value is considered array-like if it's
  12258. * not a function and has a `value.length` that's an integer greater than or
  12259. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  12260. *
  12261. * @static
  12262. * @memberOf _
  12263. * @since 4.0.0
  12264. * @category Lang
  12265. * @param {*} value The value to check.
  12266. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  12267. * @example
  12268. *
  12269. * _.isArrayLike([1, 2, 3]);
  12270. * // => true
  12271. *
  12272. * _.isArrayLike(document.body.children);
  12273. * // => true
  12274. *
  12275. * _.isArrayLike('abc');
  12276. * // => true
  12277. *
  12278. * _.isArrayLike(_.noop);
  12279. * // => false
  12280. */
  12281. function isArrayLike(value) {
  12282. return value != null && isLength(value.length) && !isFunction(value);
  12283. }
  12284. /**
  12285. * This method is like `_.isArrayLike` except that it also checks if `value`
  12286. * is an object.
  12287. *
  12288. * @static
  12289. * @memberOf _
  12290. * @since 4.0.0
  12291. * @category Lang
  12292. * @param {*} value The value to check.
  12293. * @returns {boolean} Returns `true` if `value` is an array-like object,
  12294. * else `false`.
  12295. * @example
  12296. *
  12297. * _.isArrayLikeObject([1, 2, 3]);
  12298. * // => true
  12299. *
  12300. * _.isArrayLikeObject(document.body.children);
  12301. * // => true
  12302. *
  12303. * _.isArrayLikeObject('abc');
  12304. * // => false
  12305. *
  12306. * _.isArrayLikeObject(_.noop);
  12307. * // => false
  12308. */
  12309. function isArrayLikeObject(value) {
  12310. return isObjectLike(value) && isArrayLike(value);
  12311. }
  12312. /**
  12313. * Checks if `value` is classified as a boolean primitive or object.
  12314. *
  12315. * @static
  12316. * @memberOf _
  12317. * @since 0.1.0
  12318. * @category Lang
  12319. * @param {*} value The value to check.
  12320. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  12321. * @example
  12322. *
  12323. * _.isBoolean(false);
  12324. * // => true
  12325. *
  12326. * _.isBoolean(null);
  12327. * // => false
  12328. */
  12329. function isBoolean(value) {
  12330. return value === true || value === false ||
  12331. (isObjectLike(value) && baseGetTag(value) == boolTag);
  12332. }
  12333. /**
  12334. * Checks if `value` is a buffer.
  12335. *
  12336. * @static
  12337. * @memberOf _
  12338. * @since 4.3.0
  12339. * @category Lang
  12340. * @param {*} value The value to check.
  12341. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  12342. * @example
  12343. *
  12344. * _.isBuffer(new Buffer(2));
  12345. * // => true
  12346. *
  12347. * _.isBuffer(new Uint8Array(2));
  12348. * // => false
  12349. */
  12350. var isBuffer = nativeIsBuffer || stubFalse;
  12351. /**
  12352. * Checks if `value` is classified as a `Date` object.
  12353. *
  12354. * @static
  12355. * @memberOf _
  12356. * @since 0.1.0
  12357. * @category Lang
  12358. * @param {*} value The value to check.
  12359. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  12360. * @example
  12361. *
  12362. * _.isDate(new Date);
  12363. * // => true
  12364. *
  12365. * _.isDate('Mon April 23 2012');
  12366. * // => false
  12367. */
  12368. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  12369. /**
  12370. * Checks if `value` is likely a DOM element.
  12371. *
  12372. * @static
  12373. * @memberOf _
  12374. * @since 0.1.0
  12375. * @category Lang
  12376. * @param {*} value The value to check.
  12377. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  12378. * @example
  12379. *
  12380. * _.isElement(document.body);
  12381. * // => true
  12382. *
  12383. * _.isElement('<body>');
  12384. * // => false
  12385. */
  12386. function isElement(value) {
  12387. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  12388. }
  12389. /**
  12390. * Checks if `value` is an empty object, collection, map, or set.
  12391. *
  12392. * Objects are considered empty if they have no own enumerable string keyed
  12393. * properties.
  12394. *
  12395. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  12396. * jQuery-like collections are considered empty if they have a `length` of `0`.
  12397. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  12398. *
  12399. * @static
  12400. * @memberOf _
  12401. * @since 0.1.0
  12402. * @category Lang
  12403. * @param {*} value The value to check.
  12404. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  12405. * @example
  12406. *
  12407. * _.isEmpty(null);
  12408. * // => true
  12409. *
  12410. * _.isEmpty(true);
  12411. * // => true
  12412. *
  12413. * _.isEmpty(1);
  12414. * // => true
  12415. *
  12416. * _.isEmpty([1, 2, 3]);
  12417. * // => false
  12418. *
  12419. * _.isEmpty({ 'a': 1 });
  12420. * // => false
  12421. */
  12422. function isEmpty(value) {
  12423. if (value == null) {
  12424. return true;
  12425. }
  12426. if (isArrayLike(value) &&
  12427. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  12428. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  12429. return !value.length;
  12430. }
  12431. var tag = getTag(value);
  12432. if (tag == mapTag || tag == setTag) {
  12433. return !value.size;
  12434. }
  12435. if (isPrototype(value)) {
  12436. return !baseKeys(value).length;
  12437. }
  12438. for (var key in value) {
  12439. if (hasOwnProperty.call(value, key)) {
  12440. return false;
  12441. }
  12442. }
  12443. return true;
  12444. }
  12445. /**
  12446. * Performs a deep comparison between two values to determine if they are
  12447. * equivalent.
  12448. *
  12449. * **Note:** This method supports comparing arrays, array buffers, booleans,
  12450. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  12451. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  12452. * by their own, not inherited, enumerable properties. Functions and DOM
  12453. * nodes are compared by strict equality, i.e. `===`.
  12454. *
  12455. * @static
  12456. * @memberOf _
  12457. * @since 0.1.0
  12458. * @category Lang
  12459. * @param {*} value The value to compare.
  12460. * @param {*} other The other value to compare.
  12461. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12462. * @example
  12463. *
  12464. * var object = { 'a': 1 };
  12465. * var other = { 'a': 1 };
  12466. *
  12467. * _.isEqual(object, other);
  12468. * // => true
  12469. *
  12470. * object === other;
  12471. * // => false
  12472. */
  12473. function isEqual(value, other) {
  12474. return baseIsEqual(value, other);
  12475. }
  12476. /**
  12477. * This method is like `_.isEqual` except that it accepts `customizer` which
  12478. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12479. * are handled by the method instead. The `customizer` is invoked with up to
  12480. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  12481. *
  12482. * @static
  12483. * @memberOf _
  12484. * @since 4.0.0
  12485. * @category Lang
  12486. * @param {*} value The value to compare.
  12487. * @param {*} other The other value to compare.
  12488. * @param {Function} [customizer] The function to customize comparisons.
  12489. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12490. * @example
  12491. *
  12492. * function isGreeting(value) {
  12493. * return /^h(?:i|ello)$/.test(value);
  12494. * }
  12495. *
  12496. * function customizer(objValue, othValue) {
  12497. * if (isGreeting(objValue) && isGreeting(othValue)) {
  12498. * return true;
  12499. * }
  12500. * }
  12501. *
  12502. * var array = ['hello', 'goodbye'];
  12503. * var other = ['hi', 'goodbye'];
  12504. *
  12505. * _.isEqualWith(array, other, customizer);
  12506. * // => true
  12507. */
  12508. function isEqualWith(value, other, customizer) {
  12509. customizer = typeof customizer == 'function' ? customizer : undefined;
  12510. var result = customizer ? customizer(value, other) : undefined;
  12511. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  12512. }
  12513. /**
  12514. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  12515. * `SyntaxError`, `TypeError`, or `URIError` object.
  12516. *
  12517. * @static
  12518. * @memberOf _
  12519. * @since 3.0.0
  12520. * @category Lang
  12521. * @param {*} value The value to check.
  12522. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  12523. * @example
  12524. *
  12525. * _.isError(new Error);
  12526. * // => true
  12527. *
  12528. * _.isError(Error);
  12529. * // => false
  12530. */
  12531. function isError(value) {
  12532. if (!isObjectLike(value)) {
  12533. return false;
  12534. }
  12535. var tag = baseGetTag(value);
  12536. return tag == errorTag || tag == domExcTag ||
  12537. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  12538. }
  12539. /**
  12540. * Checks if `value` is a finite primitive number.
  12541. *
  12542. * **Note:** This method is based on
  12543. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  12544. *
  12545. * @static
  12546. * @memberOf _
  12547. * @since 0.1.0
  12548. * @category Lang
  12549. * @param {*} value The value to check.
  12550. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  12551. * @example
  12552. *
  12553. * _.isFinite(3);
  12554. * // => true
  12555. *
  12556. * _.isFinite(Number.MIN_VALUE);
  12557. * // => true
  12558. *
  12559. * _.isFinite(Infinity);
  12560. * // => false
  12561. *
  12562. * _.isFinite('3');
  12563. * // => false
  12564. */
  12565. function isFinite(value) {
  12566. return typeof value == 'number' && nativeIsFinite(value);
  12567. }
  12568. /**
  12569. * Checks if `value` is classified as a `Function` object.
  12570. *
  12571. * @static
  12572. * @memberOf _
  12573. * @since 0.1.0
  12574. * @category Lang
  12575. * @param {*} value The value to check.
  12576. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  12577. * @example
  12578. *
  12579. * _.isFunction(_);
  12580. * // => true
  12581. *
  12582. * _.isFunction(/abc/);
  12583. * // => false
  12584. */
  12585. function isFunction(value) {
  12586. if (!isObject(value)) {
  12587. return false;
  12588. }
  12589. // The use of `Object#toString` avoids issues with the `typeof` operator
  12590. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  12591. var tag = baseGetTag(value);
  12592. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  12593. }
  12594. /**
  12595. * Checks if `value` is an integer.
  12596. *
  12597. * **Note:** This method is based on
  12598. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  12599. *
  12600. * @static
  12601. * @memberOf _
  12602. * @since 4.0.0
  12603. * @category Lang
  12604. * @param {*} value The value to check.
  12605. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  12606. * @example
  12607. *
  12608. * _.isInteger(3);
  12609. * // => true
  12610. *
  12611. * _.isInteger(Number.MIN_VALUE);
  12612. * // => false
  12613. *
  12614. * _.isInteger(Infinity);
  12615. * // => false
  12616. *
  12617. * _.isInteger('3');
  12618. * // => false
  12619. */
  12620. function isInteger(value) {
  12621. return typeof value == 'number' && value == toInteger(value);
  12622. }
  12623. /**
  12624. * Checks if `value` is a valid array-like length.
  12625. *
  12626. * **Note:** This method is loosely based on
  12627. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12628. *
  12629. * @static
  12630. * @memberOf _
  12631. * @since 4.0.0
  12632. * @category Lang
  12633. * @param {*} value The value to check.
  12634. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  12635. * @example
  12636. *
  12637. * _.isLength(3);
  12638. * // => true
  12639. *
  12640. * _.isLength(Number.MIN_VALUE);
  12641. * // => false
  12642. *
  12643. * _.isLength(Infinity);
  12644. * // => false
  12645. *
  12646. * _.isLength('3');
  12647. * // => false
  12648. */
  12649. function isLength(value) {
  12650. return typeof value == 'number' &&
  12651. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  12652. }
  12653. /**
  12654. * Checks if `value` is the
  12655. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  12656. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  12657. *
  12658. * @static
  12659. * @memberOf _
  12660. * @since 0.1.0
  12661. * @category Lang
  12662. * @param {*} value The value to check.
  12663. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  12664. * @example
  12665. *
  12666. * _.isObject({});
  12667. * // => true
  12668. *
  12669. * _.isObject([1, 2, 3]);
  12670. * // => true
  12671. *
  12672. * _.isObject(_.noop);
  12673. * // => true
  12674. *
  12675. * _.isObject(null);
  12676. * // => false
  12677. */
  12678. function isObject(value) {
  12679. var type = typeof value;
  12680. return value != null && (type == 'object' || type == 'function');
  12681. }
  12682. /**
  12683. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12684. * and has a `typeof` result of "object".
  12685. *
  12686. * @static
  12687. * @memberOf _
  12688. * @since 4.0.0
  12689. * @category Lang
  12690. * @param {*} value The value to check.
  12691. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12692. * @example
  12693. *
  12694. * _.isObjectLike({});
  12695. * // => true
  12696. *
  12697. * _.isObjectLike([1, 2, 3]);
  12698. * // => true
  12699. *
  12700. * _.isObjectLike(_.noop);
  12701. * // => false
  12702. *
  12703. * _.isObjectLike(null);
  12704. * // => false
  12705. */
  12706. function isObjectLike(value) {
  12707. return value != null && typeof value == 'object';
  12708. }
  12709. /**
  12710. * Checks if `value` is classified as a `Map` object.
  12711. *
  12712. * @static
  12713. * @memberOf _
  12714. * @since 4.3.0
  12715. * @category Lang
  12716. * @param {*} value The value to check.
  12717. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12718. * @example
  12719. *
  12720. * _.isMap(new Map);
  12721. * // => true
  12722. *
  12723. * _.isMap(new WeakMap);
  12724. * // => false
  12725. */
  12726. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  12727. /**
  12728. * Performs a partial deep comparison between `object` and `source` to
  12729. * determine if `object` contains equivalent property values.
  12730. *
  12731. * **Note:** This method is equivalent to `_.matches` when `source` is
  12732. * partially applied.
  12733. *
  12734. * Partial comparisons will match empty array and empty object `source`
  12735. * values against any array or object value, respectively. See `_.isEqual`
  12736. * for a list of supported value comparisons.
  12737. *
  12738. * @static
  12739. * @memberOf _
  12740. * @since 3.0.0
  12741. * @category Lang
  12742. * @param {Object} object The object to inspect.
  12743. * @param {Object} source The object of property values to match.
  12744. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12745. * @example
  12746. *
  12747. * var object = { 'a': 1, 'b': 2 };
  12748. *
  12749. * _.isMatch(object, { 'b': 2 });
  12750. * // => true
  12751. *
  12752. * _.isMatch(object, { 'b': 1 });
  12753. * // => false
  12754. */
  12755. function isMatch(object, source) {
  12756. return object === source || baseIsMatch(object, source, getMatchData(source));
  12757. }
  12758. /**
  12759. * This method is like `_.isMatch` except that it accepts `customizer` which
  12760. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12761. * are handled by the method instead. The `customizer` is invoked with five
  12762. * arguments: (objValue, srcValue, index|key, object, source).
  12763. *
  12764. * @static
  12765. * @memberOf _
  12766. * @since 4.0.0
  12767. * @category Lang
  12768. * @param {Object} object The object to inspect.
  12769. * @param {Object} source The object of property values to match.
  12770. * @param {Function} [customizer] The function to customize comparisons.
  12771. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12772. * @example
  12773. *
  12774. * function isGreeting(value) {
  12775. * return /^h(?:i|ello)$/.test(value);
  12776. * }
  12777. *
  12778. * function customizer(objValue, srcValue) {
  12779. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  12780. * return true;
  12781. * }
  12782. * }
  12783. *
  12784. * var object = { 'greeting': 'hello' };
  12785. * var source = { 'greeting': 'hi' };
  12786. *
  12787. * _.isMatchWith(object, source, customizer);
  12788. * // => true
  12789. */
  12790. function isMatchWith(object, source, customizer) {
  12791. customizer = typeof customizer == 'function' ? customizer : undefined;
  12792. return baseIsMatch(object, source, getMatchData(source), customizer);
  12793. }
  12794. /**
  12795. * Checks if `value` is `NaN`.
  12796. *
  12797. * **Note:** This method is based on
  12798. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  12799. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  12800. * `undefined` and other non-number values.
  12801. *
  12802. * @static
  12803. * @memberOf _
  12804. * @since 0.1.0
  12805. * @category Lang
  12806. * @param {*} value The value to check.
  12807. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12808. * @example
  12809. *
  12810. * _.isNaN(NaN);
  12811. * // => true
  12812. *
  12813. * _.isNaN(new Number(NaN));
  12814. * // => true
  12815. *
  12816. * isNaN(undefined);
  12817. * // => true
  12818. *
  12819. * _.isNaN(undefined);
  12820. * // => false
  12821. */
  12822. function isNaN(value) {
  12823. // An `NaN` primitive is the only value that is not equal to itself.
  12824. // Perform the `toStringTag` check first to avoid errors with some
  12825. // ActiveX objects in IE.
  12826. return isNumber(value) && value != +value;
  12827. }
  12828. /**
  12829. * Checks if `value` is a pristine native function.
  12830. *
  12831. * **Note:** This method can't reliably detect native functions in the presence
  12832. * of the core-js package because core-js circumvents this kind of detection.
  12833. * Despite multiple requests, the core-js maintainer has made it clear: any
  12834. * attempt to fix the detection will be obstructed. As a result, we're left
  12835. * with little choice but to throw an error. Unfortunately, this also affects
  12836. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  12837. * which rely on core-js.
  12838. *
  12839. * @static
  12840. * @memberOf _
  12841. * @since 3.0.0
  12842. * @category Lang
  12843. * @param {*} value The value to check.
  12844. * @returns {boolean} Returns `true` if `value` is a native function,
  12845. * else `false`.
  12846. * @example
  12847. *
  12848. * _.isNative(Array.prototype.push);
  12849. * // => true
  12850. *
  12851. * _.isNative(_);
  12852. * // => false
  12853. */
  12854. function isNative(value) {
  12855. if (isMaskable(value)) {
  12856. throw new Error(CORE_ERROR_TEXT);
  12857. }
  12858. return baseIsNative(value);
  12859. }
  12860. /**
  12861. * Checks if `value` is `null`.
  12862. *
  12863. * @static
  12864. * @memberOf _
  12865. * @since 0.1.0
  12866. * @category Lang
  12867. * @param {*} value The value to check.
  12868. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12869. * @example
  12870. *
  12871. * _.isNull(null);
  12872. * // => true
  12873. *
  12874. * _.isNull(void 0);
  12875. * // => false
  12876. */
  12877. function isNull(value) {
  12878. return value === null;
  12879. }
  12880. /**
  12881. * Checks if `value` is `null` or `undefined`.
  12882. *
  12883. * @static
  12884. * @memberOf _
  12885. * @since 4.0.0
  12886. * @category Lang
  12887. * @param {*} value The value to check.
  12888. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12889. * @example
  12890. *
  12891. * _.isNil(null);
  12892. * // => true
  12893. *
  12894. * _.isNil(void 0);
  12895. * // => true
  12896. *
  12897. * _.isNil(NaN);
  12898. * // => false
  12899. */
  12900. function isNil(value) {
  12901. return value == null;
  12902. }
  12903. /**
  12904. * Checks if `value` is classified as a `Number` primitive or object.
  12905. *
  12906. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12907. * classified as numbers, use the `_.isFinite` method.
  12908. *
  12909. * @static
  12910. * @memberOf _
  12911. * @since 0.1.0
  12912. * @category Lang
  12913. * @param {*} value The value to check.
  12914. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12915. * @example
  12916. *
  12917. * _.isNumber(3);
  12918. * // => true
  12919. *
  12920. * _.isNumber(Number.MIN_VALUE);
  12921. * // => true
  12922. *
  12923. * _.isNumber(Infinity);
  12924. * // => true
  12925. *
  12926. * _.isNumber('3');
  12927. * // => false
  12928. */
  12929. function isNumber(value) {
  12930. return typeof value == 'number' ||
  12931. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12932. }
  12933. /**
  12934. * Checks if `value` is a plain object, that is, an object created by the
  12935. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12936. *
  12937. * @static
  12938. * @memberOf _
  12939. * @since 0.8.0
  12940. * @category Lang
  12941. * @param {*} value The value to check.
  12942. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12943. * @example
  12944. *
  12945. * function Foo() {
  12946. * this.a = 1;
  12947. * }
  12948. *
  12949. * _.isPlainObject(new Foo);
  12950. * // => false
  12951. *
  12952. * _.isPlainObject([1, 2, 3]);
  12953. * // => false
  12954. *
  12955. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12956. * // => true
  12957. *
  12958. * _.isPlainObject(Object.create(null));
  12959. * // => true
  12960. */
  12961. function isPlainObject(value) {
  12962. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12963. return false;
  12964. }
  12965. var proto = getPrototype(value);
  12966. if (proto === null) {
  12967. return true;
  12968. }
  12969. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12970. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12971. funcToString.call(Ctor) == objectCtorString;
  12972. }
  12973. /**
  12974. * Checks if `value` is classified as a `RegExp` object.
  12975. *
  12976. * @static
  12977. * @memberOf _
  12978. * @since 0.1.0
  12979. * @category Lang
  12980. * @param {*} value The value to check.
  12981. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12982. * @example
  12983. *
  12984. * _.isRegExp(/abc/);
  12985. * // => true
  12986. *
  12987. * _.isRegExp('/abc/');
  12988. * // => false
  12989. */
  12990. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12991. /**
  12992. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12993. * double precision number which isn't the result of a rounded unsafe integer.
  12994. *
  12995. * **Note:** This method is based on
  12996. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12997. *
  12998. * @static
  12999. * @memberOf _
  13000. * @since 4.0.0
  13001. * @category Lang
  13002. * @param {*} value The value to check.
  13003. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  13004. * @example
  13005. *
  13006. * _.isSafeInteger(3);
  13007. * // => true
  13008. *
  13009. * _.isSafeInteger(Number.MIN_VALUE);
  13010. * // => false
  13011. *
  13012. * _.isSafeInteger(Infinity);
  13013. * // => false
  13014. *
  13015. * _.isSafeInteger('3');
  13016. * // => false
  13017. */
  13018. function isSafeInteger(value) {
  13019. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  13020. }
  13021. /**
  13022. * Checks if `value` is classified as a `Set` object.
  13023. *
  13024. * @static
  13025. * @memberOf _
  13026. * @since 4.3.0
  13027. * @category Lang
  13028. * @param {*} value The value to check.
  13029. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  13030. * @example
  13031. *
  13032. * _.isSet(new Set);
  13033. * // => true
  13034. *
  13035. * _.isSet(new WeakSet);
  13036. * // => false
  13037. */
  13038. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  13039. /**
  13040. * Checks if `value` is classified as a `String` primitive or object.
  13041. *
  13042. * @static
  13043. * @since 0.1.0
  13044. * @memberOf _
  13045. * @category Lang
  13046. * @param {*} value The value to check.
  13047. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  13048. * @example
  13049. *
  13050. * _.isString('abc');
  13051. * // => true
  13052. *
  13053. * _.isString(1);
  13054. * // => false
  13055. */
  13056. function isString(value) {
  13057. return typeof value == 'string' ||
  13058. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  13059. }
  13060. /**
  13061. * Checks if `value` is classified as a `Symbol` primitive or object.
  13062. *
  13063. * @static
  13064. * @memberOf _
  13065. * @since 4.0.0
  13066. * @category Lang
  13067. * @param {*} value The value to check.
  13068. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  13069. * @example
  13070. *
  13071. * _.isSymbol(Symbol.iterator);
  13072. * // => true
  13073. *
  13074. * _.isSymbol('abc');
  13075. * // => false
  13076. */
  13077. function isSymbol(value) {
  13078. return typeof value == 'symbol' ||
  13079. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  13080. }
  13081. /**
  13082. * Checks if `value` is classified as a typed array.
  13083. *
  13084. * @static
  13085. * @memberOf _
  13086. * @since 3.0.0
  13087. * @category Lang
  13088. * @param {*} value The value to check.
  13089. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  13090. * @example
  13091. *
  13092. * _.isTypedArray(new Uint8Array);
  13093. * // => true
  13094. *
  13095. * _.isTypedArray([]);
  13096. * // => false
  13097. */
  13098. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  13099. /**
  13100. * Checks if `value` is `undefined`.
  13101. *
  13102. * @static
  13103. * @since 0.1.0
  13104. * @memberOf _
  13105. * @category Lang
  13106. * @param {*} value The value to check.
  13107. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  13108. * @example
  13109. *
  13110. * _.isUndefined(void 0);
  13111. * // => true
  13112. *
  13113. * _.isUndefined(null);
  13114. * // => false
  13115. */
  13116. function isUndefined(value) {
  13117. return value === undefined;
  13118. }
  13119. /**
  13120. * Checks if `value` is classified as a `WeakMap` object.
  13121. *
  13122. * @static
  13123. * @memberOf _
  13124. * @since 4.3.0
  13125. * @category Lang
  13126. * @param {*} value The value to check.
  13127. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  13128. * @example
  13129. *
  13130. * _.isWeakMap(new WeakMap);
  13131. * // => true
  13132. *
  13133. * _.isWeakMap(new Map);
  13134. * // => false
  13135. */
  13136. function isWeakMap(value) {
  13137. return isObjectLike(value) && getTag(value) == weakMapTag;
  13138. }
  13139. /**
  13140. * Checks if `value` is classified as a `WeakSet` object.
  13141. *
  13142. * @static
  13143. * @memberOf _
  13144. * @since 4.3.0
  13145. * @category Lang
  13146. * @param {*} value The value to check.
  13147. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  13148. * @example
  13149. *
  13150. * _.isWeakSet(new WeakSet);
  13151. * // => true
  13152. *
  13153. * _.isWeakSet(new Set);
  13154. * // => false
  13155. */
  13156. function isWeakSet(value) {
  13157. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  13158. }
  13159. /**
  13160. * Checks if `value` is less than `other`.
  13161. *
  13162. * @static
  13163. * @memberOf _
  13164. * @since 3.9.0
  13165. * @category Lang
  13166. * @param {*} value The value to compare.
  13167. * @param {*} other The other value to compare.
  13168. * @returns {boolean} Returns `true` if `value` is less than `other`,
  13169. * else `false`.
  13170. * @see _.gt
  13171. * @example
  13172. *
  13173. * _.lt(1, 3);
  13174. * // => true
  13175. *
  13176. * _.lt(3, 3);
  13177. * // => false
  13178. *
  13179. * _.lt(3, 1);
  13180. * // => false
  13181. */
  13182. var lt = createRelationalOperation(baseLt);
  13183. /**
  13184. * Checks if `value` is less than or equal to `other`.
  13185. *
  13186. * @static
  13187. * @memberOf _
  13188. * @since 3.9.0
  13189. * @category Lang
  13190. * @param {*} value The value to compare.
  13191. * @param {*} other The other value to compare.
  13192. * @returns {boolean} Returns `true` if `value` is less than or equal to
  13193. * `other`, else `false`.
  13194. * @see _.gte
  13195. * @example
  13196. *
  13197. * _.lte(1, 3);
  13198. * // => true
  13199. *
  13200. * _.lte(3, 3);
  13201. * // => true
  13202. *
  13203. * _.lte(3, 1);
  13204. * // => false
  13205. */
  13206. var lte = createRelationalOperation(function(value, other) {
  13207. return value <= other;
  13208. });
  13209. /**
  13210. * Converts `value` to an array.
  13211. *
  13212. * @static
  13213. * @since 0.1.0
  13214. * @memberOf _
  13215. * @category Lang
  13216. * @param {*} value The value to convert.
  13217. * @returns {Array} Returns the converted array.
  13218. * @example
  13219. *
  13220. * _.toArray({ 'a': 1, 'b': 2 });
  13221. * // => [1, 2]
  13222. *
  13223. * _.toArray('abc');
  13224. * // => ['a', 'b', 'c']
  13225. *
  13226. * _.toArray(1);
  13227. * // => []
  13228. *
  13229. * _.toArray(null);
  13230. * // => []
  13231. */
  13232. function toArray(value) {
  13233. if (!value) {
  13234. return [];
  13235. }
  13236. if (isArrayLike(value)) {
  13237. return isString(value) ? stringToArray(value) : copyArray(value);
  13238. }
  13239. if (symIterator && value[symIterator]) {
  13240. return iteratorToArray(value[symIterator]());
  13241. }
  13242. var tag = getTag(value),
  13243. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  13244. return func(value);
  13245. }
  13246. /**
  13247. * Converts `value` to a finite number.
  13248. *
  13249. * @static
  13250. * @memberOf _
  13251. * @since 4.12.0
  13252. * @category Lang
  13253. * @param {*} value The value to convert.
  13254. * @returns {number} Returns the converted number.
  13255. * @example
  13256. *
  13257. * _.toFinite(3.2);
  13258. * // => 3.2
  13259. *
  13260. * _.toFinite(Number.MIN_VALUE);
  13261. * // => 5e-324
  13262. *
  13263. * _.toFinite(Infinity);
  13264. * // => 1.7976931348623157e+308
  13265. *
  13266. * _.toFinite('3.2');
  13267. * // => 3.2
  13268. */
  13269. function toFinite(value) {
  13270. if (!value) {
  13271. return value === 0 ? value : 0;
  13272. }
  13273. value = toNumber(value);
  13274. if (value === INFINITY || value === -INFINITY) {
  13275. var sign = (value < 0 ? -1 : 1);
  13276. return sign * MAX_INTEGER;
  13277. }
  13278. return value === value ? value : 0;
  13279. }
  13280. /**
  13281. * Converts `value` to an integer.
  13282. *
  13283. * **Note:** This method is loosely based on
  13284. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  13285. *
  13286. * @static
  13287. * @memberOf _
  13288. * @since 4.0.0
  13289. * @category Lang
  13290. * @param {*} value The value to convert.
  13291. * @returns {number} Returns the converted integer.
  13292. * @example
  13293. *
  13294. * _.toInteger(3.2);
  13295. * // => 3
  13296. *
  13297. * _.toInteger(Number.MIN_VALUE);
  13298. * // => 0
  13299. *
  13300. * _.toInteger(Infinity);
  13301. * // => 1.7976931348623157e+308
  13302. *
  13303. * _.toInteger('3.2');
  13304. * // => 3
  13305. */
  13306. function toInteger(value) {
  13307. var result = toFinite(value),
  13308. remainder = result % 1;
  13309. return result === result ? (remainder ? result - remainder : result) : 0;
  13310. }
  13311. /**
  13312. * Converts `value` to an integer suitable for use as the length of an
  13313. * array-like object.
  13314. *
  13315. * **Note:** This method is based on
  13316. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  13317. *
  13318. * @static
  13319. * @memberOf _
  13320. * @since 4.0.0
  13321. * @category Lang
  13322. * @param {*} value The value to convert.
  13323. * @returns {number} Returns the converted integer.
  13324. * @example
  13325. *
  13326. * _.toLength(3.2);
  13327. * // => 3
  13328. *
  13329. * _.toLength(Number.MIN_VALUE);
  13330. * // => 0
  13331. *
  13332. * _.toLength(Infinity);
  13333. * // => 4294967295
  13334. *
  13335. * _.toLength('3.2');
  13336. * // => 3
  13337. */
  13338. function toLength(value) {
  13339. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  13340. }
  13341. /**
  13342. * Converts `value` to a number.
  13343. *
  13344. * @static
  13345. * @memberOf _
  13346. * @since 4.0.0
  13347. * @category Lang
  13348. * @param {*} value The value to process.
  13349. * @returns {number} Returns the number.
  13350. * @example
  13351. *
  13352. * _.toNumber(3.2);
  13353. * // => 3.2
  13354. *
  13355. * _.toNumber(Number.MIN_VALUE);
  13356. * // => 5e-324
  13357. *
  13358. * _.toNumber(Infinity);
  13359. * // => Infinity
  13360. *
  13361. * _.toNumber('3.2');
  13362. * // => 3.2
  13363. */
  13364. function toNumber(value) {
  13365. if (typeof value == 'number') {
  13366. return value;
  13367. }
  13368. if (isSymbol(value)) {
  13369. return NAN;
  13370. }
  13371. if (isObject(value)) {
  13372. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  13373. value = isObject(other) ? (other + '') : other;
  13374. }
  13375. if (typeof value != 'string') {
  13376. return value === 0 ? value : +value;
  13377. }
  13378. value = baseTrim(value);
  13379. var isBinary = reIsBinary.test(value);
  13380. return (isBinary || reIsOctal.test(value))
  13381. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  13382. : (reIsBadHex.test(value) ? NAN : +value);
  13383. }
  13384. /**
  13385. * Converts `value` to a plain object flattening inherited enumerable string
  13386. * keyed properties of `value` to own properties of the plain object.
  13387. *
  13388. * @static
  13389. * @memberOf _
  13390. * @since 3.0.0
  13391. * @category Lang
  13392. * @param {*} value The value to convert.
  13393. * @returns {Object} Returns the converted plain object.
  13394. * @example
  13395. *
  13396. * function Foo() {
  13397. * this.b = 2;
  13398. * }
  13399. *
  13400. * Foo.prototype.c = 3;
  13401. *
  13402. * _.assign({ 'a': 1 }, new Foo);
  13403. * // => { 'a': 1, 'b': 2 }
  13404. *
  13405. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  13406. * // => { 'a': 1, 'b': 2, 'c': 3 }
  13407. */
  13408. function toPlainObject(value) {
  13409. return copyObject(value, keysIn(value));
  13410. }
  13411. /**
  13412. * Converts `value` to a safe integer. A safe integer can be compared and
  13413. * represented correctly.
  13414. *
  13415. * @static
  13416. * @memberOf _
  13417. * @since 4.0.0
  13418. * @category Lang
  13419. * @param {*} value The value to convert.
  13420. * @returns {number} Returns the converted integer.
  13421. * @example
  13422. *
  13423. * _.toSafeInteger(3.2);
  13424. * // => 3
  13425. *
  13426. * _.toSafeInteger(Number.MIN_VALUE);
  13427. * // => 0
  13428. *
  13429. * _.toSafeInteger(Infinity);
  13430. * // => 9007199254740991
  13431. *
  13432. * _.toSafeInteger('3.2');
  13433. * // => 3
  13434. */
  13435. function toSafeInteger(value) {
  13436. return value
  13437. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  13438. : (value === 0 ? value : 0);
  13439. }
  13440. /**
  13441. * Converts `value` to a string. An empty string is returned for `null`
  13442. * and `undefined` values. The sign of `-0` is preserved.
  13443. *
  13444. * @static
  13445. * @memberOf _
  13446. * @since 4.0.0
  13447. * @category Lang
  13448. * @param {*} value The value to convert.
  13449. * @returns {string} Returns the converted string.
  13450. * @example
  13451. *
  13452. * _.toString(null);
  13453. * // => ''
  13454. *
  13455. * _.toString(-0);
  13456. * // => '-0'
  13457. *
  13458. * _.toString([1, 2, 3]);
  13459. * // => '1,2,3'
  13460. */
  13461. function toString(value) {
  13462. return value == null ? '' : baseToString(value);
  13463. }
  13464. /*------------------------------------------------------------------------*/
  13465. /**
  13466. * Assigns own enumerable string keyed properties of source objects to the
  13467. * destination object. Source objects are applied from left to right.
  13468. * Subsequent sources overwrite property assignments of previous sources.
  13469. *
  13470. * **Note:** This method mutates `object` and is loosely based on
  13471. * [`Object.assign`](https://mdn.io/Object/assign).
  13472. *
  13473. * @static
  13474. * @memberOf _
  13475. * @since 0.10.0
  13476. * @category Object
  13477. * @param {Object} object The destination object.
  13478. * @param {...Object} [sources] The source objects.
  13479. * @returns {Object} Returns `object`.
  13480. * @see _.assignIn
  13481. * @example
  13482. *
  13483. * function Foo() {
  13484. * this.a = 1;
  13485. * }
  13486. *
  13487. * function Bar() {
  13488. * this.c = 3;
  13489. * }
  13490. *
  13491. * Foo.prototype.b = 2;
  13492. * Bar.prototype.d = 4;
  13493. *
  13494. * _.assign({ 'a': 0 }, new Foo, new Bar);
  13495. * // => { 'a': 1, 'c': 3 }
  13496. */
  13497. var assign = createAssigner(function(object, source) {
  13498. if (isPrototype(source) || isArrayLike(source)) {
  13499. copyObject(source, keys(source), object);
  13500. return;
  13501. }
  13502. for (var key in source) {
  13503. if (hasOwnProperty.call(source, key)) {
  13504. assignValue(object, key, source[key]);
  13505. }
  13506. }
  13507. });
  13508. /**
  13509. * This method is like `_.assign` except that it iterates over own and
  13510. * inherited source properties.
  13511. *
  13512. * **Note:** This method mutates `object`.
  13513. *
  13514. * @static
  13515. * @memberOf _
  13516. * @since 4.0.0
  13517. * @alias extend
  13518. * @category Object
  13519. * @param {Object} object The destination object.
  13520. * @param {...Object} [sources] The source objects.
  13521. * @returns {Object} Returns `object`.
  13522. * @see _.assign
  13523. * @example
  13524. *
  13525. * function Foo() {
  13526. * this.a = 1;
  13527. * }
  13528. *
  13529. * function Bar() {
  13530. * this.c = 3;
  13531. * }
  13532. *
  13533. * Foo.prototype.b = 2;
  13534. * Bar.prototype.d = 4;
  13535. *
  13536. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  13537. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  13538. */
  13539. var assignIn = createAssigner(function(object, source) {
  13540. copyObject(source, keysIn(source), object);
  13541. });
  13542. /**
  13543. * This method is like `_.assignIn` except that it accepts `customizer`
  13544. * which is invoked to produce the assigned values. If `customizer` returns
  13545. * `undefined`, assignment is handled by the method instead. The `customizer`
  13546. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13547. *
  13548. * **Note:** This method mutates `object`.
  13549. *
  13550. * @static
  13551. * @memberOf _
  13552. * @since 4.0.0
  13553. * @alias extendWith
  13554. * @category Object
  13555. * @param {Object} object The destination object.
  13556. * @param {...Object} sources The source objects.
  13557. * @param {Function} [customizer] The function to customize assigned values.
  13558. * @returns {Object} Returns `object`.
  13559. * @see _.assignWith
  13560. * @example
  13561. *
  13562. * function customizer(objValue, srcValue) {
  13563. * return _.isUndefined(objValue) ? srcValue : objValue;
  13564. * }
  13565. *
  13566. * var defaults = _.partialRight(_.assignInWith, customizer);
  13567. *
  13568. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13569. * // => { 'a': 1, 'b': 2 }
  13570. */
  13571. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  13572. copyObject(source, keysIn(source), object, customizer);
  13573. });
  13574. /**
  13575. * This method is like `_.assign` except that it accepts `customizer`
  13576. * which is invoked to produce the assigned values. If `customizer` returns
  13577. * `undefined`, assignment is handled by the method instead. The `customizer`
  13578. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13579. *
  13580. * **Note:** This method mutates `object`.
  13581. *
  13582. * @static
  13583. * @memberOf _
  13584. * @since 4.0.0
  13585. * @category Object
  13586. * @param {Object} object The destination object.
  13587. * @param {...Object} sources The source objects.
  13588. * @param {Function} [customizer] The function to customize assigned values.
  13589. * @returns {Object} Returns `object`.
  13590. * @see _.assignInWith
  13591. * @example
  13592. *
  13593. * function customizer(objValue, srcValue) {
  13594. * return _.isUndefined(objValue) ? srcValue : objValue;
  13595. * }
  13596. *
  13597. * var defaults = _.partialRight(_.assignWith, customizer);
  13598. *
  13599. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13600. * // => { 'a': 1, 'b': 2 }
  13601. */
  13602. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  13603. copyObject(source, keys(source), object, customizer);
  13604. });
  13605. /**
  13606. * Creates an array of values corresponding to `paths` of `object`.
  13607. *
  13608. * @static
  13609. * @memberOf _
  13610. * @since 1.0.0
  13611. * @category Object
  13612. * @param {Object} object The object to iterate over.
  13613. * @param {...(string|string[])} [paths] The property paths to pick.
  13614. * @returns {Array} Returns the picked values.
  13615. * @example
  13616. *
  13617. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  13618. *
  13619. * _.at(object, ['a[0].b.c', 'a[1]']);
  13620. * // => [3, 4]
  13621. */
  13622. var at = flatRest(baseAt);
  13623. /**
  13624. * Creates an object that inherits from the `prototype` object. If a
  13625. * `properties` object is given, its own enumerable string keyed properties
  13626. * are assigned to the created object.
  13627. *
  13628. * @static
  13629. * @memberOf _
  13630. * @since 2.3.0
  13631. * @category Object
  13632. * @param {Object} prototype The object to inherit from.
  13633. * @param {Object} [properties] The properties to assign to the object.
  13634. * @returns {Object} Returns the new object.
  13635. * @example
  13636. *
  13637. * function Shape() {
  13638. * this.x = 0;
  13639. * this.y = 0;
  13640. * }
  13641. *
  13642. * function Circle() {
  13643. * Shape.call(this);
  13644. * }
  13645. *
  13646. * Circle.prototype = _.create(Shape.prototype, {
  13647. * 'constructor': Circle
  13648. * });
  13649. *
  13650. * var circle = new Circle;
  13651. * circle instanceof Circle;
  13652. * // => true
  13653. *
  13654. * circle instanceof Shape;
  13655. * // => true
  13656. */
  13657. function create(prototype, properties) {
  13658. var result = baseCreate(prototype);
  13659. return properties == null ? result : baseAssign(result, properties);
  13660. }
  13661. /**
  13662. * Assigns own and inherited enumerable string keyed properties of source
  13663. * objects to the destination object for all destination properties that
  13664. * resolve to `undefined`. Source objects are applied from left to right.
  13665. * Once a property is set, additional values of the same property are ignored.
  13666. *
  13667. * **Note:** This method mutates `object`.
  13668. *
  13669. * @static
  13670. * @since 0.1.0
  13671. * @memberOf _
  13672. * @category Object
  13673. * @param {Object} object The destination object.
  13674. * @param {...Object} [sources] The source objects.
  13675. * @returns {Object} Returns `object`.
  13676. * @see _.defaultsDeep
  13677. * @example
  13678. *
  13679. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13680. * // => { 'a': 1, 'b': 2 }
  13681. */
  13682. var defaults = baseRest(function(object, sources) {
  13683. object = Object(object);
  13684. var index = -1;
  13685. var length = sources.length;
  13686. var guard = length > 2 ? sources[2] : undefined;
  13687. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13688. length = 1;
  13689. }
  13690. while (++index < length) {
  13691. var source = sources[index];
  13692. var props = keysIn(source);
  13693. var propsIndex = -1;
  13694. var propsLength = props.length;
  13695. while (++propsIndex < propsLength) {
  13696. var key = props[propsIndex];
  13697. var value = object[key];
  13698. if (value === undefined ||
  13699. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  13700. object[key] = source[key];
  13701. }
  13702. }
  13703. }
  13704. return object;
  13705. });
  13706. /**
  13707. * This method is like `_.defaults` except that it recursively assigns
  13708. * default properties.
  13709. *
  13710. * **Note:** This method mutates `object`.
  13711. *
  13712. * @static
  13713. * @memberOf _
  13714. * @since 3.10.0
  13715. * @category Object
  13716. * @param {Object} object The destination object.
  13717. * @param {...Object} [sources] The source objects.
  13718. * @returns {Object} Returns `object`.
  13719. * @see _.defaults
  13720. * @example
  13721. *
  13722. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  13723. * // => { 'a': { 'b': 2, 'c': 3 } }
  13724. */
  13725. var defaultsDeep = baseRest(function(args) {
  13726. args.push(undefined, customDefaultsMerge);
  13727. return apply(mergeWith, undefined, args);
  13728. });
  13729. /**
  13730. * This method is like `_.find` except that it returns the key of the first
  13731. * element `predicate` returns truthy for instead of the element itself.
  13732. *
  13733. * @static
  13734. * @memberOf _
  13735. * @since 1.1.0
  13736. * @category Object
  13737. * @param {Object} object The object to inspect.
  13738. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13739. * @returns {string|undefined} Returns the key of the matched element,
  13740. * else `undefined`.
  13741. * @example
  13742. *
  13743. * var users = {
  13744. * 'barney': { 'age': 36, 'active': true },
  13745. * 'fred': { 'age': 40, 'active': false },
  13746. * 'pebbles': { 'age': 1, 'active': true }
  13747. * };
  13748. *
  13749. * _.findKey(users, function(o) { return o.age < 40; });
  13750. * // => 'barney' (iteration order is not guaranteed)
  13751. *
  13752. * // The `_.matches` iteratee shorthand.
  13753. * _.findKey(users, { 'age': 1, 'active': true });
  13754. * // => 'pebbles'
  13755. *
  13756. * // The `_.matchesProperty` iteratee shorthand.
  13757. * _.findKey(users, ['active', false]);
  13758. * // => 'fred'
  13759. *
  13760. * // The `_.property` iteratee shorthand.
  13761. * _.findKey(users, 'active');
  13762. * // => 'barney'
  13763. */
  13764. function findKey(object, predicate) {
  13765. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  13766. }
  13767. /**
  13768. * This method is like `_.findKey` except that it iterates over elements of
  13769. * a collection in the opposite order.
  13770. *
  13771. * @static
  13772. * @memberOf _
  13773. * @since 2.0.0
  13774. * @category Object
  13775. * @param {Object} object The object to inspect.
  13776. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13777. * @returns {string|undefined} Returns the key of the matched element,
  13778. * else `undefined`.
  13779. * @example
  13780. *
  13781. * var users = {
  13782. * 'barney': { 'age': 36, 'active': true },
  13783. * 'fred': { 'age': 40, 'active': false },
  13784. * 'pebbles': { 'age': 1, 'active': true }
  13785. * };
  13786. *
  13787. * _.findLastKey(users, function(o) { return o.age < 40; });
  13788. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  13789. *
  13790. * // The `_.matches` iteratee shorthand.
  13791. * _.findLastKey(users, { 'age': 36, 'active': true });
  13792. * // => 'barney'
  13793. *
  13794. * // The `_.matchesProperty` iteratee shorthand.
  13795. * _.findLastKey(users, ['active', false]);
  13796. * // => 'fred'
  13797. *
  13798. * // The `_.property` iteratee shorthand.
  13799. * _.findLastKey(users, 'active');
  13800. * // => 'pebbles'
  13801. */
  13802. function findLastKey(object, predicate) {
  13803. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  13804. }
  13805. /**
  13806. * Iterates over own and inherited enumerable string keyed properties of an
  13807. * object and invokes `iteratee` for each property. The iteratee is invoked
  13808. * with three arguments: (value, key, object). Iteratee functions may exit
  13809. * iteration early by explicitly returning `false`.
  13810. *
  13811. * @static
  13812. * @memberOf _
  13813. * @since 0.3.0
  13814. * @category Object
  13815. * @param {Object} object The object to iterate over.
  13816. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13817. * @returns {Object} Returns `object`.
  13818. * @see _.forInRight
  13819. * @example
  13820. *
  13821. * function Foo() {
  13822. * this.a = 1;
  13823. * this.b = 2;
  13824. * }
  13825. *
  13826. * Foo.prototype.c = 3;
  13827. *
  13828. * _.forIn(new Foo, function(value, key) {
  13829. * console.log(key);
  13830. * });
  13831. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  13832. */
  13833. function forIn(object, iteratee) {
  13834. return object == null
  13835. ? object
  13836. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  13837. }
  13838. /**
  13839. * This method is like `_.forIn` except that it iterates over properties of
  13840. * `object` in the opposite order.
  13841. *
  13842. * @static
  13843. * @memberOf _
  13844. * @since 2.0.0
  13845. * @category Object
  13846. * @param {Object} object The object to iterate over.
  13847. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13848. * @returns {Object} Returns `object`.
  13849. * @see _.forIn
  13850. * @example
  13851. *
  13852. * function Foo() {
  13853. * this.a = 1;
  13854. * this.b = 2;
  13855. * }
  13856. *
  13857. * Foo.prototype.c = 3;
  13858. *
  13859. * _.forInRight(new Foo, function(value, key) {
  13860. * console.log(key);
  13861. * });
  13862. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13863. */
  13864. function forInRight(object, iteratee) {
  13865. return object == null
  13866. ? object
  13867. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13868. }
  13869. /**
  13870. * Iterates over own enumerable string keyed properties of an object and
  13871. * invokes `iteratee` for each property. The iteratee is invoked with three
  13872. * arguments: (value, key, object). Iteratee functions may exit iteration
  13873. * early by explicitly returning `false`.
  13874. *
  13875. * @static
  13876. * @memberOf _
  13877. * @since 0.3.0
  13878. * @category Object
  13879. * @param {Object} object The object to iterate over.
  13880. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13881. * @returns {Object} Returns `object`.
  13882. * @see _.forOwnRight
  13883. * @example
  13884. *
  13885. * function Foo() {
  13886. * this.a = 1;
  13887. * this.b = 2;
  13888. * }
  13889. *
  13890. * Foo.prototype.c = 3;
  13891. *
  13892. * _.forOwn(new Foo, function(value, key) {
  13893. * console.log(key);
  13894. * });
  13895. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13896. */
  13897. function forOwn(object, iteratee) {
  13898. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13899. }
  13900. /**
  13901. * This method is like `_.forOwn` except that it iterates over properties of
  13902. * `object` in the opposite order.
  13903. *
  13904. * @static
  13905. * @memberOf _
  13906. * @since 2.0.0
  13907. * @category Object
  13908. * @param {Object} object The object to iterate over.
  13909. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13910. * @returns {Object} Returns `object`.
  13911. * @see _.forOwn
  13912. * @example
  13913. *
  13914. * function Foo() {
  13915. * this.a = 1;
  13916. * this.b = 2;
  13917. * }
  13918. *
  13919. * Foo.prototype.c = 3;
  13920. *
  13921. * _.forOwnRight(new Foo, function(value, key) {
  13922. * console.log(key);
  13923. * });
  13924. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13925. */
  13926. function forOwnRight(object, iteratee) {
  13927. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13928. }
  13929. /**
  13930. * Creates an array of function property names from own enumerable properties
  13931. * of `object`.
  13932. *
  13933. * @static
  13934. * @since 0.1.0
  13935. * @memberOf _
  13936. * @category Object
  13937. * @param {Object} object The object to inspect.
  13938. * @returns {Array} Returns the function names.
  13939. * @see _.functionsIn
  13940. * @example
  13941. *
  13942. * function Foo() {
  13943. * this.a = _.constant('a');
  13944. * this.b = _.constant('b');
  13945. * }
  13946. *
  13947. * Foo.prototype.c = _.constant('c');
  13948. *
  13949. * _.functions(new Foo);
  13950. * // => ['a', 'b']
  13951. */
  13952. function functions(object) {
  13953. return object == null ? [] : baseFunctions(object, keys(object));
  13954. }
  13955. /**
  13956. * Creates an array of function property names from own and inherited
  13957. * enumerable properties of `object`.
  13958. *
  13959. * @static
  13960. * @memberOf _
  13961. * @since 4.0.0
  13962. * @category Object
  13963. * @param {Object} object The object to inspect.
  13964. * @returns {Array} Returns the function names.
  13965. * @see _.functions
  13966. * @example
  13967. *
  13968. * function Foo() {
  13969. * this.a = _.constant('a');
  13970. * this.b = _.constant('b');
  13971. * }
  13972. *
  13973. * Foo.prototype.c = _.constant('c');
  13974. *
  13975. * _.functionsIn(new Foo);
  13976. * // => ['a', 'b', 'c']
  13977. */
  13978. function functionsIn(object) {
  13979. return object == null ? [] : baseFunctions(object, keysIn(object));
  13980. }
  13981. /**
  13982. * Gets the value at `path` of `object`. If the resolved value is
  13983. * `undefined`, the `defaultValue` is returned in its place.
  13984. *
  13985. * @static
  13986. * @memberOf _
  13987. * @since 3.7.0
  13988. * @category Object
  13989. * @param {Object} object The object to query.
  13990. * @param {Array|string} path The path of the property to get.
  13991. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13992. * @returns {*} Returns the resolved value.
  13993. * @example
  13994. *
  13995. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13996. *
  13997. * _.get(object, 'a[0].b.c');
  13998. * // => 3
  13999. *
  14000. * _.get(object, ['a', '0', 'b', 'c']);
  14001. * // => 3
  14002. *
  14003. * _.get(object, 'a.b.c', 'default');
  14004. * // => 'default'
  14005. */
  14006. function get(object, path, defaultValue) {
  14007. var result = object == null ? undefined : baseGet(object, path);
  14008. return result === undefined ? defaultValue : result;
  14009. }
  14010. /**
  14011. * Checks if `path` is a direct property of `object`.
  14012. *
  14013. * @static
  14014. * @since 0.1.0
  14015. * @memberOf _
  14016. * @category Object
  14017. * @param {Object} object The object to query.
  14018. * @param {Array|string} path The path to check.
  14019. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14020. * @example
  14021. *
  14022. * var object = { 'a': { 'b': 2 } };
  14023. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  14024. *
  14025. * _.has(object, 'a');
  14026. * // => true
  14027. *
  14028. * _.has(object, 'a.b');
  14029. * // => true
  14030. *
  14031. * _.has(object, ['a', 'b']);
  14032. * // => true
  14033. *
  14034. * _.has(other, 'a');
  14035. * // => false
  14036. */
  14037. function has(object, path) {
  14038. return object != null && hasPath(object, path, baseHas);
  14039. }
  14040. /**
  14041. * Checks if `path` is a direct or inherited property of `object`.
  14042. *
  14043. * @static
  14044. * @memberOf _
  14045. * @since 4.0.0
  14046. * @category Object
  14047. * @param {Object} object The object to query.
  14048. * @param {Array|string} path The path to check.
  14049. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14050. * @example
  14051. *
  14052. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  14053. *
  14054. * _.hasIn(object, 'a');
  14055. * // => true
  14056. *
  14057. * _.hasIn(object, 'a.b');
  14058. * // => true
  14059. *
  14060. * _.hasIn(object, ['a', 'b']);
  14061. * // => true
  14062. *
  14063. * _.hasIn(object, 'b');
  14064. * // => false
  14065. */
  14066. function hasIn(object, path) {
  14067. return object != null && hasPath(object, path, baseHasIn);
  14068. }
  14069. /**
  14070. * Creates an object composed of the inverted keys and values of `object`.
  14071. * If `object` contains duplicate values, subsequent values overwrite
  14072. * property assignments of previous values.
  14073. *
  14074. * @static
  14075. * @memberOf _
  14076. * @since 0.7.0
  14077. * @category Object
  14078. * @param {Object} object The object to invert.
  14079. * @returns {Object} Returns the new inverted object.
  14080. * @example
  14081. *
  14082. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  14083. *
  14084. * _.invert(object);
  14085. * // => { '1': 'c', '2': 'b' }
  14086. */
  14087. var invert = createInverter(function(result, value, key) {
  14088. if (value != null &&
  14089. typeof value.toString != 'function') {
  14090. value = nativeObjectToString.call(value);
  14091. }
  14092. result[value] = key;
  14093. }, constant(identity));
  14094. /**
  14095. * This method is like `_.invert` except that the inverted object is generated
  14096. * from the results of running each element of `object` thru `iteratee`. The
  14097. * corresponding inverted value of each inverted key is an array of keys
  14098. * responsible for generating the inverted value. The iteratee is invoked
  14099. * with one argument: (value).
  14100. *
  14101. * @static
  14102. * @memberOf _
  14103. * @since 4.1.0
  14104. * @category Object
  14105. * @param {Object} object The object to invert.
  14106. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  14107. * @returns {Object} Returns the new inverted object.
  14108. * @example
  14109. *
  14110. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  14111. *
  14112. * _.invertBy(object);
  14113. * // => { '1': ['a', 'c'], '2': ['b'] }
  14114. *
  14115. * _.invertBy(object, function(value) {
  14116. * return 'group' + value;
  14117. * });
  14118. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  14119. */
  14120. var invertBy = createInverter(function(result, value, key) {
  14121. if (value != null &&
  14122. typeof value.toString != 'function') {
  14123. value = nativeObjectToString.call(value);
  14124. }
  14125. if (hasOwnProperty.call(result, value)) {
  14126. result[value].push(key);
  14127. } else {
  14128. result[value] = [key];
  14129. }
  14130. }, getIteratee);
  14131. /**
  14132. * Invokes the method at `path` of `object`.
  14133. *
  14134. * @static
  14135. * @memberOf _
  14136. * @since 4.0.0
  14137. * @category Object
  14138. * @param {Object} object The object to query.
  14139. * @param {Array|string} path The path of the method to invoke.
  14140. * @param {...*} [args] The arguments to invoke the method with.
  14141. * @returns {*} Returns the result of the invoked method.
  14142. * @example
  14143. *
  14144. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  14145. *
  14146. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  14147. * // => [2, 3]
  14148. */
  14149. var invoke = baseRest(baseInvoke);
  14150. /**
  14151. * Creates an array of the own enumerable property names of `object`.
  14152. *
  14153. * **Note:** Non-object values are coerced to objects. See the
  14154. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  14155. * for more details.
  14156. *
  14157. * @static
  14158. * @since 0.1.0
  14159. * @memberOf _
  14160. * @category Object
  14161. * @param {Object} object The object to query.
  14162. * @returns {Array} Returns the array of property names.
  14163. * @example
  14164. *
  14165. * function Foo() {
  14166. * this.a = 1;
  14167. * this.b = 2;
  14168. * }
  14169. *
  14170. * Foo.prototype.c = 3;
  14171. *
  14172. * _.keys(new Foo);
  14173. * // => ['a', 'b'] (iteration order is not guaranteed)
  14174. *
  14175. * _.keys('hi');
  14176. * // => ['0', '1']
  14177. */
  14178. function keys(object) {
  14179. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14180. }
  14181. /**
  14182. * Creates an array of the own and inherited enumerable property names of `object`.
  14183. *
  14184. * **Note:** Non-object values are coerced to objects.
  14185. *
  14186. * @static
  14187. * @memberOf _
  14188. * @since 3.0.0
  14189. * @category Object
  14190. * @param {Object} object The object to query.
  14191. * @returns {Array} Returns the array of property names.
  14192. * @example
  14193. *
  14194. * function Foo() {
  14195. * this.a = 1;
  14196. * this.b = 2;
  14197. * }
  14198. *
  14199. * Foo.prototype.c = 3;
  14200. *
  14201. * _.keysIn(new Foo);
  14202. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  14203. */
  14204. function keysIn(object) {
  14205. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  14206. }
  14207. /**
  14208. * The opposite of `_.mapValues`; this method creates an object with the
  14209. * same values as `object` and keys generated by running each own enumerable
  14210. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  14211. * with three arguments: (value, key, object).
  14212. *
  14213. * @static
  14214. * @memberOf _
  14215. * @since 3.8.0
  14216. * @category Object
  14217. * @param {Object} object The object to iterate over.
  14218. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14219. * @returns {Object} Returns the new mapped object.
  14220. * @see _.mapValues
  14221. * @example
  14222. *
  14223. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  14224. * return key + value;
  14225. * });
  14226. * // => { 'a1': 1, 'b2': 2 }
  14227. */
  14228. function mapKeys(object, iteratee) {
  14229. var result = {};
  14230. iteratee = getIteratee(iteratee, 3);
  14231. baseForOwn(object, function(value, key, object) {
  14232. baseAssignValue(result, iteratee(value, key, object), value);
  14233. });
  14234. return result;
  14235. }
  14236. /**
  14237. * Creates an object with the same keys as `object` and values generated
  14238. * by running each own enumerable string keyed property of `object` thru
  14239. * `iteratee`. The iteratee is invoked with three arguments:
  14240. * (value, key, object).
  14241. *
  14242. * @static
  14243. * @memberOf _
  14244. * @since 2.4.0
  14245. * @category Object
  14246. * @param {Object} object The object to iterate over.
  14247. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14248. * @returns {Object} Returns the new mapped object.
  14249. * @see _.mapKeys
  14250. * @example
  14251. *
  14252. * var users = {
  14253. * 'fred': { 'user': 'fred', 'age': 40 },
  14254. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  14255. * };
  14256. *
  14257. * _.mapValues(users, function(o) { return o.age; });
  14258. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  14259. *
  14260. * // The `_.property` iteratee shorthand.
  14261. * _.mapValues(users, 'age');
  14262. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  14263. */
  14264. function mapValues(object, iteratee) {
  14265. var result = {};
  14266. iteratee = getIteratee(iteratee, 3);
  14267. baseForOwn(object, function(value, key, object) {
  14268. baseAssignValue(result, key, iteratee(value, key, object));
  14269. });
  14270. return result;
  14271. }
  14272. /**
  14273. * This method is like `_.assign` except that it recursively merges own and
  14274. * inherited enumerable string keyed properties of source objects into the
  14275. * destination object. Source properties that resolve to `undefined` are
  14276. * skipped if a destination value exists. Array and plain object properties
  14277. * are merged recursively. Other objects and value types are overridden by
  14278. * assignment. Source objects are applied from left to right. Subsequent
  14279. * sources overwrite property assignments of previous sources.
  14280. *
  14281. * **Note:** This method mutates `object`.
  14282. *
  14283. * @static
  14284. * @memberOf _
  14285. * @since 0.5.0
  14286. * @category Object
  14287. * @param {Object} object The destination object.
  14288. * @param {...Object} [sources] The source objects.
  14289. * @returns {Object} Returns `object`.
  14290. * @example
  14291. *
  14292. * var object = {
  14293. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  14294. * };
  14295. *
  14296. * var other = {
  14297. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  14298. * };
  14299. *
  14300. * _.merge(object, other);
  14301. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  14302. */
  14303. var merge = createAssigner(function(object, source, srcIndex) {
  14304. baseMerge(object, source, srcIndex);
  14305. });
  14306. /**
  14307. * This method is like `_.merge` except that it accepts `customizer` which
  14308. * is invoked to produce the merged values of the destination and source
  14309. * properties. If `customizer` returns `undefined`, merging is handled by the
  14310. * method instead. The `customizer` is invoked with six arguments:
  14311. * (objValue, srcValue, key, object, source, stack).
  14312. *
  14313. * **Note:** This method mutates `object`.
  14314. *
  14315. * @static
  14316. * @memberOf _
  14317. * @since 4.0.0
  14318. * @category Object
  14319. * @param {Object} object The destination object.
  14320. * @param {...Object} sources The source objects.
  14321. * @param {Function} customizer The function to customize assigned values.
  14322. * @returns {Object} Returns `object`.
  14323. * @example
  14324. *
  14325. * function customizer(objValue, srcValue) {
  14326. * if (_.isArray(objValue)) {
  14327. * return objValue.concat(srcValue);
  14328. * }
  14329. * }
  14330. *
  14331. * var object = { 'a': [1], 'b': [2] };
  14332. * var other = { 'a': [3], 'b': [4] };
  14333. *
  14334. * _.mergeWith(object, other, customizer);
  14335. * // => { 'a': [1, 3], 'b': [2, 4] }
  14336. */
  14337. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  14338. baseMerge(object, source, srcIndex, customizer);
  14339. });
  14340. /**
  14341. * The opposite of `_.pick`; this method creates an object composed of the
  14342. * own and inherited enumerable property paths of `object` that are not omitted.
  14343. *
  14344. * **Note:** This method is considerably slower than `_.pick`.
  14345. *
  14346. * @static
  14347. * @since 0.1.0
  14348. * @memberOf _
  14349. * @category Object
  14350. * @param {Object} object The source object.
  14351. * @param {...(string|string[])} [paths] The property paths to omit.
  14352. * @returns {Object} Returns the new object.
  14353. * @example
  14354. *
  14355. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14356. *
  14357. * _.omit(object, ['a', 'c']);
  14358. * // => { 'b': '2' }
  14359. */
  14360. var omit = flatRest(function(object, paths) {
  14361. var result = {};
  14362. if (object == null) {
  14363. return result;
  14364. }
  14365. var isDeep = false;
  14366. paths = arrayMap(paths, function(path) {
  14367. path = castPath(path, object);
  14368. isDeep || (isDeep = path.length > 1);
  14369. return path;
  14370. });
  14371. copyObject(object, getAllKeysIn(object), result);
  14372. if (isDeep) {
  14373. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  14374. }
  14375. var length = paths.length;
  14376. while (length--) {
  14377. baseUnset(result, paths[length]);
  14378. }
  14379. return result;
  14380. });
  14381. /**
  14382. * The opposite of `_.pickBy`; this method creates an object composed of
  14383. * the own and inherited enumerable string keyed properties of `object` that
  14384. * `predicate` doesn't return truthy for. The predicate is invoked with two
  14385. * arguments: (value, key).
  14386. *
  14387. * @static
  14388. * @memberOf _
  14389. * @since 4.0.0
  14390. * @category Object
  14391. * @param {Object} object The source object.
  14392. * @param {Function} [predicate=_.identity] The function invoked per property.
  14393. * @returns {Object} Returns the new object.
  14394. * @example
  14395. *
  14396. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14397. *
  14398. * _.omitBy(object, _.isNumber);
  14399. * // => { 'b': '2' }
  14400. */
  14401. function omitBy(object, predicate) {
  14402. return pickBy(object, negate(getIteratee(predicate)));
  14403. }
  14404. /**
  14405. * Creates an object composed of the picked `object` properties.
  14406. *
  14407. * @static
  14408. * @since 0.1.0
  14409. * @memberOf _
  14410. * @category Object
  14411. * @param {Object} object The source object.
  14412. * @param {...(string|string[])} [paths] The property paths to pick.
  14413. * @returns {Object} Returns the new object.
  14414. * @example
  14415. *
  14416. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14417. *
  14418. * _.pick(object, ['a', 'c']);
  14419. * // => { 'a': 1, 'c': 3 }
  14420. */
  14421. var pick = flatRest(function(object, paths) {
  14422. return object == null ? {} : basePick(object, paths);
  14423. });
  14424. /**
  14425. * Creates an object composed of the `object` properties `predicate` returns
  14426. * truthy for. The predicate is invoked with two arguments: (value, key).
  14427. *
  14428. * @static
  14429. * @memberOf _
  14430. * @since 4.0.0
  14431. * @category Object
  14432. * @param {Object} object The source object.
  14433. * @param {Function} [predicate=_.identity] The function invoked per property.
  14434. * @returns {Object} Returns the new object.
  14435. * @example
  14436. *
  14437. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14438. *
  14439. * _.pickBy(object, _.isNumber);
  14440. * // => { 'a': 1, 'c': 3 }
  14441. */
  14442. function pickBy(object, predicate) {
  14443. if (object == null) {
  14444. return {};
  14445. }
  14446. var props = arrayMap(getAllKeysIn(object), function(prop) {
  14447. return [prop];
  14448. });
  14449. predicate = getIteratee(predicate);
  14450. return basePickBy(object, props, function(value, path) {
  14451. return predicate(value, path[0]);
  14452. });
  14453. }
  14454. /**
  14455. * This method is like `_.get` except that if the resolved value is a
  14456. * function it's invoked with the `this` binding of its parent object and
  14457. * its result is returned.
  14458. *
  14459. * @static
  14460. * @since 0.1.0
  14461. * @memberOf _
  14462. * @category Object
  14463. * @param {Object} object The object to query.
  14464. * @param {Array|string} path The path of the property to resolve.
  14465. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14466. * @returns {*} Returns the resolved value.
  14467. * @example
  14468. *
  14469. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  14470. *
  14471. * _.result(object, 'a[0].b.c1');
  14472. * // => 3
  14473. *
  14474. * _.result(object, 'a[0].b.c2');
  14475. * // => 4
  14476. *
  14477. * _.result(object, 'a[0].b.c3', 'default');
  14478. * // => 'default'
  14479. *
  14480. * _.result(object, 'a[0].b.c3', _.constant('default'));
  14481. * // => 'default'
  14482. */
  14483. function result(object, path, defaultValue) {
  14484. path = castPath(path, object);
  14485. var index = -1,
  14486. length = path.length;
  14487. // Ensure the loop is entered when path is empty.
  14488. if (!length) {
  14489. length = 1;
  14490. object = undefined;
  14491. }
  14492. while (++index < length) {
  14493. var value = object == null ? undefined : object[toKey(path[index])];
  14494. if (value === undefined) {
  14495. index = length;
  14496. value = defaultValue;
  14497. }
  14498. object = isFunction(value) ? value.call(object) : value;
  14499. }
  14500. return object;
  14501. }
  14502. /**
  14503. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  14504. * it's created. Arrays are created for missing index properties while objects
  14505. * are created for all other missing properties. Use `_.setWith` to customize
  14506. * `path` creation.
  14507. *
  14508. * **Note:** This method mutates `object`.
  14509. *
  14510. * @static
  14511. * @memberOf _
  14512. * @since 3.7.0
  14513. * @category Object
  14514. * @param {Object} object The object to modify.
  14515. * @param {Array|string} path The path of the property to set.
  14516. * @param {*} value The value to set.
  14517. * @returns {Object} Returns `object`.
  14518. * @example
  14519. *
  14520. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14521. *
  14522. * _.set(object, 'a[0].b.c', 4);
  14523. * console.log(object.a[0].b.c);
  14524. * // => 4
  14525. *
  14526. * _.set(object, ['x', '0', 'y', 'z'], 5);
  14527. * console.log(object.x[0].y.z);
  14528. * // => 5
  14529. */
  14530. function set(object, path, value) {
  14531. return object == null ? object : baseSet(object, path, value);
  14532. }
  14533. /**
  14534. * This method is like `_.set` except that it accepts `customizer` which is
  14535. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14536. * path creation is handled by the method instead. The `customizer` is invoked
  14537. * with three arguments: (nsValue, key, nsObject).
  14538. *
  14539. * **Note:** This method mutates `object`.
  14540. *
  14541. * @static
  14542. * @memberOf _
  14543. * @since 4.0.0
  14544. * @category Object
  14545. * @param {Object} object The object to modify.
  14546. * @param {Array|string} path The path of the property to set.
  14547. * @param {*} value The value to set.
  14548. * @param {Function} [customizer] The function to customize assigned values.
  14549. * @returns {Object} Returns `object`.
  14550. * @example
  14551. *
  14552. * var object = {};
  14553. *
  14554. * _.setWith(object, '[0][1]', 'a', Object);
  14555. * // => { '0': { '1': 'a' } }
  14556. */
  14557. function setWith(object, path, value, customizer) {
  14558. customizer = typeof customizer == 'function' ? customizer : undefined;
  14559. return object == null ? object : baseSet(object, path, value, customizer);
  14560. }
  14561. /**
  14562. * Creates an array of own enumerable string keyed-value pairs for `object`
  14563. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  14564. * entries are returned.
  14565. *
  14566. * @static
  14567. * @memberOf _
  14568. * @since 4.0.0
  14569. * @alias entries
  14570. * @category Object
  14571. * @param {Object} object The object to query.
  14572. * @returns {Array} Returns the key-value pairs.
  14573. * @example
  14574. *
  14575. * function Foo() {
  14576. * this.a = 1;
  14577. * this.b = 2;
  14578. * }
  14579. *
  14580. * Foo.prototype.c = 3;
  14581. *
  14582. * _.toPairs(new Foo);
  14583. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  14584. */
  14585. var toPairs = createToPairs(keys);
  14586. /**
  14587. * Creates an array of own and inherited enumerable string keyed-value pairs
  14588. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  14589. * or set, its entries are returned.
  14590. *
  14591. * @static
  14592. * @memberOf _
  14593. * @since 4.0.0
  14594. * @alias entriesIn
  14595. * @category Object
  14596. * @param {Object} object The object to query.
  14597. * @returns {Array} Returns the key-value pairs.
  14598. * @example
  14599. *
  14600. * function Foo() {
  14601. * this.a = 1;
  14602. * this.b = 2;
  14603. * }
  14604. *
  14605. * Foo.prototype.c = 3;
  14606. *
  14607. * _.toPairsIn(new Foo);
  14608. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  14609. */
  14610. var toPairsIn = createToPairs(keysIn);
  14611. /**
  14612. * An alternative to `_.reduce`; this method transforms `object` to a new
  14613. * `accumulator` object which is the result of running each of its own
  14614. * enumerable string keyed properties thru `iteratee`, with each invocation
  14615. * potentially mutating the `accumulator` object. If `accumulator` is not
  14616. * provided, a new object with the same `[[Prototype]]` will be used. The
  14617. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  14618. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14619. *
  14620. * @static
  14621. * @memberOf _
  14622. * @since 1.3.0
  14623. * @category Object
  14624. * @param {Object} object The object to iterate over.
  14625. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14626. * @param {*} [accumulator] The custom accumulator value.
  14627. * @returns {*} Returns the accumulated value.
  14628. * @example
  14629. *
  14630. * _.transform([2, 3, 4], function(result, n) {
  14631. * result.push(n *= n);
  14632. * return n % 2 == 0;
  14633. * }, []);
  14634. * // => [4, 9]
  14635. *
  14636. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  14637. * (result[value] || (result[value] = [])).push(key);
  14638. * }, {});
  14639. * // => { '1': ['a', 'c'], '2': ['b'] }
  14640. */
  14641. function transform(object, iteratee, accumulator) {
  14642. var isArr = isArray(object),
  14643. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  14644. iteratee = getIteratee(iteratee, 4);
  14645. if (accumulator == null) {
  14646. var Ctor = object && object.constructor;
  14647. if (isArrLike) {
  14648. accumulator = isArr ? new Ctor : [];
  14649. }
  14650. else if (isObject(object)) {
  14651. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  14652. }
  14653. else {
  14654. accumulator = {};
  14655. }
  14656. }
  14657. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  14658. return iteratee(accumulator, value, index, object);
  14659. });
  14660. return accumulator;
  14661. }
  14662. /**
  14663. * Removes the property at `path` of `object`.
  14664. *
  14665. * **Note:** This method mutates `object`.
  14666. *
  14667. * @static
  14668. * @memberOf _
  14669. * @since 4.0.0
  14670. * @category Object
  14671. * @param {Object} object The object to modify.
  14672. * @param {Array|string} path The path of the property to unset.
  14673. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  14674. * @example
  14675. *
  14676. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  14677. * _.unset(object, 'a[0].b.c');
  14678. * // => true
  14679. *
  14680. * console.log(object);
  14681. * // => { 'a': [{ 'b': {} }] };
  14682. *
  14683. * _.unset(object, ['a', '0', 'b', 'c']);
  14684. * // => true
  14685. *
  14686. * console.log(object);
  14687. * // => { 'a': [{ 'b': {} }] };
  14688. */
  14689. function unset(object, path) {
  14690. return object == null ? true : baseUnset(object, path);
  14691. }
  14692. /**
  14693. * This method is like `_.set` except that accepts `updater` to produce the
  14694. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  14695. * is invoked with one argument: (value).
  14696. *
  14697. * **Note:** This method mutates `object`.
  14698. *
  14699. * @static
  14700. * @memberOf _
  14701. * @since 4.6.0
  14702. * @category Object
  14703. * @param {Object} object The object to modify.
  14704. * @param {Array|string} path The path of the property to set.
  14705. * @param {Function} updater The function to produce the updated value.
  14706. * @returns {Object} Returns `object`.
  14707. * @example
  14708. *
  14709. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14710. *
  14711. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  14712. * console.log(object.a[0].b.c);
  14713. * // => 9
  14714. *
  14715. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  14716. * console.log(object.x[0].y.z);
  14717. * // => 0
  14718. */
  14719. function update(object, path, updater) {
  14720. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  14721. }
  14722. /**
  14723. * This method is like `_.update` except that it accepts `customizer` which is
  14724. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14725. * path creation is handled by the method instead. The `customizer` is invoked
  14726. * with three arguments: (nsValue, key, nsObject).
  14727. *
  14728. * **Note:** This method mutates `object`.
  14729. *
  14730. * @static
  14731. * @memberOf _
  14732. * @since 4.6.0
  14733. * @category Object
  14734. * @param {Object} object The object to modify.
  14735. * @param {Array|string} path The path of the property to set.
  14736. * @param {Function} updater The function to produce the updated value.
  14737. * @param {Function} [customizer] The function to customize assigned values.
  14738. * @returns {Object} Returns `object`.
  14739. * @example
  14740. *
  14741. * var object = {};
  14742. *
  14743. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  14744. * // => { '0': { '1': 'a' } }
  14745. */
  14746. function updateWith(object, path, updater, customizer) {
  14747. customizer = typeof customizer == 'function' ? customizer : undefined;
  14748. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  14749. }
  14750. /**
  14751. * Creates an array of the own enumerable string keyed property values of `object`.
  14752. *
  14753. * **Note:** Non-object values are coerced to objects.
  14754. *
  14755. * @static
  14756. * @since 0.1.0
  14757. * @memberOf _
  14758. * @category Object
  14759. * @param {Object} object The object to query.
  14760. * @returns {Array} Returns the array of property values.
  14761. * @example
  14762. *
  14763. * function Foo() {
  14764. * this.a = 1;
  14765. * this.b = 2;
  14766. * }
  14767. *
  14768. * Foo.prototype.c = 3;
  14769. *
  14770. * _.values(new Foo);
  14771. * // => [1, 2] (iteration order is not guaranteed)
  14772. *
  14773. * _.values('hi');
  14774. * // => ['h', 'i']
  14775. */
  14776. function values(object) {
  14777. return object == null ? [] : baseValues(object, keys(object));
  14778. }
  14779. /**
  14780. * Creates an array of the own and inherited enumerable string keyed property
  14781. * values of `object`.
  14782. *
  14783. * **Note:** Non-object values are coerced to objects.
  14784. *
  14785. * @static
  14786. * @memberOf _
  14787. * @since 3.0.0
  14788. * @category Object
  14789. * @param {Object} object The object to query.
  14790. * @returns {Array} Returns the array of property values.
  14791. * @example
  14792. *
  14793. * function Foo() {
  14794. * this.a = 1;
  14795. * this.b = 2;
  14796. * }
  14797. *
  14798. * Foo.prototype.c = 3;
  14799. *
  14800. * _.valuesIn(new Foo);
  14801. * // => [1, 2, 3] (iteration order is not guaranteed)
  14802. */
  14803. function valuesIn(object) {
  14804. return object == null ? [] : baseValues(object, keysIn(object));
  14805. }
  14806. /*------------------------------------------------------------------------*/
  14807. /**
  14808. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  14809. *
  14810. * @static
  14811. * @memberOf _
  14812. * @since 4.0.0
  14813. * @category Number
  14814. * @param {number} number The number to clamp.
  14815. * @param {number} [lower] The lower bound.
  14816. * @param {number} upper The upper bound.
  14817. * @returns {number} Returns the clamped number.
  14818. * @example
  14819. *
  14820. * _.clamp(-10, -5, 5);
  14821. * // => -5
  14822. *
  14823. * _.clamp(10, -5, 5);
  14824. * // => 5
  14825. */
  14826. function clamp(number, lower, upper) {
  14827. if (upper === undefined) {
  14828. upper = lower;
  14829. lower = undefined;
  14830. }
  14831. if (upper !== undefined) {
  14832. upper = toNumber(upper);
  14833. upper = upper === upper ? upper : 0;
  14834. }
  14835. if (lower !== undefined) {
  14836. lower = toNumber(lower);
  14837. lower = lower === lower ? lower : 0;
  14838. }
  14839. return baseClamp(toNumber(number), lower, upper);
  14840. }
  14841. /**
  14842. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14843. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14844. * If `start` is greater than `end` the params are swapped to support
  14845. * negative ranges.
  14846. *
  14847. * @static
  14848. * @memberOf _
  14849. * @since 3.3.0
  14850. * @category Number
  14851. * @param {number} number The number to check.
  14852. * @param {number} [start=0] The start of the range.
  14853. * @param {number} end The end of the range.
  14854. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14855. * @see _.range, _.rangeRight
  14856. * @example
  14857. *
  14858. * _.inRange(3, 2, 4);
  14859. * // => true
  14860. *
  14861. * _.inRange(4, 8);
  14862. * // => true
  14863. *
  14864. * _.inRange(4, 2);
  14865. * // => false
  14866. *
  14867. * _.inRange(2, 2);
  14868. * // => false
  14869. *
  14870. * _.inRange(1.2, 2);
  14871. * // => true
  14872. *
  14873. * _.inRange(5.2, 4);
  14874. * // => false
  14875. *
  14876. * _.inRange(-3, -2, -6);
  14877. * // => true
  14878. */
  14879. function inRange(number, start, end) {
  14880. start = toFinite(start);
  14881. if (end === undefined) {
  14882. end = start;
  14883. start = 0;
  14884. } else {
  14885. end = toFinite(end);
  14886. }
  14887. number = toNumber(number);
  14888. return baseInRange(number, start, end);
  14889. }
  14890. /**
  14891. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14892. * If only one argument is provided a number between `0` and the given number
  14893. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14894. * floats, a floating-point number is returned instead of an integer.
  14895. *
  14896. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14897. * floating-point values which can produce unexpected results.
  14898. *
  14899. * @static
  14900. * @memberOf _
  14901. * @since 0.7.0
  14902. * @category Number
  14903. * @param {number} [lower=0] The lower bound.
  14904. * @param {number} [upper=1] The upper bound.
  14905. * @param {boolean} [floating] Specify returning a floating-point number.
  14906. * @returns {number} Returns the random number.
  14907. * @example
  14908. *
  14909. * _.random(0, 5);
  14910. * // => an integer between 0 and 5
  14911. *
  14912. * _.random(5);
  14913. * // => also an integer between 0 and 5
  14914. *
  14915. * _.random(5, true);
  14916. * // => a floating-point number between 0 and 5
  14917. *
  14918. * _.random(1.2, 5.2);
  14919. * // => a floating-point number between 1.2 and 5.2
  14920. */
  14921. function random(lower, upper, floating) {
  14922. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14923. upper = floating = undefined;
  14924. }
  14925. if (floating === undefined) {
  14926. if (typeof upper == 'boolean') {
  14927. floating = upper;
  14928. upper = undefined;
  14929. }
  14930. else if (typeof lower == 'boolean') {
  14931. floating = lower;
  14932. lower = undefined;
  14933. }
  14934. }
  14935. if (lower === undefined && upper === undefined) {
  14936. lower = 0;
  14937. upper = 1;
  14938. }
  14939. else {
  14940. lower = toFinite(lower);
  14941. if (upper === undefined) {
  14942. upper = lower;
  14943. lower = 0;
  14944. } else {
  14945. upper = toFinite(upper);
  14946. }
  14947. }
  14948. if (lower > upper) {
  14949. var temp = lower;
  14950. lower = upper;
  14951. upper = temp;
  14952. }
  14953. if (floating || lower % 1 || upper % 1) {
  14954. var rand = nativeRandom();
  14955. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14956. }
  14957. return baseRandom(lower, upper);
  14958. }
  14959. /*------------------------------------------------------------------------*/
  14960. /**
  14961. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14962. *
  14963. * @static
  14964. * @memberOf _
  14965. * @since 3.0.0
  14966. * @category String
  14967. * @param {string} [string=''] The string to convert.
  14968. * @returns {string} Returns the camel cased string.
  14969. * @example
  14970. *
  14971. * _.camelCase('Foo Bar');
  14972. * // => 'fooBar'
  14973. *
  14974. * _.camelCase('--foo-bar--');
  14975. * // => 'fooBar'
  14976. *
  14977. * _.camelCase('__FOO_BAR__');
  14978. * // => 'fooBar'
  14979. */
  14980. var camelCase = createCompounder(function(result, word, index) {
  14981. word = word.toLowerCase();
  14982. return result + (index ? capitalize(word) : word);
  14983. });
  14984. /**
  14985. * Converts the first character of `string` to upper case and the remaining
  14986. * to lower case.
  14987. *
  14988. * @static
  14989. * @memberOf _
  14990. * @since 3.0.0
  14991. * @category String
  14992. * @param {string} [string=''] The string to capitalize.
  14993. * @returns {string} Returns the capitalized string.
  14994. * @example
  14995. *
  14996. * _.capitalize('FRED');
  14997. * // => 'Fred'
  14998. */
  14999. function capitalize(string) {
  15000. return upperFirst(toString(string).toLowerCase());
  15001. }
  15002. /**
  15003. * Deburrs `string` by converting
  15004. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  15005. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  15006. * letters to basic Latin letters and removing
  15007. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  15008. *
  15009. * @static
  15010. * @memberOf _
  15011. * @since 3.0.0
  15012. * @category String
  15013. * @param {string} [string=''] The string to deburr.
  15014. * @returns {string} Returns the deburred string.
  15015. * @example
  15016. *
  15017. * _.deburr('déjà vu');
  15018. * // => 'deja vu'
  15019. */
  15020. function deburr(string) {
  15021. string = toString(string);
  15022. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  15023. }
  15024. /**
  15025. * Checks if `string` ends with the given target string.
  15026. *
  15027. * @static
  15028. * @memberOf _
  15029. * @since 3.0.0
  15030. * @category String
  15031. * @param {string} [string=''] The string to inspect.
  15032. * @param {string} [target] The string to search for.
  15033. * @param {number} [position=string.length] The position to search up to.
  15034. * @returns {boolean} Returns `true` if `string` ends with `target`,
  15035. * else `false`.
  15036. * @example
  15037. *
  15038. * _.endsWith('abc', 'c');
  15039. * // => true
  15040. *
  15041. * _.endsWith('abc', 'b');
  15042. * // => false
  15043. *
  15044. * _.endsWith('abc', 'b', 2);
  15045. * // => true
  15046. */
  15047. function endsWith(string, target, position) {
  15048. string = toString(string);
  15049. target = baseToString(target);
  15050. var length = string.length;
  15051. position = position === undefined
  15052. ? length
  15053. : baseClamp(toInteger(position), 0, length);
  15054. var end = position;
  15055. position -= target.length;
  15056. return position >= 0 && string.slice(position, end) == target;
  15057. }
  15058. /**
  15059. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  15060. * corresponding HTML entities.
  15061. *
  15062. * **Note:** No other characters are escaped. To escape additional
  15063. * characters use a third-party library like [_he_](https://mths.be/he).
  15064. *
  15065. * Though the ">" character is escaped for symmetry, characters like
  15066. * ">" and "/" don't need escaping in HTML and have no special meaning
  15067. * unless they're part of a tag or unquoted attribute value. See
  15068. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  15069. * (under "semi-related fun fact") for more details.
  15070. *
  15071. * When working with HTML you should always
  15072. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  15073. * XSS vectors.
  15074. *
  15075. * @static
  15076. * @since 0.1.0
  15077. * @memberOf _
  15078. * @category String
  15079. * @param {string} [string=''] The string to escape.
  15080. * @returns {string} Returns the escaped string.
  15081. * @example
  15082. *
  15083. * _.escape('fred, barney, & pebbles');
  15084. * // => 'fred, barney, &amp; pebbles'
  15085. */
  15086. function escape(string) {
  15087. string = toString(string);
  15088. return (string && reHasUnescapedHtml.test(string))
  15089. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  15090. : string;
  15091. }
  15092. /**
  15093. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  15094. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  15095. *
  15096. * @static
  15097. * @memberOf _
  15098. * @since 3.0.0
  15099. * @category String
  15100. * @param {string} [string=''] The string to escape.
  15101. * @returns {string} Returns the escaped string.
  15102. * @example
  15103. *
  15104. * _.escapeRegExp('[lodash](https://lodash.com/)');
  15105. * // => '\[lodash\]\(https://lodash\.com/\)'
  15106. */
  15107. function escapeRegExp(string) {
  15108. string = toString(string);
  15109. return (string && reHasRegExpChar.test(string))
  15110. ? string.replace(reRegExpChar, '\\$&')
  15111. : string;
  15112. }
  15113. /**
  15114. * Converts `string` to
  15115. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  15116. *
  15117. * @static
  15118. * @memberOf _
  15119. * @since 3.0.0
  15120. * @category String
  15121. * @param {string} [string=''] The string to convert.
  15122. * @returns {string} Returns the kebab cased string.
  15123. * @example
  15124. *
  15125. * _.kebabCase('Foo Bar');
  15126. * // => 'foo-bar'
  15127. *
  15128. * _.kebabCase('fooBar');
  15129. * // => 'foo-bar'
  15130. *
  15131. * _.kebabCase('__FOO_BAR__');
  15132. * // => 'foo-bar'
  15133. */
  15134. var kebabCase = createCompounder(function(result, word, index) {
  15135. return result + (index ? '-' : '') + word.toLowerCase();
  15136. });
  15137. /**
  15138. * Converts `string`, as space separated words, to lower case.
  15139. *
  15140. * @static
  15141. * @memberOf _
  15142. * @since 4.0.0
  15143. * @category String
  15144. * @param {string} [string=''] The string to convert.
  15145. * @returns {string} Returns the lower cased string.
  15146. * @example
  15147. *
  15148. * _.lowerCase('--Foo-Bar--');
  15149. * // => 'foo bar'
  15150. *
  15151. * _.lowerCase('fooBar');
  15152. * // => 'foo bar'
  15153. *
  15154. * _.lowerCase('__FOO_BAR__');
  15155. * // => 'foo bar'
  15156. */
  15157. var lowerCase = createCompounder(function(result, word, index) {
  15158. return result + (index ? ' ' : '') + word.toLowerCase();
  15159. });
  15160. /**
  15161. * Converts the first character of `string` to lower case.
  15162. *
  15163. * @static
  15164. * @memberOf _
  15165. * @since 4.0.0
  15166. * @category String
  15167. * @param {string} [string=''] The string to convert.
  15168. * @returns {string} Returns the converted string.
  15169. * @example
  15170. *
  15171. * _.lowerFirst('Fred');
  15172. * // => 'fred'
  15173. *
  15174. * _.lowerFirst('FRED');
  15175. * // => 'fRED'
  15176. */
  15177. var lowerFirst = createCaseFirst('toLowerCase');
  15178. /**
  15179. * Pads `string` on the left and right sides if it's shorter than `length`.
  15180. * Padding characters are truncated if they can't be evenly divided by `length`.
  15181. *
  15182. * @static
  15183. * @memberOf _
  15184. * @since 3.0.0
  15185. * @category String
  15186. * @param {string} [string=''] The string to pad.
  15187. * @param {number} [length=0] The padding length.
  15188. * @param {string} [chars=' '] The string used as padding.
  15189. * @returns {string} Returns the padded string.
  15190. * @example
  15191. *
  15192. * _.pad('abc', 8);
  15193. * // => ' abc '
  15194. *
  15195. * _.pad('abc', 8, '_-');
  15196. * // => '_-abc_-_'
  15197. *
  15198. * _.pad('abc', 3);
  15199. * // => 'abc'
  15200. */
  15201. function pad(string, length, chars) {
  15202. string = toString(string);
  15203. length = toInteger(length);
  15204. var strLength = length ? stringSize(string) : 0;
  15205. if (!length || strLength >= length) {
  15206. return string;
  15207. }
  15208. var mid = (length - strLength) / 2;
  15209. return (
  15210. createPadding(nativeFloor(mid), chars) +
  15211. string +
  15212. createPadding(nativeCeil(mid), chars)
  15213. );
  15214. }
  15215. /**
  15216. * Pads `string` on the right side if it's shorter than `length`. Padding
  15217. * characters are truncated if they exceed `length`.
  15218. *
  15219. * @static
  15220. * @memberOf _
  15221. * @since 4.0.0
  15222. * @category String
  15223. * @param {string} [string=''] The string to pad.
  15224. * @param {number} [length=0] The padding length.
  15225. * @param {string} [chars=' '] The string used as padding.
  15226. * @returns {string} Returns the padded string.
  15227. * @example
  15228. *
  15229. * _.padEnd('abc', 6);
  15230. * // => 'abc '
  15231. *
  15232. * _.padEnd('abc', 6, '_-');
  15233. * // => 'abc_-_'
  15234. *
  15235. * _.padEnd('abc', 3);
  15236. * // => 'abc'
  15237. */
  15238. function padEnd(string, length, chars) {
  15239. string = toString(string);
  15240. length = toInteger(length);
  15241. var strLength = length ? stringSize(string) : 0;
  15242. return (length && strLength < length)
  15243. ? (string + createPadding(length - strLength, chars))
  15244. : string;
  15245. }
  15246. /**
  15247. * Pads `string` on the left side if it's shorter than `length`. Padding
  15248. * characters are truncated if they exceed `length`.
  15249. *
  15250. * @static
  15251. * @memberOf _
  15252. * @since 4.0.0
  15253. * @category String
  15254. * @param {string} [string=''] The string to pad.
  15255. * @param {number} [length=0] The padding length.
  15256. * @param {string} [chars=' '] The string used as padding.
  15257. * @returns {string} Returns the padded string.
  15258. * @example
  15259. *
  15260. * _.padStart('abc', 6);
  15261. * // => ' abc'
  15262. *
  15263. * _.padStart('abc', 6, '_-');
  15264. * // => '_-_abc'
  15265. *
  15266. * _.padStart('abc', 3);
  15267. * // => 'abc'
  15268. */
  15269. function padStart(string, length, chars) {
  15270. string = toString(string);
  15271. length = toInteger(length);
  15272. var strLength = length ? stringSize(string) : 0;
  15273. return (length && strLength < length)
  15274. ? (createPadding(length - strLength, chars) + string)
  15275. : string;
  15276. }
  15277. /**
  15278. * Converts `string` to an integer of the specified radix. If `radix` is
  15279. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  15280. * hexadecimal, in which case a `radix` of `16` is used.
  15281. *
  15282. * **Note:** This method aligns with the
  15283. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  15284. *
  15285. * @static
  15286. * @memberOf _
  15287. * @since 1.1.0
  15288. * @category String
  15289. * @param {string} string The string to convert.
  15290. * @param {number} [radix=10] The radix to interpret `value` by.
  15291. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15292. * @returns {number} Returns the converted integer.
  15293. * @example
  15294. *
  15295. * _.parseInt('08');
  15296. * // => 8
  15297. *
  15298. * _.map(['6', '08', '10'], _.parseInt);
  15299. * // => [6, 8, 10]
  15300. */
  15301. function parseInt(string, radix, guard) {
  15302. if (guard || radix == null) {
  15303. radix = 0;
  15304. } else if (radix) {
  15305. radix = +radix;
  15306. }
  15307. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  15308. }
  15309. /**
  15310. * Repeats the given string `n` times.
  15311. *
  15312. * @static
  15313. * @memberOf _
  15314. * @since 3.0.0
  15315. * @category String
  15316. * @param {string} [string=''] The string to repeat.
  15317. * @param {number} [n=1] The number of times to repeat the string.
  15318. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15319. * @returns {string} Returns the repeated string.
  15320. * @example
  15321. *
  15322. * _.repeat('*', 3);
  15323. * // => '***'
  15324. *
  15325. * _.repeat('abc', 2);
  15326. * // => 'abcabc'
  15327. *
  15328. * _.repeat('abc', 0);
  15329. * // => ''
  15330. */
  15331. function repeat(string, n, guard) {
  15332. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  15333. n = 1;
  15334. } else {
  15335. n = toInteger(n);
  15336. }
  15337. return baseRepeat(toString(string), n);
  15338. }
  15339. /**
  15340. * Replaces matches for `pattern` in `string` with `replacement`.
  15341. *
  15342. * **Note:** This method is based on
  15343. * [`String#replace`](https://mdn.io/String/replace).
  15344. *
  15345. * @static
  15346. * @memberOf _
  15347. * @since 4.0.0
  15348. * @category String
  15349. * @param {string} [string=''] The string to modify.
  15350. * @param {RegExp|string} pattern The pattern to replace.
  15351. * @param {Function|string} replacement The match replacement.
  15352. * @returns {string} Returns the modified string.
  15353. * @example
  15354. *
  15355. * _.replace('Hi Fred', 'Fred', 'Barney');
  15356. * // => 'Hi Barney'
  15357. */
  15358. function replace() {
  15359. var args = arguments,
  15360. string = toString(args[0]);
  15361. return args.length < 3 ? string : string.replace(args[1], args[2]);
  15362. }
  15363. /**
  15364. * Converts `string` to
  15365. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  15366. *
  15367. * @static
  15368. * @memberOf _
  15369. * @since 3.0.0
  15370. * @category String
  15371. * @param {string} [string=''] The string to convert.
  15372. * @returns {string} Returns the snake cased string.
  15373. * @example
  15374. *
  15375. * _.snakeCase('Foo Bar');
  15376. * // => 'foo_bar'
  15377. *
  15378. * _.snakeCase('fooBar');
  15379. * // => 'foo_bar'
  15380. *
  15381. * _.snakeCase('--FOO-BAR--');
  15382. * // => 'foo_bar'
  15383. */
  15384. var snakeCase = createCompounder(function(result, word, index) {
  15385. return result + (index ? '_' : '') + word.toLowerCase();
  15386. });
  15387. /**
  15388. * Splits `string` by `separator`.
  15389. *
  15390. * **Note:** This method is based on
  15391. * [`String#split`](https://mdn.io/String/split).
  15392. *
  15393. * @static
  15394. * @memberOf _
  15395. * @since 4.0.0
  15396. * @category String
  15397. * @param {string} [string=''] The string to split.
  15398. * @param {RegExp|string} separator The separator pattern to split by.
  15399. * @param {number} [limit] The length to truncate results to.
  15400. * @returns {Array} Returns the string segments.
  15401. * @example
  15402. *
  15403. * _.split('a-b-c', '-', 2);
  15404. * // => ['a', 'b']
  15405. */
  15406. function split(string, separator, limit) {
  15407. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  15408. separator = limit = undefined;
  15409. }
  15410. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  15411. if (!limit) {
  15412. return [];
  15413. }
  15414. string = toString(string);
  15415. if (string && (
  15416. typeof separator == 'string' ||
  15417. (separator != null && !isRegExp(separator))
  15418. )) {
  15419. separator = baseToString(separator);
  15420. if (!separator && hasUnicode(string)) {
  15421. return castSlice(stringToArray(string), 0, limit);
  15422. }
  15423. }
  15424. return string.split(separator, limit);
  15425. }
  15426. /**
  15427. * Converts `string` to
  15428. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  15429. *
  15430. * @static
  15431. * @memberOf _
  15432. * @since 3.1.0
  15433. * @category String
  15434. * @param {string} [string=''] The string to convert.
  15435. * @returns {string} Returns the start cased string.
  15436. * @example
  15437. *
  15438. * _.startCase('--foo-bar--');
  15439. * // => 'Foo Bar'
  15440. *
  15441. * _.startCase('fooBar');
  15442. * // => 'Foo Bar'
  15443. *
  15444. * _.startCase('__FOO_BAR__');
  15445. * // => 'FOO BAR'
  15446. */
  15447. var startCase = createCompounder(function(result, word, index) {
  15448. return result + (index ? ' ' : '') + upperFirst(word);
  15449. });
  15450. /**
  15451. * Checks if `string` starts with the given target string.
  15452. *
  15453. * @static
  15454. * @memberOf _
  15455. * @since 3.0.0
  15456. * @category String
  15457. * @param {string} [string=''] The string to inspect.
  15458. * @param {string} [target] The string to search for.
  15459. * @param {number} [position=0] The position to search from.
  15460. * @returns {boolean} Returns `true` if `string` starts with `target`,
  15461. * else `false`.
  15462. * @example
  15463. *
  15464. * _.startsWith('abc', 'a');
  15465. * // => true
  15466. *
  15467. * _.startsWith('abc', 'b');
  15468. * // => false
  15469. *
  15470. * _.startsWith('abc', 'b', 1);
  15471. * // => true
  15472. */
  15473. function startsWith(string, target, position) {
  15474. string = toString(string);
  15475. position = position == null
  15476. ? 0
  15477. : baseClamp(toInteger(position), 0, string.length);
  15478. target = baseToString(target);
  15479. return string.slice(position, position + target.length) == target;
  15480. }
  15481. /**
  15482. * Creates a compiled template function that can interpolate data properties
  15483. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  15484. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  15485. * properties may be accessed as free variables in the template. If a setting
  15486. * object is given, it takes precedence over `_.templateSettings` values.
  15487. *
  15488. * **Note:** In the development build `_.template` utilizes
  15489. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  15490. * for easier debugging.
  15491. *
  15492. * For more information on precompiling templates see
  15493. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  15494. *
  15495. * For more information on Chrome extension sandboxes see
  15496. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  15497. *
  15498. * @static
  15499. * @since 0.1.0
  15500. * @memberOf _
  15501. * @category String
  15502. * @param {string} [string=''] The template string.
  15503. * @param {Object} [options={}] The options object.
  15504. * @param {RegExp} [options.escape=_.templateSettings.escape]
  15505. * The HTML "escape" delimiter.
  15506. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  15507. * The "evaluate" delimiter.
  15508. * @param {Object} [options.imports=_.templateSettings.imports]
  15509. * An object to import into the template as free variables.
  15510. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  15511. * The "interpolate" delimiter.
  15512. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  15513. * The sourceURL of the compiled template.
  15514. * @param {string} [options.variable='obj']
  15515. * The data object variable name.
  15516. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15517. * @returns {Function} Returns the compiled template function.
  15518. * @example
  15519. *
  15520. * // Use the "interpolate" delimiter to create a compiled template.
  15521. * var compiled = _.template('hello <%= user %>!');
  15522. * compiled({ 'user': 'fred' });
  15523. * // => 'hello fred!'
  15524. *
  15525. * // Use the HTML "escape" delimiter to escape data property values.
  15526. * var compiled = _.template('<b><%- value %></b>');
  15527. * compiled({ 'value': '<script>' });
  15528. * // => '<b>&lt;script&gt;</b>'
  15529. *
  15530. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  15531. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  15532. * compiled({ 'users': ['fred', 'barney'] });
  15533. * // => '<li>fred</li><li>barney</li>'
  15534. *
  15535. * // Use the internal `print` function in "evaluate" delimiters.
  15536. * var compiled = _.template('<% print("hello " + user); %>!');
  15537. * compiled({ 'user': 'barney' });
  15538. * // => 'hello barney!'
  15539. *
  15540. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  15541. * // Disable support by replacing the "interpolate" delimiter.
  15542. * var compiled = _.template('hello ${ user }!');
  15543. * compiled({ 'user': 'pebbles' });
  15544. * // => 'hello pebbles!'
  15545. *
  15546. * // Use backslashes to treat delimiters as plain text.
  15547. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  15548. * compiled({ 'value': 'ignored' });
  15549. * // => '<%- value %>'
  15550. *
  15551. * // Use the `imports` option to import `jQuery` as `jq`.
  15552. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  15553. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  15554. * compiled({ 'users': ['fred', 'barney'] });
  15555. * // => '<li>fred</li><li>barney</li>'
  15556. *
  15557. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  15558. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  15559. * compiled(data);
  15560. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  15561. *
  15562. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  15563. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  15564. * compiled.source;
  15565. * // => function(data) {
  15566. * // var __t, __p = '';
  15567. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  15568. * // return __p;
  15569. * // }
  15570. *
  15571. * // Use custom template delimiters.
  15572. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  15573. * var compiled = _.template('hello {{ user }}!');
  15574. * compiled({ 'user': 'mustache' });
  15575. * // => 'hello mustache!'
  15576. *
  15577. * // Use the `source` property to inline compiled templates for meaningful
  15578. * // line numbers in error messages and stack traces.
  15579. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  15580. * var JST = {\
  15581. * "main": ' + _.template(mainText).source + '\
  15582. * };\
  15583. * ');
  15584. */
  15585. function template(string, options, guard) {
  15586. // Based on John Resig's `tmpl` implementation
  15587. // (http://ejohn.org/blog/javascript-micro-templating/)
  15588. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  15589. var settings = lodash.templateSettings;
  15590. if (guard && isIterateeCall(string, options, guard)) {
  15591. options = undefined;
  15592. }
  15593. string = toString(string);
  15594. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  15595. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  15596. importsKeys = keys(imports),
  15597. importsValues = baseValues(imports, importsKeys);
  15598. var isEscaping,
  15599. isEvaluating,
  15600. index = 0,
  15601. interpolate = options.interpolate || reNoMatch,
  15602. source = "__p += '";
  15603. // Compile the regexp to match each delimiter.
  15604. var reDelimiters = RegExp(
  15605. (options.escape || reNoMatch).source + '|' +
  15606. interpolate.source + '|' +
  15607. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  15608. (options.evaluate || reNoMatch).source + '|$'
  15609. , 'g');
  15610. // Use a sourceURL for easier debugging.
  15611. // The sourceURL gets injected into the source that's eval-ed, so be careful
  15612. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  15613. // and escape the comment, thus injecting code that gets evaled.
  15614. var sourceURL = '//# sourceURL=' +
  15615. (hasOwnProperty.call(options, 'sourceURL')
  15616. ? (options.sourceURL + '').replace(/\s/g, ' ')
  15617. : ('lodash.templateSources[' + (++templateCounter) + ']')
  15618. ) + '\n';
  15619. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  15620. interpolateValue || (interpolateValue = esTemplateValue);
  15621. // Escape characters that can't be included in string literals.
  15622. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  15623. // Replace delimiters with snippets.
  15624. if (escapeValue) {
  15625. isEscaping = true;
  15626. source += "' +\n__e(" + escapeValue + ") +\n'";
  15627. }
  15628. if (evaluateValue) {
  15629. isEvaluating = true;
  15630. source += "';\n" + evaluateValue + ";\n__p += '";
  15631. }
  15632. if (interpolateValue) {
  15633. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  15634. }
  15635. index = offset + match.length;
  15636. // The JS engine embedded in Adobe products needs `match` returned in
  15637. // order to produce the correct `offset` value.
  15638. return match;
  15639. });
  15640. source += "';\n";
  15641. // If `variable` is not specified wrap a with-statement around the generated
  15642. // code to add the data object to the top of the scope chain.
  15643. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  15644. if (!variable) {
  15645. source = 'with (obj) {\n' + source + '\n}\n';
  15646. }
  15647. // Throw an error if a forbidden character was found in `variable`, to prevent
  15648. // potential command injection attacks.
  15649. else if (reForbiddenIdentifierChars.test(variable)) {
  15650. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  15651. }
  15652. // Cleanup code by stripping empty strings.
  15653. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  15654. .replace(reEmptyStringMiddle, '$1')
  15655. .replace(reEmptyStringTrailing, '$1;');
  15656. // Frame code as the function body.
  15657. source = 'function(' + (variable || 'obj') + ') {\n' +
  15658. (variable
  15659. ? ''
  15660. : 'obj || (obj = {});\n'
  15661. ) +
  15662. "var __t, __p = ''" +
  15663. (isEscaping
  15664. ? ', __e = _.escape'
  15665. : ''
  15666. ) +
  15667. (isEvaluating
  15668. ? ', __j = Array.prototype.join;\n' +
  15669. "function print() { __p += __j.call(arguments, '') }\n"
  15670. : ';\n'
  15671. ) +
  15672. source +
  15673. 'return __p\n}';
  15674. var result = attempt(function() {
  15675. return Function(importsKeys, sourceURL + 'return ' + source)
  15676. .apply(undefined, importsValues);
  15677. });
  15678. // Provide the compiled function's source by its `toString` method or
  15679. // the `source` property as a convenience for inlining compiled templates.
  15680. result.source = source;
  15681. if (isError(result)) {
  15682. throw result;
  15683. }
  15684. return result;
  15685. }
  15686. /**
  15687. * Converts `string`, as a whole, to lower case just like
  15688. * [String#toLowerCase](https://mdn.io/toLowerCase).
  15689. *
  15690. * @static
  15691. * @memberOf _
  15692. * @since 4.0.0
  15693. * @category String
  15694. * @param {string} [string=''] The string to convert.
  15695. * @returns {string} Returns the lower cased string.
  15696. * @example
  15697. *
  15698. * _.toLower('--Foo-Bar--');
  15699. * // => '--foo-bar--'
  15700. *
  15701. * _.toLower('fooBar');
  15702. * // => 'foobar'
  15703. *
  15704. * _.toLower('__FOO_BAR__');
  15705. * // => '__foo_bar__'
  15706. */
  15707. function toLower(value) {
  15708. return toString(value).toLowerCase();
  15709. }
  15710. /**
  15711. * Converts `string`, as a whole, to upper case just like
  15712. * [String#toUpperCase](https://mdn.io/toUpperCase).
  15713. *
  15714. * @static
  15715. * @memberOf _
  15716. * @since 4.0.0
  15717. * @category String
  15718. * @param {string} [string=''] The string to convert.
  15719. * @returns {string} Returns the upper cased string.
  15720. * @example
  15721. *
  15722. * _.toUpper('--foo-bar--');
  15723. * // => '--FOO-BAR--'
  15724. *
  15725. * _.toUpper('fooBar');
  15726. * // => 'FOOBAR'
  15727. *
  15728. * _.toUpper('__foo_bar__');
  15729. * // => '__FOO_BAR__'
  15730. */
  15731. function toUpper(value) {
  15732. return toString(value).toUpperCase();
  15733. }
  15734. /**
  15735. * Removes leading and trailing whitespace or specified characters from `string`.
  15736. *
  15737. * @static
  15738. * @memberOf _
  15739. * @since 3.0.0
  15740. * @category String
  15741. * @param {string} [string=''] The string to trim.
  15742. * @param {string} [chars=whitespace] The characters to trim.
  15743. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15744. * @returns {string} Returns the trimmed string.
  15745. * @example
  15746. *
  15747. * _.trim(' abc ');
  15748. * // => 'abc'
  15749. *
  15750. * _.trim('-_-abc-_-', '_-');
  15751. * // => 'abc'
  15752. *
  15753. * _.map([' foo ', ' bar '], _.trim);
  15754. * // => ['foo', 'bar']
  15755. */
  15756. function trim(string, chars, guard) {
  15757. string = toString(string);
  15758. if (string && (guard || chars === undefined)) {
  15759. return baseTrim(string);
  15760. }
  15761. if (!string || !(chars = baseToString(chars))) {
  15762. return string;
  15763. }
  15764. var strSymbols = stringToArray(string),
  15765. chrSymbols = stringToArray(chars),
  15766. start = charsStartIndex(strSymbols, chrSymbols),
  15767. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  15768. return castSlice(strSymbols, start, end).join('');
  15769. }
  15770. /**
  15771. * Removes trailing whitespace or specified characters from `string`.
  15772. *
  15773. * @static
  15774. * @memberOf _
  15775. * @since 4.0.0
  15776. * @category String
  15777. * @param {string} [string=''] The string to trim.
  15778. * @param {string} [chars=whitespace] The characters to trim.
  15779. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15780. * @returns {string} Returns the trimmed string.
  15781. * @example
  15782. *
  15783. * _.trimEnd(' abc ');
  15784. * // => ' abc'
  15785. *
  15786. * _.trimEnd('-_-abc-_-', '_-');
  15787. * // => '-_-abc'
  15788. */
  15789. function trimEnd(string, chars, guard) {
  15790. string = toString(string);
  15791. if (string && (guard || chars === undefined)) {
  15792. return string.slice(0, trimmedEndIndex(string) + 1);
  15793. }
  15794. if (!string || !(chars = baseToString(chars))) {
  15795. return string;
  15796. }
  15797. var strSymbols = stringToArray(string),
  15798. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  15799. return castSlice(strSymbols, 0, end).join('');
  15800. }
  15801. /**
  15802. * Removes leading whitespace or specified characters from `string`.
  15803. *
  15804. * @static
  15805. * @memberOf _
  15806. * @since 4.0.0
  15807. * @category String
  15808. * @param {string} [string=''] The string to trim.
  15809. * @param {string} [chars=whitespace] The characters to trim.
  15810. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15811. * @returns {string} Returns the trimmed string.
  15812. * @example
  15813. *
  15814. * _.trimStart(' abc ');
  15815. * // => 'abc '
  15816. *
  15817. * _.trimStart('-_-abc-_-', '_-');
  15818. * // => 'abc-_-'
  15819. */
  15820. function trimStart(string, chars, guard) {
  15821. string = toString(string);
  15822. if (string && (guard || chars === undefined)) {
  15823. return string.replace(reTrimStart, '');
  15824. }
  15825. if (!string || !(chars = baseToString(chars))) {
  15826. return string;
  15827. }
  15828. var strSymbols = stringToArray(string),
  15829. start = charsStartIndex(strSymbols, stringToArray(chars));
  15830. return castSlice(strSymbols, start).join('');
  15831. }
  15832. /**
  15833. * Truncates `string` if it's longer than the given maximum string length.
  15834. * The last characters of the truncated string are replaced with the omission
  15835. * string which defaults to "...".
  15836. *
  15837. * @static
  15838. * @memberOf _
  15839. * @since 4.0.0
  15840. * @category String
  15841. * @param {string} [string=''] The string to truncate.
  15842. * @param {Object} [options={}] The options object.
  15843. * @param {number} [options.length=30] The maximum string length.
  15844. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  15845. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15846. * @returns {string} Returns the truncated string.
  15847. * @example
  15848. *
  15849. * _.truncate('hi-diddly-ho there, neighborino');
  15850. * // => 'hi-diddly-ho there, neighbo...'
  15851. *
  15852. * _.truncate('hi-diddly-ho there, neighborino', {
  15853. * 'length': 24,
  15854. * 'separator': ' '
  15855. * });
  15856. * // => 'hi-diddly-ho there,...'
  15857. *
  15858. * _.truncate('hi-diddly-ho there, neighborino', {
  15859. * 'length': 24,
  15860. * 'separator': /,? +/
  15861. * });
  15862. * // => 'hi-diddly-ho there...'
  15863. *
  15864. * _.truncate('hi-diddly-ho there, neighborino', {
  15865. * 'omission': ' [...]'
  15866. * });
  15867. * // => 'hi-diddly-ho there, neig [...]'
  15868. */
  15869. function truncate(string, options) {
  15870. var length = DEFAULT_TRUNC_LENGTH,
  15871. omission = DEFAULT_TRUNC_OMISSION;
  15872. if (isObject(options)) {
  15873. var separator = 'separator' in options ? options.separator : separator;
  15874. length = 'length' in options ? toInteger(options.length) : length;
  15875. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15876. }
  15877. string = toString(string);
  15878. var strLength = string.length;
  15879. if (hasUnicode(string)) {
  15880. var strSymbols = stringToArray(string);
  15881. strLength = strSymbols.length;
  15882. }
  15883. if (length >= strLength) {
  15884. return string;
  15885. }
  15886. var end = length - stringSize(omission);
  15887. if (end < 1) {
  15888. return omission;
  15889. }
  15890. var result = strSymbols
  15891. ? castSlice(strSymbols, 0, end).join('')
  15892. : string.slice(0, end);
  15893. if (separator === undefined) {
  15894. return result + omission;
  15895. }
  15896. if (strSymbols) {
  15897. end += (result.length - end);
  15898. }
  15899. if (isRegExp(separator)) {
  15900. if (string.slice(end).search(separator)) {
  15901. var match,
  15902. substring = result;
  15903. if (!separator.global) {
  15904. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15905. }
  15906. separator.lastIndex = 0;
  15907. while ((match = separator.exec(substring))) {
  15908. var newEnd = match.index;
  15909. }
  15910. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15911. }
  15912. } else if (string.indexOf(baseToString(separator), end) != end) {
  15913. var index = result.lastIndexOf(separator);
  15914. if (index > -1) {
  15915. result = result.slice(0, index);
  15916. }
  15917. }
  15918. return result + omission;
  15919. }
  15920. /**
  15921. * The inverse of `_.escape`; this method converts the HTML entities
  15922. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15923. * their corresponding characters.
  15924. *
  15925. * **Note:** No other HTML entities are unescaped. To unescape additional
  15926. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15927. *
  15928. * @static
  15929. * @memberOf _
  15930. * @since 0.6.0
  15931. * @category String
  15932. * @param {string} [string=''] The string to unescape.
  15933. * @returns {string} Returns the unescaped string.
  15934. * @example
  15935. *
  15936. * _.unescape('fred, barney, &amp; pebbles');
  15937. * // => 'fred, barney, & pebbles'
  15938. */
  15939. function unescape(string) {
  15940. string = toString(string);
  15941. return (string && reHasEscapedHtml.test(string))
  15942. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15943. : string;
  15944. }
  15945. /**
  15946. * Converts `string`, as space separated words, to upper case.
  15947. *
  15948. * @static
  15949. * @memberOf _
  15950. * @since 4.0.0
  15951. * @category String
  15952. * @param {string} [string=''] The string to convert.
  15953. * @returns {string} Returns the upper cased string.
  15954. * @example
  15955. *
  15956. * _.upperCase('--foo-bar');
  15957. * // => 'FOO BAR'
  15958. *
  15959. * _.upperCase('fooBar');
  15960. * // => 'FOO BAR'
  15961. *
  15962. * _.upperCase('__foo_bar__');
  15963. * // => 'FOO BAR'
  15964. */
  15965. var upperCase = createCompounder(function(result, word, index) {
  15966. return result + (index ? ' ' : '') + word.toUpperCase();
  15967. });
  15968. /**
  15969. * Converts the first character of `string` to upper case.
  15970. *
  15971. * @static
  15972. * @memberOf _
  15973. * @since 4.0.0
  15974. * @category String
  15975. * @param {string} [string=''] The string to convert.
  15976. * @returns {string} Returns the converted string.
  15977. * @example
  15978. *
  15979. * _.upperFirst('fred');
  15980. * // => 'Fred'
  15981. *
  15982. * _.upperFirst('FRED');
  15983. * // => 'FRED'
  15984. */
  15985. var upperFirst = createCaseFirst('toUpperCase');
  15986. /**
  15987. * Splits `string` into an array of its words.
  15988. *
  15989. * @static
  15990. * @memberOf _
  15991. * @since 3.0.0
  15992. * @category String
  15993. * @param {string} [string=''] The string to inspect.
  15994. * @param {RegExp|string} [pattern] The pattern to match words.
  15995. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15996. * @returns {Array} Returns the words of `string`.
  15997. * @example
  15998. *
  15999. * _.words('fred, barney, & pebbles');
  16000. * // => ['fred', 'barney', 'pebbles']
  16001. *
  16002. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  16003. * // => ['fred', 'barney', '&', 'pebbles']
  16004. */
  16005. function words(string, pattern, guard) {
  16006. string = toString(string);
  16007. pattern = guard ? undefined : pattern;
  16008. if (pattern === undefined) {
  16009. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  16010. }
  16011. return string.match(pattern) || [];
  16012. }
  16013. /*------------------------------------------------------------------------*/
  16014. /**
  16015. * Attempts to invoke `func`, returning either the result or the caught error
  16016. * object. Any additional arguments are provided to `func` when it's invoked.
  16017. *
  16018. * @static
  16019. * @memberOf _
  16020. * @since 3.0.0
  16021. * @category Util
  16022. * @param {Function} func The function to attempt.
  16023. * @param {...*} [args] The arguments to invoke `func` with.
  16024. * @returns {*} Returns the `func` result or error object.
  16025. * @example
  16026. *
  16027. * // Avoid throwing errors for invalid selectors.
  16028. * var elements = _.attempt(function(selector) {
  16029. * return document.querySelectorAll(selector);
  16030. * }, '>_>');
  16031. *
  16032. * if (_.isError(elements)) {
  16033. * elements = [];
  16034. * }
  16035. */
  16036. var attempt = baseRest(function(func, args) {
  16037. try {
  16038. return apply(func, undefined, args);
  16039. } catch (e) {
  16040. return isError(e) ? e : new Error(e);
  16041. }
  16042. });
  16043. /**
  16044. * Binds methods of an object to the object itself, overwriting the existing
  16045. * method.
  16046. *
  16047. * **Note:** This method doesn't set the "length" property of bound functions.
  16048. *
  16049. * @static
  16050. * @since 0.1.0
  16051. * @memberOf _
  16052. * @category Util
  16053. * @param {Object} object The object to bind and assign the bound methods to.
  16054. * @param {...(string|string[])} methodNames The object method names to bind.
  16055. * @returns {Object} Returns `object`.
  16056. * @example
  16057. *
  16058. * var view = {
  16059. * 'label': 'docs',
  16060. * 'click': function() {
  16061. * console.log('clicked ' + this.label);
  16062. * }
  16063. * };
  16064. *
  16065. * _.bindAll(view, ['click']);
  16066. * jQuery(element).on('click', view.click);
  16067. * // => Logs 'clicked docs' when clicked.
  16068. */
  16069. var bindAll = flatRest(function(object, methodNames) {
  16070. arrayEach(methodNames, function(key) {
  16071. key = toKey(key);
  16072. baseAssignValue(object, key, bind(object[key], object));
  16073. });
  16074. return object;
  16075. });
  16076. /**
  16077. * Creates a function that iterates over `pairs` and invokes the corresponding
  16078. * function of the first predicate to return truthy. The predicate-function
  16079. * pairs are invoked with the `this` binding and arguments of the created
  16080. * function.
  16081. *
  16082. * @static
  16083. * @memberOf _
  16084. * @since 4.0.0
  16085. * @category Util
  16086. * @param {Array} pairs The predicate-function pairs.
  16087. * @returns {Function} Returns the new composite function.
  16088. * @example
  16089. *
  16090. * var func = _.cond([
  16091. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  16092. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  16093. * [_.stubTrue, _.constant('no match')]
  16094. * ]);
  16095. *
  16096. * func({ 'a': 1, 'b': 2 });
  16097. * // => 'matches A'
  16098. *
  16099. * func({ 'a': 0, 'b': 1 });
  16100. * // => 'matches B'
  16101. *
  16102. * func({ 'a': '1', 'b': '2' });
  16103. * // => 'no match'
  16104. */
  16105. function cond(pairs) {
  16106. var length = pairs == null ? 0 : pairs.length,
  16107. toIteratee = getIteratee();
  16108. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  16109. if (typeof pair[1] != 'function') {
  16110. throw new TypeError(FUNC_ERROR_TEXT);
  16111. }
  16112. return [toIteratee(pair[0]), pair[1]];
  16113. });
  16114. return baseRest(function(args) {
  16115. var index = -1;
  16116. while (++index < length) {
  16117. var pair = pairs[index];
  16118. if (apply(pair[0], this, args)) {
  16119. return apply(pair[1], this, args);
  16120. }
  16121. }
  16122. });
  16123. }
  16124. /**
  16125. * Creates a function that invokes the predicate properties of `source` with
  16126. * the corresponding property values of a given object, returning `true` if
  16127. * all predicates return truthy, else `false`.
  16128. *
  16129. * **Note:** The created function is equivalent to `_.conformsTo` with
  16130. * `source` partially applied.
  16131. *
  16132. * @static
  16133. * @memberOf _
  16134. * @since 4.0.0
  16135. * @category Util
  16136. * @param {Object} source The object of property predicates to conform to.
  16137. * @returns {Function} Returns the new spec function.
  16138. * @example
  16139. *
  16140. * var objects = [
  16141. * { 'a': 2, 'b': 1 },
  16142. * { 'a': 1, 'b': 2 }
  16143. * ];
  16144. *
  16145. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  16146. * // => [{ 'a': 1, 'b': 2 }]
  16147. */
  16148. function conforms(source) {
  16149. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  16150. }
  16151. /**
  16152. * Creates a function that returns `value`.
  16153. *
  16154. * @static
  16155. * @memberOf _
  16156. * @since 2.4.0
  16157. * @category Util
  16158. * @param {*} value The value to return from the new function.
  16159. * @returns {Function} Returns the new constant function.
  16160. * @example
  16161. *
  16162. * var objects = _.times(2, _.constant({ 'a': 1 }));
  16163. *
  16164. * console.log(objects);
  16165. * // => [{ 'a': 1 }, { 'a': 1 }]
  16166. *
  16167. * console.log(objects[0] === objects[1]);
  16168. * // => true
  16169. */
  16170. function constant(value) {
  16171. return function() {
  16172. return value;
  16173. };
  16174. }
  16175. /**
  16176. * Checks `value` to determine whether a default value should be returned in
  16177. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  16178. * or `undefined`.
  16179. *
  16180. * @static
  16181. * @memberOf _
  16182. * @since 4.14.0
  16183. * @category Util
  16184. * @param {*} value The value to check.
  16185. * @param {*} defaultValue The default value.
  16186. * @returns {*} Returns the resolved value.
  16187. * @example
  16188. *
  16189. * _.defaultTo(1, 10);
  16190. * // => 1
  16191. *
  16192. * _.defaultTo(undefined, 10);
  16193. * // => 10
  16194. */
  16195. function defaultTo(value, defaultValue) {
  16196. return (value == null || value !== value) ? defaultValue : value;
  16197. }
  16198. /**
  16199. * Creates a function that returns the result of invoking the given functions
  16200. * with the `this` binding of the created function, where each successive
  16201. * invocation is supplied the return value of the previous.
  16202. *
  16203. * @static
  16204. * @memberOf _
  16205. * @since 3.0.0
  16206. * @category Util
  16207. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  16208. * @returns {Function} Returns the new composite function.
  16209. * @see _.flowRight
  16210. * @example
  16211. *
  16212. * function square(n) {
  16213. * return n * n;
  16214. * }
  16215. *
  16216. * var addSquare = _.flow([_.add, square]);
  16217. * addSquare(1, 2);
  16218. * // => 9
  16219. */
  16220. var flow = createFlow();
  16221. /**
  16222. * This method is like `_.flow` except that it creates a function that
  16223. * invokes the given functions from right to left.
  16224. *
  16225. * @static
  16226. * @since 3.0.0
  16227. * @memberOf _
  16228. * @category Util
  16229. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  16230. * @returns {Function} Returns the new composite function.
  16231. * @see _.flow
  16232. * @example
  16233. *
  16234. * function square(n) {
  16235. * return n * n;
  16236. * }
  16237. *
  16238. * var addSquare = _.flowRight([square, _.add]);
  16239. * addSquare(1, 2);
  16240. * // => 9
  16241. */
  16242. var flowRight = createFlow(true);
  16243. /**
  16244. * This method returns the first argument it receives.
  16245. *
  16246. * @static
  16247. * @since 0.1.0
  16248. * @memberOf _
  16249. * @category Util
  16250. * @param {*} value Any value.
  16251. * @returns {*} Returns `value`.
  16252. * @example
  16253. *
  16254. * var object = { 'a': 1 };
  16255. *
  16256. * console.log(_.identity(object) === object);
  16257. * // => true
  16258. */
  16259. function identity(value) {
  16260. return value;
  16261. }
  16262. /**
  16263. * Creates a function that invokes `func` with the arguments of the created
  16264. * function. If `func` is a property name, the created function returns the
  16265. * property value for a given element. If `func` is an array or object, the
  16266. * created function returns `true` for elements that contain the equivalent
  16267. * source properties, otherwise it returns `false`.
  16268. *
  16269. * @static
  16270. * @since 4.0.0
  16271. * @memberOf _
  16272. * @category Util
  16273. * @param {*} [func=_.identity] The value to convert to a callback.
  16274. * @returns {Function} Returns the callback.
  16275. * @example
  16276. *
  16277. * var users = [
  16278. * { 'user': 'barney', 'age': 36, 'active': true },
  16279. * { 'user': 'fred', 'age': 40, 'active': false }
  16280. * ];
  16281. *
  16282. * // The `_.matches` iteratee shorthand.
  16283. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  16284. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  16285. *
  16286. * // The `_.matchesProperty` iteratee shorthand.
  16287. * _.filter(users, _.iteratee(['user', 'fred']));
  16288. * // => [{ 'user': 'fred', 'age': 40 }]
  16289. *
  16290. * // The `_.property` iteratee shorthand.
  16291. * _.map(users, _.iteratee('user'));
  16292. * // => ['barney', 'fred']
  16293. *
  16294. * // Create custom iteratee shorthands.
  16295. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  16296. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  16297. * return func.test(string);
  16298. * };
  16299. * });
  16300. *
  16301. * _.filter(['abc', 'def'], /ef/);
  16302. * // => ['def']
  16303. */
  16304. function iteratee(func) {
  16305. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  16306. }
  16307. /**
  16308. * Creates a function that performs a partial deep comparison between a given
  16309. * object and `source`, returning `true` if the given object has equivalent
  16310. * property values, else `false`.
  16311. *
  16312. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  16313. * partially applied.
  16314. *
  16315. * Partial comparisons will match empty array and empty object `source`
  16316. * values against any array or object value, respectively. See `_.isEqual`
  16317. * for a list of supported value comparisons.
  16318. *
  16319. * **Note:** Multiple values can be checked by combining several matchers
  16320. * using `_.overSome`
  16321. *
  16322. * @static
  16323. * @memberOf _
  16324. * @since 3.0.0
  16325. * @category Util
  16326. * @param {Object} source The object of property values to match.
  16327. * @returns {Function} Returns the new spec function.
  16328. * @example
  16329. *
  16330. * var objects = [
  16331. * { 'a': 1, 'b': 2, 'c': 3 },
  16332. * { 'a': 4, 'b': 5, 'c': 6 }
  16333. * ];
  16334. *
  16335. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  16336. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  16337. *
  16338. * // Checking for several possible values
  16339. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  16340. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16341. */
  16342. function matches(source) {
  16343. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  16344. }
  16345. /**
  16346. * Creates a function that performs a partial deep comparison between the
  16347. * value at `path` of a given object to `srcValue`, returning `true` if the
  16348. * object value is equivalent, else `false`.
  16349. *
  16350. * **Note:** Partial comparisons will match empty array and empty object
  16351. * `srcValue` values against any array or object value, respectively. See
  16352. * `_.isEqual` for a list of supported value comparisons.
  16353. *
  16354. * **Note:** Multiple values can be checked by combining several matchers
  16355. * using `_.overSome`
  16356. *
  16357. * @static
  16358. * @memberOf _
  16359. * @since 3.2.0
  16360. * @category Util
  16361. * @param {Array|string} path The path of the property to get.
  16362. * @param {*} srcValue The value to match.
  16363. * @returns {Function} Returns the new spec function.
  16364. * @example
  16365. *
  16366. * var objects = [
  16367. * { 'a': 1, 'b': 2, 'c': 3 },
  16368. * { 'a': 4, 'b': 5, 'c': 6 }
  16369. * ];
  16370. *
  16371. * _.find(objects, _.matchesProperty('a', 4));
  16372. * // => { 'a': 4, 'b': 5, 'c': 6 }
  16373. *
  16374. * // Checking for several possible values
  16375. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  16376. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16377. */
  16378. function matchesProperty(path, srcValue) {
  16379. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  16380. }
  16381. /**
  16382. * Creates a function that invokes the method at `path` of a given object.
  16383. * Any additional arguments are provided to the invoked method.
  16384. *
  16385. * @static
  16386. * @memberOf _
  16387. * @since 3.7.0
  16388. * @category Util
  16389. * @param {Array|string} path The path of the method to invoke.
  16390. * @param {...*} [args] The arguments to invoke the method with.
  16391. * @returns {Function} Returns the new invoker function.
  16392. * @example
  16393. *
  16394. * var objects = [
  16395. * { 'a': { 'b': _.constant(2) } },
  16396. * { 'a': { 'b': _.constant(1) } }
  16397. * ];
  16398. *
  16399. * _.map(objects, _.method('a.b'));
  16400. * // => [2, 1]
  16401. *
  16402. * _.map(objects, _.method(['a', 'b']));
  16403. * // => [2, 1]
  16404. */
  16405. var method = baseRest(function(path, args) {
  16406. return function(object) {
  16407. return baseInvoke(object, path, args);
  16408. };
  16409. });
  16410. /**
  16411. * The opposite of `_.method`; this method creates a function that invokes
  16412. * the method at a given path of `object`. Any additional arguments are
  16413. * provided to the invoked method.
  16414. *
  16415. * @static
  16416. * @memberOf _
  16417. * @since 3.7.0
  16418. * @category Util
  16419. * @param {Object} object The object to query.
  16420. * @param {...*} [args] The arguments to invoke the method with.
  16421. * @returns {Function} Returns the new invoker function.
  16422. * @example
  16423. *
  16424. * var array = _.times(3, _.constant),
  16425. * object = { 'a': array, 'b': array, 'c': array };
  16426. *
  16427. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  16428. * // => [2, 0]
  16429. *
  16430. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  16431. * // => [2, 0]
  16432. */
  16433. var methodOf = baseRest(function(object, args) {
  16434. return function(path) {
  16435. return baseInvoke(object, path, args);
  16436. };
  16437. });
  16438. /**
  16439. * Adds all own enumerable string keyed function properties of a source
  16440. * object to the destination object. If `object` is a function, then methods
  16441. * are added to its prototype as well.
  16442. *
  16443. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  16444. * avoid conflicts caused by modifying the original.
  16445. *
  16446. * @static
  16447. * @since 0.1.0
  16448. * @memberOf _
  16449. * @category Util
  16450. * @param {Function|Object} [object=lodash] The destination object.
  16451. * @param {Object} source The object of functions to add.
  16452. * @param {Object} [options={}] The options object.
  16453. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  16454. * @returns {Function|Object} Returns `object`.
  16455. * @example
  16456. *
  16457. * function vowels(string) {
  16458. * return _.filter(string, function(v) {
  16459. * return /[aeiou]/i.test(v);
  16460. * });
  16461. * }
  16462. *
  16463. * _.mixin({ 'vowels': vowels });
  16464. * _.vowels('fred');
  16465. * // => ['e']
  16466. *
  16467. * _('fred').vowels().value();
  16468. * // => ['e']
  16469. *
  16470. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  16471. * _('fred').vowels();
  16472. * // => ['e']
  16473. */
  16474. function mixin(object, source, options) {
  16475. var props = keys(source),
  16476. methodNames = baseFunctions(source, props);
  16477. if (options == null &&
  16478. !(isObject(source) && (methodNames.length || !props.length))) {
  16479. options = source;
  16480. source = object;
  16481. object = this;
  16482. methodNames = baseFunctions(source, keys(source));
  16483. }
  16484. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  16485. isFunc = isFunction(object);
  16486. arrayEach(methodNames, function(methodName) {
  16487. var func = source[methodName];
  16488. object[methodName] = func;
  16489. if (isFunc) {
  16490. object.prototype[methodName] = function() {
  16491. var chainAll = this.__chain__;
  16492. if (chain || chainAll) {
  16493. var result = object(this.__wrapped__),
  16494. actions = result.__actions__ = copyArray(this.__actions__);
  16495. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  16496. result.__chain__ = chainAll;
  16497. return result;
  16498. }
  16499. return func.apply(object, arrayPush([this.value()], arguments));
  16500. };
  16501. }
  16502. });
  16503. return object;
  16504. }
  16505. /**
  16506. * Reverts the `_` variable to its previous value and returns a reference to
  16507. * the `lodash` function.
  16508. *
  16509. * @static
  16510. * @since 0.1.0
  16511. * @memberOf _
  16512. * @category Util
  16513. * @returns {Function} Returns the `lodash` function.
  16514. * @example
  16515. *
  16516. * var lodash = _.noConflict();
  16517. */
  16518. function noConflict() {
  16519. if (root._ === this) {
  16520. root._ = oldDash;
  16521. }
  16522. return this;
  16523. }
  16524. /**
  16525. * This method returns `undefined`.
  16526. *
  16527. * @static
  16528. * @memberOf _
  16529. * @since 2.3.0
  16530. * @category Util
  16531. * @example
  16532. *
  16533. * _.times(2, _.noop);
  16534. * // => [undefined, undefined]
  16535. */
  16536. function noop() {
  16537. // No operation performed.
  16538. }
  16539. /**
  16540. * Creates a function that gets the argument at index `n`. If `n` is negative,
  16541. * the nth argument from the end is returned.
  16542. *
  16543. * @static
  16544. * @memberOf _
  16545. * @since 4.0.0
  16546. * @category Util
  16547. * @param {number} [n=0] The index of the argument to return.
  16548. * @returns {Function} Returns the new pass-thru function.
  16549. * @example
  16550. *
  16551. * var func = _.nthArg(1);
  16552. * func('a', 'b', 'c', 'd');
  16553. * // => 'b'
  16554. *
  16555. * var func = _.nthArg(-2);
  16556. * func('a', 'b', 'c', 'd');
  16557. * // => 'c'
  16558. */
  16559. function nthArg(n) {
  16560. n = toInteger(n);
  16561. return baseRest(function(args) {
  16562. return baseNth(args, n);
  16563. });
  16564. }
  16565. /**
  16566. * Creates a function that invokes `iteratees` with the arguments it receives
  16567. * and returns their results.
  16568. *
  16569. * @static
  16570. * @memberOf _
  16571. * @since 4.0.0
  16572. * @category Util
  16573. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  16574. * The iteratees to invoke.
  16575. * @returns {Function} Returns the new function.
  16576. * @example
  16577. *
  16578. * var func = _.over([Math.max, Math.min]);
  16579. *
  16580. * func(1, 2, 3, 4);
  16581. * // => [4, 1]
  16582. */
  16583. var over = createOver(arrayMap);
  16584. /**
  16585. * Creates a function that checks if **all** of the `predicates` return
  16586. * truthy when invoked with the arguments it receives.
  16587. *
  16588. * Following shorthands are possible for providing predicates.
  16589. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16590. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16591. *
  16592. * @static
  16593. * @memberOf _
  16594. * @since 4.0.0
  16595. * @category Util
  16596. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16597. * The predicates to check.
  16598. * @returns {Function} Returns the new function.
  16599. * @example
  16600. *
  16601. * var func = _.overEvery([Boolean, isFinite]);
  16602. *
  16603. * func('1');
  16604. * // => true
  16605. *
  16606. * func(null);
  16607. * // => false
  16608. *
  16609. * func(NaN);
  16610. * // => false
  16611. */
  16612. var overEvery = createOver(arrayEvery);
  16613. /**
  16614. * Creates a function that checks if **any** of the `predicates` return
  16615. * truthy when invoked with the arguments it receives.
  16616. *
  16617. * Following shorthands are possible for providing predicates.
  16618. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16619. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16620. *
  16621. * @static
  16622. * @memberOf _
  16623. * @since 4.0.0
  16624. * @category Util
  16625. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16626. * The predicates to check.
  16627. * @returns {Function} Returns the new function.
  16628. * @example
  16629. *
  16630. * var func = _.overSome([Boolean, isFinite]);
  16631. *
  16632. * func('1');
  16633. * // => true
  16634. *
  16635. * func(null);
  16636. * // => true
  16637. *
  16638. * func(NaN);
  16639. * // => false
  16640. *
  16641. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  16642. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  16643. */
  16644. var overSome = createOver(arraySome);
  16645. /**
  16646. * Creates a function that returns the value at `path` of a given object.
  16647. *
  16648. * @static
  16649. * @memberOf _
  16650. * @since 2.4.0
  16651. * @category Util
  16652. * @param {Array|string} path The path of the property to get.
  16653. * @returns {Function} Returns the new accessor function.
  16654. * @example
  16655. *
  16656. * var objects = [
  16657. * { 'a': { 'b': 2 } },
  16658. * { 'a': { 'b': 1 } }
  16659. * ];
  16660. *
  16661. * _.map(objects, _.property('a.b'));
  16662. * // => [2, 1]
  16663. *
  16664. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  16665. * // => [1, 2]
  16666. */
  16667. function property(path) {
  16668. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  16669. }
  16670. /**
  16671. * The opposite of `_.property`; this method creates a function that returns
  16672. * the value at a given path of `object`.
  16673. *
  16674. * @static
  16675. * @memberOf _
  16676. * @since 3.0.0
  16677. * @category Util
  16678. * @param {Object} object The object to query.
  16679. * @returns {Function} Returns the new accessor function.
  16680. * @example
  16681. *
  16682. * var array = [0, 1, 2],
  16683. * object = { 'a': array, 'b': array, 'c': array };
  16684. *
  16685. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  16686. * // => [2, 0]
  16687. *
  16688. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  16689. * // => [2, 0]
  16690. */
  16691. function propertyOf(object) {
  16692. return function(path) {
  16693. return object == null ? undefined : baseGet(object, path);
  16694. };
  16695. }
  16696. /**
  16697. * Creates an array of numbers (positive and/or negative) progressing from
  16698. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  16699. * `start` is specified without an `end` or `step`. If `end` is not specified,
  16700. * it's set to `start` with `start` then set to `0`.
  16701. *
  16702. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  16703. * floating-point values which can produce unexpected results.
  16704. *
  16705. * @static
  16706. * @since 0.1.0
  16707. * @memberOf _
  16708. * @category Util
  16709. * @param {number} [start=0] The start of the range.
  16710. * @param {number} end The end of the range.
  16711. * @param {number} [step=1] The value to increment or decrement by.
  16712. * @returns {Array} Returns the range of numbers.
  16713. * @see _.inRange, _.rangeRight
  16714. * @example
  16715. *
  16716. * _.range(4);
  16717. * // => [0, 1, 2, 3]
  16718. *
  16719. * _.range(-4);
  16720. * // => [0, -1, -2, -3]
  16721. *
  16722. * _.range(1, 5);
  16723. * // => [1, 2, 3, 4]
  16724. *
  16725. * _.range(0, 20, 5);
  16726. * // => [0, 5, 10, 15]
  16727. *
  16728. * _.range(0, -4, -1);
  16729. * // => [0, -1, -2, -3]
  16730. *
  16731. * _.range(1, 4, 0);
  16732. * // => [1, 1, 1]
  16733. *
  16734. * _.range(0);
  16735. * // => []
  16736. */
  16737. var range = createRange();
  16738. /**
  16739. * This method is like `_.range` except that it populates values in
  16740. * descending order.
  16741. *
  16742. * @static
  16743. * @memberOf _
  16744. * @since 4.0.0
  16745. * @category Util
  16746. * @param {number} [start=0] The start of the range.
  16747. * @param {number} end The end of the range.
  16748. * @param {number} [step=1] The value to increment or decrement by.
  16749. * @returns {Array} Returns the range of numbers.
  16750. * @see _.inRange, _.range
  16751. * @example
  16752. *
  16753. * _.rangeRight(4);
  16754. * // => [3, 2, 1, 0]
  16755. *
  16756. * _.rangeRight(-4);
  16757. * // => [-3, -2, -1, 0]
  16758. *
  16759. * _.rangeRight(1, 5);
  16760. * // => [4, 3, 2, 1]
  16761. *
  16762. * _.rangeRight(0, 20, 5);
  16763. * // => [15, 10, 5, 0]
  16764. *
  16765. * _.rangeRight(0, -4, -1);
  16766. * // => [-3, -2, -1, 0]
  16767. *
  16768. * _.rangeRight(1, 4, 0);
  16769. * // => [1, 1, 1]
  16770. *
  16771. * _.rangeRight(0);
  16772. * // => []
  16773. */
  16774. var rangeRight = createRange(true);
  16775. /**
  16776. * This method returns a new empty array.
  16777. *
  16778. * @static
  16779. * @memberOf _
  16780. * @since 4.13.0
  16781. * @category Util
  16782. * @returns {Array} Returns the new empty array.
  16783. * @example
  16784. *
  16785. * var arrays = _.times(2, _.stubArray);
  16786. *
  16787. * console.log(arrays);
  16788. * // => [[], []]
  16789. *
  16790. * console.log(arrays[0] === arrays[1]);
  16791. * // => false
  16792. */
  16793. function stubArray() {
  16794. return [];
  16795. }
  16796. /**
  16797. * This method returns `false`.
  16798. *
  16799. * @static
  16800. * @memberOf _
  16801. * @since 4.13.0
  16802. * @category Util
  16803. * @returns {boolean} Returns `false`.
  16804. * @example
  16805. *
  16806. * _.times(2, _.stubFalse);
  16807. * // => [false, false]
  16808. */
  16809. function stubFalse() {
  16810. return false;
  16811. }
  16812. /**
  16813. * This method returns a new empty object.
  16814. *
  16815. * @static
  16816. * @memberOf _
  16817. * @since 4.13.0
  16818. * @category Util
  16819. * @returns {Object} Returns the new empty object.
  16820. * @example
  16821. *
  16822. * var objects = _.times(2, _.stubObject);
  16823. *
  16824. * console.log(objects);
  16825. * // => [{}, {}]
  16826. *
  16827. * console.log(objects[0] === objects[1]);
  16828. * // => false
  16829. */
  16830. function stubObject() {
  16831. return {};
  16832. }
  16833. /**
  16834. * This method returns an empty string.
  16835. *
  16836. * @static
  16837. * @memberOf _
  16838. * @since 4.13.0
  16839. * @category Util
  16840. * @returns {string} Returns the empty string.
  16841. * @example
  16842. *
  16843. * _.times(2, _.stubString);
  16844. * // => ['', '']
  16845. */
  16846. function stubString() {
  16847. return '';
  16848. }
  16849. /**
  16850. * This method returns `true`.
  16851. *
  16852. * @static
  16853. * @memberOf _
  16854. * @since 4.13.0
  16855. * @category Util
  16856. * @returns {boolean} Returns `true`.
  16857. * @example
  16858. *
  16859. * _.times(2, _.stubTrue);
  16860. * // => [true, true]
  16861. */
  16862. function stubTrue() {
  16863. return true;
  16864. }
  16865. /**
  16866. * Invokes the iteratee `n` times, returning an array of the results of
  16867. * each invocation. The iteratee is invoked with one argument; (index).
  16868. *
  16869. * @static
  16870. * @since 0.1.0
  16871. * @memberOf _
  16872. * @category Util
  16873. * @param {number} n The number of times to invoke `iteratee`.
  16874. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16875. * @returns {Array} Returns the array of results.
  16876. * @example
  16877. *
  16878. * _.times(3, String);
  16879. * // => ['0', '1', '2']
  16880. *
  16881. * _.times(4, _.constant(0));
  16882. * // => [0, 0, 0, 0]
  16883. */
  16884. function times(n, iteratee) {
  16885. n = toInteger(n);
  16886. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16887. return [];
  16888. }
  16889. var index = MAX_ARRAY_LENGTH,
  16890. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16891. iteratee = getIteratee(iteratee);
  16892. n -= MAX_ARRAY_LENGTH;
  16893. var result = baseTimes(length, iteratee);
  16894. while (++index < n) {
  16895. iteratee(index);
  16896. }
  16897. return result;
  16898. }
  16899. /**
  16900. * Converts `value` to a property path array.
  16901. *
  16902. * @static
  16903. * @memberOf _
  16904. * @since 4.0.0
  16905. * @category Util
  16906. * @param {*} value The value to convert.
  16907. * @returns {Array} Returns the new property path array.
  16908. * @example
  16909. *
  16910. * _.toPath('a.b.c');
  16911. * // => ['a', 'b', 'c']
  16912. *
  16913. * _.toPath('a[0].b.c');
  16914. * // => ['a', '0', 'b', 'c']
  16915. */
  16916. function toPath(value) {
  16917. if (isArray(value)) {
  16918. return arrayMap(value, toKey);
  16919. }
  16920. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16921. }
  16922. /**
  16923. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16924. *
  16925. * @static
  16926. * @since 0.1.0
  16927. * @memberOf _
  16928. * @category Util
  16929. * @param {string} [prefix=''] The value to prefix the ID with.
  16930. * @returns {string} Returns the unique ID.
  16931. * @example
  16932. *
  16933. * _.uniqueId('contact_');
  16934. * // => 'contact_104'
  16935. *
  16936. * _.uniqueId();
  16937. * // => '105'
  16938. */
  16939. function uniqueId(prefix) {
  16940. var id = ++idCounter;
  16941. return toString(prefix) + id;
  16942. }
  16943. /*------------------------------------------------------------------------*/
  16944. /**
  16945. * Adds two numbers.
  16946. *
  16947. * @static
  16948. * @memberOf _
  16949. * @since 3.4.0
  16950. * @category Math
  16951. * @param {number} augend The first number in an addition.
  16952. * @param {number} addend The second number in an addition.
  16953. * @returns {number} Returns the total.
  16954. * @example
  16955. *
  16956. * _.add(6, 4);
  16957. * // => 10
  16958. */
  16959. var add = createMathOperation(function(augend, addend) {
  16960. return augend + addend;
  16961. }, 0);
  16962. /**
  16963. * Computes `number` rounded up to `precision`.
  16964. *
  16965. * @static
  16966. * @memberOf _
  16967. * @since 3.10.0
  16968. * @category Math
  16969. * @param {number} number The number to round up.
  16970. * @param {number} [precision=0] The precision to round up to.
  16971. * @returns {number} Returns the rounded up number.
  16972. * @example
  16973. *
  16974. * _.ceil(4.006);
  16975. * // => 5
  16976. *
  16977. * _.ceil(6.004, 2);
  16978. * // => 6.01
  16979. *
  16980. * _.ceil(6040, -2);
  16981. * // => 6100
  16982. */
  16983. var ceil = createRound('ceil');
  16984. /**
  16985. * Divide two numbers.
  16986. *
  16987. * @static
  16988. * @memberOf _
  16989. * @since 4.7.0
  16990. * @category Math
  16991. * @param {number} dividend The first number in a division.
  16992. * @param {number} divisor The second number in a division.
  16993. * @returns {number} Returns the quotient.
  16994. * @example
  16995. *
  16996. * _.divide(6, 4);
  16997. * // => 1.5
  16998. */
  16999. var divide = createMathOperation(function(dividend, divisor) {
  17000. return dividend / divisor;
  17001. }, 1);
  17002. /**
  17003. * Computes `number` rounded down to `precision`.
  17004. *
  17005. * @static
  17006. * @memberOf _
  17007. * @since 3.10.0
  17008. * @category Math
  17009. * @param {number} number The number to round down.
  17010. * @param {number} [precision=0] The precision to round down to.
  17011. * @returns {number} Returns the rounded down number.
  17012. * @example
  17013. *
  17014. * _.floor(4.006);
  17015. * // => 4
  17016. *
  17017. * _.floor(0.046, 2);
  17018. * // => 0.04
  17019. *
  17020. * _.floor(4060, -2);
  17021. * // => 4000
  17022. */
  17023. var floor = createRound('floor');
  17024. /**
  17025. * Computes the maximum value of `array`. If `array` is empty or falsey,
  17026. * `undefined` is returned.
  17027. *
  17028. * @static
  17029. * @since 0.1.0
  17030. * @memberOf _
  17031. * @category Math
  17032. * @param {Array} array The array to iterate over.
  17033. * @returns {*} Returns the maximum value.
  17034. * @example
  17035. *
  17036. * _.max([4, 2, 8, 6]);
  17037. * // => 8
  17038. *
  17039. * _.max([]);
  17040. * // => undefined
  17041. */
  17042. function max(array) {
  17043. return (array && array.length)
  17044. ? baseExtremum(array, identity, baseGt)
  17045. : undefined;
  17046. }
  17047. /**
  17048. * This method is like `_.max` except that it accepts `iteratee` which is
  17049. * invoked for each element in `array` to generate the criterion by which
  17050. * the value is ranked. The iteratee is invoked with one argument: (value).
  17051. *
  17052. * @static
  17053. * @memberOf _
  17054. * @since 4.0.0
  17055. * @category Math
  17056. * @param {Array} array The array to iterate over.
  17057. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17058. * @returns {*} Returns the maximum value.
  17059. * @example
  17060. *
  17061. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  17062. *
  17063. * _.maxBy(objects, function(o) { return o.n; });
  17064. * // => { 'n': 2 }
  17065. *
  17066. * // The `_.property` iteratee shorthand.
  17067. * _.maxBy(objects, 'n');
  17068. * // => { 'n': 2 }
  17069. */
  17070. function maxBy(array, iteratee) {
  17071. return (array && array.length)
  17072. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  17073. : undefined;
  17074. }
  17075. /**
  17076. * Computes the mean of the values in `array`.
  17077. *
  17078. * @static
  17079. * @memberOf _
  17080. * @since 4.0.0
  17081. * @category Math
  17082. * @param {Array} array The array to iterate over.
  17083. * @returns {number} Returns the mean.
  17084. * @example
  17085. *
  17086. * _.mean([4, 2, 8, 6]);
  17087. * // => 5
  17088. */
  17089. function mean(array) {
  17090. return baseMean(array, identity);
  17091. }
  17092. /**
  17093. * This method is like `_.mean` except that it accepts `iteratee` which is
  17094. * invoked for each element in `array` to generate the value to be averaged.
  17095. * The iteratee is invoked with one argument: (value).
  17096. *
  17097. * @static
  17098. * @memberOf _
  17099. * @since 4.7.0
  17100. * @category Math
  17101. * @param {Array} array The array to iterate over.
  17102. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17103. * @returns {number} Returns the mean.
  17104. * @example
  17105. *
  17106. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  17107. *
  17108. * _.meanBy(objects, function(o) { return o.n; });
  17109. * // => 5
  17110. *
  17111. * // The `_.property` iteratee shorthand.
  17112. * _.meanBy(objects, 'n');
  17113. * // => 5
  17114. */
  17115. function meanBy(array, iteratee) {
  17116. return baseMean(array, getIteratee(iteratee, 2));
  17117. }
  17118. /**
  17119. * Computes the minimum value of `array`. If `array` is empty or falsey,
  17120. * `undefined` is returned.
  17121. *
  17122. * @static
  17123. * @since 0.1.0
  17124. * @memberOf _
  17125. * @category Math
  17126. * @param {Array} array The array to iterate over.
  17127. * @returns {*} Returns the minimum value.
  17128. * @example
  17129. *
  17130. * _.min([4, 2, 8, 6]);
  17131. * // => 2
  17132. *
  17133. * _.min([]);
  17134. * // => undefined
  17135. */
  17136. function min(array) {
  17137. return (array && array.length)
  17138. ? baseExtremum(array, identity, baseLt)
  17139. : undefined;
  17140. }
  17141. /**
  17142. * This method is like `_.min` except that it accepts `iteratee` which is
  17143. * invoked for each element in `array` to generate the criterion by which
  17144. * the value is ranked. The iteratee is invoked with one argument: (value).
  17145. *
  17146. * @static
  17147. * @memberOf _
  17148. * @since 4.0.0
  17149. * @category Math
  17150. * @param {Array} array The array to iterate over.
  17151. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17152. * @returns {*} Returns the minimum value.
  17153. * @example
  17154. *
  17155. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  17156. *
  17157. * _.minBy(objects, function(o) { return o.n; });
  17158. * // => { 'n': 1 }
  17159. *
  17160. * // The `_.property` iteratee shorthand.
  17161. * _.minBy(objects, 'n');
  17162. * // => { 'n': 1 }
  17163. */
  17164. function minBy(array, iteratee) {
  17165. return (array && array.length)
  17166. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  17167. : undefined;
  17168. }
  17169. /**
  17170. * Multiply two numbers.
  17171. *
  17172. * @static
  17173. * @memberOf _
  17174. * @since 4.7.0
  17175. * @category Math
  17176. * @param {number} multiplier The first number in a multiplication.
  17177. * @param {number} multiplicand The second number in a multiplication.
  17178. * @returns {number} Returns the product.
  17179. * @example
  17180. *
  17181. * _.multiply(6, 4);
  17182. * // => 24
  17183. */
  17184. var multiply = createMathOperation(function(multiplier, multiplicand) {
  17185. return multiplier * multiplicand;
  17186. }, 1);
  17187. /**
  17188. * Computes `number` rounded to `precision`.
  17189. *
  17190. * @static
  17191. * @memberOf _
  17192. * @since 3.10.0
  17193. * @category Math
  17194. * @param {number} number The number to round.
  17195. * @param {number} [precision=0] The precision to round to.
  17196. * @returns {number} Returns the rounded number.
  17197. * @example
  17198. *
  17199. * _.round(4.006);
  17200. * // => 4
  17201. *
  17202. * _.round(4.006, 2);
  17203. * // => 4.01
  17204. *
  17205. * _.round(4060, -2);
  17206. * // => 4100
  17207. */
  17208. var round = createRound('round');
  17209. /**
  17210. * Subtract two numbers.
  17211. *
  17212. * @static
  17213. * @memberOf _
  17214. * @since 4.0.0
  17215. * @category Math
  17216. * @param {number} minuend The first number in a subtraction.
  17217. * @param {number} subtrahend The second number in a subtraction.
  17218. * @returns {number} Returns the difference.
  17219. * @example
  17220. *
  17221. * _.subtract(6, 4);
  17222. * // => 2
  17223. */
  17224. var subtract = createMathOperation(function(minuend, subtrahend) {
  17225. return minuend - subtrahend;
  17226. }, 0);
  17227. /**
  17228. * Computes the sum of the values in `array`.
  17229. *
  17230. * @static
  17231. * @memberOf _
  17232. * @since 3.4.0
  17233. * @category Math
  17234. * @param {Array} array The array to iterate over.
  17235. * @returns {number} Returns the sum.
  17236. * @example
  17237. *
  17238. * _.sum([4, 2, 8, 6]);
  17239. * // => 20
  17240. */
  17241. function sum(array) {
  17242. return (array && array.length)
  17243. ? baseSum(array, identity)
  17244. : 0;
  17245. }
  17246. /**
  17247. * This method is like `_.sum` except that it accepts `iteratee` which is
  17248. * invoked for each element in `array` to generate the value to be summed.
  17249. * The iteratee is invoked with one argument: (value).
  17250. *
  17251. * @static
  17252. * @memberOf _
  17253. * @since 4.0.0
  17254. * @category Math
  17255. * @param {Array} array The array to iterate over.
  17256. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17257. * @returns {number} Returns the sum.
  17258. * @example
  17259. *
  17260. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  17261. *
  17262. * _.sumBy(objects, function(o) { return o.n; });
  17263. * // => 20
  17264. *
  17265. * // The `_.property` iteratee shorthand.
  17266. * _.sumBy(objects, 'n');
  17267. * // => 20
  17268. */
  17269. function sumBy(array, iteratee) {
  17270. return (array && array.length)
  17271. ? baseSum(array, getIteratee(iteratee, 2))
  17272. : 0;
  17273. }
  17274. /*------------------------------------------------------------------------*/
  17275. // Add methods that return wrapped values in chain sequences.
  17276. lodash.after = after;
  17277. lodash.ary = ary;
  17278. lodash.assign = assign;
  17279. lodash.assignIn = assignIn;
  17280. lodash.assignInWith = assignInWith;
  17281. lodash.assignWith = assignWith;
  17282. lodash.at = at;
  17283. lodash.before = before;
  17284. lodash.bind = bind;
  17285. lodash.bindAll = bindAll;
  17286. lodash.bindKey = bindKey;
  17287. lodash.castArray = castArray;
  17288. lodash.chain = chain;
  17289. lodash.chunk = chunk;
  17290. lodash.compact = compact;
  17291. lodash.concat = concat;
  17292. lodash.cond = cond;
  17293. lodash.conforms = conforms;
  17294. lodash.constant = constant;
  17295. lodash.countBy = countBy;
  17296. lodash.create = create;
  17297. lodash.curry = curry;
  17298. lodash.curryRight = curryRight;
  17299. lodash.debounce = debounce;
  17300. lodash.defaults = defaults;
  17301. lodash.defaultsDeep = defaultsDeep;
  17302. lodash.defer = defer;
  17303. lodash.delay = delay;
  17304. lodash.difference = difference;
  17305. lodash.differenceBy = differenceBy;
  17306. lodash.differenceWith = differenceWith;
  17307. lodash.drop = drop;
  17308. lodash.dropRight = dropRight;
  17309. lodash.dropRightWhile = dropRightWhile;
  17310. lodash.dropWhile = dropWhile;
  17311. lodash.fill = fill;
  17312. lodash.filter = filter;
  17313. lodash.flatMap = flatMap;
  17314. lodash.flatMapDeep = flatMapDeep;
  17315. lodash.flatMapDepth = flatMapDepth;
  17316. lodash.flatten = flatten;
  17317. lodash.flattenDeep = flattenDeep;
  17318. lodash.flattenDepth = flattenDepth;
  17319. lodash.flip = flip;
  17320. lodash.flow = flow;
  17321. lodash.flowRight = flowRight;
  17322. lodash.fromPairs = fromPairs;
  17323. lodash.functions = functions;
  17324. lodash.functionsIn = functionsIn;
  17325. lodash.groupBy = groupBy;
  17326. lodash.initial = initial;
  17327. lodash.intersection = intersection;
  17328. lodash.intersectionBy = intersectionBy;
  17329. lodash.intersectionWith = intersectionWith;
  17330. lodash.invert = invert;
  17331. lodash.invertBy = invertBy;
  17332. lodash.invokeMap = invokeMap;
  17333. lodash.iteratee = iteratee;
  17334. lodash.keyBy = keyBy;
  17335. lodash.keys = keys;
  17336. lodash.keysIn = keysIn;
  17337. lodash.map = map;
  17338. lodash.mapKeys = mapKeys;
  17339. lodash.mapValues = mapValues;
  17340. lodash.matches = matches;
  17341. lodash.matchesProperty = matchesProperty;
  17342. lodash.memoize = memoize;
  17343. lodash.merge = merge;
  17344. lodash.mergeWith = mergeWith;
  17345. lodash.method = method;
  17346. lodash.methodOf = methodOf;
  17347. lodash.mixin = mixin;
  17348. lodash.negate = negate;
  17349. lodash.nthArg = nthArg;
  17350. lodash.omit = omit;
  17351. lodash.omitBy = omitBy;
  17352. lodash.once = once;
  17353. lodash.orderBy = orderBy;
  17354. lodash.over = over;
  17355. lodash.overArgs = overArgs;
  17356. lodash.overEvery = overEvery;
  17357. lodash.overSome = overSome;
  17358. lodash.partial = partial;
  17359. lodash.partialRight = partialRight;
  17360. lodash.partition = partition;
  17361. lodash.pick = pick;
  17362. lodash.pickBy = pickBy;
  17363. lodash.property = property;
  17364. lodash.propertyOf = propertyOf;
  17365. lodash.pull = pull;
  17366. lodash.pullAll = pullAll;
  17367. lodash.pullAllBy = pullAllBy;
  17368. lodash.pullAllWith = pullAllWith;
  17369. lodash.pullAt = pullAt;
  17370. lodash.range = range;
  17371. lodash.rangeRight = rangeRight;
  17372. lodash.rearg = rearg;
  17373. lodash.reject = reject;
  17374. lodash.remove = remove;
  17375. lodash.rest = rest;
  17376. lodash.reverse = reverse;
  17377. lodash.sampleSize = sampleSize;
  17378. lodash.set = set;
  17379. lodash.setWith = setWith;
  17380. lodash.shuffle = shuffle;
  17381. lodash.slice = slice;
  17382. lodash.sortBy = sortBy;
  17383. lodash.sortedUniq = sortedUniq;
  17384. lodash.sortedUniqBy = sortedUniqBy;
  17385. lodash.split = split;
  17386. lodash.spread = spread;
  17387. lodash.tail = tail;
  17388. lodash.take = take;
  17389. lodash.takeRight = takeRight;
  17390. lodash.takeRightWhile = takeRightWhile;
  17391. lodash.takeWhile = takeWhile;
  17392. lodash.tap = tap;
  17393. lodash.throttle = throttle;
  17394. lodash.thru = thru;
  17395. lodash.toArray = toArray;
  17396. lodash.toPairs = toPairs;
  17397. lodash.toPairsIn = toPairsIn;
  17398. lodash.toPath = toPath;
  17399. lodash.toPlainObject = toPlainObject;
  17400. lodash.transform = transform;
  17401. lodash.unary = unary;
  17402. lodash.union = union;
  17403. lodash.unionBy = unionBy;
  17404. lodash.unionWith = unionWith;
  17405. lodash.uniq = uniq;
  17406. lodash.uniqBy = uniqBy;
  17407. lodash.uniqWith = uniqWith;
  17408. lodash.unset = unset;
  17409. lodash.unzip = unzip;
  17410. lodash.unzipWith = unzipWith;
  17411. lodash.update = update;
  17412. lodash.updateWith = updateWith;
  17413. lodash.values = values;
  17414. lodash.valuesIn = valuesIn;
  17415. lodash.without = without;
  17416. lodash.words = words;
  17417. lodash.wrap = wrap;
  17418. lodash.xor = xor;
  17419. lodash.xorBy = xorBy;
  17420. lodash.xorWith = xorWith;
  17421. lodash.zip = zip;
  17422. lodash.zipObject = zipObject;
  17423. lodash.zipObjectDeep = zipObjectDeep;
  17424. lodash.zipWith = zipWith;
  17425. // Add aliases.
  17426. lodash.entries = toPairs;
  17427. lodash.entriesIn = toPairsIn;
  17428. lodash.extend = assignIn;
  17429. lodash.extendWith = assignInWith;
  17430. // Add methods to `lodash.prototype`.
  17431. mixin(lodash, lodash);
  17432. /*------------------------------------------------------------------------*/
  17433. // Add methods that return unwrapped values in chain sequences.
  17434. lodash.add = add;
  17435. lodash.attempt = attempt;
  17436. lodash.camelCase = camelCase;
  17437. lodash.capitalize = capitalize;
  17438. lodash.ceil = ceil;
  17439. lodash.clamp = clamp;
  17440. lodash.clone = clone;
  17441. lodash.cloneDeep = cloneDeep;
  17442. lodash.cloneDeepWith = cloneDeepWith;
  17443. lodash.cloneWith = cloneWith;
  17444. lodash.conformsTo = conformsTo;
  17445. lodash.deburr = deburr;
  17446. lodash.defaultTo = defaultTo;
  17447. lodash.divide = divide;
  17448. lodash.endsWith = endsWith;
  17449. lodash.eq = eq;
  17450. lodash.escape = escape;
  17451. lodash.escapeRegExp = escapeRegExp;
  17452. lodash.every = every;
  17453. lodash.find = find;
  17454. lodash.findIndex = findIndex;
  17455. lodash.findKey = findKey;
  17456. lodash.findLast = findLast;
  17457. lodash.findLastIndex = findLastIndex;
  17458. lodash.findLastKey = findLastKey;
  17459. lodash.floor = floor;
  17460. lodash.forEach = forEach;
  17461. lodash.forEachRight = forEachRight;
  17462. lodash.forIn = forIn;
  17463. lodash.forInRight = forInRight;
  17464. lodash.forOwn = forOwn;
  17465. lodash.forOwnRight = forOwnRight;
  17466. lodash.get = get;
  17467. lodash.gt = gt;
  17468. lodash.gte = gte;
  17469. lodash.has = has;
  17470. lodash.hasIn = hasIn;
  17471. lodash.head = head;
  17472. lodash.identity = identity;
  17473. lodash.includes = includes;
  17474. lodash.indexOf = indexOf;
  17475. lodash.inRange = inRange;
  17476. lodash.invoke = invoke;
  17477. lodash.isArguments = isArguments;
  17478. lodash.isArray = isArray;
  17479. lodash.isArrayBuffer = isArrayBuffer;
  17480. lodash.isArrayLike = isArrayLike;
  17481. lodash.isArrayLikeObject = isArrayLikeObject;
  17482. lodash.isBoolean = isBoolean;
  17483. lodash.isBuffer = isBuffer;
  17484. lodash.isDate = isDate;
  17485. lodash.isElement = isElement;
  17486. lodash.isEmpty = isEmpty;
  17487. lodash.isEqual = isEqual;
  17488. lodash.isEqualWith = isEqualWith;
  17489. lodash.isError = isError;
  17490. lodash.isFinite = isFinite;
  17491. lodash.isFunction = isFunction;
  17492. lodash.isInteger = isInteger;
  17493. lodash.isLength = isLength;
  17494. lodash.isMap = isMap;
  17495. lodash.isMatch = isMatch;
  17496. lodash.isMatchWith = isMatchWith;
  17497. lodash.isNaN = isNaN;
  17498. lodash.isNative = isNative;
  17499. lodash.isNil = isNil;
  17500. lodash.isNull = isNull;
  17501. lodash.isNumber = isNumber;
  17502. lodash.isObject = isObject;
  17503. lodash.isObjectLike = isObjectLike;
  17504. lodash.isPlainObject = isPlainObject;
  17505. lodash.isRegExp = isRegExp;
  17506. lodash.isSafeInteger = isSafeInteger;
  17507. lodash.isSet = isSet;
  17508. lodash.isString = isString;
  17509. lodash.isSymbol = isSymbol;
  17510. lodash.isTypedArray = isTypedArray;
  17511. lodash.isUndefined = isUndefined;
  17512. lodash.isWeakMap = isWeakMap;
  17513. lodash.isWeakSet = isWeakSet;
  17514. lodash.join = join;
  17515. lodash.kebabCase = kebabCase;
  17516. lodash.last = last;
  17517. lodash.lastIndexOf = lastIndexOf;
  17518. lodash.lowerCase = lowerCase;
  17519. lodash.lowerFirst = lowerFirst;
  17520. lodash.lt = lt;
  17521. lodash.lte = lte;
  17522. lodash.max = max;
  17523. lodash.maxBy = maxBy;
  17524. lodash.mean = mean;
  17525. lodash.meanBy = meanBy;
  17526. lodash.min = min;
  17527. lodash.minBy = minBy;
  17528. lodash.stubArray = stubArray;
  17529. lodash.stubFalse = stubFalse;
  17530. lodash.stubObject = stubObject;
  17531. lodash.stubString = stubString;
  17532. lodash.stubTrue = stubTrue;
  17533. lodash.multiply = multiply;
  17534. lodash.nth = nth;
  17535. lodash.noConflict = noConflict;
  17536. lodash.noop = noop;
  17537. lodash.now = now;
  17538. lodash.pad = pad;
  17539. lodash.padEnd = padEnd;
  17540. lodash.padStart = padStart;
  17541. lodash.parseInt = parseInt;
  17542. lodash.random = random;
  17543. lodash.reduce = reduce;
  17544. lodash.reduceRight = reduceRight;
  17545. lodash.repeat = repeat;
  17546. lodash.replace = replace;
  17547. lodash.result = result;
  17548. lodash.round = round;
  17549. lodash.runInContext = runInContext;
  17550. lodash.sample = sample;
  17551. lodash.size = size;
  17552. lodash.snakeCase = snakeCase;
  17553. lodash.some = some;
  17554. lodash.sortedIndex = sortedIndex;
  17555. lodash.sortedIndexBy = sortedIndexBy;
  17556. lodash.sortedIndexOf = sortedIndexOf;
  17557. lodash.sortedLastIndex = sortedLastIndex;
  17558. lodash.sortedLastIndexBy = sortedLastIndexBy;
  17559. lodash.sortedLastIndexOf = sortedLastIndexOf;
  17560. lodash.startCase = startCase;
  17561. lodash.startsWith = startsWith;
  17562. lodash.subtract = subtract;
  17563. lodash.sum = sum;
  17564. lodash.sumBy = sumBy;
  17565. lodash.template = template;
  17566. lodash.times = times;
  17567. lodash.toFinite = toFinite;
  17568. lodash.toInteger = toInteger;
  17569. lodash.toLength = toLength;
  17570. lodash.toLower = toLower;
  17571. lodash.toNumber = toNumber;
  17572. lodash.toSafeInteger = toSafeInteger;
  17573. lodash.toString = toString;
  17574. lodash.toUpper = toUpper;
  17575. lodash.trim = trim;
  17576. lodash.trimEnd = trimEnd;
  17577. lodash.trimStart = trimStart;
  17578. lodash.truncate = truncate;
  17579. lodash.unescape = unescape;
  17580. lodash.uniqueId = uniqueId;
  17581. lodash.upperCase = upperCase;
  17582. lodash.upperFirst = upperFirst;
  17583. // Add aliases.
  17584. lodash.each = forEach;
  17585. lodash.eachRight = forEachRight;
  17586. lodash.first = head;
  17587. mixin(lodash, (function() {
  17588. var source = {};
  17589. baseForOwn(lodash, function(func, methodName) {
  17590. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  17591. source[methodName] = func;
  17592. }
  17593. });
  17594. return source;
  17595. }()), { 'chain': false });
  17596. /*------------------------------------------------------------------------*/
  17597. /**
  17598. * The semantic version number.
  17599. *
  17600. * @static
  17601. * @memberOf _
  17602. * @type {string}
  17603. */
  17604. lodash.VERSION = VERSION;
  17605. // Assign default placeholders.
  17606. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  17607. lodash[methodName].placeholder = lodash;
  17608. });
  17609. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  17610. arrayEach(['drop', 'take'], function(methodName, index) {
  17611. LazyWrapper.prototype[methodName] = function(n) {
  17612. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  17613. var result = (this.__filtered__ && !index)
  17614. ? new LazyWrapper(this)
  17615. : this.clone();
  17616. if (result.__filtered__) {
  17617. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  17618. } else {
  17619. result.__views__.push({
  17620. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  17621. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  17622. });
  17623. }
  17624. return result;
  17625. };
  17626. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  17627. return this.reverse()[methodName](n).reverse();
  17628. };
  17629. });
  17630. // Add `LazyWrapper` methods that accept an `iteratee` value.
  17631. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  17632. var type = index + 1,
  17633. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  17634. LazyWrapper.prototype[methodName] = function(iteratee) {
  17635. var result = this.clone();
  17636. result.__iteratees__.push({
  17637. 'iteratee': getIteratee(iteratee, 3),
  17638. 'type': type
  17639. });
  17640. result.__filtered__ = result.__filtered__ || isFilter;
  17641. return result;
  17642. };
  17643. });
  17644. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  17645. arrayEach(['head', 'last'], function(methodName, index) {
  17646. var takeName = 'take' + (index ? 'Right' : '');
  17647. LazyWrapper.prototype[methodName] = function() {
  17648. return this[takeName](1).value()[0];
  17649. };
  17650. });
  17651. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  17652. arrayEach(['initial', 'tail'], function(methodName, index) {
  17653. var dropName = 'drop' + (index ? '' : 'Right');
  17654. LazyWrapper.prototype[methodName] = function() {
  17655. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  17656. };
  17657. });
  17658. LazyWrapper.prototype.compact = function() {
  17659. return this.filter(identity);
  17660. };
  17661. LazyWrapper.prototype.find = function(predicate) {
  17662. return this.filter(predicate).head();
  17663. };
  17664. LazyWrapper.prototype.findLast = function(predicate) {
  17665. return this.reverse().find(predicate);
  17666. };
  17667. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  17668. if (typeof path == 'function') {
  17669. return new LazyWrapper(this);
  17670. }
  17671. return this.map(function(value) {
  17672. return baseInvoke(value, path, args);
  17673. });
  17674. });
  17675. LazyWrapper.prototype.reject = function(predicate) {
  17676. return this.filter(negate(getIteratee(predicate)));
  17677. };
  17678. LazyWrapper.prototype.slice = function(start, end) {
  17679. start = toInteger(start);
  17680. var result = this;
  17681. if (result.__filtered__ && (start > 0 || end < 0)) {
  17682. return new LazyWrapper(result);
  17683. }
  17684. if (start < 0) {
  17685. result = result.takeRight(-start);
  17686. } else if (start) {
  17687. result = result.drop(start);
  17688. }
  17689. if (end !== undefined) {
  17690. end = toInteger(end);
  17691. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  17692. }
  17693. return result;
  17694. };
  17695. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  17696. return this.reverse().takeWhile(predicate).reverse();
  17697. };
  17698. LazyWrapper.prototype.toArray = function() {
  17699. return this.take(MAX_ARRAY_LENGTH);
  17700. };
  17701. // Add `LazyWrapper` methods to `lodash.prototype`.
  17702. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17703. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  17704. isTaker = /^(?:head|last)$/.test(methodName),
  17705. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  17706. retUnwrapped = isTaker || /^find/.test(methodName);
  17707. if (!lodashFunc) {
  17708. return;
  17709. }
  17710. lodash.prototype[methodName] = function() {
  17711. var value = this.__wrapped__,
  17712. args = isTaker ? [1] : arguments,
  17713. isLazy = value instanceof LazyWrapper,
  17714. iteratee = args[0],
  17715. useLazy = isLazy || isArray(value);
  17716. var interceptor = function(value) {
  17717. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  17718. return (isTaker && chainAll) ? result[0] : result;
  17719. };
  17720. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  17721. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  17722. isLazy = useLazy = false;
  17723. }
  17724. var chainAll = this.__chain__,
  17725. isHybrid = !!this.__actions__.length,
  17726. isUnwrapped = retUnwrapped && !chainAll,
  17727. onlyLazy = isLazy && !isHybrid;
  17728. if (!retUnwrapped && useLazy) {
  17729. value = onlyLazy ? value : new LazyWrapper(this);
  17730. var result = func.apply(value, args);
  17731. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  17732. return new LodashWrapper(result, chainAll);
  17733. }
  17734. if (isUnwrapped && onlyLazy) {
  17735. return func.apply(this, args);
  17736. }
  17737. result = this.thru(interceptor);
  17738. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  17739. };
  17740. });
  17741. // Add `Array` methods to `lodash.prototype`.
  17742. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  17743. var func = arrayProto[methodName],
  17744. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  17745. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  17746. lodash.prototype[methodName] = function() {
  17747. var args = arguments;
  17748. if (retUnwrapped && !this.__chain__) {
  17749. var value = this.value();
  17750. return func.apply(isArray(value) ? value : [], args);
  17751. }
  17752. return this[chainName](function(value) {
  17753. return func.apply(isArray(value) ? value : [], args);
  17754. });
  17755. };
  17756. });
  17757. // Map minified method names to their real names.
  17758. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17759. var lodashFunc = lodash[methodName];
  17760. if (lodashFunc) {
  17761. var key = lodashFunc.name + '';
  17762. if (!hasOwnProperty.call(realNames, key)) {
  17763. realNames[key] = [];
  17764. }
  17765. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  17766. }
  17767. });
  17768. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  17769. 'name': 'wrapper',
  17770. 'func': undefined
  17771. }];
  17772. // Add methods to `LazyWrapper`.
  17773. LazyWrapper.prototype.clone = lazyClone;
  17774. LazyWrapper.prototype.reverse = lazyReverse;
  17775. LazyWrapper.prototype.value = lazyValue;
  17776. // Add chain sequence methods to the `lodash` wrapper.
  17777. lodash.prototype.at = wrapperAt;
  17778. lodash.prototype.chain = wrapperChain;
  17779. lodash.prototype.commit = wrapperCommit;
  17780. lodash.prototype.next = wrapperNext;
  17781. lodash.prototype.plant = wrapperPlant;
  17782. lodash.prototype.reverse = wrapperReverse;
  17783. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  17784. // Add lazy aliases.
  17785. lodash.prototype.first = lodash.prototype.head;
  17786. if (symIterator) {
  17787. lodash.prototype[symIterator] = wrapperToIterator;
  17788. }
  17789. return lodash;
  17790. });
  17791. /*--------------------------------------------------------------------------*/
  17792. // Export lodash.
  17793. var _ = runInContext();
  17794. // Some AMD build optimizers, like r.js, check for condition patterns like:
  17795. if (true) {
  17796. // Expose Lodash on the global object to prevent errors when Lodash is
  17797. // loaded by a script tag in the presence of an AMD loader.
  17798. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  17799. // Use `_.noConflict` to remove Lodash from the global object.
  17800. root._ = _;
  17801. // Define as an anonymous module so, through path mapping, it can be
  17802. // referenced as the "underscore" module.
  17803. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17804. return _;
  17805. }).call(exports, __webpack_require__, exports, module),
  17806. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17807. }
  17808. // Check for `exports` after `define` in case a build optimizer adds it.
  17809. else {}
  17810. }.call(this));
  17811. /***/ }),
  17812. /***/ "./node_modules/vue-loader/dist/exportHelper.js":
  17813. /*!******************************************************!*\
  17814. !*** ./node_modules/vue-loader/dist/exportHelper.js ***!
  17815. \******************************************************/
  17816. /***/ ((__unused_webpack_module, exports) => {
  17817. "use strict";
  17818. Object.defineProperty(exports, "__esModule", ({ value: true }));
  17819. // runtime helper for setting properties on components
  17820. // in a tree-shakable way
  17821. exports["default"] = (sfc, props) => {
  17822. const target = sfc.__vccOpts || sfc;
  17823. for (const [key, val] of props) {
  17824. target[key] = val;
  17825. }
  17826. return target;
  17827. };
  17828. /***/ }),
  17829. /***/ "./resources/js/components/AppDropdown.vue":
  17830. /*!*************************************************!*\
  17831. !*** ./resources/js/components/AppDropdown.vue ***!
  17832. \*************************************************/
  17833. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17834. "use strict";
  17835. __webpack_require__.r(__webpack_exports__);
  17836. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17837. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17838. /* harmony export */ });
  17839. /* harmony import */ var _AppDropdown_vue_vue_type_template_id_ce0d1992__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppDropdown.vue?vue&type=template&id=ce0d1992 */ "./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992");
  17840. /* harmony import */ var _AppDropdown_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppDropdown.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js");
  17841. /* 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");
  17842. ;
  17843. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppDropdown_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppDropdown_vue_vue_type_template_id_ce0d1992__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppDropdown.vue"]])
  17844. /* hot reload */
  17845. if (false) {}
  17846. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17847. /***/ }),
  17848. /***/ "./resources/js/components/AppFooter.vue":
  17849. /*!***********************************************!*\
  17850. !*** ./resources/js/components/AppFooter.vue ***!
  17851. \***********************************************/
  17852. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17853. "use strict";
  17854. __webpack_require__.r(__webpack_exports__);
  17855. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17856. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17857. /* harmony export */ });
  17858. /* 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");
  17859. /* 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");
  17860. const script = {}
  17861. ;
  17862. 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"]])
  17863. /* hot reload */
  17864. if (false) {}
  17865. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17866. /***/ }),
  17867. /***/ "./resources/js/components/AppInputText.vue":
  17868. /*!**************************************************!*\
  17869. !*** ./resources/js/components/AppInputText.vue ***!
  17870. \**************************************************/
  17871. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17872. "use strict";
  17873. __webpack_require__.r(__webpack_exports__);
  17874. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17875. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17876. /* harmony export */ });
  17877. /* harmony import */ var _AppInputText_vue_vue_type_template_id_16729fe1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppInputText.vue?vue&type=template&id=16729fe1 */ "./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1");
  17878. /* harmony import */ var _AppInputText_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppInputText.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js");
  17879. /* 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");
  17880. ;
  17881. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppInputText_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppInputText_vue_vue_type_template_id_16729fe1__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppInputText.vue"]])
  17882. /* hot reload */
  17883. if (false) {}
  17884. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17885. /***/ }),
  17886. /***/ "./resources/js/components/AppMessage.vue":
  17887. /*!************************************************!*\
  17888. !*** ./resources/js/components/AppMessage.vue ***!
  17889. \************************************************/
  17890. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17891. "use strict";
  17892. __webpack_require__.r(__webpack_exports__);
  17893. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17894. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17895. /* harmony export */ });
  17896. /* 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");
  17897. /* 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");
  17898. /* 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");
  17899. ;
  17900. 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"]])
  17901. /* hot reload */
  17902. if (false) {}
  17903. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17904. /***/ }),
  17905. /***/ "./resources/js/components/AppSidebar.vue":
  17906. /*!************************************************!*\
  17907. !*** ./resources/js/components/AppSidebar.vue ***!
  17908. \************************************************/
  17909. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17910. "use strict";
  17911. __webpack_require__.r(__webpack_exports__);
  17912. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17913. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17914. /* harmony export */ });
  17915. /* 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");
  17916. /* 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");
  17917. /* 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");
  17918. ;
  17919. 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"]])
  17920. /* hot reload */
  17921. if (false) {}
  17922. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17923. /***/ }),
  17924. /***/ "./resources/js/components/AppSubSidebar.vue":
  17925. /*!***************************************************!*\
  17926. !*** ./resources/js/components/AppSubSidebar.vue ***!
  17927. \***************************************************/
  17928. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17929. "use strict";
  17930. __webpack_require__.r(__webpack_exports__);
  17931. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17932. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17933. /* harmony export */ });
  17934. /* 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");
  17935. /* 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");
  17936. /* 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");
  17937. ;
  17938. 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"]])
  17939. /* hot reload */
  17940. if (false) {}
  17941. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17942. /***/ }),
  17943. /***/ "./resources/js/components/AppTopBar.vue":
  17944. /*!***********************************************!*\
  17945. !*** ./resources/js/components/AppTopBar.vue ***!
  17946. \***********************************************/
  17947. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17948. "use strict";
  17949. __webpack_require__.r(__webpack_exports__);
  17950. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17951. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17952. /* harmony export */ });
  17953. /* 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");
  17954. /* 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");
  17955. /* 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");
  17956. ;
  17957. 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"]])
  17958. /* hot reload */
  17959. if (false) {}
  17960. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17961. /***/ }),
  17962. /***/ "./resources/js/layouts/AppLayout.vue":
  17963. /*!********************************************!*\
  17964. !*** ./resources/js/layouts/AppLayout.vue ***!
  17965. \********************************************/
  17966. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17967. "use strict";
  17968. __webpack_require__.r(__webpack_exports__);
  17969. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17970. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17971. /* harmony export */ });
  17972. /* 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");
  17973. /* 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");
  17974. /* 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");
  17975. ;
  17976. 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"]])
  17977. /* hot reload */
  17978. if (false) {}
  17979. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17980. /***/ }),
  17981. /***/ "./resources/js/pages/member/Edit.vue":
  17982. /*!********************************************!*\
  17983. !*** ./resources/js/pages/member/Edit.vue ***!
  17984. \********************************************/
  17985. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17986. "use strict";
  17987. __webpack_require__.r(__webpack_exports__);
  17988. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17989. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17990. /* harmony export */ });
  17991. /* harmony import */ var _Edit_vue_vue_type_template_id_1a9fb226__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Edit.vue?vue&type=template&id=1a9fb226 */ "./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226");
  17992. /* harmony import */ var _Edit_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Edit.vue?vue&type=script&setup=true&lang=js */ "./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js");
  17993. /* 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");
  17994. ;
  17995. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Edit_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Edit_vue_vue_type_template_id_1a9fb226__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/pages/member/Edit.vue"]])
  17996. /* hot reload */
  17997. if (false) {}
  17998. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17999. /***/ }),
  18000. /***/ "./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js":
  18001. /*!************************************************************************************!*\
  18002. !*** ./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js ***!
  18003. \************************************************************************************/
  18004. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18005. "use strict";
  18006. __webpack_require__.r(__webpack_exports__);
  18007. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18008. /* 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_AppDropdown_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  18009. /* harmony export */ });
  18010. /* 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_AppDropdown_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]!./AppDropdown.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/AppDropdown.vue?vue&type=script&setup=true&lang=js");
  18011. /***/ }),
  18012. /***/ "./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js":
  18013. /*!*************************************************************************************!*\
  18014. !*** ./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js ***!
  18015. \*************************************************************************************/
  18016. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18017. "use strict";
  18018. __webpack_require__.r(__webpack_exports__);
  18019. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18020. /* 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_AppInputText_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  18021. /* harmony export */ });
  18022. /* 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_AppInputText_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]!./AppInputText.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/AppInputText.vue?vue&type=script&setup=true&lang=js");
  18023. /***/ }),
  18024. /***/ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  18025. /*!***********************************************************************************!*\
  18026. !*** ./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  18027. \***********************************************************************************/
  18028. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18029. "use strict";
  18030. __webpack_require__.r(__webpack_exports__);
  18031. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18032. /* 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"])
  18033. /* harmony export */ });
  18034. /* 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");
  18035. /***/ }),
  18036. /***/ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  18037. /*!***********************************************************************************!*\
  18038. !*** ./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  18039. \***********************************************************************************/
  18040. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18041. "use strict";
  18042. __webpack_require__.r(__webpack_exports__);
  18043. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18044. /* 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"])
  18045. /* harmony export */ });
  18046. /* 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");
  18047. /***/ }),
  18048. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  18049. /*!**************************************************************************************!*\
  18050. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  18051. \**************************************************************************************/
  18052. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18053. "use strict";
  18054. __webpack_require__.r(__webpack_exports__);
  18055. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18056. /* 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"])
  18057. /* harmony export */ });
  18058. /* 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");
  18059. /***/ }),
  18060. /***/ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  18061. /*!**********************************************************************************!*\
  18062. !*** ./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  18063. \**********************************************************************************/
  18064. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18065. "use strict";
  18066. __webpack_require__.r(__webpack_exports__);
  18067. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18068. /* 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"])
  18069. /* harmony export */ });
  18070. /* 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");
  18071. /***/ }),
  18072. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  18073. /*!*******************************************************************************!*\
  18074. !*** ./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  18075. \*******************************************************************************/
  18076. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18077. "use strict";
  18078. __webpack_require__.r(__webpack_exports__);
  18079. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18080. /* 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"])
  18081. /* harmony export */ });
  18082. /* 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");
  18083. /***/ }),
  18084. /***/ "./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js":
  18085. /*!*******************************************************************************!*\
  18086. !*** ./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js ***!
  18087. \*******************************************************************************/
  18088. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18089. "use strict";
  18090. __webpack_require__.r(__webpack_exports__);
  18091. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18092. /* 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_Edit_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  18093. /* harmony export */ });
  18094. /* 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_Edit_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]!./Edit.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/member/Edit.vue?vue&type=script&setup=true&lang=js");
  18095. /***/ }),
  18096. /***/ "./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992":
  18097. /*!*******************************************************************************!*\
  18098. !*** ./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992 ***!
  18099. \*******************************************************************************/
  18100. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18101. "use strict";
  18102. __webpack_require__.r(__webpack_exports__);
  18103. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18104. /* 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_AppDropdown_vue_vue_type_template_id_ce0d1992__WEBPACK_IMPORTED_MODULE_0__.render)
  18105. /* harmony export */ });
  18106. /* 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_AppDropdown_vue_vue_type_template_id_ce0d1992__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]!./AppDropdown.vue?vue&type=template&id=ce0d1992 */ "./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/AppDropdown.vue?vue&type=template&id=ce0d1992");
  18107. /***/ }),
  18108. /***/ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  18109. /*!*****************************************************************************!*\
  18110. !*** ./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  18111. \*****************************************************************************/
  18112. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18113. "use strict";
  18114. __webpack_require__.r(__webpack_exports__);
  18115. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18116. /* 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)
  18117. /* harmony export */ });
  18118. /* 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");
  18119. /***/ }),
  18120. /***/ "./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1":
  18121. /*!********************************************************************************!*\
  18122. !*** ./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1 ***!
  18123. \********************************************************************************/
  18124. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18125. "use strict";
  18126. __webpack_require__.r(__webpack_exports__);
  18127. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18128. /* 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_AppInputText_vue_vue_type_template_id_16729fe1__WEBPACK_IMPORTED_MODULE_0__.render)
  18129. /* harmony export */ });
  18130. /* 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_AppInputText_vue_vue_type_template_id_16729fe1__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]!./AppInputText.vue?vue&type=template&id=16729fe1 */ "./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/AppInputText.vue?vue&type=template&id=16729fe1");
  18131. /***/ }),
  18132. /***/ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  18133. /*!******************************************************************************!*\
  18134. !*** ./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  18135. \******************************************************************************/
  18136. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18137. "use strict";
  18138. __webpack_require__.r(__webpack_exports__);
  18139. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18140. /* 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)
  18141. /* harmony export */ });
  18142. /* 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");
  18143. /***/ }),
  18144. /***/ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  18145. /*!******************************************************************************!*\
  18146. !*** ./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  18147. \******************************************************************************/
  18148. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18149. "use strict";
  18150. __webpack_require__.r(__webpack_exports__);
  18151. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18152. /* 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)
  18153. /* harmony export */ });
  18154. /* 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");
  18155. /***/ }),
  18156. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  18157. /*!*********************************************************************************!*\
  18158. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  18159. \*********************************************************************************/
  18160. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18161. "use strict";
  18162. __webpack_require__.r(__webpack_exports__);
  18163. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18164. /* 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)
  18165. /* harmony export */ });
  18166. /* 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");
  18167. /***/ }),
  18168. /***/ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  18169. /*!*****************************************************************************!*\
  18170. !*** ./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  18171. \*****************************************************************************/
  18172. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18173. "use strict";
  18174. __webpack_require__.r(__webpack_exports__);
  18175. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18176. /* 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)
  18177. /* harmony export */ });
  18178. /* 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");
  18179. /***/ }),
  18180. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  18181. /*!**************************************************************************!*\
  18182. !*** ./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  18183. \**************************************************************************/
  18184. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18185. "use strict";
  18186. __webpack_require__.r(__webpack_exports__);
  18187. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18188. /* 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)
  18189. /* harmony export */ });
  18190. /* 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");
  18191. /***/ }),
  18192. /***/ "./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226":
  18193. /*!**************************************************************************!*\
  18194. !*** ./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226 ***!
  18195. \**************************************************************************/
  18196. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18197. "use strict";
  18198. __webpack_require__.r(__webpack_exports__);
  18199. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18200. /* 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_Edit_vue_vue_type_template_id_1a9fb226__WEBPACK_IMPORTED_MODULE_0__.render)
  18201. /* harmony export */ });
  18202. /* 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_Edit_vue_vue_type_template_id_1a9fb226__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]!./Edit.vue?vue&type=template&id=1a9fb226 */ "./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/member/Edit.vue?vue&type=template&id=1a9fb226");
  18203. /***/ })
  18204. }]);