app.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/FollowButton.vue?vue&type=script&lang=js&":
  1574. /*!***********************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/FollowButton.vue?vue&type=script&lang=js& ***!
  1576. \***********************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. /* harmony default export */ __webpack_exports__["default"] = ({
  1588. props: ['userId', 'follows'],
  1589. mounted: function mounted() {
  1590. console.log('Component mounted.');
  1591. },
  1592. data: function data() {
  1593. return {
  1594. status: this.follows
  1595. };
  1596. },
  1597. methods: {
  1598. followUser: function followUser() {
  1599. var _this = this;
  1600. axios.post('/follow/' + this.userId).then(function (response) {
  1601. _this.status = !_this.status;
  1602. })["catch"](function (errors) {
  1603. if (errors.response.status == 401) {
  1604. window.location = '/login';
  1605. }
  1606. });
  1607. }
  1608. },
  1609. computed: {
  1610. ButtonText: function ButtonText() {
  1611. return this.status ? 'Unfollow' : 'Follow';
  1612. }
  1613. }
  1614. });
  1615. /***/ }),
  1616. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1617. /*!*****************************************************!*\
  1618. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1619. \*****************************************************/
  1620. /*! no static exports found */
  1621. /***/ (function(module, exports, __webpack_require__) {
  1622. /*!
  1623. * Bootstrap v4.5.3 (https://getbootstrap.com/)
  1624. * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1625. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1626. */
  1627. (function (global, factory) {
  1628. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1629. undefined;
  1630. }(this, (function (exports, $, Popper) { 'use strict';
  1631. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  1632. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  1633. var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
  1634. function _defineProperties(target, props) {
  1635. for (var i = 0; i < props.length; i++) {
  1636. var descriptor = props[i];
  1637. descriptor.enumerable = descriptor.enumerable || false;
  1638. descriptor.configurable = true;
  1639. if ("value" in descriptor) descriptor.writable = true;
  1640. Object.defineProperty(target, descriptor.key, descriptor);
  1641. }
  1642. }
  1643. function _createClass(Constructor, protoProps, staticProps) {
  1644. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1645. if (staticProps) _defineProperties(Constructor, staticProps);
  1646. return Constructor;
  1647. }
  1648. function _extends() {
  1649. _extends = Object.assign || function (target) {
  1650. for (var i = 1; i < arguments.length; i++) {
  1651. var source = arguments[i];
  1652. for (var key in source) {
  1653. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1654. target[key] = source[key];
  1655. }
  1656. }
  1657. }
  1658. return target;
  1659. };
  1660. return _extends.apply(this, arguments);
  1661. }
  1662. function _inheritsLoose(subClass, superClass) {
  1663. subClass.prototype = Object.create(superClass.prototype);
  1664. subClass.prototype.constructor = subClass;
  1665. subClass.__proto__ = superClass;
  1666. }
  1667. /**
  1668. * --------------------------------------------------------------------------
  1669. * Bootstrap (v4.5.3): util.js
  1670. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1671. * --------------------------------------------------------------------------
  1672. */
  1673. /**
  1674. * ------------------------------------------------------------------------
  1675. * Private TransitionEnd Helpers
  1676. * ------------------------------------------------------------------------
  1677. */
  1678. var TRANSITION_END = 'transitionend';
  1679. var MAX_UID = 1000000;
  1680. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1681. function toType(obj) {
  1682. if (obj === null || typeof obj === 'undefined') {
  1683. return "" + obj;
  1684. }
  1685. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1686. }
  1687. function getSpecialTransitionEndEvent() {
  1688. return {
  1689. bindType: TRANSITION_END,
  1690. delegateType: TRANSITION_END,
  1691. handle: function handle(event) {
  1692. if ($__default['default'](event.target).is(this)) {
  1693. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1694. }
  1695. return undefined;
  1696. }
  1697. };
  1698. }
  1699. function transitionEndEmulator(duration) {
  1700. var _this = this;
  1701. var called = false;
  1702. $__default['default'](this).one(Util.TRANSITION_END, function () {
  1703. called = true;
  1704. });
  1705. setTimeout(function () {
  1706. if (!called) {
  1707. Util.triggerTransitionEnd(_this);
  1708. }
  1709. }, duration);
  1710. return this;
  1711. }
  1712. function setTransitionEndSupport() {
  1713. $__default['default'].fn.emulateTransitionEnd = transitionEndEmulator;
  1714. $__default['default'].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1715. }
  1716. /**
  1717. * --------------------------------------------------------------------------
  1718. * Public Util Api
  1719. * --------------------------------------------------------------------------
  1720. */
  1721. var Util = {
  1722. TRANSITION_END: 'bsTransitionEnd',
  1723. getUID: function getUID(prefix) {
  1724. do {
  1725. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1726. } while (document.getElementById(prefix));
  1727. return prefix;
  1728. },
  1729. getSelectorFromElement: function getSelectorFromElement(element) {
  1730. var selector = element.getAttribute('data-target');
  1731. if (!selector || selector === '#') {
  1732. var hrefAttr = element.getAttribute('href');
  1733. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  1734. }
  1735. try {
  1736. return document.querySelector(selector) ? selector : null;
  1737. } catch (_) {
  1738. return null;
  1739. }
  1740. },
  1741. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  1742. if (!element) {
  1743. return 0;
  1744. } // Get transition-duration of the element
  1745. var transitionDuration = $__default['default'](element).css('transition-duration');
  1746. var transitionDelay = $__default['default'](element).css('transition-delay');
  1747. var floatTransitionDuration = parseFloat(transitionDuration);
  1748. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  1749. if (!floatTransitionDuration && !floatTransitionDelay) {
  1750. return 0;
  1751. } // If multiple durations are defined, take the first
  1752. transitionDuration = transitionDuration.split(',')[0];
  1753. transitionDelay = transitionDelay.split(',')[0];
  1754. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  1755. },
  1756. reflow: function reflow(element) {
  1757. return element.offsetHeight;
  1758. },
  1759. triggerTransitionEnd: function triggerTransitionEnd(element) {
  1760. $__default['default'](element).trigger(TRANSITION_END);
  1761. },
  1762. supportsTransitionEnd: function supportsTransitionEnd() {
  1763. return Boolean(TRANSITION_END);
  1764. },
  1765. isElement: function isElement(obj) {
  1766. return (obj[0] || obj).nodeType;
  1767. },
  1768. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  1769. for (var property in configTypes) {
  1770. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  1771. var expectedTypes = configTypes[property];
  1772. var value = config[property];
  1773. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  1774. if (!new RegExp(expectedTypes).test(valueType)) {
  1775. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  1776. }
  1777. }
  1778. }
  1779. },
  1780. findShadowRoot: function findShadowRoot(element) {
  1781. if (!document.documentElement.attachShadow) {
  1782. return null;
  1783. } // Can find the shadow root otherwise it'll return the document
  1784. if (typeof element.getRootNode === 'function') {
  1785. var root = element.getRootNode();
  1786. return root instanceof ShadowRoot ? root : null;
  1787. }
  1788. if (element instanceof ShadowRoot) {
  1789. return element;
  1790. } // when we don't find a shadow root
  1791. if (!element.parentNode) {
  1792. return null;
  1793. }
  1794. return Util.findShadowRoot(element.parentNode);
  1795. },
  1796. jQueryDetection: function jQueryDetection() {
  1797. if (typeof $__default['default'] === 'undefined') {
  1798. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  1799. }
  1800. var version = $__default['default'].fn.jquery.split(' ')[0].split('.');
  1801. var minMajor = 1;
  1802. var ltMajor = 2;
  1803. var minMinor = 9;
  1804. var minPatch = 1;
  1805. var maxMajor = 4;
  1806. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  1807. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  1808. }
  1809. }
  1810. };
  1811. Util.jQueryDetection();
  1812. setTransitionEndSupport();
  1813. /**
  1814. * ------------------------------------------------------------------------
  1815. * Constants
  1816. * ------------------------------------------------------------------------
  1817. */
  1818. var NAME = 'alert';
  1819. var VERSION = '4.5.3';
  1820. var DATA_KEY = 'bs.alert';
  1821. var EVENT_KEY = "." + DATA_KEY;
  1822. var DATA_API_KEY = '.data-api';
  1823. var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME];
  1824. var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  1825. var EVENT_CLOSE = "close" + EVENT_KEY;
  1826. var EVENT_CLOSED = "closed" + EVENT_KEY;
  1827. var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  1828. var CLASS_NAME_ALERT = 'alert';
  1829. var CLASS_NAME_FADE = 'fade';
  1830. var CLASS_NAME_SHOW = 'show';
  1831. /**
  1832. * ------------------------------------------------------------------------
  1833. * Class Definition
  1834. * ------------------------------------------------------------------------
  1835. */
  1836. var Alert = /*#__PURE__*/function () {
  1837. function Alert(element) {
  1838. this._element = element;
  1839. } // Getters
  1840. var _proto = Alert.prototype;
  1841. // Public
  1842. _proto.close = function close(element) {
  1843. var rootElement = this._element;
  1844. if (element) {
  1845. rootElement = this._getRootElement(element);
  1846. }
  1847. var customEvent = this._triggerCloseEvent(rootElement);
  1848. if (customEvent.isDefaultPrevented()) {
  1849. return;
  1850. }
  1851. this._removeElement(rootElement);
  1852. };
  1853. _proto.dispose = function dispose() {
  1854. $__default['default'].removeData(this._element, DATA_KEY);
  1855. this._element = null;
  1856. } // Private
  1857. ;
  1858. _proto._getRootElement = function _getRootElement(element) {
  1859. var selector = Util.getSelectorFromElement(element);
  1860. var parent = false;
  1861. if (selector) {
  1862. parent = document.querySelector(selector);
  1863. }
  1864. if (!parent) {
  1865. parent = $__default['default'](element).closest("." + CLASS_NAME_ALERT)[0];
  1866. }
  1867. return parent;
  1868. };
  1869. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  1870. var closeEvent = $__default['default'].Event(EVENT_CLOSE);
  1871. $__default['default'](element).trigger(closeEvent);
  1872. return closeEvent;
  1873. };
  1874. _proto._removeElement = function _removeElement(element) {
  1875. var _this = this;
  1876. $__default['default'](element).removeClass(CLASS_NAME_SHOW);
  1877. if (!$__default['default'](element).hasClass(CLASS_NAME_FADE)) {
  1878. this._destroyElement(element);
  1879. return;
  1880. }
  1881. var transitionDuration = Util.getTransitionDurationFromElement(element);
  1882. $__default['default'](element).one(Util.TRANSITION_END, function (event) {
  1883. return _this._destroyElement(element, event);
  1884. }).emulateTransitionEnd(transitionDuration);
  1885. };
  1886. _proto._destroyElement = function _destroyElement(element) {
  1887. $__default['default'](element).detach().trigger(EVENT_CLOSED).remove();
  1888. } // Static
  1889. ;
  1890. Alert._jQueryInterface = function _jQueryInterface(config) {
  1891. return this.each(function () {
  1892. var $element = $__default['default'](this);
  1893. var data = $element.data(DATA_KEY);
  1894. if (!data) {
  1895. data = new Alert(this);
  1896. $element.data(DATA_KEY, data);
  1897. }
  1898. if (config === 'close') {
  1899. data[config](this);
  1900. }
  1901. });
  1902. };
  1903. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  1904. return function (event) {
  1905. if (event) {
  1906. event.preventDefault();
  1907. }
  1908. alertInstance.close(this);
  1909. };
  1910. };
  1911. _createClass(Alert, null, [{
  1912. key: "VERSION",
  1913. get: function get() {
  1914. return VERSION;
  1915. }
  1916. }]);
  1917. return Alert;
  1918. }();
  1919. /**
  1920. * ------------------------------------------------------------------------
  1921. * Data Api implementation
  1922. * ------------------------------------------------------------------------
  1923. */
  1924. $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
  1925. /**
  1926. * ------------------------------------------------------------------------
  1927. * jQuery
  1928. * ------------------------------------------------------------------------
  1929. */
  1930. $__default['default'].fn[NAME] = Alert._jQueryInterface;
  1931. $__default['default'].fn[NAME].Constructor = Alert;
  1932. $__default['default'].fn[NAME].noConflict = function () {
  1933. $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
  1934. return Alert._jQueryInterface;
  1935. };
  1936. /**
  1937. * ------------------------------------------------------------------------
  1938. * Constants
  1939. * ------------------------------------------------------------------------
  1940. */
  1941. var NAME$1 = 'button';
  1942. var VERSION$1 = '4.5.3';
  1943. var DATA_KEY$1 = 'bs.button';
  1944. var EVENT_KEY$1 = "." + DATA_KEY$1;
  1945. var DATA_API_KEY$1 = '.data-api';
  1946. var JQUERY_NO_CONFLICT$1 = $__default['default'].fn[NAME$1];
  1947. var CLASS_NAME_ACTIVE = 'active';
  1948. var CLASS_NAME_BUTTON = 'btn';
  1949. var CLASS_NAME_FOCUS = 'focus';
  1950. var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
  1951. var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
  1952. var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
  1953. var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
  1954. var SELECTOR_INPUT = 'input:not([type="hidden"])';
  1955. var SELECTOR_ACTIVE = '.active';
  1956. var SELECTOR_BUTTON = '.btn';
  1957. var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
  1958. var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
  1959. var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
  1960. /**
  1961. * ------------------------------------------------------------------------
  1962. * Class Definition
  1963. * ------------------------------------------------------------------------
  1964. */
  1965. var Button = /*#__PURE__*/function () {
  1966. function Button(element) {
  1967. this._element = element;
  1968. this.shouldAvoidTriggerChange = false;
  1969. } // Getters
  1970. var _proto = Button.prototype;
  1971. // Public
  1972. _proto.toggle = function toggle() {
  1973. var triggerChangeEvent = true;
  1974. var addAriaPressed = true;
  1975. var rootElement = $__default['default'](this._element).closest(SELECTOR_DATA_TOGGLES)[0];
  1976. if (rootElement) {
  1977. var input = this._element.querySelector(SELECTOR_INPUT);
  1978. if (input) {
  1979. if (input.type === 'radio') {
  1980. if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  1981. triggerChangeEvent = false;
  1982. } else {
  1983. var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
  1984. if (activeElement) {
  1985. $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE);
  1986. }
  1987. }
  1988. }
  1989. if (triggerChangeEvent) {
  1990. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  1991. if (input.type === 'checkbox' || input.type === 'radio') {
  1992. input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
  1993. }
  1994. if (!this.shouldAvoidTriggerChange) {
  1995. $__default['default'](input).trigger('change');
  1996. }
  1997. }
  1998. input.focus();
  1999. addAriaPressed = false;
  2000. }
  2001. }
  2002. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2003. if (addAriaPressed) {
  2004. this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
  2005. }
  2006. if (triggerChangeEvent) {
  2007. $__default['default'](this._element).toggleClass(CLASS_NAME_ACTIVE);
  2008. }
  2009. }
  2010. };
  2011. _proto.dispose = function dispose() {
  2012. $__default['default'].removeData(this._element, DATA_KEY$1);
  2013. this._element = null;
  2014. } // Static
  2015. ;
  2016. Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) {
  2017. return this.each(function () {
  2018. var $element = $__default['default'](this);
  2019. var data = $element.data(DATA_KEY$1);
  2020. if (!data) {
  2021. data = new Button(this);
  2022. $element.data(DATA_KEY$1, data);
  2023. }
  2024. data.shouldAvoidTriggerChange = avoidTriggerChange;
  2025. if (config === 'toggle') {
  2026. data[config]();
  2027. }
  2028. });
  2029. };
  2030. _createClass(Button, null, [{
  2031. key: "VERSION",
  2032. get: function get() {
  2033. return VERSION$1;
  2034. }
  2035. }]);
  2036. return Button;
  2037. }();
  2038. /**
  2039. * ------------------------------------------------------------------------
  2040. * Data Api implementation
  2041. * ------------------------------------------------------------------------
  2042. */
  2043. $__default['default'](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2044. var button = event.target;
  2045. var initialButton = button;
  2046. if (!$__default['default'](button).hasClass(CLASS_NAME_BUTTON)) {
  2047. button = $__default['default'](button).closest(SELECTOR_BUTTON)[0];
  2048. }
  2049. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2050. event.preventDefault(); // work around Firefox bug #1540995
  2051. } else {
  2052. var inputBtn = button.querySelector(SELECTOR_INPUT);
  2053. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2054. event.preventDefault(); // work around Firefox bug #1540995
  2055. return;
  2056. }
  2057. if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') {
  2058. Button._jQueryInterface.call($__default['default'](button), 'toggle', initialButton.tagName === 'INPUT');
  2059. }
  2060. }
  2061. }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2062. var button = $__default['default'](event.target).closest(SELECTOR_BUTTON)[0];
  2063. $__default['default'](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
  2064. });
  2065. $__default['default'](window).on(EVENT_LOAD_DATA_API, function () {
  2066. // ensure correct active class is set to match the controls' actual values/states
  2067. // find all checkboxes/readio buttons inside data-toggle groups
  2068. var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
  2069. for (var i = 0, len = buttons.length; i < len; i++) {
  2070. var button = buttons[i];
  2071. var input = button.querySelector(SELECTOR_INPUT);
  2072. if (input.checked || input.hasAttribute('checked')) {
  2073. button.classList.add(CLASS_NAME_ACTIVE);
  2074. } else {
  2075. button.classList.remove(CLASS_NAME_ACTIVE);
  2076. }
  2077. } // find all button toggles
  2078. buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
  2079. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2080. var _button = buttons[_i];
  2081. if (_button.getAttribute('aria-pressed') === 'true') {
  2082. _button.classList.add(CLASS_NAME_ACTIVE);
  2083. } else {
  2084. _button.classList.remove(CLASS_NAME_ACTIVE);
  2085. }
  2086. }
  2087. });
  2088. /**
  2089. * ------------------------------------------------------------------------
  2090. * jQuery
  2091. * ------------------------------------------------------------------------
  2092. */
  2093. $__default['default'].fn[NAME$1] = Button._jQueryInterface;
  2094. $__default['default'].fn[NAME$1].Constructor = Button;
  2095. $__default['default'].fn[NAME$1].noConflict = function () {
  2096. $__default['default'].fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2097. return Button._jQueryInterface;
  2098. };
  2099. /**
  2100. * ------------------------------------------------------------------------
  2101. * Constants
  2102. * ------------------------------------------------------------------------
  2103. */
  2104. var NAME$2 = 'carousel';
  2105. var VERSION$2 = '4.5.3';
  2106. var DATA_KEY$2 = 'bs.carousel';
  2107. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2108. var DATA_API_KEY$2 = '.data-api';
  2109. var JQUERY_NO_CONFLICT$2 = $__default['default'].fn[NAME$2];
  2110. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2111. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2112. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2113. var SWIPE_THRESHOLD = 40;
  2114. var Default = {
  2115. interval: 5000,
  2116. keyboard: true,
  2117. slide: false,
  2118. pause: 'hover',
  2119. wrap: true,
  2120. touch: true
  2121. };
  2122. var DefaultType = {
  2123. interval: '(number|boolean)',
  2124. keyboard: 'boolean',
  2125. slide: '(boolean|string)',
  2126. pause: '(string|boolean)',
  2127. wrap: 'boolean',
  2128. touch: 'boolean'
  2129. };
  2130. var DIRECTION_NEXT = 'next';
  2131. var DIRECTION_PREV = 'prev';
  2132. var DIRECTION_LEFT = 'left';
  2133. var DIRECTION_RIGHT = 'right';
  2134. var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  2135. var EVENT_SLID = "slid" + EVENT_KEY$2;
  2136. var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  2137. var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  2138. var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  2139. var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  2140. var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  2141. var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  2142. var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  2143. var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  2144. var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  2145. var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  2146. var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  2147. var CLASS_NAME_CAROUSEL = 'carousel';
  2148. var CLASS_NAME_ACTIVE$1 = 'active';
  2149. var CLASS_NAME_SLIDE = 'slide';
  2150. var CLASS_NAME_RIGHT = 'carousel-item-right';
  2151. var CLASS_NAME_LEFT = 'carousel-item-left';
  2152. var CLASS_NAME_NEXT = 'carousel-item-next';
  2153. var CLASS_NAME_PREV = 'carousel-item-prev';
  2154. var CLASS_NAME_POINTER_EVENT = 'pointer-event';
  2155. var SELECTOR_ACTIVE$1 = '.active';
  2156. var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  2157. var SELECTOR_ITEM = '.carousel-item';
  2158. var SELECTOR_ITEM_IMG = '.carousel-item img';
  2159. var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  2160. var SELECTOR_INDICATORS = '.carousel-indicators';
  2161. var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
  2162. var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
  2163. var PointerType = {
  2164. TOUCH: 'touch',
  2165. PEN: 'pen'
  2166. };
  2167. /**
  2168. * ------------------------------------------------------------------------
  2169. * Class Definition
  2170. * ------------------------------------------------------------------------
  2171. */
  2172. var Carousel = /*#__PURE__*/function () {
  2173. function Carousel(element, config) {
  2174. this._items = null;
  2175. this._interval = null;
  2176. this._activeElement = null;
  2177. this._isPaused = false;
  2178. this._isSliding = false;
  2179. this.touchTimeout = null;
  2180. this.touchStartX = 0;
  2181. this.touchDeltaX = 0;
  2182. this._config = this._getConfig(config);
  2183. this._element = element;
  2184. this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
  2185. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2186. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2187. this._addEventListeners();
  2188. } // Getters
  2189. var _proto = Carousel.prototype;
  2190. // Public
  2191. _proto.next = function next() {
  2192. if (!this._isSliding) {
  2193. this._slide(DIRECTION_NEXT);
  2194. }
  2195. };
  2196. _proto.nextWhenVisible = function nextWhenVisible() {
  2197. var $element = $__default['default'](this._element); // Don't call next when the page isn't visible
  2198. // or the carousel or its parent isn't visible
  2199. if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
  2200. this.next();
  2201. }
  2202. };
  2203. _proto.prev = function prev() {
  2204. if (!this._isSliding) {
  2205. this._slide(DIRECTION_PREV);
  2206. }
  2207. };
  2208. _proto.pause = function pause(event) {
  2209. if (!event) {
  2210. this._isPaused = true;
  2211. }
  2212. if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
  2213. Util.triggerTransitionEnd(this._element);
  2214. this.cycle(true);
  2215. }
  2216. clearInterval(this._interval);
  2217. this._interval = null;
  2218. };
  2219. _proto.cycle = function cycle(event) {
  2220. if (!event) {
  2221. this._isPaused = false;
  2222. }
  2223. if (this._interval) {
  2224. clearInterval(this._interval);
  2225. this._interval = null;
  2226. }
  2227. if (this._config.interval && !this._isPaused) {
  2228. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2229. }
  2230. };
  2231. _proto.to = function to(index) {
  2232. var _this = this;
  2233. this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2234. var activeIndex = this._getItemIndex(this._activeElement);
  2235. if (index > this._items.length - 1 || index < 0) {
  2236. return;
  2237. }
  2238. if (this._isSliding) {
  2239. $__default['default'](this._element).one(EVENT_SLID, function () {
  2240. return _this.to(index);
  2241. });
  2242. return;
  2243. }
  2244. if (activeIndex === index) {
  2245. this.pause();
  2246. this.cycle();
  2247. return;
  2248. }
  2249. var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
  2250. this._slide(direction, this._items[index]);
  2251. };
  2252. _proto.dispose = function dispose() {
  2253. $__default['default'](this._element).off(EVENT_KEY$2);
  2254. $__default['default'].removeData(this._element, DATA_KEY$2);
  2255. this._items = null;
  2256. this._config = null;
  2257. this._element = null;
  2258. this._interval = null;
  2259. this._isPaused = null;
  2260. this._isSliding = null;
  2261. this._activeElement = null;
  2262. this._indicatorsElement = null;
  2263. } // Private
  2264. ;
  2265. _proto._getConfig = function _getConfig(config) {
  2266. config = _extends({}, Default, config);
  2267. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2268. return config;
  2269. };
  2270. _proto._handleSwipe = function _handleSwipe() {
  2271. var absDeltax = Math.abs(this.touchDeltaX);
  2272. if (absDeltax <= SWIPE_THRESHOLD) {
  2273. return;
  2274. }
  2275. var direction = absDeltax / this.touchDeltaX;
  2276. this.touchDeltaX = 0; // swipe left
  2277. if (direction > 0) {
  2278. this.prev();
  2279. } // swipe right
  2280. if (direction < 0) {
  2281. this.next();
  2282. }
  2283. };
  2284. _proto._addEventListeners = function _addEventListeners() {
  2285. var _this2 = this;
  2286. if (this._config.keyboard) {
  2287. $__default['default'](this._element).on(EVENT_KEYDOWN, function (event) {
  2288. return _this2._keydown(event);
  2289. });
  2290. }
  2291. if (this._config.pause === 'hover') {
  2292. $__default['default'](this._element).on(EVENT_MOUSEENTER, function (event) {
  2293. return _this2.pause(event);
  2294. }).on(EVENT_MOUSELEAVE, function (event) {
  2295. return _this2.cycle(event);
  2296. });
  2297. }
  2298. if (this._config.touch) {
  2299. this._addTouchEventListeners();
  2300. }
  2301. };
  2302. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2303. var _this3 = this;
  2304. if (!this._touchSupported) {
  2305. return;
  2306. }
  2307. var start = function start(event) {
  2308. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2309. _this3.touchStartX = event.originalEvent.clientX;
  2310. } else if (!_this3._pointerEvent) {
  2311. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2312. }
  2313. };
  2314. var move = function move(event) {
  2315. // ensure swiping with one touch and not pinching
  2316. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2317. _this3.touchDeltaX = 0;
  2318. } else {
  2319. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2320. }
  2321. };
  2322. var end = function end(event) {
  2323. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2324. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2325. }
  2326. _this3._handleSwipe();
  2327. if (_this3._config.pause === 'hover') {
  2328. // If it's a touch-enabled device, mouseenter/leave are fired as
  2329. // part of the mouse compatibility events on first tap - the carousel
  2330. // would stop cycling until user tapped out of it;
  2331. // here, we listen for touchend, explicitly pause the carousel
  2332. // (as if it's the second time we tap on it, mouseenter compat event
  2333. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2334. // events to fire) we explicitly restart cycling
  2335. _this3.pause();
  2336. if (_this3.touchTimeout) {
  2337. clearTimeout(_this3.touchTimeout);
  2338. }
  2339. _this3.touchTimeout = setTimeout(function (event) {
  2340. return _this3.cycle(event);
  2341. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2342. }
  2343. };
  2344. $__default['default'](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
  2345. return e.preventDefault();
  2346. });
  2347. if (this._pointerEvent) {
  2348. $__default['default'](this._element).on(EVENT_POINTERDOWN, function (event) {
  2349. return start(event);
  2350. });
  2351. $__default['default'](this._element).on(EVENT_POINTERUP, function (event) {
  2352. return end(event);
  2353. });
  2354. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  2355. } else {
  2356. $__default['default'](this._element).on(EVENT_TOUCHSTART, function (event) {
  2357. return start(event);
  2358. });
  2359. $__default['default'](this._element).on(EVENT_TOUCHMOVE, function (event) {
  2360. return move(event);
  2361. });
  2362. $__default['default'](this._element).on(EVENT_TOUCHEND, function (event) {
  2363. return end(event);
  2364. });
  2365. }
  2366. };
  2367. _proto._keydown = function _keydown(event) {
  2368. if (/input|textarea/i.test(event.target.tagName)) {
  2369. return;
  2370. }
  2371. switch (event.which) {
  2372. case ARROW_LEFT_KEYCODE:
  2373. event.preventDefault();
  2374. this.prev();
  2375. break;
  2376. case ARROW_RIGHT_KEYCODE:
  2377. event.preventDefault();
  2378. this.next();
  2379. break;
  2380. }
  2381. };
  2382. _proto._getItemIndex = function _getItemIndex(element) {
  2383. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
  2384. return this._items.indexOf(element);
  2385. };
  2386. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2387. var isNextDirection = direction === DIRECTION_NEXT;
  2388. var isPrevDirection = direction === DIRECTION_PREV;
  2389. var activeIndex = this._getItemIndex(activeElement);
  2390. var lastItemIndex = this._items.length - 1;
  2391. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2392. if (isGoingToWrap && !this._config.wrap) {
  2393. return activeElement;
  2394. }
  2395. var delta = direction === DIRECTION_PREV ? -1 : 1;
  2396. var itemIndex = (activeIndex + delta) % this._items.length;
  2397. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2398. };
  2399. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2400. var targetIndex = this._getItemIndex(relatedTarget);
  2401. var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
  2402. var slideEvent = $__default['default'].Event(EVENT_SLIDE, {
  2403. relatedTarget: relatedTarget,
  2404. direction: eventDirectionName,
  2405. from: fromIndex,
  2406. to: targetIndex
  2407. });
  2408. $__default['default'](this._element).trigger(slideEvent);
  2409. return slideEvent;
  2410. };
  2411. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2412. if (this._indicatorsElement) {
  2413. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
  2414. $__default['default'](indicators).removeClass(CLASS_NAME_ACTIVE$1);
  2415. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2416. if (nextIndicator) {
  2417. $__default['default'](nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
  2418. }
  2419. }
  2420. };
  2421. _proto._slide = function _slide(direction, element) {
  2422. var _this4 = this;
  2423. var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2424. var activeElementIndex = this._getItemIndex(activeElement);
  2425. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2426. var nextElementIndex = this._getItemIndex(nextElement);
  2427. var isCycling = Boolean(this._interval);
  2428. var directionalClassName;
  2429. var orderClassName;
  2430. var eventDirectionName;
  2431. if (direction === DIRECTION_NEXT) {
  2432. directionalClassName = CLASS_NAME_LEFT;
  2433. orderClassName = CLASS_NAME_NEXT;
  2434. eventDirectionName = DIRECTION_LEFT;
  2435. } else {
  2436. directionalClassName = CLASS_NAME_RIGHT;
  2437. orderClassName = CLASS_NAME_PREV;
  2438. eventDirectionName = DIRECTION_RIGHT;
  2439. }
  2440. if (nextElement && $__default['default'](nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
  2441. this._isSliding = false;
  2442. return;
  2443. }
  2444. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2445. if (slideEvent.isDefaultPrevented()) {
  2446. return;
  2447. }
  2448. if (!activeElement || !nextElement) {
  2449. // Some weirdness is happening, so we bail
  2450. return;
  2451. }
  2452. this._isSliding = true;
  2453. if (isCycling) {
  2454. this.pause();
  2455. }
  2456. this._setActiveIndicatorElement(nextElement);
  2457. var slidEvent = $__default['default'].Event(EVENT_SLID, {
  2458. relatedTarget: nextElement,
  2459. direction: eventDirectionName,
  2460. from: activeElementIndex,
  2461. to: nextElementIndex
  2462. });
  2463. if ($__default['default'](this._element).hasClass(CLASS_NAME_SLIDE)) {
  2464. $__default['default'](nextElement).addClass(orderClassName);
  2465. Util.reflow(nextElement);
  2466. $__default['default'](activeElement).addClass(directionalClassName);
  2467. $__default['default'](nextElement).addClass(directionalClassName);
  2468. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2469. if (nextElementInterval) {
  2470. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2471. this._config.interval = nextElementInterval;
  2472. } else {
  2473. this._config.interval = this._config.defaultInterval || this._config.interval;
  2474. }
  2475. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2476. $__default['default'](activeElement).one(Util.TRANSITION_END, function () {
  2477. $__default['default'](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
  2478. $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
  2479. _this4._isSliding = false;
  2480. setTimeout(function () {
  2481. return $__default['default'](_this4._element).trigger(slidEvent);
  2482. }, 0);
  2483. }).emulateTransitionEnd(transitionDuration);
  2484. } else {
  2485. $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1);
  2486. $__default['default'](nextElement).addClass(CLASS_NAME_ACTIVE$1);
  2487. this._isSliding = false;
  2488. $__default['default'](this._element).trigger(slidEvent);
  2489. }
  2490. if (isCycling) {
  2491. this.cycle();
  2492. }
  2493. } // Static
  2494. ;
  2495. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2496. return this.each(function () {
  2497. var data = $__default['default'](this).data(DATA_KEY$2);
  2498. var _config = _extends({}, Default, $__default['default'](this).data());
  2499. if (typeof config === 'object') {
  2500. _config = _extends({}, _config, config);
  2501. }
  2502. var action = typeof config === 'string' ? config : _config.slide;
  2503. if (!data) {
  2504. data = new Carousel(this, _config);
  2505. $__default['default'](this).data(DATA_KEY$2, data);
  2506. }
  2507. if (typeof config === 'number') {
  2508. data.to(config);
  2509. } else if (typeof action === 'string') {
  2510. if (typeof data[action] === 'undefined') {
  2511. throw new TypeError("No method named \"" + action + "\"");
  2512. }
  2513. data[action]();
  2514. } else if (_config.interval && _config.ride) {
  2515. data.pause();
  2516. data.cycle();
  2517. }
  2518. });
  2519. };
  2520. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2521. var selector = Util.getSelectorFromElement(this);
  2522. if (!selector) {
  2523. return;
  2524. }
  2525. var target = $__default['default'](selector)[0];
  2526. if (!target || !$__default['default'](target).hasClass(CLASS_NAME_CAROUSEL)) {
  2527. return;
  2528. }
  2529. var config = _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
  2530. var slideIndex = this.getAttribute('data-slide-to');
  2531. if (slideIndex) {
  2532. config.interval = false;
  2533. }
  2534. Carousel._jQueryInterface.call($__default['default'](target), config);
  2535. if (slideIndex) {
  2536. $__default['default'](target).data(DATA_KEY$2).to(slideIndex);
  2537. }
  2538. event.preventDefault();
  2539. };
  2540. _createClass(Carousel, null, [{
  2541. key: "VERSION",
  2542. get: function get() {
  2543. return VERSION$2;
  2544. }
  2545. }, {
  2546. key: "Default",
  2547. get: function get() {
  2548. return Default;
  2549. }
  2550. }]);
  2551. return Carousel;
  2552. }();
  2553. /**
  2554. * ------------------------------------------------------------------------
  2555. * Data Api implementation
  2556. * ------------------------------------------------------------------------
  2557. */
  2558. $__default['default'](document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
  2559. $__default['default'](window).on(EVENT_LOAD_DATA_API$1, function () {
  2560. var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
  2561. for (var i = 0, len = carousels.length; i < len; i++) {
  2562. var $carousel = $__default['default'](carousels[i]);
  2563. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2564. }
  2565. });
  2566. /**
  2567. * ------------------------------------------------------------------------
  2568. * jQuery
  2569. * ------------------------------------------------------------------------
  2570. */
  2571. $__default['default'].fn[NAME$2] = Carousel._jQueryInterface;
  2572. $__default['default'].fn[NAME$2].Constructor = Carousel;
  2573. $__default['default'].fn[NAME$2].noConflict = function () {
  2574. $__default['default'].fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2575. return Carousel._jQueryInterface;
  2576. };
  2577. /**
  2578. * ------------------------------------------------------------------------
  2579. * Constants
  2580. * ------------------------------------------------------------------------
  2581. */
  2582. var NAME$3 = 'collapse';
  2583. var VERSION$3 = '4.5.3';
  2584. var DATA_KEY$3 = 'bs.collapse';
  2585. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2586. var DATA_API_KEY$3 = '.data-api';
  2587. var JQUERY_NO_CONFLICT$3 = $__default['default'].fn[NAME$3];
  2588. var Default$1 = {
  2589. toggle: true,
  2590. parent: ''
  2591. };
  2592. var DefaultType$1 = {
  2593. toggle: 'boolean',
  2594. parent: '(string|element)'
  2595. };
  2596. var EVENT_SHOW = "show" + EVENT_KEY$3;
  2597. var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  2598. var EVENT_HIDE = "hide" + EVENT_KEY$3;
  2599. var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  2600. var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  2601. var CLASS_NAME_SHOW$1 = 'show';
  2602. var CLASS_NAME_COLLAPSE = 'collapse';
  2603. var CLASS_NAME_COLLAPSING = 'collapsing';
  2604. var CLASS_NAME_COLLAPSED = 'collapsed';
  2605. var DIMENSION_WIDTH = 'width';
  2606. var DIMENSION_HEIGHT = 'height';
  2607. var SELECTOR_ACTIVES = '.show, .collapsing';
  2608. var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
  2609. /**
  2610. * ------------------------------------------------------------------------
  2611. * Class Definition
  2612. * ------------------------------------------------------------------------
  2613. */
  2614. var Collapse = /*#__PURE__*/function () {
  2615. function Collapse(element, config) {
  2616. this._isTransitioning = false;
  2617. this._element = element;
  2618. this._config = this._getConfig(config);
  2619. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2620. var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
  2621. for (var i = 0, len = toggleList.length; i < len; i++) {
  2622. var elem = toggleList[i];
  2623. var selector = Util.getSelectorFromElement(elem);
  2624. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  2625. return foundElem === element;
  2626. });
  2627. if (selector !== null && filterElement.length > 0) {
  2628. this._selector = selector;
  2629. this._triggerArray.push(elem);
  2630. }
  2631. }
  2632. this._parent = this._config.parent ? this._getParent() : null;
  2633. if (!this._config.parent) {
  2634. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  2635. }
  2636. if (this._config.toggle) {
  2637. this.toggle();
  2638. }
  2639. } // Getters
  2640. var _proto = Collapse.prototype;
  2641. // Public
  2642. _proto.toggle = function toggle() {
  2643. if ($__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2644. this.hide();
  2645. } else {
  2646. this.show();
  2647. }
  2648. };
  2649. _proto.show = function show() {
  2650. var _this = this;
  2651. if (this._isTransitioning || $__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2652. return;
  2653. }
  2654. var actives;
  2655. var activesData;
  2656. if (this._parent) {
  2657. actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
  2658. if (typeof _this._config.parent === 'string') {
  2659. return elem.getAttribute('data-parent') === _this._config.parent;
  2660. }
  2661. return elem.classList.contains(CLASS_NAME_COLLAPSE);
  2662. });
  2663. if (actives.length === 0) {
  2664. actives = null;
  2665. }
  2666. }
  2667. if (actives) {
  2668. activesData = $__default['default'](actives).not(this._selector).data(DATA_KEY$3);
  2669. if (activesData && activesData._isTransitioning) {
  2670. return;
  2671. }
  2672. }
  2673. var startEvent = $__default['default'].Event(EVENT_SHOW);
  2674. $__default['default'](this._element).trigger(startEvent);
  2675. if (startEvent.isDefaultPrevented()) {
  2676. return;
  2677. }
  2678. if (actives) {
  2679. Collapse._jQueryInterface.call($__default['default'](actives).not(this._selector), 'hide');
  2680. if (!activesData) {
  2681. $__default['default'](actives).data(DATA_KEY$3, null);
  2682. }
  2683. }
  2684. var dimension = this._getDimension();
  2685. $__default['default'](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
  2686. this._element.style[dimension] = 0;
  2687. if (this._triggerArray.length) {
  2688. $__default['default'](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
  2689. }
  2690. this.setTransitioning(true);
  2691. var complete = function complete() {
  2692. $__default['default'](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  2693. _this._element.style[dimension] = '';
  2694. _this.setTransitioning(false);
  2695. $__default['default'](_this._element).trigger(EVENT_SHOWN);
  2696. };
  2697. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  2698. var scrollSize = "scroll" + capitalizedDimension;
  2699. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2700. $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2701. this._element.style[dimension] = this._element[scrollSize] + "px";
  2702. };
  2703. _proto.hide = function hide() {
  2704. var _this2 = this;
  2705. if (this._isTransitioning || !$__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2706. return;
  2707. }
  2708. var startEvent = $__default['default'].Event(EVENT_HIDE);
  2709. $__default['default'](this._element).trigger(startEvent);
  2710. if (startEvent.isDefaultPrevented()) {
  2711. return;
  2712. }
  2713. var dimension = this._getDimension();
  2714. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  2715. Util.reflow(this._element);
  2716. $__default['default'](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  2717. var triggerArrayLength = this._triggerArray.length;
  2718. if (triggerArrayLength > 0) {
  2719. for (var i = 0; i < triggerArrayLength; i++) {
  2720. var trigger = this._triggerArray[i];
  2721. var selector = Util.getSelectorFromElement(trigger);
  2722. if (selector !== null) {
  2723. var $elem = $__default['default']([].slice.call(document.querySelectorAll(selector)));
  2724. if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
  2725. $__default['default'](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
  2726. }
  2727. }
  2728. }
  2729. }
  2730. this.setTransitioning(true);
  2731. var complete = function complete() {
  2732. _this2.setTransitioning(false);
  2733. $__default['default'](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
  2734. };
  2735. this._element.style[dimension] = '';
  2736. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2737. $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2738. };
  2739. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  2740. this._isTransitioning = isTransitioning;
  2741. };
  2742. _proto.dispose = function dispose() {
  2743. $__default['default'].removeData(this._element, DATA_KEY$3);
  2744. this._config = null;
  2745. this._parent = null;
  2746. this._element = null;
  2747. this._triggerArray = null;
  2748. this._isTransitioning = null;
  2749. } // Private
  2750. ;
  2751. _proto._getConfig = function _getConfig(config) {
  2752. config = _extends({}, Default$1, config);
  2753. config.toggle = Boolean(config.toggle); // Coerce string values
  2754. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  2755. return config;
  2756. };
  2757. _proto._getDimension = function _getDimension() {
  2758. var hasWidth = $__default['default'](this._element).hasClass(DIMENSION_WIDTH);
  2759. return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
  2760. };
  2761. _proto._getParent = function _getParent() {
  2762. var _this3 = this;
  2763. var parent;
  2764. if (Util.isElement(this._config.parent)) {
  2765. parent = this._config.parent; // It's a jQuery object
  2766. if (typeof this._config.parent.jquery !== 'undefined') {
  2767. parent = this._config.parent[0];
  2768. }
  2769. } else {
  2770. parent = document.querySelector(this._config.parent);
  2771. }
  2772. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  2773. var children = [].slice.call(parent.querySelectorAll(selector));
  2774. $__default['default'](children).each(function (i, element) {
  2775. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  2776. });
  2777. return parent;
  2778. };
  2779. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  2780. var isOpen = $__default['default'](element).hasClass(CLASS_NAME_SHOW$1);
  2781. if (triggerArray.length) {
  2782. $__default['default'](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  2783. }
  2784. } // Static
  2785. ;
  2786. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  2787. var selector = Util.getSelectorFromElement(element);
  2788. return selector ? document.querySelector(selector) : null;
  2789. };
  2790. Collapse._jQueryInterface = function _jQueryInterface(config) {
  2791. return this.each(function () {
  2792. var $element = $__default['default'](this);
  2793. var data = $element.data(DATA_KEY$3);
  2794. var _config = _extends({}, Default$1, $element.data(), typeof config === 'object' && config ? config : {});
  2795. if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
  2796. _config.toggle = false;
  2797. }
  2798. if (!data) {
  2799. data = new Collapse(this, _config);
  2800. $element.data(DATA_KEY$3, data);
  2801. }
  2802. if (typeof config === 'string') {
  2803. if (typeof data[config] === 'undefined') {
  2804. throw new TypeError("No method named \"" + config + "\"");
  2805. }
  2806. data[config]();
  2807. }
  2808. });
  2809. };
  2810. _createClass(Collapse, null, [{
  2811. key: "VERSION",
  2812. get: function get() {
  2813. return VERSION$3;
  2814. }
  2815. }, {
  2816. key: "Default",
  2817. get: function get() {
  2818. return Default$1;
  2819. }
  2820. }]);
  2821. return Collapse;
  2822. }();
  2823. /**
  2824. * ------------------------------------------------------------------------
  2825. * Data Api implementation
  2826. * ------------------------------------------------------------------------
  2827. */
  2828. $__default['default'](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
  2829. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  2830. if (event.currentTarget.tagName === 'A') {
  2831. event.preventDefault();
  2832. }
  2833. var $trigger = $__default['default'](this);
  2834. var selector = Util.getSelectorFromElement(this);
  2835. var selectors = [].slice.call(document.querySelectorAll(selector));
  2836. $__default['default'](selectors).each(function () {
  2837. var $target = $__default['default'](this);
  2838. var data = $target.data(DATA_KEY$3);
  2839. var config = data ? 'toggle' : $trigger.data();
  2840. Collapse._jQueryInterface.call($target, config);
  2841. });
  2842. });
  2843. /**
  2844. * ------------------------------------------------------------------------
  2845. * jQuery
  2846. * ------------------------------------------------------------------------
  2847. */
  2848. $__default['default'].fn[NAME$3] = Collapse._jQueryInterface;
  2849. $__default['default'].fn[NAME$3].Constructor = Collapse;
  2850. $__default['default'].fn[NAME$3].noConflict = function () {
  2851. $__default['default'].fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  2852. return Collapse._jQueryInterface;
  2853. };
  2854. /**
  2855. * ------------------------------------------------------------------------
  2856. * Constants
  2857. * ------------------------------------------------------------------------
  2858. */
  2859. var NAME$4 = 'dropdown';
  2860. var VERSION$4 = '4.5.3';
  2861. var DATA_KEY$4 = 'bs.dropdown';
  2862. var EVENT_KEY$4 = "." + DATA_KEY$4;
  2863. var DATA_API_KEY$4 = '.data-api';
  2864. var JQUERY_NO_CONFLICT$4 = $__default['default'].fn[NAME$4];
  2865. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  2866. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  2867. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  2868. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  2869. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  2870. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  2871. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  2872. var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
  2873. var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  2874. var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  2875. var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  2876. var EVENT_CLICK = "click" + EVENT_KEY$4;
  2877. var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  2878. var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  2879. var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
  2880. var CLASS_NAME_DISABLED = 'disabled';
  2881. var CLASS_NAME_SHOW$2 = 'show';
  2882. var CLASS_NAME_DROPUP = 'dropup';
  2883. var CLASS_NAME_DROPRIGHT = 'dropright';
  2884. var CLASS_NAME_DROPLEFT = 'dropleft';
  2885. var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  2886. var CLASS_NAME_POSITION_STATIC = 'position-static';
  2887. var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
  2888. var SELECTOR_FORM_CHILD = '.dropdown form';
  2889. var SELECTOR_MENU = '.dropdown-menu';
  2890. var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  2891. var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  2892. var PLACEMENT_TOP = 'top-start';
  2893. var PLACEMENT_TOPEND = 'top-end';
  2894. var PLACEMENT_BOTTOM = 'bottom-start';
  2895. var PLACEMENT_BOTTOMEND = 'bottom-end';
  2896. var PLACEMENT_RIGHT = 'right-start';
  2897. var PLACEMENT_LEFT = 'left-start';
  2898. var Default$2 = {
  2899. offset: 0,
  2900. flip: true,
  2901. boundary: 'scrollParent',
  2902. reference: 'toggle',
  2903. display: 'dynamic',
  2904. popperConfig: null
  2905. };
  2906. var DefaultType$2 = {
  2907. offset: '(number|string|function)',
  2908. flip: 'boolean',
  2909. boundary: '(string|element)',
  2910. reference: '(string|element)',
  2911. display: 'string',
  2912. popperConfig: '(null|object)'
  2913. };
  2914. /**
  2915. * ------------------------------------------------------------------------
  2916. * Class Definition
  2917. * ------------------------------------------------------------------------
  2918. */
  2919. var Dropdown = /*#__PURE__*/function () {
  2920. function Dropdown(element, config) {
  2921. this._element = element;
  2922. this._popper = null;
  2923. this._config = this._getConfig(config);
  2924. this._menu = this._getMenuElement();
  2925. this._inNavbar = this._detectNavbar();
  2926. this._addEventListeners();
  2927. } // Getters
  2928. var _proto = Dropdown.prototype;
  2929. // Public
  2930. _proto.toggle = function toggle() {
  2931. if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED)) {
  2932. return;
  2933. }
  2934. var isActive = $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2);
  2935. Dropdown._clearMenus();
  2936. if (isActive) {
  2937. return;
  2938. }
  2939. this.show(true);
  2940. };
  2941. _proto.show = function show(usePopper) {
  2942. if (usePopper === void 0) {
  2943. usePopper = false;
  2944. }
  2945. if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  2946. return;
  2947. }
  2948. var relatedTarget = {
  2949. relatedTarget: this._element
  2950. };
  2951. var showEvent = $__default['default'].Event(EVENT_SHOW$1, relatedTarget);
  2952. var parent = Dropdown._getParentFromElement(this._element);
  2953. $__default['default'](parent).trigger(showEvent);
  2954. if (showEvent.isDefaultPrevented()) {
  2955. return;
  2956. } // Disable totally Popper.js for Dropdown in Navbar
  2957. if (!this._inNavbar && usePopper) {
  2958. /**
  2959. * Check for Popper dependency
  2960. * Popper - https://popper.js.org
  2961. */
  2962. if (typeof Popper__default['default'] === 'undefined') {
  2963. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  2964. }
  2965. var referenceElement = this._element;
  2966. if (this._config.reference === 'parent') {
  2967. referenceElement = parent;
  2968. } else if (Util.isElement(this._config.reference)) {
  2969. referenceElement = this._config.reference; // Check if it's jQuery element
  2970. if (typeof this._config.reference.jquery !== 'undefined') {
  2971. referenceElement = this._config.reference[0];
  2972. }
  2973. } // If boundary is not `scrollParent`, then set position to `static`
  2974. // to allow the menu to "escape" the scroll parent's boundaries
  2975. // https://github.com/twbs/bootstrap/issues/24251
  2976. if (this._config.boundary !== 'scrollParent') {
  2977. $__default['default'](parent).addClass(CLASS_NAME_POSITION_STATIC);
  2978. }
  2979. this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
  2980. } // If this is a touch-enabled device we add extra
  2981. // empty mouseover listeners to the body's immediate children;
  2982. // only needed because of broken event delegation on iOS
  2983. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2984. if ('ontouchstart' in document.documentElement && $__default['default'](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
  2985. $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
  2986. }
  2987. this._element.focus();
  2988. this._element.setAttribute('aria-expanded', true);
  2989. $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
  2990. $__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_SHOWN$1, relatedTarget));
  2991. };
  2992. _proto.hide = function hide() {
  2993. if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || !$__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  2994. return;
  2995. }
  2996. var relatedTarget = {
  2997. relatedTarget: this._element
  2998. };
  2999. var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
  3000. var parent = Dropdown._getParentFromElement(this._element);
  3001. $__default['default'](parent).trigger(hideEvent);
  3002. if (hideEvent.isDefaultPrevented()) {
  3003. return;
  3004. }
  3005. if (this._popper) {
  3006. this._popper.destroy();
  3007. }
  3008. $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
  3009. $__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
  3010. };
  3011. _proto.dispose = function dispose() {
  3012. $__default['default'].removeData(this._element, DATA_KEY$4);
  3013. $__default['default'](this._element).off(EVENT_KEY$4);
  3014. this._element = null;
  3015. this._menu = null;
  3016. if (this._popper !== null) {
  3017. this._popper.destroy();
  3018. this._popper = null;
  3019. }
  3020. };
  3021. _proto.update = function update() {
  3022. this._inNavbar = this._detectNavbar();
  3023. if (this._popper !== null) {
  3024. this._popper.scheduleUpdate();
  3025. }
  3026. } // Private
  3027. ;
  3028. _proto._addEventListeners = function _addEventListeners() {
  3029. var _this = this;
  3030. $__default['default'](this._element).on(EVENT_CLICK, function (event) {
  3031. event.preventDefault();
  3032. event.stopPropagation();
  3033. _this.toggle();
  3034. });
  3035. };
  3036. _proto._getConfig = function _getConfig(config) {
  3037. config = _extends({}, this.constructor.Default, $__default['default'](this._element).data(), config);
  3038. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3039. return config;
  3040. };
  3041. _proto._getMenuElement = function _getMenuElement() {
  3042. if (!this._menu) {
  3043. var parent = Dropdown._getParentFromElement(this._element);
  3044. if (parent) {
  3045. this._menu = parent.querySelector(SELECTOR_MENU);
  3046. }
  3047. }
  3048. return this._menu;
  3049. };
  3050. _proto._getPlacement = function _getPlacement() {
  3051. var $parentDropdown = $__default['default'](this._element.parentNode);
  3052. var placement = PLACEMENT_BOTTOM; // Handle dropup
  3053. if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
  3054. placement = $__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  3055. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
  3056. placement = PLACEMENT_RIGHT;
  3057. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
  3058. placement = PLACEMENT_LEFT;
  3059. } else if ($__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
  3060. placement = PLACEMENT_BOTTOMEND;
  3061. }
  3062. return placement;
  3063. };
  3064. _proto._detectNavbar = function _detectNavbar() {
  3065. return $__default['default'](this._element).closest('.navbar').length > 0;
  3066. };
  3067. _proto._getOffset = function _getOffset() {
  3068. var _this2 = this;
  3069. var offset = {};
  3070. if (typeof this._config.offset === 'function') {
  3071. offset.fn = function (data) {
  3072. data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  3073. return data;
  3074. };
  3075. } else {
  3076. offset.offset = this._config.offset;
  3077. }
  3078. return offset;
  3079. };
  3080. _proto._getPopperConfig = function _getPopperConfig() {
  3081. var popperConfig = {
  3082. placement: this._getPlacement(),
  3083. modifiers: {
  3084. offset: this._getOffset(),
  3085. flip: {
  3086. enabled: this._config.flip
  3087. },
  3088. preventOverflow: {
  3089. boundariesElement: this._config.boundary
  3090. }
  3091. }
  3092. }; // Disable Popper.js if we have a static display
  3093. if (this._config.display === 'static') {
  3094. popperConfig.modifiers.applyStyle = {
  3095. enabled: false
  3096. };
  3097. }
  3098. return _extends({}, popperConfig, this._config.popperConfig);
  3099. } // Static
  3100. ;
  3101. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3102. return this.each(function () {
  3103. var data = $__default['default'](this).data(DATA_KEY$4);
  3104. var _config = typeof config === 'object' ? config : null;
  3105. if (!data) {
  3106. data = new Dropdown(this, _config);
  3107. $__default['default'](this).data(DATA_KEY$4, data);
  3108. }
  3109. if (typeof config === 'string') {
  3110. if (typeof data[config] === 'undefined') {
  3111. throw new TypeError("No method named \"" + config + "\"");
  3112. }
  3113. data[config]();
  3114. }
  3115. });
  3116. };
  3117. Dropdown._clearMenus = function _clearMenus(event) {
  3118. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3119. return;
  3120. }
  3121. var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
  3122. for (var i = 0, len = toggles.length; i < len; i++) {
  3123. var parent = Dropdown._getParentFromElement(toggles[i]);
  3124. var context = $__default['default'](toggles[i]).data(DATA_KEY$4);
  3125. var relatedTarget = {
  3126. relatedTarget: toggles[i]
  3127. };
  3128. if (event && event.type === 'click') {
  3129. relatedTarget.clickEvent = event;
  3130. }
  3131. if (!context) {
  3132. continue;
  3133. }
  3134. var dropdownMenu = context._menu;
  3135. if (!$__default['default'](parent).hasClass(CLASS_NAME_SHOW$2)) {
  3136. continue;
  3137. }
  3138. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default['default'].contains(parent, event.target)) {
  3139. continue;
  3140. }
  3141. var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
  3142. $__default['default'](parent).trigger(hideEvent);
  3143. if (hideEvent.isDefaultPrevented()) {
  3144. continue;
  3145. } // If this is a touch-enabled device we remove the extra
  3146. // empty mouseover listeners we added for iOS support
  3147. if ('ontouchstart' in document.documentElement) {
  3148. $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
  3149. }
  3150. toggles[i].setAttribute('aria-expanded', 'false');
  3151. if (context._popper) {
  3152. context._popper.destroy();
  3153. }
  3154. $__default['default'](dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
  3155. $__default['default'](parent).removeClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
  3156. }
  3157. };
  3158. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3159. var parent;
  3160. var selector = Util.getSelectorFromElement(element);
  3161. if (selector) {
  3162. parent = document.querySelector(selector);
  3163. }
  3164. return parent || element.parentNode;
  3165. } // eslint-disable-next-line complexity
  3166. ;
  3167. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3168. // If not input/textarea:
  3169. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3170. // If input/textarea:
  3171. // - If space key => not a dropdown command
  3172. // - If key is other than escape
  3173. // - If key is not up or down => not a dropdown command
  3174. // - If trigger inside the menu => not a dropdown command
  3175. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default['default'](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3176. return;
  3177. }
  3178. if (this.disabled || $__default['default'](this).hasClass(CLASS_NAME_DISABLED)) {
  3179. return;
  3180. }
  3181. var parent = Dropdown._getParentFromElement(this);
  3182. var isActive = $__default['default'](parent).hasClass(CLASS_NAME_SHOW$2);
  3183. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3184. return;
  3185. }
  3186. event.preventDefault();
  3187. event.stopPropagation();
  3188. if (!isActive || event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE) {
  3189. if (event.which === ESCAPE_KEYCODE) {
  3190. $__default['default'](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
  3191. }
  3192. $__default['default'](this).trigger('click');
  3193. return;
  3194. }
  3195. var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
  3196. return $__default['default'](item).is(':visible');
  3197. });
  3198. if (items.length === 0) {
  3199. return;
  3200. }
  3201. var index = items.indexOf(event.target);
  3202. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3203. // Up
  3204. index--;
  3205. }
  3206. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3207. // Down
  3208. index++;
  3209. }
  3210. if (index < 0) {
  3211. index = 0;
  3212. }
  3213. items[index].focus();
  3214. };
  3215. _createClass(Dropdown, null, [{
  3216. key: "VERSION",
  3217. get: function get() {
  3218. return VERSION$4;
  3219. }
  3220. }, {
  3221. key: "Default",
  3222. get: function get() {
  3223. return Default$2;
  3224. }
  3225. }, {
  3226. key: "DefaultType",
  3227. get: function get() {
  3228. return DefaultType$2;
  3229. }
  3230. }]);
  3231. return Dropdown;
  3232. }();
  3233. /**
  3234. * ------------------------------------------------------------------------
  3235. * Data Api implementation
  3236. * ------------------------------------------------------------------------
  3237. */
  3238. $__default['default'](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
  3239. event.preventDefault();
  3240. event.stopPropagation();
  3241. Dropdown._jQueryInterface.call($__default['default'](this), 'toggle');
  3242. }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
  3243. e.stopPropagation();
  3244. });
  3245. /**
  3246. * ------------------------------------------------------------------------
  3247. * jQuery
  3248. * ------------------------------------------------------------------------
  3249. */
  3250. $__default['default'].fn[NAME$4] = Dropdown._jQueryInterface;
  3251. $__default['default'].fn[NAME$4].Constructor = Dropdown;
  3252. $__default['default'].fn[NAME$4].noConflict = function () {
  3253. $__default['default'].fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3254. return Dropdown._jQueryInterface;
  3255. };
  3256. /**
  3257. * ------------------------------------------------------------------------
  3258. * Constants
  3259. * ------------------------------------------------------------------------
  3260. */
  3261. var NAME$5 = 'modal';
  3262. var VERSION$5 = '4.5.3';
  3263. var DATA_KEY$5 = 'bs.modal';
  3264. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3265. var DATA_API_KEY$5 = '.data-api';
  3266. var JQUERY_NO_CONFLICT$5 = $__default['default'].fn[NAME$5];
  3267. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3268. var Default$3 = {
  3269. backdrop: true,
  3270. keyboard: true,
  3271. focus: true,
  3272. show: true
  3273. };
  3274. var DefaultType$3 = {
  3275. backdrop: '(boolean|string)',
  3276. keyboard: 'boolean',
  3277. focus: 'boolean',
  3278. show: 'boolean'
  3279. };
  3280. var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  3281. var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  3282. var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  3283. var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  3284. var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  3285. var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  3286. var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  3287. var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  3288. var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  3289. var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  3290. var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  3291. var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  3292. var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
  3293. var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  3294. var CLASS_NAME_BACKDROP = 'modal-backdrop';
  3295. var CLASS_NAME_OPEN = 'modal-open';
  3296. var CLASS_NAME_FADE$1 = 'fade';
  3297. var CLASS_NAME_SHOW$3 = 'show';
  3298. var CLASS_NAME_STATIC = 'modal-static';
  3299. var SELECTOR_DIALOG = '.modal-dialog';
  3300. var SELECTOR_MODAL_BODY = '.modal-body';
  3301. var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
  3302. var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
  3303. var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  3304. var SELECTOR_STICKY_CONTENT = '.sticky-top';
  3305. /**
  3306. * ------------------------------------------------------------------------
  3307. * Class Definition
  3308. * ------------------------------------------------------------------------
  3309. */
  3310. var Modal = /*#__PURE__*/function () {
  3311. function Modal(element, config) {
  3312. this._config = this._getConfig(config);
  3313. this._element = element;
  3314. this._dialog = element.querySelector(SELECTOR_DIALOG);
  3315. this._backdrop = null;
  3316. this._isShown = false;
  3317. this._isBodyOverflowing = false;
  3318. this._ignoreBackdropClick = false;
  3319. this._isTransitioning = false;
  3320. this._scrollbarWidth = 0;
  3321. } // Getters
  3322. var _proto = Modal.prototype;
  3323. // Public
  3324. _proto.toggle = function toggle(relatedTarget) {
  3325. return this._isShown ? this.hide() : this.show(relatedTarget);
  3326. };
  3327. _proto.show = function show(relatedTarget) {
  3328. var _this = this;
  3329. if (this._isShown || this._isTransitioning) {
  3330. return;
  3331. }
  3332. if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
  3333. this._isTransitioning = true;
  3334. }
  3335. var showEvent = $__default['default'].Event(EVENT_SHOW$2, {
  3336. relatedTarget: relatedTarget
  3337. });
  3338. $__default['default'](this._element).trigger(showEvent);
  3339. if (this._isShown || showEvent.isDefaultPrevented()) {
  3340. return;
  3341. }
  3342. this._isShown = true;
  3343. this._checkScrollbar();
  3344. this._setScrollbar();
  3345. this._adjustDialog();
  3346. this._setEscapeEvent();
  3347. this._setResizeEvent();
  3348. $__default['default'](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
  3349. return _this.hide(event);
  3350. });
  3351. $__default['default'](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
  3352. $__default['default'](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
  3353. if ($__default['default'](event.target).is(_this._element)) {
  3354. _this._ignoreBackdropClick = true;
  3355. }
  3356. });
  3357. });
  3358. this._showBackdrop(function () {
  3359. return _this._showElement(relatedTarget);
  3360. });
  3361. };
  3362. _proto.hide = function hide(event) {
  3363. var _this2 = this;
  3364. if (event) {
  3365. event.preventDefault();
  3366. }
  3367. if (!this._isShown || this._isTransitioning) {
  3368. return;
  3369. }
  3370. var hideEvent = $__default['default'].Event(EVENT_HIDE$2);
  3371. $__default['default'](this._element).trigger(hideEvent);
  3372. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3373. return;
  3374. }
  3375. this._isShown = false;
  3376. var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
  3377. if (transition) {
  3378. this._isTransitioning = true;
  3379. }
  3380. this._setEscapeEvent();
  3381. this._setResizeEvent();
  3382. $__default['default'](document).off(EVENT_FOCUSIN);
  3383. $__default['default'](this._element).removeClass(CLASS_NAME_SHOW$3);
  3384. $__default['default'](this._element).off(EVENT_CLICK_DISMISS);
  3385. $__default['default'](this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
  3386. if (transition) {
  3387. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3388. $__default['default'](this._element).one(Util.TRANSITION_END, function (event) {
  3389. return _this2._hideModal(event);
  3390. }).emulateTransitionEnd(transitionDuration);
  3391. } else {
  3392. this._hideModal();
  3393. }
  3394. };
  3395. _proto.dispose = function dispose() {
  3396. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3397. return $__default['default'](htmlElement).off(EVENT_KEY$5);
  3398. });
  3399. /**
  3400. * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
  3401. * Do not move `document` in `htmlElements` array
  3402. * It will remove `EVENT_CLICK_DATA_API` event that should remain
  3403. */
  3404. $__default['default'](document).off(EVENT_FOCUSIN);
  3405. $__default['default'].removeData(this._element, DATA_KEY$5);
  3406. this._config = null;
  3407. this._element = null;
  3408. this._dialog = null;
  3409. this._backdrop = null;
  3410. this._isShown = null;
  3411. this._isBodyOverflowing = null;
  3412. this._ignoreBackdropClick = null;
  3413. this._isTransitioning = null;
  3414. this._scrollbarWidth = null;
  3415. };
  3416. _proto.handleUpdate = function handleUpdate() {
  3417. this._adjustDialog();
  3418. } // Private
  3419. ;
  3420. _proto._getConfig = function _getConfig(config) {
  3421. config = _extends({}, Default$3, config);
  3422. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3423. return config;
  3424. };
  3425. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3426. var _this3 = this;
  3427. if (this._config.backdrop === 'static') {
  3428. var hideEventPrevented = $__default['default'].Event(EVENT_HIDE_PREVENTED);
  3429. $__default['default'](this._element).trigger(hideEventPrevented);
  3430. if (hideEventPrevented.isDefaultPrevented()) {
  3431. return;
  3432. }
  3433. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3434. if (!isModalOverflowing) {
  3435. this._element.style.overflowY = 'hidden';
  3436. }
  3437. this._element.classList.add(CLASS_NAME_STATIC);
  3438. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3439. $__default['default'](this._element).off(Util.TRANSITION_END);
  3440. $__default['default'](this._element).one(Util.TRANSITION_END, function () {
  3441. _this3._element.classList.remove(CLASS_NAME_STATIC);
  3442. if (!isModalOverflowing) {
  3443. $__default['default'](_this3._element).one(Util.TRANSITION_END, function () {
  3444. _this3._element.style.overflowY = '';
  3445. }).emulateTransitionEnd(_this3._element, modalTransitionDuration);
  3446. }
  3447. }).emulateTransitionEnd(modalTransitionDuration);
  3448. this._element.focus();
  3449. } else {
  3450. this.hide();
  3451. }
  3452. };
  3453. _proto._showElement = function _showElement(relatedTarget) {
  3454. var _this4 = this;
  3455. var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
  3456. var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
  3457. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3458. // Don't move modal's DOM position
  3459. document.body.appendChild(this._element);
  3460. }
  3461. this._element.style.display = 'block';
  3462. this._element.removeAttribute('aria-hidden');
  3463. this._element.setAttribute('aria-modal', true);
  3464. this._element.setAttribute('role', 'dialog');
  3465. if ($__default['default'](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
  3466. modalBody.scrollTop = 0;
  3467. } else {
  3468. this._element.scrollTop = 0;
  3469. }
  3470. if (transition) {
  3471. Util.reflow(this._element);
  3472. }
  3473. $__default['default'](this._element).addClass(CLASS_NAME_SHOW$3);
  3474. if (this._config.focus) {
  3475. this._enforceFocus();
  3476. }
  3477. var shownEvent = $__default['default'].Event(EVENT_SHOWN$2, {
  3478. relatedTarget: relatedTarget
  3479. });
  3480. var transitionComplete = function transitionComplete() {
  3481. if (_this4._config.focus) {
  3482. _this4._element.focus();
  3483. }
  3484. _this4._isTransitioning = false;
  3485. $__default['default'](_this4._element).trigger(shownEvent);
  3486. };
  3487. if (transition) {
  3488. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3489. $__default['default'](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3490. } else {
  3491. transitionComplete();
  3492. }
  3493. };
  3494. _proto._enforceFocus = function _enforceFocus() {
  3495. var _this5 = this;
  3496. $__default['default'](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
  3497. .on(EVENT_FOCUSIN, function (event) {
  3498. if (document !== event.target && _this5._element !== event.target && $__default['default'](_this5._element).has(event.target).length === 0) {
  3499. _this5._element.focus();
  3500. }
  3501. });
  3502. };
  3503. _proto._setEscapeEvent = function _setEscapeEvent() {
  3504. var _this6 = this;
  3505. if (this._isShown) {
  3506. $__default['default'](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
  3507. if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3508. event.preventDefault();
  3509. _this6.hide();
  3510. } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3511. _this6._triggerBackdropTransition();
  3512. }
  3513. });
  3514. } else if (!this._isShown) {
  3515. $__default['default'](this._element).off(EVENT_KEYDOWN_DISMISS);
  3516. }
  3517. };
  3518. _proto._setResizeEvent = function _setResizeEvent() {
  3519. var _this7 = this;
  3520. if (this._isShown) {
  3521. $__default['default'](window).on(EVENT_RESIZE, function (event) {
  3522. return _this7.handleUpdate(event);
  3523. });
  3524. } else {
  3525. $__default['default'](window).off(EVENT_RESIZE);
  3526. }
  3527. };
  3528. _proto._hideModal = function _hideModal() {
  3529. var _this8 = this;
  3530. this._element.style.display = 'none';
  3531. this._element.setAttribute('aria-hidden', true);
  3532. this._element.removeAttribute('aria-modal');
  3533. this._element.removeAttribute('role');
  3534. this._isTransitioning = false;
  3535. this._showBackdrop(function () {
  3536. $__default['default'](document.body).removeClass(CLASS_NAME_OPEN);
  3537. _this8._resetAdjustments();
  3538. _this8._resetScrollbar();
  3539. $__default['default'](_this8._element).trigger(EVENT_HIDDEN$2);
  3540. });
  3541. };
  3542. _proto._removeBackdrop = function _removeBackdrop() {
  3543. if (this._backdrop) {
  3544. $__default['default'](this._backdrop).remove();
  3545. this._backdrop = null;
  3546. }
  3547. };
  3548. _proto._showBackdrop = function _showBackdrop(callback) {
  3549. var _this9 = this;
  3550. var animate = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
  3551. if (this._isShown && this._config.backdrop) {
  3552. this._backdrop = document.createElement('div');
  3553. this._backdrop.className = CLASS_NAME_BACKDROP;
  3554. if (animate) {
  3555. this._backdrop.classList.add(animate);
  3556. }
  3557. $__default['default'](this._backdrop).appendTo(document.body);
  3558. $__default['default'](this._element).on(EVENT_CLICK_DISMISS, function (event) {
  3559. if (_this9._ignoreBackdropClick) {
  3560. _this9._ignoreBackdropClick = false;
  3561. return;
  3562. }
  3563. if (event.target !== event.currentTarget) {
  3564. return;
  3565. }
  3566. _this9._triggerBackdropTransition();
  3567. });
  3568. if (animate) {
  3569. Util.reflow(this._backdrop);
  3570. }
  3571. $__default['default'](this._backdrop).addClass(CLASS_NAME_SHOW$3);
  3572. if (!callback) {
  3573. return;
  3574. }
  3575. if (!animate) {
  3576. callback();
  3577. return;
  3578. }
  3579. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3580. $__default['default'](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3581. } else if (!this._isShown && this._backdrop) {
  3582. $__default['default'](this._backdrop).removeClass(CLASS_NAME_SHOW$3);
  3583. var callbackRemove = function callbackRemove() {
  3584. _this9._removeBackdrop();
  3585. if (callback) {
  3586. callback();
  3587. }
  3588. };
  3589. if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
  3590. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3591. $__default['default'](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3592. } else {
  3593. callbackRemove();
  3594. }
  3595. } else if (callback) {
  3596. callback();
  3597. }
  3598. } // ----------------------------------------------------------------------
  3599. // the following methods are used to handle overflowing modals
  3600. // todo (fat): these should probably be refactored out of modal.js
  3601. // ----------------------------------------------------------------------
  3602. ;
  3603. _proto._adjustDialog = function _adjustDialog() {
  3604. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3605. if (!this._isBodyOverflowing && isModalOverflowing) {
  3606. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3607. }
  3608. if (this._isBodyOverflowing && !isModalOverflowing) {
  3609. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3610. }
  3611. };
  3612. _proto._resetAdjustments = function _resetAdjustments() {
  3613. this._element.style.paddingLeft = '';
  3614. this._element.style.paddingRight = '';
  3615. };
  3616. _proto._checkScrollbar = function _checkScrollbar() {
  3617. var rect = document.body.getBoundingClientRect();
  3618. this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
  3619. this._scrollbarWidth = this._getScrollbarWidth();
  3620. };
  3621. _proto._setScrollbar = function _setScrollbar() {
  3622. var _this10 = this;
  3623. if (this._isBodyOverflowing) {
  3624. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3625. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3626. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  3627. var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
  3628. $__default['default'](fixedContent).each(function (index, element) {
  3629. var actualPadding = element.style.paddingRight;
  3630. var calculatedPadding = $__default['default'](element).css('padding-right');
  3631. $__default['default'](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  3632. }); // Adjust sticky content margin
  3633. $__default['default'](stickyContent).each(function (index, element) {
  3634. var actualMargin = element.style.marginRight;
  3635. var calculatedMargin = $__default['default'](element).css('margin-right');
  3636. $__default['default'](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  3637. }); // Adjust body padding
  3638. var actualPadding = document.body.style.paddingRight;
  3639. var calculatedPadding = $__default['default'](document.body).css('padding-right');
  3640. $__default['default'](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3641. }
  3642. $__default['default'](document.body).addClass(CLASS_NAME_OPEN);
  3643. };
  3644. _proto._resetScrollbar = function _resetScrollbar() {
  3645. // Restore fixed content padding
  3646. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  3647. $__default['default'](fixedContent).each(function (index, element) {
  3648. var padding = $__default['default'](element).data('padding-right');
  3649. $__default['default'](element).removeData('padding-right');
  3650. element.style.paddingRight = padding ? padding : '';
  3651. }); // Restore sticky content
  3652. var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
  3653. $__default['default'](elements).each(function (index, element) {
  3654. var margin = $__default['default'](element).data('margin-right');
  3655. if (typeof margin !== 'undefined') {
  3656. $__default['default'](element).css('margin-right', margin).removeData('margin-right');
  3657. }
  3658. }); // Restore body padding
  3659. var padding = $__default['default'](document.body).data('padding-right');
  3660. $__default['default'](document.body).removeData('padding-right');
  3661. document.body.style.paddingRight = padding ? padding : '';
  3662. };
  3663. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3664. // thx d.walsh
  3665. var scrollDiv = document.createElement('div');
  3666. scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
  3667. document.body.appendChild(scrollDiv);
  3668. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3669. document.body.removeChild(scrollDiv);
  3670. return scrollbarWidth;
  3671. } // Static
  3672. ;
  3673. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3674. return this.each(function () {
  3675. var data = $__default['default'](this).data(DATA_KEY$5);
  3676. var _config = _extends({}, Default$3, $__default['default'](this).data(), typeof config === 'object' && config ? config : {});
  3677. if (!data) {
  3678. data = new Modal(this, _config);
  3679. $__default['default'](this).data(DATA_KEY$5, data);
  3680. }
  3681. if (typeof config === 'string') {
  3682. if (typeof data[config] === 'undefined') {
  3683. throw new TypeError("No method named \"" + config + "\"");
  3684. }
  3685. data[config](relatedTarget);
  3686. } else if (_config.show) {
  3687. data.show(relatedTarget);
  3688. }
  3689. });
  3690. };
  3691. _createClass(Modal, null, [{
  3692. key: "VERSION",
  3693. get: function get() {
  3694. return VERSION$5;
  3695. }
  3696. }, {
  3697. key: "Default",
  3698. get: function get() {
  3699. return Default$3;
  3700. }
  3701. }]);
  3702. return Modal;
  3703. }();
  3704. /**
  3705. * ------------------------------------------------------------------------
  3706. * Data Api implementation
  3707. * ------------------------------------------------------------------------
  3708. */
  3709. $__default['default'](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
  3710. var _this11 = this;
  3711. var target;
  3712. var selector = Util.getSelectorFromElement(this);
  3713. if (selector) {
  3714. target = document.querySelector(selector);
  3715. }
  3716. var config = $__default['default'](target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
  3717. if (this.tagName === 'A' || this.tagName === 'AREA') {
  3718. event.preventDefault();
  3719. }
  3720. var $target = $__default['default'](target).one(EVENT_SHOW$2, function (showEvent) {
  3721. if (showEvent.isDefaultPrevented()) {
  3722. // Only register focus restorer if modal will actually get shown
  3723. return;
  3724. }
  3725. $target.one(EVENT_HIDDEN$2, function () {
  3726. if ($__default['default'](_this11).is(':visible')) {
  3727. _this11.focus();
  3728. }
  3729. });
  3730. });
  3731. Modal._jQueryInterface.call($__default['default'](target), config, this);
  3732. });
  3733. /**
  3734. * ------------------------------------------------------------------------
  3735. * jQuery
  3736. * ------------------------------------------------------------------------
  3737. */
  3738. $__default['default'].fn[NAME$5] = Modal._jQueryInterface;
  3739. $__default['default'].fn[NAME$5].Constructor = Modal;
  3740. $__default['default'].fn[NAME$5].noConflict = function () {
  3741. $__default['default'].fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  3742. return Modal._jQueryInterface;
  3743. };
  3744. /**
  3745. * --------------------------------------------------------------------------
  3746. * Bootstrap (v4.5.3): tools/sanitizer.js
  3747. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3748. * --------------------------------------------------------------------------
  3749. */
  3750. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  3751. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  3752. var DefaultWhitelist = {
  3753. // Global attributes allowed on any supplied element below.
  3754. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  3755. a: ['target', 'href', 'title', 'rel'],
  3756. area: [],
  3757. b: [],
  3758. br: [],
  3759. col: [],
  3760. code: [],
  3761. div: [],
  3762. em: [],
  3763. hr: [],
  3764. h1: [],
  3765. h2: [],
  3766. h3: [],
  3767. h4: [],
  3768. h5: [],
  3769. h6: [],
  3770. i: [],
  3771. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  3772. li: [],
  3773. ol: [],
  3774. p: [],
  3775. pre: [],
  3776. s: [],
  3777. small: [],
  3778. span: [],
  3779. sub: [],
  3780. sup: [],
  3781. strong: [],
  3782. u: [],
  3783. ul: []
  3784. };
  3785. /**
  3786. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  3787. *
  3788. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3789. */
  3790. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
  3791. /**
  3792. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  3793. *
  3794. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3795. */
  3796. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
  3797. function allowedAttribute(attr, allowedAttributeList) {
  3798. var attrName = attr.nodeName.toLowerCase();
  3799. if (allowedAttributeList.indexOf(attrName) !== -1) {
  3800. if (uriAttrs.indexOf(attrName) !== -1) {
  3801. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  3802. }
  3803. return true;
  3804. }
  3805. var regExp = allowedAttributeList.filter(function (attrRegex) {
  3806. return attrRegex instanceof RegExp;
  3807. }); // Check if a regular expression validates the attribute.
  3808. for (var i = 0, len = regExp.length; i < len; i++) {
  3809. if (attrName.match(regExp[i])) {
  3810. return true;
  3811. }
  3812. }
  3813. return false;
  3814. }
  3815. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  3816. if (unsafeHtml.length === 0) {
  3817. return unsafeHtml;
  3818. }
  3819. if (sanitizeFn && typeof sanitizeFn === 'function') {
  3820. return sanitizeFn(unsafeHtml);
  3821. }
  3822. var domParser = new window.DOMParser();
  3823. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  3824. var whitelistKeys = Object.keys(whiteList);
  3825. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  3826. var _loop = function _loop(i, len) {
  3827. var el = elements[i];
  3828. var elName = el.nodeName.toLowerCase();
  3829. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  3830. el.parentNode.removeChild(el);
  3831. return "continue";
  3832. }
  3833. var attributeList = [].slice.call(el.attributes);
  3834. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  3835. attributeList.forEach(function (attr) {
  3836. if (!allowedAttribute(attr, whitelistedAttributes)) {
  3837. el.removeAttribute(attr.nodeName);
  3838. }
  3839. });
  3840. };
  3841. for (var i = 0, len = elements.length; i < len; i++) {
  3842. var _ret = _loop(i);
  3843. if (_ret === "continue") continue;
  3844. }
  3845. return createdDocument.body.innerHTML;
  3846. }
  3847. /**
  3848. * ------------------------------------------------------------------------
  3849. * Constants
  3850. * ------------------------------------------------------------------------
  3851. */
  3852. var NAME$6 = 'tooltip';
  3853. var VERSION$6 = '4.5.3';
  3854. var DATA_KEY$6 = 'bs.tooltip';
  3855. var EVENT_KEY$6 = "." + DATA_KEY$6;
  3856. var JQUERY_NO_CONFLICT$6 = $__default['default'].fn[NAME$6];
  3857. var CLASS_PREFIX = 'bs-tooltip';
  3858. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  3859. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  3860. var DefaultType$4 = {
  3861. animation: 'boolean',
  3862. template: 'string',
  3863. title: '(string|element|function)',
  3864. trigger: 'string',
  3865. delay: '(number|object)',
  3866. html: 'boolean',
  3867. selector: '(string|boolean)',
  3868. placement: '(string|function)',
  3869. offset: '(number|string|function)',
  3870. container: '(string|element|boolean)',
  3871. fallbackPlacement: '(string|array)',
  3872. boundary: '(string|element)',
  3873. sanitize: 'boolean',
  3874. sanitizeFn: '(null|function)',
  3875. whiteList: 'object',
  3876. popperConfig: '(null|object)'
  3877. };
  3878. var AttachmentMap = {
  3879. AUTO: 'auto',
  3880. TOP: 'top',
  3881. RIGHT: 'right',
  3882. BOTTOM: 'bottom',
  3883. LEFT: 'left'
  3884. };
  3885. var Default$4 = {
  3886. animation: true,
  3887. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  3888. trigger: 'hover focus',
  3889. title: '',
  3890. delay: 0,
  3891. html: false,
  3892. selector: false,
  3893. placement: 'top',
  3894. offset: 0,
  3895. container: false,
  3896. fallbackPlacement: 'flip',
  3897. boundary: 'scrollParent',
  3898. sanitize: true,
  3899. sanitizeFn: null,
  3900. whiteList: DefaultWhitelist,
  3901. popperConfig: null
  3902. };
  3903. var HOVER_STATE_SHOW = 'show';
  3904. var HOVER_STATE_OUT = 'out';
  3905. var Event = {
  3906. HIDE: "hide" + EVENT_KEY$6,
  3907. HIDDEN: "hidden" + EVENT_KEY$6,
  3908. SHOW: "show" + EVENT_KEY$6,
  3909. SHOWN: "shown" + EVENT_KEY$6,
  3910. INSERTED: "inserted" + EVENT_KEY$6,
  3911. CLICK: "click" + EVENT_KEY$6,
  3912. FOCUSIN: "focusin" + EVENT_KEY$6,
  3913. FOCUSOUT: "focusout" + EVENT_KEY$6,
  3914. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  3915. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  3916. };
  3917. var CLASS_NAME_FADE$2 = 'fade';
  3918. var CLASS_NAME_SHOW$4 = 'show';
  3919. var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  3920. var SELECTOR_ARROW = '.arrow';
  3921. var TRIGGER_HOVER = 'hover';
  3922. var TRIGGER_FOCUS = 'focus';
  3923. var TRIGGER_CLICK = 'click';
  3924. var TRIGGER_MANUAL = 'manual';
  3925. /**
  3926. * ------------------------------------------------------------------------
  3927. * Class Definition
  3928. * ------------------------------------------------------------------------
  3929. */
  3930. var Tooltip = /*#__PURE__*/function () {
  3931. function Tooltip(element, config) {
  3932. if (typeof Popper__default['default'] === 'undefined') {
  3933. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  3934. } // private
  3935. this._isEnabled = true;
  3936. this._timeout = 0;
  3937. this._hoverState = '';
  3938. this._activeTrigger = {};
  3939. this._popper = null; // Protected
  3940. this.element = element;
  3941. this.config = this._getConfig(config);
  3942. this.tip = null;
  3943. this._setListeners();
  3944. } // Getters
  3945. var _proto = Tooltip.prototype;
  3946. // Public
  3947. _proto.enable = function enable() {
  3948. this._isEnabled = true;
  3949. };
  3950. _proto.disable = function disable() {
  3951. this._isEnabled = false;
  3952. };
  3953. _proto.toggleEnabled = function toggleEnabled() {
  3954. this._isEnabled = !this._isEnabled;
  3955. };
  3956. _proto.toggle = function toggle(event) {
  3957. if (!this._isEnabled) {
  3958. return;
  3959. }
  3960. if (event) {
  3961. var dataKey = this.constructor.DATA_KEY;
  3962. var context = $__default['default'](event.currentTarget).data(dataKey);
  3963. if (!context) {
  3964. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3965. $__default['default'](event.currentTarget).data(dataKey, context);
  3966. }
  3967. context._activeTrigger.click = !context._activeTrigger.click;
  3968. if (context._isWithActiveTrigger()) {
  3969. context._enter(null, context);
  3970. } else {
  3971. context._leave(null, context);
  3972. }
  3973. } else {
  3974. if ($__default['default'](this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
  3975. this._leave(null, this);
  3976. return;
  3977. }
  3978. this._enter(null, this);
  3979. }
  3980. };
  3981. _proto.dispose = function dispose() {
  3982. clearTimeout(this._timeout);
  3983. $__default['default'].removeData(this.element, this.constructor.DATA_KEY);
  3984. $__default['default'](this.element).off(this.constructor.EVENT_KEY);
  3985. $__default['default'](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  3986. if (this.tip) {
  3987. $__default['default'](this.tip).remove();
  3988. }
  3989. this._isEnabled = null;
  3990. this._timeout = null;
  3991. this._hoverState = null;
  3992. this._activeTrigger = null;
  3993. if (this._popper) {
  3994. this._popper.destroy();
  3995. }
  3996. this._popper = null;
  3997. this.element = null;
  3998. this.config = null;
  3999. this.tip = null;
  4000. };
  4001. _proto.show = function show() {
  4002. var _this = this;
  4003. if ($__default['default'](this.element).css('display') === 'none') {
  4004. throw new Error('Please use show on visible elements');
  4005. }
  4006. var showEvent = $__default['default'].Event(this.constructor.Event.SHOW);
  4007. if (this.isWithContent() && this._isEnabled) {
  4008. $__default['default'](this.element).trigger(showEvent);
  4009. var shadowRoot = Util.findShadowRoot(this.element);
  4010. var isInTheDom = $__default['default'].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4011. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4012. return;
  4013. }
  4014. var tip = this.getTipElement();
  4015. var tipId = Util.getUID(this.constructor.NAME);
  4016. tip.setAttribute('id', tipId);
  4017. this.element.setAttribute('aria-describedby', tipId);
  4018. this.setContent();
  4019. if (this.config.animation) {
  4020. $__default['default'](tip).addClass(CLASS_NAME_FADE$2);
  4021. }
  4022. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4023. var attachment = this._getAttachment(placement);
  4024. this.addAttachmentClass(attachment);
  4025. var container = this._getContainer();
  4026. $__default['default'](tip).data(this.constructor.DATA_KEY, this);
  4027. if (!$__default['default'].contains(this.element.ownerDocument.documentElement, this.tip)) {
  4028. $__default['default'](tip).appendTo(container);
  4029. }
  4030. $__default['default'](this.element).trigger(this.constructor.Event.INSERTED);
  4031. this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
  4032. $__default['default'](tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra
  4033. // empty mouseover listeners to the body's immediate children;
  4034. // only needed because of broken event delegation on iOS
  4035. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4036. if ('ontouchstart' in document.documentElement) {
  4037. $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
  4038. }
  4039. var complete = function complete() {
  4040. if (_this.config.animation) {
  4041. _this._fixTransition();
  4042. }
  4043. var prevHoverState = _this._hoverState;
  4044. _this._hoverState = null;
  4045. $__default['default'](_this.element).trigger(_this.constructor.Event.SHOWN);
  4046. if (prevHoverState === HOVER_STATE_OUT) {
  4047. _this._leave(null, _this);
  4048. }
  4049. };
  4050. if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4051. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4052. $__default['default'](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4053. } else {
  4054. complete();
  4055. }
  4056. }
  4057. };
  4058. _proto.hide = function hide(callback) {
  4059. var _this2 = this;
  4060. var tip = this.getTipElement();
  4061. var hideEvent = $__default['default'].Event(this.constructor.Event.HIDE);
  4062. var complete = function complete() {
  4063. if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
  4064. tip.parentNode.removeChild(tip);
  4065. }
  4066. _this2._cleanTipClass();
  4067. _this2.element.removeAttribute('aria-describedby');
  4068. $__default['default'](_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4069. if (_this2._popper !== null) {
  4070. _this2._popper.destroy();
  4071. }
  4072. if (callback) {
  4073. callback();
  4074. }
  4075. };
  4076. $__default['default'](this.element).trigger(hideEvent);
  4077. if (hideEvent.isDefaultPrevented()) {
  4078. return;
  4079. }
  4080. $__default['default'](tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
  4081. // empty mouseover listeners we added for iOS support
  4082. if ('ontouchstart' in document.documentElement) {
  4083. $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
  4084. }
  4085. this._activeTrigger[TRIGGER_CLICK] = false;
  4086. this._activeTrigger[TRIGGER_FOCUS] = false;
  4087. this._activeTrigger[TRIGGER_HOVER] = false;
  4088. if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4089. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4090. $__default['default'](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4091. } else {
  4092. complete();
  4093. }
  4094. this._hoverState = '';
  4095. };
  4096. _proto.update = function update() {
  4097. if (this._popper !== null) {
  4098. this._popper.scheduleUpdate();
  4099. }
  4100. } // Protected
  4101. ;
  4102. _proto.isWithContent = function isWithContent() {
  4103. return Boolean(this.getTitle());
  4104. };
  4105. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4106. $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4107. };
  4108. _proto.getTipElement = function getTipElement() {
  4109. this.tip = this.tip || $__default['default'](this.config.template)[0];
  4110. return this.tip;
  4111. };
  4112. _proto.setContent = function setContent() {
  4113. var tip = this.getTipElement();
  4114. this.setElementContent($__default['default'](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
  4115. $__default['default'](tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
  4116. };
  4117. _proto.setElementContent = function setElementContent($element, content) {
  4118. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4119. // Content is a DOM node or a jQuery
  4120. if (this.config.html) {
  4121. if (!$__default['default'](content).parent().is($element)) {
  4122. $element.empty().append(content);
  4123. }
  4124. } else {
  4125. $element.text($__default['default'](content).text());
  4126. }
  4127. return;
  4128. }
  4129. if (this.config.html) {
  4130. if (this.config.sanitize) {
  4131. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4132. }
  4133. $element.html(content);
  4134. } else {
  4135. $element.text(content);
  4136. }
  4137. };
  4138. _proto.getTitle = function getTitle() {
  4139. var title = this.element.getAttribute('data-original-title');
  4140. if (!title) {
  4141. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4142. }
  4143. return title;
  4144. } // Private
  4145. ;
  4146. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4147. var _this3 = this;
  4148. var defaultBsConfig = {
  4149. placement: attachment,
  4150. modifiers: {
  4151. offset: this._getOffset(),
  4152. flip: {
  4153. behavior: this.config.fallbackPlacement
  4154. },
  4155. arrow: {
  4156. element: SELECTOR_ARROW
  4157. },
  4158. preventOverflow: {
  4159. boundariesElement: this.config.boundary
  4160. }
  4161. },
  4162. onCreate: function onCreate(data) {
  4163. if (data.originalPlacement !== data.placement) {
  4164. _this3._handlePopperPlacementChange(data);
  4165. }
  4166. },
  4167. onUpdate: function onUpdate(data) {
  4168. return _this3._handlePopperPlacementChange(data);
  4169. }
  4170. };
  4171. return _extends({}, defaultBsConfig, this.config.popperConfig);
  4172. };
  4173. _proto._getOffset = function _getOffset() {
  4174. var _this4 = this;
  4175. var offset = {};
  4176. if (typeof this.config.offset === 'function') {
  4177. offset.fn = function (data) {
  4178. data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
  4179. return data;
  4180. };
  4181. } else {
  4182. offset.offset = this.config.offset;
  4183. }
  4184. return offset;
  4185. };
  4186. _proto._getContainer = function _getContainer() {
  4187. if (this.config.container === false) {
  4188. return document.body;
  4189. }
  4190. if (Util.isElement(this.config.container)) {
  4191. return $__default['default'](this.config.container);
  4192. }
  4193. return $__default['default'](document).find(this.config.container);
  4194. };
  4195. _proto._getAttachment = function _getAttachment(placement) {
  4196. return AttachmentMap[placement.toUpperCase()];
  4197. };
  4198. _proto._setListeners = function _setListeners() {
  4199. var _this5 = this;
  4200. var triggers = this.config.trigger.split(' ');
  4201. triggers.forEach(function (trigger) {
  4202. if (trigger === 'click') {
  4203. $__default['default'](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4204. return _this5.toggle(event);
  4205. });
  4206. } else if (trigger !== TRIGGER_MANUAL) {
  4207. var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4208. var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4209. $__default['default'](_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4210. return _this5._enter(event);
  4211. }).on(eventOut, _this5.config.selector, function (event) {
  4212. return _this5._leave(event);
  4213. });
  4214. }
  4215. });
  4216. this._hideModalHandler = function () {
  4217. if (_this5.element) {
  4218. _this5.hide();
  4219. }
  4220. };
  4221. $__default['default'](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4222. if (this.config.selector) {
  4223. this.config = _extends({}, this.config, {
  4224. trigger: 'manual',
  4225. selector: ''
  4226. });
  4227. } else {
  4228. this._fixTitle();
  4229. }
  4230. };
  4231. _proto._fixTitle = function _fixTitle() {
  4232. var titleType = typeof this.element.getAttribute('data-original-title');
  4233. if (this.element.getAttribute('title') || titleType !== 'string') {
  4234. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4235. this.element.setAttribute('title', '');
  4236. }
  4237. };
  4238. _proto._enter = function _enter(event, context) {
  4239. var dataKey = this.constructor.DATA_KEY;
  4240. context = context || $__default['default'](event.currentTarget).data(dataKey);
  4241. if (!context) {
  4242. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4243. $__default['default'](event.currentTarget).data(dataKey, context);
  4244. }
  4245. if (event) {
  4246. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  4247. }
  4248. if ($__default['default'](context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
  4249. context._hoverState = HOVER_STATE_SHOW;
  4250. return;
  4251. }
  4252. clearTimeout(context._timeout);
  4253. context._hoverState = HOVER_STATE_SHOW;
  4254. if (!context.config.delay || !context.config.delay.show) {
  4255. context.show();
  4256. return;
  4257. }
  4258. context._timeout = setTimeout(function () {
  4259. if (context._hoverState === HOVER_STATE_SHOW) {
  4260. context.show();
  4261. }
  4262. }, context.config.delay.show);
  4263. };
  4264. _proto._leave = function _leave(event, context) {
  4265. var dataKey = this.constructor.DATA_KEY;
  4266. context = context || $__default['default'](event.currentTarget).data(dataKey);
  4267. if (!context) {
  4268. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4269. $__default['default'](event.currentTarget).data(dataKey, context);
  4270. }
  4271. if (event) {
  4272. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
  4273. }
  4274. if (context._isWithActiveTrigger()) {
  4275. return;
  4276. }
  4277. clearTimeout(context._timeout);
  4278. context._hoverState = HOVER_STATE_OUT;
  4279. if (!context.config.delay || !context.config.delay.hide) {
  4280. context.hide();
  4281. return;
  4282. }
  4283. context._timeout = setTimeout(function () {
  4284. if (context._hoverState === HOVER_STATE_OUT) {
  4285. context.hide();
  4286. }
  4287. }, context.config.delay.hide);
  4288. };
  4289. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4290. for (var trigger in this._activeTrigger) {
  4291. if (this._activeTrigger[trigger]) {
  4292. return true;
  4293. }
  4294. }
  4295. return false;
  4296. };
  4297. _proto._getConfig = function _getConfig(config) {
  4298. var dataAttributes = $__default['default'](this.element).data();
  4299. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4300. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4301. delete dataAttributes[dataAttr];
  4302. }
  4303. });
  4304. config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  4305. if (typeof config.delay === 'number') {
  4306. config.delay = {
  4307. show: config.delay,
  4308. hide: config.delay
  4309. };
  4310. }
  4311. if (typeof config.title === 'number') {
  4312. config.title = config.title.toString();
  4313. }
  4314. if (typeof config.content === 'number') {
  4315. config.content = config.content.toString();
  4316. }
  4317. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4318. if (config.sanitize) {
  4319. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4320. }
  4321. return config;
  4322. };
  4323. _proto._getDelegateConfig = function _getDelegateConfig() {
  4324. var config = {};
  4325. if (this.config) {
  4326. for (var key in this.config) {
  4327. if (this.constructor.Default[key] !== this.config[key]) {
  4328. config[key] = this.config[key];
  4329. }
  4330. }
  4331. }
  4332. return config;
  4333. };
  4334. _proto._cleanTipClass = function _cleanTipClass() {
  4335. var $tip = $__default['default'](this.getTipElement());
  4336. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4337. if (tabClass !== null && tabClass.length) {
  4338. $tip.removeClass(tabClass.join(''));
  4339. }
  4340. };
  4341. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4342. this.tip = popperData.instance.popper;
  4343. this._cleanTipClass();
  4344. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4345. };
  4346. _proto._fixTransition = function _fixTransition() {
  4347. var tip = this.getTipElement();
  4348. var initConfigAnimation = this.config.animation;
  4349. if (tip.getAttribute('x-placement') !== null) {
  4350. return;
  4351. }
  4352. $__default['default'](tip).removeClass(CLASS_NAME_FADE$2);
  4353. this.config.animation = false;
  4354. this.hide();
  4355. this.show();
  4356. this.config.animation = initConfigAnimation;
  4357. } // Static
  4358. ;
  4359. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4360. return this.each(function () {
  4361. var $element = $__default['default'](this);
  4362. var data = $element.data(DATA_KEY$6);
  4363. var _config = typeof config === 'object' && config;
  4364. if (!data && /dispose|hide/.test(config)) {
  4365. return;
  4366. }
  4367. if (!data) {
  4368. data = new Tooltip(this, _config);
  4369. $element.data(DATA_KEY$6, data);
  4370. }
  4371. if (typeof config === 'string') {
  4372. if (typeof data[config] === 'undefined') {
  4373. throw new TypeError("No method named \"" + config + "\"");
  4374. }
  4375. data[config]();
  4376. }
  4377. });
  4378. };
  4379. _createClass(Tooltip, null, [{
  4380. key: "VERSION",
  4381. get: function get() {
  4382. return VERSION$6;
  4383. }
  4384. }, {
  4385. key: "Default",
  4386. get: function get() {
  4387. return Default$4;
  4388. }
  4389. }, {
  4390. key: "NAME",
  4391. get: function get() {
  4392. return NAME$6;
  4393. }
  4394. }, {
  4395. key: "DATA_KEY",
  4396. get: function get() {
  4397. return DATA_KEY$6;
  4398. }
  4399. }, {
  4400. key: "Event",
  4401. get: function get() {
  4402. return Event;
  4403. }
  4404. }, {
  4405. key: "EVENT_KEY",
  4406. get: function get() {
  4407. return EVENT_KEY$6;
  4408. }
  4409. }, {
  4410. key: "DefaultType",
  4411. get: function get() {
  4412. return DefaultType$4;
  4413. }
  4414. }]);
  4415. return Tooltip;
  4416. }();
  4417. /**
  4418. * ------------------------------------------------------------------------
  4419. * jQuery
  4420. * ------------------------------------------------------------------------
  4421. */
  4422. $__default['default'].fn[NAME$6] = Tooltip._jQueryInterface;
  4423. $__default['default'].fn[NAME$6].Constructor = Tooltip;
  4424. $__default['default'].fn[NAME$6].noConflict = function () {
  4425. $__default['default'].fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4426. return Tooltip._jQueryInterface;
  4427. };
  4428. /**
  4429. * ------------------------------------------------------------------------
  4430. * Constants
  4431. * ------------------------------------------------------------------------
  4432. */
  4433. var NAME$7 = 'popover';
  4434. var VERSION$7 = '4.5.3';
  4435. var DATA_KEY$7 = 'bs.popover';
  4436. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4437. var JQUERY_NO_CONFLICT$7 = $__default['default'].fn[NAME$7];
  4438. var CLASS_PREFIX$1 = 'bs-popover';
  4439. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4440. var Default$5 = _extends({}, Tooltip.Default, {
  4441. placement: 'right',
  4442. trigger: 'click',
  4443. content: '',
  4444. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4445. });
  4446. var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
  4447. content: '(string|element|function)'
  4448. });
  4449. var CLASS_NAME_FADE$3 = 'fade';
  4450. var CLASS_NAME_SHOW$5 = 'show';
  4451. var SELECTOR_TITLE = '.popover-header';
  4452. var SELECTOR_CONTENT = '.popover-body';
  4453. var Event$1 = {
  4454. HIDE: "hide" + EVENT_KEY$7,
  4455. HIDDEN: "hidden" + EVENT_KEY$7,
  4456. SHOW: "show" + EVENT_KEY$7,
  4457. SHOWN: "shown" + EVENT_KEY$7,
  4458. INSERTED: "inserted" + EVENT_KEY$7,
  4459. CLICK: "click" + EVENT_KEY$7,
  4460. FOCUSIN: "focusin" + EVENT_KEY$7,
  4461. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4462. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4463. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4464. };
  4465. /**
  4466. * ------------------------------------------------------------------------
  4467. * Class Definition
  4468. * ------------------------------------------------------------------------
  4469. */
  4470. var Popover = /*#__PURE__*/function (_Tooltip) {
  4471. _inheritsLoose(Popover, _Tooltip);
  4472. function Popover() {
  4473. return _Tooltip.apply(this, arguments) || this;
  4474. }
  4475. var _proto = Popover.prototype;
  4476. // Overrides
  4477. _proto.isWithContent = function isWithContent() {
  4478. return this.getTitle() || this._getContent();
  4479. };
  4480. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4481. $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4482. };
  4483. _proto.getTipElement = function getTipElement() {
  4484. this.tip = this.tip || $__default['default'](this.config.template)[0];
  4485. return this.tip;
  4486. };
  4487. _proto.setContent = function setContent() {
  4488. var $tip = $__default['default'](this.getTipElement()); // We use append for html objects to maintain js events
  4489. this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
  4490. var content = this._getContent();
  4491. if (typeof content === 'function') {
  4492. content = content.call(this.element);
  4493. }
  4494. this.setElementContent($tip.find(SELECTOR_CONTENT), content);
  4495. $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
  4496. } // Private
  4497. ;
  4498. _proto._getContent = function _getContent() {
  4499. return this.element.getAttribute('data-content') || this.config.content;
  4500. };
  4501. _proto._cleanTipClass = function _cleanTipClass() {
  4502. var $tip = $__default['default'](this.getTipElement());
  4503. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4504. if (tabClass !== null && tabClass.length > 0) {
  4505. $tip.removeClass(tabClass.join(''));
  4506. }
  4507. } // Static
  4508. ;
  4509. Popover._jQueryInterface = function _jQueryInterface(config) {
  4510. return this.each(function () {
  4511. var data = $__default['default'](this).data(DATA_KEY$7);
  4512. var _config = typeof config === 'object' ? config : null;
  4513. if (!data && /dispose|hide/.test(config)) {
  4514. return;
  4515. }
  4516. if (!data) {
  4517. data = new Popover(this, _config);
  4518. $__default['default'](this).data(DATA_KEY$7, data);
  4519. }
  4520. if (typeof config === 'string') {
  4521. if (typeof data[config] === 'undefined') {
  4522. throw new TypeError("No method named \"" + config + "\"");
  4523. }
  4524. data[config]();
  4525. }
  4526. });
  4527. };
  4528. _createClass(Popover, null, [{
  4529. key: "VERSION",
  4530. // Getters
  4531. get: function get() {
  4532. return VERSION$7;
  4533. }
  4534. }, {
  4535. key: "Default",
  4536. get: function get() {
  4537. return Default$5;
  4538. }
  4539. }, {
  4540. key: "NAME",
  4541. get: function get() {
  4542. return NAME$7;
  4543. }
  4544. }, {
  4545. key: "DATA_KEY",
  4546. get: function get() {
  4547. return DATA_KEY$7;
  4548. }
  4549. }, {
  4550. key: "Event",
  4551. get: function get() {
  4552. return Event$1;
  4553. }
  4554. }, {
  4555. key: "EVENT_KEY",
  4556. get: function get() {
  4557. return EVENT_KEY$7;
  4558. }
  4559. }, {
  4560. key: "DefaultType",
  4561. get: function get() {
  4562. return DefaultType$5;
  4563. }
  4564. }]);
  4565. return Popover;
  4566. }(Tooltip);
  4567. /**
  4568. * ------------------------------------------------------------------------
  4569. * jQuery
  4570. * ------------------------------------------------------------------------
  4571. */
  4572. $__default['default'].fn[NAME$7] = Popover._jQueryInterface;
  4573. $__default['default'].fn[NAME$7].Constructor = Popover;
  4574. $__default['default'].fn[NAME$7].noConflict = function () {
  4575. $__default['default'].fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4576. return Popover._jQueryInterface;
  4577. };
  4578. /**
  4579. * ------------------------------------------------------------------------
  4580. * Constants
  4581. * ------------------------------------------------------------------------
  4582. */
  4583. var NAME$8 = 'scrollspy';
  4584. var VERSION$8 = '4.5.3';
  4585. var DATA_KEY$8 = 'bs.scrollspy';
  4586. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4587. var DATA_API_KEY$6 = '.data-api';
  4588. var JQUERY_NO_CONFLICT$8 = $__default['default'].fn[NAME$8];
  4589. var Default$6 = {
  4590. offset: 10,
  4591. method: 'auto',
  4592. target: ''
  4593. };
  4594. var DefaultType$6 = {
  4595. offset: 'number',
  4596. method: 'string',
  4597. target: '(string|element)'
  4598. };
  4599. var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  4600. var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  4601. var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  4602. var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  4603. var CLASS_NAME_ACTIVE$2 = 'active';
  4604. var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
  4605. var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  4606. var SELECTOR_NAV_LINKS = '.nav-link';
  4607. var SELECTOR_NAV_ITEMS = '.nav-item';
  4608. var SELECTOR_LIST_ITEMS = '.list-group-item';
  4609. var SELECTOR_DROPDOWN = '.dropdown';
  4610. var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
  4611. var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  4612. var METHOD_OFFSET = 'offset';
  4613. var METHOD_POSITION = 'position';
  4614. /**
  4615. * ------------------------------------------------------------------------
  4616. * Class Definition
  4617. * ------------------------------------------------------------------------
  4618. */
  4619. var ScrollSpy = /*#__PURE__*/function () {
  4620. function ScrollSpy(element, config) {
  4621. var _this = this;
  4622. this._element = element;
  4623. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4624. this._config = this._getConfig(config);
  4625. this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
  4626. this._offsets = [];
  4627. this._targets = [];
  4628. this._activeTarget = null;
  4629. this._scrollHeight = 0;
  4630. $__default['default'](this._scrollElement).on(EVENT_SCROLL, function (event) {
  4631. return _this._process(event);
  4632. });
  4633. this.refresh();
  4634. this._process();
  4635. } // Getters
  4636. var _proto = ScrollSpy.prototype;
  4637. // Public
  4638. _proto.refresh = function refresh() {
  4639. var _this2 = this;
  4640. var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  4641. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4642. var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  4643. this._offsets = [];
  4644. this._targets = [];
  4645. this._scrollHeight = this._getScrollHeight();
  4646. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4647. targets.map(function (element) {
  4648. var target;
  4649. var targetSelector = Util.getSelectorFromElement(element);
  4650. if (targetSelector) {
  4651. target = document.querySelector(targetSelector);
  4652. }
  4653. if (target) {
  4654. var targetBCR = target.getBoundingClientRect();
  4655. if (targetBCR.width || targetBCR.height) {
  4656. // TODO (fat): remove sketch reliance on jQuery position/offset
  4657. return [$__default['default'](target)[offsetMethod]().top + offsetBase, targetSelector];
  4658. }
  4659. }
  4660. return null;
  4661. }).filter(function (item) {
  4662. return item;
  4663. }).sort(function (a, b) {
  4664. return a[0] - b[0];
  4665. }).forEach(function (item) {
  4666. _this2._offsets.push(item[0]);
  4667. _this2._targets.push(item[1]);
  4668. });
  4669. };
  4670. _proto.dispose = function dispose() {
  4671. $__default['default'].removeData(this._element, DATA_KEY$8);
  4672. $__default['default'](this._scrollElement).off(EVENT_KEY$8);
  4673. this._element = null;
  4674. this._scrollElement = null;
  4675. this._config = null;
  4676. this._selector = null;
  4677. this._offsets = null;
  4678. this._targets = null;
  4679. this._activeTarget = null;
  4680. this._scrollHeight = null;
  4681. } // Private
  4682. ;
  4683. _proto._getConfig = function _getConfig(config) {
  4684. config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
  4685. if (typeof config.target !== 'string' && Util.isElement(config.target)) {
  4686. var id = $__default['default'](config.target).attr('id');
  4687. if (!id) {
  4688. id = Util.getUID(NAME$8);
  4689. $__default['default'](config.target).attr('id', id);
  4690. }
  4691. config.target = "#" + id;
  4692. }
  4693. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  4694. return config;
  4695. };
  4696. _proto._getScrollTop = function _getScrollTop() {
  4697. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4698. };
  4699. _proto._getScrollHeight = function _getScrollHeight() {
  4700. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4701. };
  4702. _proto._getOffsetHeight = function _getOffsetHeight() {
  4703. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4704. };
  4705. _proto._process = function _process() {
  4706. var scrollTop = this._getScrollTop() + this._config.offset;
  4707. var scrollHeight = this._getScrollHeight();
  4708. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  4709. if (this._scrollHeight !== scrollHeight) {
  4710. this.refresh();
  4711. }
  4712. if (scrollTop >= maxScroll) {
  4713. var target = this._targets[this._targets.length - 1];
  4714. if (this._activeTarget !== target) {
  4715. this._activate(target);
  4716. }
  4717. return;
  4718. }
  4719. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  4720. this._activeTarget = null;
  4721. this._clear();
  4722. return;
  4723. }
  4724. for (var i = this._offsets.length; i--;) {
  4725. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  4726. if (isActiveTarget) {
  4727. this._activate(this._targets[i]);
  4728. }
  4729. }
  4730. };
  4731. _proto._activate = function _activate(target) {
  4732. this._activeTarget = target;
  4733. this._clear();
  4734. var queries = this._selector.split(',').map(function (selector) {
  4735. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  4736. });
  4737. var $link = $__default['default']([].slice.call(document.querySelectorAll(queries.join(','))));
  4738. if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
  4739. $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
  4740. $link.addClass(CLASS_NAME_ACTIVE$2);
  4741. } else {
  4742. // Set triggered link as active
  4743. $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
  4744. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  4745. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
  4746. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
  4747. }
  4748. $__default['default'](this._scrollElement).trigger(EVENT_ACTIVATE, {
  4749. relatedTarget: target
  4750. });
  4751. };
  4752. _proto._clear = function _clear() {
  4753. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  4754. return node.classList.contains(CLASS_NAME_ACTIVE$2);
  4755. }).forEach(function (node) {
  4756. return node.classList.remove(CLASS_NAME_ACTIVE$2);
  4757. });
  4758. } // Static
  4759. ;
  4760. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  4761. return this.each(function () {
  4762. var data = $__default['default'](this).data(DATA_KEY$8);
  4763. var _config = typeof config === 'object' && config;
  4764. if (!data) {
  4765. data = new ScrollSpy(this, _config);
  4766. $__default['default'](this).data(DATA_KEY$8, data);
  4767. }
  4768. if (typeof config === 'string') {
  4769. if (typeof data[config] === 'undefined') {
  4770. throw new TypeError("No method named \"" + config + "\"");
  4771. }
  4772. data[config]();
  4773. }
  4774. });
  4775. };
  4776. _createClass(ScrollSpy, null, [{
  4777. key: "VERSION",
  4778. get: function get() {
  4779. return VERSION$8;
  4780. }
  4781. }, {
  4782. key: "Default",
  4783. get: function get() {
  4784. return Default$6;
  4785. }
  4786. }]);
  4787. return ScrollSpy;
  4788. }();
  4789. /**
  4790. * ------------------------------------------------------------------------
  4791. * Data Api implementation
  4792. * ------------------------------------------------------------------------
  4793. */
  4794. $__default['default'](window).on(EVENT_LOAD_DATA_API$2, function () {
  4795. var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
  4796. var scrollSpysLength = scrollSpys.length;
  4797. for (var i = scrollSpysLength; i--;) {
  4798. var $spy = $__default['default'](scrollSpys[i]);
  4799. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  4800. }
  4801. });
  4802. /**
  4803. * ------------------------------------------------------------------------
  4804. * jQuery
  4805. * ------------------------------------------------------------------------
  4806. */
  4807. $__default['default'].fn[NAME$8] = ScrollSpy._jQueryInterface;
  4808. $__default['default'].fn[NAME$8].Constructor = ScrollSpy;
  4809. $__default['default'].fn[NAME$8].noConflict = function () {
  4810. $__default['default'].fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  4811. return ScrollSpy._jQueryInterface;
  4812. };
  4813. /**
  4814. * ------------------------------------------------------------------------
  4815. * Constants
  4816. * ------------------------------------------------------------------------
  4817. */
  4818. var NAME$9 = 'tab';
  4819. var VERSION$9 = '4.5.3';
  4820. var DATA_KEY$9 = 'bs.tab';
  4821. var EVENT_KEY$9 = "." + DATA_KEY$9;
  4822. var DATA_API_KEY$7 = '.data-api';
  4823. var JQUERY_NO_CONFLICT$9 = $__default['default'].fn[NAME$9];
  4824. var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  4825. var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  4826. var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  4827. var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  4828. var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  4829. var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  4830. var CLASS_NAME_ACTIVE$3 = 'active';
  4831. var CLASS_NAME_DISABLED$1 = 'disabled';
  4832. var CLASS_NAME_FADE$4 = 'fade';
  4833. var CLASS_NAME_SHOW$6 = 'show';
  4834. var SELECTOR_DROPDOWN$1 = '.dropdown';
  4835. var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  4836. var SELECTOR_ACTIVE$2 = '.active';
  4837. var SELECTOR_ACTIVE_UL = '> li > .active';
  4838. var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
  4839. var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  4840. var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
  4841. /**
  4842. * ------------------------------------------------------------------------
  4843. * Class Definition
  4844. * ------------------------------------------------------------------------
  4845. */
  4846. var Tab = /*#__PURE__*/function () {
  4847. function Tab(element) {
  4848. this._element = element;
  4849. } // Getters
  4850. var _proto = Tab.prototype;
  4851. // Public
  4852. _proto.show = function show() {
  4853. var _this = this;
  4854. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default['default'](this._element).hasClass(CLASS_NAME_ACTIVE$3) || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED$1)) {
  4855. return;
  4856. }
  4857. var target;
  4858. var previous;
  4859. var listElement = $__default['default'](this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
  4860. var selector = Util.getSelectorFromElement(this._element);
  4861. if (listElement) {
  4862. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
  4863. previous = $__default['default'].makeArray($__default['default'](listElement).find(itemSelector));
  4864. previous = previous[previous.length - 1];
  4865. }
  4866. var hideEvent = $__default['default'].Event(EVENT_HIDE$3, {
  4867. relatedTarget: this._element
  4868. });
  4869. var showEvent = $__default['default'].Event(EVENT_SHOW$3, {
  4870. relatedTarget: previous
  4871. });
  4872. if (previous) {
  4873. $__default['default'](previous).trigger(hideEvent);
  4874. }
  4875. $__default['default'](this._element).trigger(showEvent);
  4876. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  4877. return;
  4878. }
  4879. if (selector) {
  4880. target = document.querySelector(selector);
  4881. }
  4882. this._activate(this._element, listElement);
  4883. var complete = function complete() {
  4884. var hiddenEvent = $__default['default'].Event(EVENT_HIDDEN$3, {
  4885. relatedTarget: _this._element
  4886. });
  4887. var shownEvent = $__default['default'].Event(EVENT_SHOWN$3, {
  4888. relatedTarget: previous
  4889. });
  4890. $__default['default'](previous).trigger(hiddenEvent);
  4891. $__default['default'](_this._element).trigger(shownEvent);
  4892. };
  4893. if (target) {
  4894. this._activate(target, target.parentNode, complete);
  4895. } else {
  4896. complete();
  4897. }
  4898. };
  4899. _proto.dispose = function dispose() {
  4900. $__default['default'].removeData(this._element, DATA_KEY$9);
  4901. this._element = null;
  4902. } // Private
  4903. ;
  4904. _proto._activate = function _activate(element, container, callback) {
  4905. var _this2 = this;
  4906. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default['default'](container).find(SELECTOR_ACTIVE_UL) : $__default['default'](container).children(SELECTOR_ACTIVE$2);
  4907. var active = activeElements[0];
  4908. var isTransitioning = callback && active && $__default['default'](active).hasClass(CLASS_NAME_FADE$4);
  4909. var complete = function complete() {
  4910. return _this2._transitionComplete(element, active, callback);
  4911. };
  4912. if (active && isTransitioning) {
  4913. var transitionDuration = Util.getTransitionDurationFromElement(active);
  4914. $__default['default'](active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4915. } else {
  4916. complete();
  4917. }
  4918. };
  4919. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  4920. if (active) {
  4921. $__default['default'](active).removeClass(CLASS_NAME_ACTIVE$3);
  4922. var dropdownChild = $__default['default'](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
  4923. if (dropdownChild) {
  4924. $__default['default'](dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
  4925. }
  4926. if (active.getAttribute('role') === 'tab') {
  4927. active.setAttribute('aria-selected', false);
  4928. }
  4929. }
  4930. $__default['default'](element).addClass(CLASS_NAME_ACTIVE$3);
  4931. if (element.getAttribute('role') === 'tab') {
  4932. element.setAttribute('aria-selected', true);
  4933. }
  4934. Util.reflow(element);
  4935. if (element.classList.contains(CLASS_NAME_FADE$4)) {
  4936. element.classList.add(CLASS_NAME_SHOW$6);
  4937. }
  4938. if (element.parentNode && $__default['default'](element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
  4939. var dropdownElement = $__default['default'](element).closest(SELECTOR_DROPDOWN$1)[0];
  4940. if (dropdownElement) {
  4941. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
  4942. $__default['default'](dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
  4943. }
  4944. element.setAttribute('aria-expanded', true);
  4945. }
  4946. if (callback) {
  4947. callback();
  4948. }
  4949. } // Static
  4950. ;
  4951. Tab._jQueryInterface = function _jQueryInterface(config) {
  4952. return this.each(function () {
  4953. var $this = $__default['default'](this);
  4954. var data = $this.data(DATA_KEY$9);
  4955. if (!data) {
  4956. data = new Tab(this);
  4957. $this.data(DATA_KEY$9, data);
  4958. }
  4959. if (typeof config === 'string') {
  4960. if (typeof data[config] === 'undefined') {
  4961. throw new TypeError("No method named \"" + config + "\"");
  4962. }
  4963. data[config]();
  4964. }
  4965. });
  4966. };
  4967. _createClass(Tab, null, [{
  4968. key: "VERSION",
  4969. get: function get() {
  4970. return VERSION$9;
  4971. }
  4972. }]);
  4973. return Tab;
  4974. }();
  4975. /**
  4976. * ------------------------------------------------------------------------
  4977. * Data Api implementation
  4978. * ------------------------------------------------------------------------
  4979. */
  4980. $__default['default'](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
  4981. event.preventDefault();
  4982. Tab._jQueryInterface.call($__default['default'](this), 'show');
  4983. });
  4984. /**
  4985. * ------------------------------------------------------------------------
  4986. * jQuery
  4987. * ------------------------------------------------------------------------
  4988. */
  4989. $__default['default'].fn[NAME$9] = Tab._jQueryInterface;
  4990. $__default['default'].fn[NAME$9].Constructor = Tab;
  4991. $__default['default'].fn[NAME$9].noConflict = function () {
  4992. $__default['default'].fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  4993. return Tab._jQueryInterface;
  4994. };
  4995. /**
  4996. * ------------------------------------------------------------------------
  4997. * Constants
  4998. * ------------------------------------------------------------------------
  4999. */
  5000. var NAME$a = 'toast';
  5001. var VERSION$a = '4.5.3';
  5002. var DATA_KEY$a = 'bs.toast';
  5003. var EVENT_KEY$a = "." + DATA_KEY$a;
  5004. var JQUERY_NO_CONFLICT$a = $__default['default'].fn[NAME$a];
  5005. var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  5006. var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  5007. var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  5008. var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  5009. var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  5010. var CLASS_NAME_FADE$5 = 'fade';
  5011. var CLASS_NAME_HIDE = 'hide';
  5012. var CLASS_NAME_SHOW$7 = 'show';
  5013. var CLASS_NAME_SHOWING = 'showing';
  5014. var DefaultType$7 = {
  5015. animation: 'boolean',
  5016. autohide: 'boolean',
  5017. delay: 'number'
  5018. };
  5019. var Default$7 = {
  5020. animation: true,
  5021. autohide: true,
  5022. delay: 500
  5023. };
  5024. var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
  5025. /**
  5026. * ------------------------------------------------------------------------
  5027. * Class Definition
  5028. * ------------------------------------------------------------------------
  5029. */
  5030. var Toast = /*#__PURE__*/function () {
  5031. function Toast(element, config) {
  5032. this._element = element;
  5033. this._config = this._getConfig(config);
  5034. this._timeout = null;
  5035. this._setListeners();
  5036. } // Getters
  5037. var _proto = Toast.prototype;
  5038. // Public
  5039. _proto.show = function show() {
  5040. var _this = this;
  5041. var showEvent = $__default['default'].Event(EVENT_SHOW$4);
  5042. $__default['default'](this._element).trigger(showEvent);
  5043. if (showEvent.isDefaultPrevented()) {
  5044. return;
  5045. }
  5046. this._clearTimeout();
  5047. if (this._config.animation) {
  5048. this._element.classList.add(CLASS_NAME_FADE$5);
  5049. }
  5050. var complete = function complete() {
  5051. _this._element.classList.remove(CLASS_NAME_SHOWING);
  5052. _this._element.classList.add(CLASS_NAME_SHOW$7);
  5053. $__default['default'](_this._element).trigger(EVENT_SHOWN$4);
  5054. if (_this._config.autohide) {
  5055. _this._timeout = setTimeout(function () {
  5056. _this.hide();
  5057. }, _this._config.delay);
  5058. }
  5059. };
  5060. this._element.classList.remove(CLASS_NAME_HIDE);
  5061. Util.reflow(this._element);
  5062. this._element.classList.add(CLASS_NAME_SHOWING);
  5063. if (this._config.animation) {
  5064. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5065. $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5066. } else {
  5067. complete();
  5068. }
  5069. };
  5070. _proto.hide = function hide() {
  5071. if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5072. return;
  5073. }
  5074. var hideEvent = $__default['default'].Event(EVENT_HIDE$4);
  5075. $__default['default'](this._element).trigger(hideEvent);
  5076. if (hideEvent.isDefaultPrevented()) {
  5077. return;
  5078. }
  5079. this._close();
  5080. };
  5081. _proto.dispose = function dispose() {
  5082. this._clearTimeout();
  5083. if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5084. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5085. }
  5086. $__default['default'](this._element).off(EVENT_CLICK_DISMISS$1);
  5087. $__default['default'].removeData(this._element, DATA_KEY$a);
  5088. this._element = null;
  5089. this._config = null;
  5090. } // Private
  5091. ;
  5092. _proto._getConfig = function _getConfig(config) {
  5093. config = _extends({}, Default$7, $__default['default'](this._element).data(), typeof config === 'object' && config ? config : {});
  5094. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5095. return config;
  5096. };
  5097. _proto._setListeners = function _setListeners() {
  5098. var _this2 = this;
  5099. $__default['default'](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
  5100. return _this2.hide();
  5101. });
  5102. };
  5103. _proto._close = function _close() {
  5104. var _this3 = this;
  5105. var complete = function complete() {
  5106. _this3._element.classList.add(CLASS_NAME_HIDE);
  5107. $__default['default'](_this3._element).trigger(EVENT_HIDDEN$4);
  5108. };
  5109. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5110. if (this._config.animation) {
  5111. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5112. $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5113. } else {
  5114. complete();
  5115. }
  5116. };
  5117. _proto._clearTimeout = function _clearTimeout() {
  5118. clearTimeout(this._timeout);
  5119. this._timeout = null;
  5120. } // Static
  5121. ;
  5122. Toast._jQueryInterface = function _jQueryInterface(config) {
  5123. return this.each(function () {
  5124. var $element = $__default['default'](this);
  5125. var data = $element.data(DATA_KEY$a);
  5126. var _config = typeof config === 'object' && config;
  5127. if (!data) {
  5128. data = new Toast(this, _config);
  5129. $element.data(DATA_KEY$a, data);
  5130. }
  5131. if (typeof config === 'string') {
  5132. if (typeof data[config] === 'undefined') {
  5133. throw new TypeError("No method named \"" + config + "\"");
  5134. }
  5135. data[config](this);
  5136. }
  5137. });
  5138. };
  5139. _createClass(Toast, null, [{
  5140. key: "VERSION",
  5141. get: function get() {
  5142. return VERSION$a;
  5143. }
  5144. }, {
  5145. key: "DefaultType",
  5146. get: function get() {
  5147. return DefaultType$7;
  5148. }
  5149. }, {
  5150. key: "Default",
  5151. get: function get() {
  5152. return Default$7;
  5153. }
  5154. }]);
  5155. return Toast;
  5156. }();
  5157. /**
  5158. * ------------------------------------------------------------------------
  5159. * jQuery
  5160. * ------------------------------------------------------------------------
  5161. */
  5162. $__default['default'].fn[NAME$a] = Toast._jQueryInterface;
  5163. $__default['default'].fn[NAME$a].Constructor = Toast;
  5164. $__default['default'].fn[NAME$a].noConflict = function () {
  5165. $__default['default'].fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5166. return Toast._jQueryInterface;
  5167. };
  5168. exports.Alert = Alert;
  5169. exports.Button = Button;
  5170. exports.Carousel = Carousel;
  5171. exports.Collapse = Collapse;
  5172. exports.Dropdown = Dropdown;
  5173. exports.Modal = Modal;
  5174. exports.Popover = Popover;
  5175. exports.Scrollspy = ScrollSpy;
  5176. exports.Tab = Tab;
  5177. exports.Toast = Toast;
  5178. exports.Tooltip = Tooltip;
  5179. exports.Util = Util;
  5180. Object.defineProperty(exports, '__esModule', { value: true });
  5181. })));
  5182. //# sourceMappingURL=bootstrap.js.map
  5183. /***/ }),
  5184. /***/ "./node_modules/jquery/dist/jquery.js":
  5185. /*!********************************************!*\
  5186. !*** ./node_modules/jquery/dist/jquery.js ***!
  5187. \********************************************/
  5188. /*! no static exports found */
  5189. /***/ (function(module, exports, __webpack_require__) {
  5190. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  5191. * jQuery JavaScript Library v3.5.1
  5192. * https://jquery.com/
  5193. *
  5194. * Includes Sizzle.js
  5195. * https://sizzlejs.com/
  5196. *
  5197. * Copyright JS Foundation and other contributors
  5198. * Released under the MIT license
  5199. * https://jquery.org/license
  5200. *
  5201. * Date: 2020-05-04T22:49Z
  5202. */
  5203. ( function( global, factory ) {
  5204. "use strict";
  5205. if ( true && typeof module.exports === "object" ) {
  5206. // For CommonJS and CommonJS-like environments where a proper `window`
  5207. // is present, execute the factory and get jQuery.
  5208. // For environments that do not have a `window` with a `document`
  5209. // (such as Node.js), expose a factory as module.exports.
  5210. // This accentuates the need for the creation of a real `window`.
  5211. // e.g. var jQuery = require("jquery")(window);
  5212. // See ticket #14549 for more info.
  5213. module.exports = global.document ?
  5214. factory( global, true ) :
  5215. function( w ) {
  5216. if ( !w.document ) {
  5217. throw new Error( "jQuery requires a window with a document" );
  5218. }
  5219. return factory( w );
  5220. };
  5221. } else {
  5222. factory( global );
  5223. }
  5224. // Pass this if window is not defined yet
  5225. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  5226. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  5227. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  5228. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  5229. // enough that all such attempts are guarded in a try block.
  5230. "use strict";
  5231. var arr = [];
  5232. var getProto = Object.getPrototypeOf;
  5233. var slice = arr.slice;
  5234. var flat = arr.flat ? function( array ) {
  5235. return arr.flat.call( array );
  5236. } : function( array ) {
  5237. return arr.concat.apply( [], array );
  5238. };
  5239. var push = arr.push;
  5240. var indexOf = arr.indexOf;
  5241. var class2type = {};
  5242. var toString = class2type.toString;
  5243. var hasOwn = class2type.hasOwnProperty;
  5244. var fnToString = hasOwn.toString;
  5245. var ObjectFunctionString = fnToString.call( Object );
  5246. var support = {};
  5247. var isFunction = function isFunction( obj ) {
  5248. // Support: Chrome <=57, Firefox <=52
  5249. // In some browsers, typeof returns "function" for HTML <object> elements
  5250. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  5251. // We don't want to classify *any* DOM node as a function.
  5252. return typeof obj === "function" && typeof obj.nodeType !== "number";
  5253. };
  5254. var isWindow = function isWindow( obj ) {
  5255. return obj != null && obj === obj.window;
  5256. };
  5257. var document = window.document;
  5258. var preservedScriptAttributes = {
  5259. type: true,
  5260. src: true,
  5261. nonce: true,
  5262. noModule: true
  5263. };
  5264. function DOMEval( code, node, doc ) {
  5265. doc = doc || document;
  5266. var i, val,
  5267. script = doc.createElement( "script" );
  5268. script.text = code;
  5269. if ( node ) {
  5270. for ( i in preservedScriptAttributes ) {
  5271. // Support: Firefox 64+, Edge 18+
  5272. // Some browsers don't support the "nonce" property on scripts.
  5273. // On the other hand, just using `getAttribute` is not enough as
  5274. // the `nonce` attribute is reset to an empty string whenever it
  5275. // becomes browsing-context connected.
  5276. // See https://github.com/whatwg/html/issues/2369
  5277. // See https://html.spec.whatwg.org/#nonce-attributes
  5278. // The `node.getAttribute` check was added for the sake of
  5279. // `jQuery.globalEval` so that it can fake a nonce-containing node
  5280. // via an object.
  5281. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  5282. if ( val ) {
  5283. script.setAttribute( i, val );
  5284. }
  5285. }
  5286. }
  5287. doc.head.appendChild( script ).parentNode.removeChild( script );
  5288. }
  5289. function toType( obj ) {
  5290. if ( obj == null ) {
  5291. return obj + "";
  5292. }
  5293. // Support: Android <=2.3 only (functionish RegExp)
  5294. return typeof obj === "object" || typeof obj === "function" ?
  5295. class2type[ toString.call( obj ) ] || "object" :
  5296. typeof obj;
  5297. }
  5298. /* global Symbol */
  5299. // Defining this global in .eslintrc.json would create a danger of using the global
  5300. // unguarded in another place, it seems safer to define global only for this module
  5301. var
  5302. version = "3.5.1",
  5303. // Define a local copy of jQuery
  5304. jQuery = function( selector, context ) {
  5305. // The jQuery object is actually just the init constructor 'enhanced'
  5306. // Need init if jQuery is called (just allow error to be thrown if not included)
  5307. return new jQuery.fn.init( selector, context );
  5308. };
  5309. jQuery.fn = jQuery.prototype = {
  5310. // The current version of jQuery being used
  5311. jquery: version,
  5312. constructor: jQuery,
  5313. // The default length of a jQuery object is 0
  5314. length: 0,
  5315. toArray: function() {
  5316. return slice.call( this );
  5317. },
  5318. // Get the Nth element in the matched element set OR
  5319. // Get the whole matched element set as a clean array
  5320. get: function( num ) {
  5321. // Return all the elements in a clean array
  5322. if ( num == null ) {
  5323. return slice.call( this );
  5324. }
  5325. // Return just the one element from the set
  5326. return num < 0 ? this[ num + this.length ] : this[ num ];
  5327. },
  5328. // Take an array of elements and push it onto the stack
  5329. // (returning the new matched element set)
  5330. pushStack: function( elems ) {
  5331. // Build a new jQuery matched element set
  5332. var ret = jQuery.merge( this.constructor(), elems );
  5333. // Add the old object onto the stack (as a reference)
  5334. ret.prevObject = this;
  5335. // Return the newly-formed element set
  5336. return ret;
  5337. },
  5338. // Execute a callback for every element in the matched set.
  5339. each: function( callback ) {
  5340. return jQuery.each( this, callback );
  5341. },
  5342. map: function( callback ) {
  5343. return this.pushStack( jQuery.map( this, function( elem, i ) {
  5344. return callback.call( elem, i, elem );
  5345. } ) );
  5346. },
  5347. slice: function() {
  5348. return this.pushStack( slice.apply( this, arguments ) );
  5349. },
  5350. first: function() {
  5351. return this.eq( 0 );
  5352. },
  5353. last: function() {
  5354. return this.eq( -1 );
  5355. },
  5356. even: function() {
  5357. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  5358. return ( i + 1 ) % 2;
  5359. } ) );
  5360. },
  5361. odd: function() {
  5362. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  5363. return i % 2;
  5364. } ) );
  5365. },
  5366. eq: function( i ) {
  5367. var len = this.length,
  5368. j = +i + ( i < 0 ? len : 0 );
  5369. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  5370. },
  5371. end: function() {
  5372. return this.prevObject || this.constructor();
  5373. },
  5374. // For internal use only.
  5375. // Behaves like an Array's method, not like a jQuery method.
  5376. push: push,
  5377. sort: arr.sort,
  5378. splice: arr.splice
  5379. };
  5380. jQuery.extend = jQuery.fn.extend = function() {
  5381. var options, name, src, copy, copyIsArray, clone,
  5382. target = arguments[ 0 ] || {},
  5383. i = 1,
  5384. length = arguments.length,
  5385. deep = false;
  5386. // Handle a deep copy situation
  5387. if ( typeof target === "boolean" ) {
  5388. deep = target;
  5389. // Skip the boolean and the target
  5390. target = arguments[ i ] || {};
  5391. i++;
  5392. }
  5393. // Handle case when target is a string or something (possible in deep copy)
  5394. if ( typeof target !== "object" && !isFunction( target ) ) {
  5395. target = {};
  5396. }
  5397. // Extend jQuery itself if only one argument is passed
  5398. if ( i === length ) {
  5399. target = this;
  5400. i--;
  5401. }
  5402. for ( ; i < length; i++ ) {
  5403. // Only deal with non-null/undefined values
  5404. if ( ( options = arguments[ i ] ) != null ) {
  5405. // Extend the base object
  5406. for ( name in options ) {
  5407. copy = options[ name ];
  5408. // Prevent Object.prototype pollution
  5409. // Prevent never-ending loop
  5410. if ( name === "__proto__" || target === copy ) {
  5411. continue;
  5412. }
  5413. // Recurse if we're merging plain objects or arrays
  5414. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  5415. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  5416. src = target[ name ];
  5417. // Ensure proper type for the source value
  5418. if ( copyIsArray && !Array.isArray( src ) ) {
  5419. clone = [];
  5420. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  5421. clone = {};
  5422. } else {
  5423. clone = src;
  5424. }
  5425. copyIsArray = false;
  5426. // Never move original objects, clone them
  5427. target[ name ] = jQuery.extend( deep, clone, copy );
  5428. // Don't bring in undefined values
  5429. } else if ( copy !== undefined ) {
  5430. target[ name ] = copy;
  5431. }
  5432. }
  5433. }
  5434. }
  5435. // Return the modified object
  5436. return target;
  5437. };
  5438. jQuery.extend( {
  5439. // Unique for each copy of jQuery on the page
  5440. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  5441. // Assume jQuery is ready without the ready module
  5442. isReady: true,
  5443. error: function( msg ) {
  5444. throw new Error( msg );
  5445. },
  5446. noop: function() {},
  5447. isPlainObject: function( obj ) {
  5448. var proto, Ctor;
  5449. // Detect obvious negatives
  5450. // Use toString instead of jQuery.type to catch host objects
  5451. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  5452. return false;
  5453. }
  5454. proto = getProto( obj );
  5455. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  5456. if ( !proto ) {
  5457. return true;
  5458. }
  5459. // Objects with prototype are plain iff they were constructed by a global Object function
  5460. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  5461. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  5462. },
  5463. isEmptyObject: function( obj ) {
  5464. var name;
  5465. for ( name in obj ) {
  5466. return false;
  5467. }
  5468. return true;
  5469. },
  5470. // Evaluates a script in a provided context; falls back to the global one
  5471. // if not specified.
  5472. globalEval: function( code, options, doc ) {
  5473. DOMEval( code, { nonce: options && options.nonce }, doc );
  5474. },
  5475. each: function( obj, callback ) {
  5476. var length, i = 0;
  5477. if ( isArrayLike( obj ) ) {
  5478. length = obj.length;
  5479. for ( ; i < length; i++ ) {
  5480. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5481. break;
  5482. }
  5483. }
  5484. } else {
  5485. for ( i in obj ) {
  5486. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5487. break;
  5488. }
  5489. }
  5490. }
  5491. return obj;
  5492. },
  5493. // results is for internal usage only
  5494. makeArray: function( arr, results ) {
  5495. var ret = results || [];
  5496. if ( arr != null ) {
  5497. if ( isArrayLike( Object( arr ) ) ) {
  5498. jQuery.merge( ret,
  5499. typeof arr === "string" ?
  5500. [ arr ] : arr
  5501. );
  5502. } else {
  5503. push.call( ret, arr );
  5504. }
  5505. }
  5506. return ret;
  5507. },
  5508. inArray: function( elem, arr, i ) {
  5509. return arr == null ? -1 : indexOf.call( arr, elem, i );
  5510. },
  5511. // Support: Android <=4.0 only, PhantomJS 1 only
  5512. // push.apply(_, arraylike) throws on ancient WebKit
  5513. merge: function( first, second ) {
  5514. var len = +second.length,
  5515. j = 0,
  5516. i = first.length;
  5517. for ( ; j < len; j++ ) {
  5518. first[ i++ ] = second[ j ];
  5519. }
  5520. first.length = i;
  5521. return first;
  5522. },
  5523. grep: function( elems, callback, invert ) {
  5524. var callbackInverse,
  5525. matches = [],
  5526. i = 0,
  5527. length = elems.length,
  5528. callbackExpect = !invert;
  5529. // Go through the array, only saving the items
  5530. // that pass the validator function
  5531. for ( ; i < length; i++ ) {
  5532. callbackInverse = !callback( elems[ i ], i );
  5533. if ( callbackInverse !== callbackExpect ) {
  5534. matches.push( elems[ i ] );
  5535. }
  5536. }
  5537. return matches;
  5538. },
  5539. // arg is for internal usage only
  5540. map: function( elems, callback, arg ) {
  5541. var length, value,
  5542. i = 0,
  5543. ret = [];
  5544. // Go through the array, translating each of the items to their new values
  5545. if ( isArrayLike( elems ) ) {
  5546. length = elems.length;
  5547. for ( ; i < length; i++ ) {
  5548. value = callback( elems[ i ], i, arg );
  5549. if ( value != null ) {
  5550. ret.push( value );
  5551. }
  5552. }
  5553. // Go through every key on the object,
  5554. } else {
  5555. for ( i in elems ) {
  5556. value = callback( elems[ i ], i, arg );
  5557. if ( value != null ) {
  5558. ret.push( value );
  5559. }
  5560. }
  5561. }
  5562. // Flatten any nested arrays
  5563. return flat( ret );
  5564. },
  5565. // A global GUID counter for objects
  5566. guid: 1,
  5567. // jQuery.support is not used in Core but other projects attach their
  5568. // properties to it so it needs to exist.
  5569. support: support
  5570. } );
  5571. if ( typeof Symbol === "function" ) {
  5572. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  5573. }
  5574. // Populate the class2type map
  5575. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5576. function( _i, name ) {
  5577. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5578. } );
  5579. function isArrayLike( obj ) {
  5580. // Support: real iOS 8.2 only (not reproducible in simulator)
  5581. // `in` check used to prevent JIT error (gh-2145)
  5582. // hasOwn isn't used here due to false negatives
  5583. // regarding Nodelist length in IE
  5584. var length = !!obj && "length" in obj && obj.length,
  5585. type = toType( obj );
  5586. if ( isFunction( obj ) || isWindow( obj ) ) {
  5587. return false;
  5588. }
  5589. return type === "array" || length === 0 ||
  5590. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  5591. }
  5592. var Sizzle =
  5593. /*!
  5594. * Sizzle CSS Selector Engine v2.3.5
  5595. * https://sizzlejs.com/
  5596. *
  5597. * Copyright JS Foundation and other contributors
  5598. * Released under the MIT license
  5599. * https://js.foundation/
  5600. *
  5601. * Date: 2020-03-14
  5602. */
  5603. ( function( window ) {
  5604. var i,
  5605. support,
  5606. Expr,
  5607. getText,
  5608. isXML,
  5609. tokenize,
  5610. compile,
  5611. select,
  5612. outermostContext,
  5613. sortInput,
  5614. hasDuplicate,
  5615. // Local document vars
  5616. setDocument,
  5617. document,
  5618. docElem,
  5619. documentIsHTML,
  5620. rbuggyQSA,
  5621. rbuggyMatches,
  5622. matches,
  5623. contains,
  5624. // Instance-specific data
  5625. expando = "sizzle" + 1 * new Date(),
  5626. preferredDoc = window.document,
  5627. dirruns = 0,
  5628. done = 0,
  5629. classCache = createCache(),
  5630. tokenCache = createCache(),
  5631. compilerCache = createCache(),
  5632. nonnativeSelectorCache = createCache(),
  5633. sortOrder = function( a, b ) {
  5634. if ( a === b ) {
  5635. hasDuplicate = true;
  5636. }
  5637. return 0;
  5638. },
  5639. // Instance methods
  5640. hasOwn = ( {} ).hasOwnProperty,
  5641. arr = [],
  5642. pop = arr.pop,
  5643. pushNative = arr.push,
  5644. push = arr.push,
  5645. slice = arr.slice,
  5646. // Use a stripped-down indexOf as it's faster than native
  5647. // https://jsperf.com/thor-indexof-vs-for/5
  5648. indexOf = function( list, elem ) {
  5649. var i = 0,
  5650. len = list.length;
  5651. for ( ; i < len; i++ ) {
  5652. if ( list[ i ] === elem ) {
  5653. return i;
  5654. }
  5655. }
  5656. return -1;
  5657. },
  5658. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
  5659. "ismap|loop|multiple|open|readonly|required|scoped",
  5660. // Regular expressions
  5661. // http://www.w3.org/TR/css3-selectors/#whitespace
  5662. whitespace = "[\\x20\\t\\r\\n\\f]",
  5663. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  5664. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  5665. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  5666. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  5667. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  5668. // Operator (capture 2)
  5669. "*([*^$|!~]?=)" + whitespace +
  5670. // "Attribute values must be CSS identifiers [capture 5]
  5671. // or strings [capture 3 or capture 4]"
  5672. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  5673. whitespace + "*\\]",
  5674. pseudos = ":(" + identifier + ")(?:\\((" +
  5675. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  5676. // 1. quoted (capture 3; capture 4 or capture 5)
  5677. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  5678. // 2. simple (capture 6)
  5679. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  5680. // 3. anything else (capture 2)
  5681. ".*" +
  5682. ")\\)|)",
  5683. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  5684. rwhitespace = new RegExp( whitespace + "+", "g" ),
  5685. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
  5686. whitespace + "+$", "g" ),
  5687. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  5688. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
  5689. "*" ),
  5690. rdescend = new RegExp( whitespace + "|>" ),
  5691. rpseudo = new RegExp( pseudos ),
  5692. ridentifier = new RegExp( "^" + identifier + "$" ),
  5693. matchExpr = {
  5694. "ID": new RegExp( "^#(" + identifier + ")" ),
  5695. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  5696. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  5697. "ATTR": new RegExp( "^" + attributes ),
  5698. "PSEUDO": new RegExp( "^" + pseudos ),
  5699. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  5700. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  5701. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  5702. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  5703. // For use in libraries implementing .is()
  5704. // We use this for POS matching in `select`
  5705. "needsContext": new RegExp( "^" + whitespace +
  5706. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  5707. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  5708. },
  5709. rhtml = /HTML$/i,
  5710. rinputs = /^(?:input|select|textarea|button)$/i,
  5711. rheader = /^h\d$/i,
  5712. rnative = /^[^{]+\{\s*\[native \w/,
  5713. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  5714. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  5715. rsibling = /[+~]/,
  5716. // CSS escapes
  5717. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  5718. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
  5719. funescape = function( escape, nonHex ) {
  5720. var high = "0x" + escape.slice( 1 ) - 0x10000;
  5721. return nonHex ?
  5722. // Strip the backslash prefix from a non-hex escape sequence
  5723. nonHex :
  5724. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  5725. // Support: IE <=11+
  5726. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  5727. // surrogate pair
  5728. high < 0 ?
  5729. String.fromCharCode( high + 0x10000 ) :
  5730. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  5731. },
  5732. // CSS string/identifier serialization
  5733. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  5734. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  5735. fcssescape = function( ch, asCodePoint ) {
  5736. if ( asCodePoint ) {
  5737. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  5738. if ( ch === "\0" ) {
  5739. return "\uFFFD";
  5740. }
  5741. // Control characters and (dependent upon position) numbers get escaped as code points
  5742. return ch.slice( 0, -1 ) + "\\" +
  5743. ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  5744. }
  5745. // Other potentially-special ASCII characters get backslash-escaped
  5746. return "\\" + ch;
  5747. },
  5748. // Used for iframes
  5749. // See setDocument()
  5750. // Removing the function wrapper causes a "Permission Denied"
  5751. // error in IE
  5752. unloadHandler = function() {
  5753. setDocument();
  5754. },
  5755. inDisabledFieldset = addCombinator(
  5756. function( elem ) {
  5757. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  5758. },
  5759. { dir: "parentNode", next: "legend" }
  5760. );
  5761. // Optimize for push.apply( _, NodeList )
  5762. try {
  5763. push.apply(
  5764. ( arr = slice.call( preferredDoc.childNodes ) ),
  5765. preferredDoc.childNodes
  5766. );
  5767. // Support: Android<4.0
  5768. // Detect silently failing push.apply
  5769. // eslint-disable-next-line no-unused-expressions
  5770. arr[ preferredDoc.childNodes.length ].nodeType;
  5771. } catch ( e ) {
  5772. push = { apply: arr.length ?
  5773. // Leverage slice if possible
  5774. function( target, els ) {
  5775. pushNative.apply( target, slice.call( els ) );
  5776. } :
  5777. // Support: IE<9
  5778. // Otherwise append directly
  5779. function( target, els ) {
  5780. var j = target.length,
  5781. i = 0;
  5782. // Can't trust NodeList.length
  5783. while ( ( target[ j++ ] = els[ i++ ] ) ) {}
  5784. target.length = j - 1;
  5785. }
  5786. };
  5787. }
  5788. function Sizzle( selector, context, results, seed ) {
  5789. var m, i, elem, nid, match, groups, newSelector,
  5790. newContext = context && context.ownerDocument,
  5791. // nodeType defaults to 9, since context defaults to document
  5792. nodeType = context ? context.nodeType : 9;
  5793. results = results || [];
  5794. // Return early from calls with invalid selector or context
  5795. if ( typeof selector !== "string" || !selector ||
  5796. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  5797. return results;
  5798. }
  5799. // Try to shortcut find operations (as opposed to filters) in HTML documents
  5800. if ( !seed ) {
  5801. setDocument( context );
  5802. context = context || document;
  5803. if ( documentIsHTML ) {
  5804. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  5805. // (excepting DocumentFragment context, where the methods don't exist)
  5806. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  5807. // ID selector
  5808. if ( ( m = match[ 1 ] ) ) {
  5809. // Document context
  5810. if ( nodeType === 9 ) {
  5811. if ( ( elem = context.getElementById( m ) ) ) {
  5812. // Support: IE, Opera, Webkit
  5813. // TODO: identify versions
  5814. // getElementById can match elements by name instead of ID
  5815. if ( elem.id === m ) {
  5816. results.push( elem );
  5817. return results;
  5818. }
  5819. } else {
  5820. return results;
  5821. }
  5822. // Element context
  5823. } else {
  5824. // Support: IE, Opera, Webkit
  5825. // TODO: identify versions
  5826. // getElementById can match elements by name instead of ID
  5827. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  5828. contains( context, elem ) &&
  5829. elem.id === m ) {
  5830. results.push( elem );
  5831. return results;
  5832. }
  5833. }
  5834. // Type selector
  5835. } else if ( match[ 2 ] ) {
  5836. push.apply( results, context.getElementsByTagName( selector ) );
  5837. return results;
  5838. // Class selector
  5839. } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
  5840. context.getElementsByClassName ) {
  5841. push.apply( results, context.getElementsByClassName( m ) );
  5842. return results;
  5843. }
  5844. }
  5845. // Take advantage of querySelectorAll
  5846. if ( support.qsa &&
  5847. !nonnativeSelectorCache[ selector + " " ] &&
  5848. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
  5849. // Support: IE 8 only
  5850. // Exclude object elements
  5851. ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
  5852. newSelector = selector;
  5853. newContext = context;
  5854. // qSA considers elements outside a scoping root when evaluating child or
  5855. // descendant combinators, which is not what we want.
  5856. // In such cases, we work around the behavior by prefixing every selector in the
  5857. // list with an ID selector referencing the scope context.
  5858. // The technique has to be used as well when a leading combinator is used
  5859. // as such selectors are not recognized by querySelectorAll.
  5860. // Thanks to Andrew Dupont for this technique.
  5861. if ( nodeType === 1 &&
  5862. ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
  5863. // Expand context for sibling selectors
  5864. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  5865. context;
  5866. // We can use :scope instead of the ID hack if the browser
  5867. // supports it & if we're not changing the context.
  5868. if ( newContext !== context || !support.scope ) {
  5869. // Capture the context ID, setting it first if necessary
  5870. if ( ( nid = context.getAttribute( "id" ) ) ) {
  5871. nid = nid.replace( rcssescape, fcssescape );
  5872. } else {
  5873. context.setAttribute( "id", ( nid = expando ) );
  5874. }
  5875. }
  5876. // Prefix every selector in the list
  5877. groups = tokenize( selector );
  5878. i = groups.length;
  5879. while ( i-- ) {
  5880. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  5881. toSelector( groups[ i ] );
  5882. }
  5883. newSelector = groups.join( "," );
  5884. }
  5885. try {
  5886. push.apply( results,
  5887. newContext.querySelectorAll( newSelector )
  5888. );
  5889. return results;
  5890. } catch ( qsaError ) {
  5891. nonnativeSelectorCache( selector, true );
  5892. } finally {
  5893. if ( nid === expando ) {
  5894. context.removeAttribute( "id" );
  5895. }
  5896. }
  5897. }
  5898. }
  5899. }
  5900. // All others
  5901. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  5902. }
  5903. /**
  5904. * Create key-value caches of limited size
  5905. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  5906. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  5907. * deleting the oldest entry
  5908. */
  5909. function createCache() {
  5910. var keys = [];
  5911. function cache( key, value ) {
  5912. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  5913. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  5914. // Only keep the most recent entries
  5915. delete cache[ keys.shift() ];
  5916. }
  5917. return ( cache[ key + " " ] = value );
  5918. }
  5919. return cache;
  5920. }
  5921. /**
  5922. * Mark a function for special use by Sizzle
  5923. * @param {Function} fn The function to mark
  5924. */
  5925. function markFunction( fn ) {
  5926. fn[ expando ] = true;
  5927. return fn;
  5928. }
  5929. /**
  5930. * Support testing using an element
  5931. * @param {Function} fn Passed the created element and returns a boolean result
  5932. */
  5933. function assert( fn ) {
  5934. var el = document.createElement( "fieldset" );
  5935. try {
  5936. return !!fn( el );
  5937. } catch ( e ) {
  5938. return false;
  5939. } finally {
  5940. // Remove from its parent by default
  5941. if ( el.parentNode ) {
  5942. el.parentNode.removeChild( el );
  5943. }
  5944. // release memory in IE
  5945. el = null;
  5946. }
  5947. }
  5948. /**
  5949. * Adds the same handler for all of the specified attrs
  5950. * @param {String} attrs Pipe-separated list of attributes
  5951. * @param {Function} handler The method that will be applied
  5952. */
  5953. function addHandle( attrs, handler ) {
  5954. var arr = attrs.split( "|" ),
  5955. i = arr.length;
  5956. while ( i-- ) {
  5957. Expr.attrHandle[ arr[ i ] ] = handler;
  5958. }
  5959. }
  5960. /**
  5961. * Checks document order of two siblings
  5962. * @param {Element} a
  5963. * @param {Element} b
  5964. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  5965. */
  5966. function siblingCheck( a, b ) {
  5967. var cur = b && a,
  5968. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  5969. a.sourceIndex - b.sourceIndex;
  5970. // Use IE sourceIndex if available on both nodes
  5971. if ( diff ) {
  5972. return diff;
  5973. }
  5974. // Check if b follows a
  5975. if ( cur ) {
  5976. while ( ( cur = cur.nextSibling ) ) {
  5977. if ( cur === b ) {
  5978. return -1;
  5979. }
  5980. }
  5981. }
  5982. return a ? 1 : -1;
  5983. }
  5984. /**
  5985. * Returns a function to use in pseudos for input types
  5986. * @param {String} type
  5987. */
  5988. function createInputPseudo( type ) {
  5989. return function( elem ) {
  5990. var name = elem.nodeName.toLowerCase();
  5991. return name === "input" && elem.type === type;
  5992. };
  5993. }
  5994. /**
  5995. * Returns a function to use in pseudos for buttons
  5996. * @param {String} type
  5997. */
  5998. function createButtonPseudo( type ) {
  5999. return function( elem ) {
  6000. var name = elem.nodeName.toLowerCase();
  6001. return ( name === "input" || name === "button" ) && elem.type === type;
  6002. };
  6003. }
  6004. /**
  6005. * Returns a function to use in pseudos for :enabled/:disabled
  6006. * @param {Boolean} disabled true for :disabled; false for :enabled
  6007. */
  6008. function createDisabledPseudo( disabled ) {
  6009. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  6010. return function( elem ) {
  6011. // Only certain elements can match :enabled or :disabled
  6012. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  6013. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  6014. if ( "form" in elem ) {
  6015. // Check for inherited disabledness on relevant non-disabled elements:
  6016. // * listed form-associated elements in a disabled fieldset
  6017. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  6018. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  6019. // * option elements in a disabled optgroup
  6020. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  6021. // All such elements have a "form" property.
  6022. if ( elem.parentNode && elem.disabled === false ) {
  6023. // Option elements defer to a parent optgroup if present
  6024. if ( "label" in elem ) {
  6025. if ( "label" in elem.parentNode ) {
  6026. return elem.parentNode.disabled === disabled;
  6027. } else {
  6028. return elem.disabled === disabled;
  6029. }
  6030. }
  6031. // Support: IE 6 - 11
  6032. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  6033. return elem.isDisabled === disabled ||
  6034. // Where there is no isDisabled, check manually
  6035. /* jshint -W018 */
  6036. elem.isDisabled !== !disabled &&
  6037. inDisabledFieldset( elem ) === disabled;
  6038. }
  6039. return elem.disabled === disabled;
  6040. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  6041. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  6042. // even exist on them, let alone have a boolean value.
  6043. } else if ( "label" in elem ) {
  6044. return elem.disabled === disabled;
  6045. }
  6046. // Remaining elements are neither :enabled nor :disabled
  6047. return false;
  6048. };
  6049. }
  6050. /**
  6051. * Returns a function to use in pseudos for positionals
  6052. * @param {Function} fn
  6053. */
  6054. function createPositionalPseudo( fn ) {
  6055. return markFunction( function( argument ) {
  6056. argument = +argument;
  6057. return markFunction( function( seed, matches ) {
  6058. var j,
  6059. matchIndexes = fn( [], seed.length, argument ),
  6060. i = matchIndexes.length;
  6061. // Match elements found at the specified indexes
  6062. while ( i-- ) {
  6063. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  6064. seed[ j ] = !( matches[ j ] = seed[ j ] );
  6065. }
  6066. }
  6067. } );
  6068. } );
  6069. }
  6070. /**
  6071. * Checks a node for validity as a Sizzle context
  6072. * @param {Element|Object=} context
  6073. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  6074. */
  6075. function testContext( context ) {
  6076. return context && typeof context.getElementsByTagName !== "undefined" && context;
  6077. }
  6078. // Expose support vars for convenience
  6079. support = Sizzle.support = {};
  6080. /**
  6081. * Detects XML nodes
  6082. * @param {Element|Object} elem An element or a document
  6083. * @returns {Boolean} True iff elem is a non-HTML XML node
  6084. */
  6085. isXML = Sizzle.isXML = function( elem ) {
  6086. var namespace = elem.namespaceURI,
  6087. docElem = ( elem.ownerDocument || elem ).documentElement;
  6088. // Support: IE <=8
  6089. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  6090. // https://bugs.jquery.com/ticket/4833
  6091. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  6092. };
  6093. /**
  6094. * Sets document-related variables once based on the current document
  6095. * @param {Element|Object} [doc] An element or document object to use to set the document
  6096. * @returns {Object} Returns the current document
  6097. */
  6098. setDocument = Sizzle.setDocument = function( node ) {
  6099. var hasCompare, subWindow,
  6100. doc = node ? node.ownerDocument || node : preferredDoc;
  6101. // Return early if doc is invalid or already selected
  6102. // Support: IE 11+, Edge 17 - 18+
  6103. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6104. // two documents; shallow comparisons work.
  6105. // eslint-disable-next-line eqeqeq
  6106. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  6107. return document;
  6108. }
  6109. // Update global variables
  6110. document = doc;
  6111. docElem = document.documentElement;
  6112. documentIsHTML = !isXML( document );
  6113. // Support: IE 9 - 11+, Edge 12 - 18+
  6114. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  6115. // Support: IE 11+, Edge 17 - 18+
  6116. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6117. // two documents; shallow comparisons work.
  6118. // eslint-disable-next-line eqeqeq
  6119. if ( preferredDoc != document &&
  6120. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  6121. // Support: IE 11, Edge
  6122. if ( subWindow.addEventListener ) {
  6123. subWindow.addEventListener( "unload", unloadHandler, false );
  6124. // Support: IE 9 - 10 only
  6125. } else if ( subWindow.attachEvent ) {
  6126. subWindow.attachEvent( "onunload", unloadHandler );
  6127. }
  6128. }
  6129. // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
  6130. // Safari 4 - 5 only, Opera <=11.6 - 12.x only
  6131. // IE/Edge & older browsers don't support the :scope pseudo-class.
  6132. // Support: Safari 6.0 only
  6133. // Safari 6.0 supports :scope but it's an alias of :root there.
  6134. support.scope = assert( function( el ) {
  6135. docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
  6136. return typeof el.querySelectorAll !== "undefined" &&
  6137. !el.querySelectorAll( ":scope fieldset div" ).length;
  6138. } );
  6139. /* Attributes
  6140. ---------------------------------------------------------------------- */
  6141. // Support: IE<8
  6142. // Verify that getAttribute really returns attributes and not properties
  6143. // (excepting IE8 booleans)
  6144. support.attributes = assert( function( el ) {
  6145. el.className = "i";
  6146. return !el.getAttribute( "className" );
  6147. } );
  6148. /* getElement(s)By*
  6149. ---------------------------------------------------------------------- */
  6150. // Check if getElementsByTagName("*") returns only elements
  6151. support.getElementsByTagName = assert( function( el ) {
  6152. el.appendChild( document.createComment( "" ) );
  6153. return !el.getElementsByTagName( "*" ).length;
  6154. } );
  6155. // Support: IE<9
  6156. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  6157. // Support: IE<10
  6158. // Check if getElementById returns elements by name
  6159. // The broken getElementById methods don't pick up programmatically-set names,
  6160. // so use a roundabout getElementsByName test
  6161. support.getById = assert( function( el ) {
  6162. docElem.appendChild( el ).id = expando;
  6163. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  6164. } );
  6165. // ID filter and find
  6166. if ( support.getById ) {
  6167. Expr.filter[ "ID" ] = function( id ) {
  6168. var attrId = id.replace( runescape, funescape );
  6169. return function( elem ) {
  6170. return elem.getAttribute( "id" ) === attrId;
  6171. };
  6172. };
  6173. Expr.find[ "ID" ] = function( id, context ) {
  6174. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6175. var elem = context.getElementById( id );
  6176. return elem ? [ elem ] : [];
  6177. }
  6178. };
  6179. } else {
  6180. Expr.filter[ "ID" ] = function( id ) {
  6181. var attrId = id.replace( runescape, funescape );
  6182. return function( elem ) {
  6183. var node = typeof elem.getAttributeNode !== "undefined" &&
  6184. elem.getAttributeNode( "id" );
  6185. return node && node.value === attrId;
  6186. };
  6187. };
  6188. // Support: IE 6 - 7 only
  6189. // getElementById is not reliable as a find shortcut
  6190. Expr.find[ "ID" ] = function( id, context ) {
  6191. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6192. var node, i, elems,
  6193. elem = context.getElementById( id );
  6194. if ( elem ) {
  6195. // Verify the id attribute
  6196. node = elem.getAttributeNode( "id" );
  6197. if ( node && node.value === id ) {
  6198. return [ elem ];
  6199. }
  6200. // Fall back on getElementsByName
  6201. elems = context.getElementsByName( id );
  6202. i = 0;
  6203. while ( ( elem = elems[ i++ ] ) ) {
  6204. node = elem.getAttributeNode( "id" );
  6205. if ( node && node.value === id ) {
  6206. return [ elem ];
  6207. }
  6208. }
  6209. }
  6210. return [];
  6211. }
  6212. };
  6213. }
  6214. // Tag
  6215. Expr.find[ "TAG" ] = support.getElementsByTagName ?
  6216. function( tag, context ) {
  6217. if ( typeof context.getElementsByTagName !== "undefined" ) {
  6218. return context.getElementsByTagName( tag );
  6219. // DocumentFragment nodes don't have gEBTN
  6220. } else if ( support.qsa ) {
  6221. return context.querySelectorAll( tag );
  6222. }
  6223. } :
  6224. function( tag, context ) {
  6225. var elem,
  6226. tmp = [],
  6227. i = 0,
  6228. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  6229. results = context.getElementsByTagName( tag );
  6230. // Filter out possible comments
  6231. if ( tag === "*" ) {
  6232. while ( ( elem = results[ i++ ] ) ) {
  6233. if ( elem.nodeType === 1 ) {
  6234. tmp.push( elem );
  6235. }
  6236. }
  6237. return tmp;
  6238. }
  6239. return results;
  6240. };
  6241. // Class
  6242. Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
  6243. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  6244. return context.getElementsByClassName( className );
  6245. }
  6246. };
  6247. /* QSA/matchesSelector
  6248. ---------------------------------------------------------------------- */
  6249. // QSA and matchesSelector support
  6250. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  6251. rbuggyMatches = [];
  6252. // qSa(:focus) reports false when true (Chrome 21)
  6253. // We allow this because of a bug in IE8/9 that throws an error
  6254. // whenever `document.activeElement` is accessed on an iframe
  6255. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  6256. // See https://bugs.jquery.com/ticket/13378
  6257. rbuggyQSA = [];
  6258. if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
  6259. // Build QSA regex
  6260. // Regex strategy adopted from Diego Perini
  6261. assert( function( el ) {
  6262. var input;
  6263. // Select is set to empty string on purpose
  6264. // This is to test IE's treatment of not explicitly
  6265. // setting a boolean content attribute,
  6266. // since its presence should be enough
  6267. // https://bugs.jquery.com/ticket/12359
  6268. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  6269. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  6270. "<option selected=''></option></select>";
  6271. // Support: IE8, Opera 11-12.16
  6272. // Nothing should be selected when empty strings follow ^= or $= or *=
  6273. // The test attribute must be unknown in Opera but "safe" for WinRT
  6274. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  6275. if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
  6276. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  6277. }
  6278. // Support: IE8
  6279. // Boolean attributes and "value" are not treated correctly
  6280. if ( !el.querySelectorAll( "[selected]" ).length ) {
  6281. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  6282. }
  6283. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  6284. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  6285. rbuggyQSA.push( "~=" );
  6286. }
  6287. // Support: IE 11+, Edge 15 - 18+
  6288. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  6289. // Adding a temporary attribute to the document before the selection works
  6290. // around the issue.
  6291. // Interestingly, IE 10 & older don't seem to have the issue.
  6292. input = document.createElement( "input" );
  6293. input.setAttribute( "name", "" );
  6294. el.appendChild( input );
  6295. if ( !el.querySelectorAll( "[name='']" ).length ) {
  6296. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  6297. whitespace + "*(?:''|\"\")" );
  6298. }
  6299. // Webkit/Opera - :checked should return selected option elements
  6300. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6301. // IE8 throws error here and will not see later tests
  6302. if ( !el.querySelectorAll( ":checked" ).length ) {
  6303. rbuggyQSA.push( ":checked" );
  6304. }
  6305. // Support: Safari 8+, iOS 8+
  6306. // https://bugs.webkit.org/show_bug.cgi?id=136851
  6307. // In-page `selector#id sibling-combinator selector` fails
  6308. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  6309. rbuggyQSA.push( ".#.+[+~]" );
  6310. }
  6311. // Support: Firefox <=3.6 - 5 only
  6312. // Old Firefox doesn't throw on a badly-escaped identifier.
  6313. el.querySelectorAll( "\\\f" );
  6314. rbuggyQSA.push( "[\\r\\n\\f]" );
  6315. } );
  6316. assert( function( el ) {
  6317. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  6318. "<select disabled='disabled'><option/></select>";
  6319. // Support: Windows 8 Native Apps
  6320. // The type and name attributes are restricted during .innerHTML assignment
  6321. var input = document.createElement( "input" );
  6322. input.setAttribute( "type", "hidden" );
  6323. el.appendChild( input ).setAttribute( "name", "D" );
  6324. // Support: IE8
  6325. // Enforce case-sensitivity of name attribute
  6326. if ( el.querySelectorAll( "[name=d]" ).length ) {
  6327. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  6328. }
  6329. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  6330. // IE8 throws error here and will not see later tests
  6331. if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
  6332. rbuggyQSA.push( ":enabled", ":disabled" );
  6333. }
  6334. // Support: IE9-11+
  6335. // IE's :disabled selector does not pick up the children of disabled fieldsets
  6336. docElem.appendChild( el ).disabled = true;
  6337. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  6338. rbuggyQSA.push( ":enabled", ":disabled" );
  6339. }
  6340. // Support: Opera 10 - 11 only
  6341. // Opera 10-11 does not throw on post-comma invalid pseudos
  6342. el.querySelectorAll( "*,:x" );
  6343. rbuggyQSA.push( ",.*:" );
  6344. } );
  6345. }
  6346. if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
  6347. docElem.webkitMatchesSelector ||
  6348. docElem.mozMatchesSelector ||
  6349. docElem.oMatchesSelector ||
  6350. docElem.msMatchesSelector ) ) ) ) {
  6351. assert( function( el ) {
  6352. // Check to see if it's possible to do matchesSelector
  6353. // on a disconnected node (IE 9)
  6354. support.disconnectedMatch = matches.call( el, "*" );
  6355. // This should fail with an exception
  6356. // Gecko does not error, returns false instead
  6357. matches.call( el, "[s!='']:x" );
  6358. rbuggyMatches.push( "!=", pseudos );
  6359. } );
  6360. }
  6361. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  6362. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
  6363. /* Contains
  6364. ---------------------------------------------------------------------- */
  6365. hasCompare = rnative.test( docElem.compareDocumentPosition );
  6366. // Element contains another
  6367. // Purposefully self-exclusive
  6368. // As in, an element does not contain itself
  6369. contains = hasCompare || rnative.test( docElem.contains ) ?
  6370. function( a, b ) {
  6371. var adown = a.nodeType === 9 ? a.documentElement : a,
  6372. bup = b && b.parentNode;
  6373. return a === bup || !!( bup && bup.nodeType === 1 && (
  6374. adown.contains ?
  6375. adown.contains( bup ) :
  6376. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  6377. ) );
  6378. } :
  6379. function( a, b ) {
  6380. if ( b ) {
  6381. while ( ( b = b.parentNode ) ) {
  6382. if ( b === a ) {
  6383. return true;
  6384. }
  6385. }
  6386. }
  6387. return false;
  6388. };
  6389. /* Sorting
  6390. ---------------------------------------------------------------------- */
  6391. // Document order sorting
  6392. sortOrder = hasCompare ?
  6393. function( a, b ) {
  6394. // Flag for duplicate removal
  6395. if ( a === b ) {
  6396. hasDuplicate = true;
  6397. return 0;
  6398. }
  6399. // Sort on method existence if only one input has compareDocumentPosition
  6400. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  6401. if ( compare ) {
  6402. return compare;
  6403. }
  6404. // Calculate position if both inputs belong to the same document
  6405. // Support: IE 11+, Edge 17 - 18+
  6406. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6407. // two documents; shallow comparisons work.
  6408. // eslint-disable-next-line eqeqeq
  6409. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  6410. a.compareDocumentPosition( b ) :
  6411. // Otherwise we know they are disconnected
  6412. 1;
  6413. // Disconnected nodes
  6414. if ( compare & 1 ||
  6415. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  6416. // Choose the first element that is related to our preferred document
  6417. // Support: IE 11+, Edge 17 - 18+
  6418. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6419. // two documents; shallow comparisons work.
  6420. // eslint-disable-next-line eqeqeq
  6421. if ( a == document || a.ownerDocument == preferredDoc &&
  6422. contains( preferredDoc, a ) ) {
  6423. return -1;
  6424. }
  6425. // Support: IE 11+, Edge 17 - 18+
  6426. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6427. // two documents; shallow comparisons work.
  6428. // eslint-disable-next-line eqeqeq
  6429. if ( b == document || b.ownerDocument == preferredDoc &&
  6430. contains( preferredDoc, b ) ) {
  6431. return 1;
  6432. }
  6433. // Maintain original order
  6434. return sortInput ?
  6435. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6436. 0;
  6437. }
  6438. return compare & 4 ? -1 : 1;
  6439. } :
  6440. function( a, b ) {
  6441. // Exit early if the nodes are identical
  6442. if ( a === b ) {
  6443. hasDuplicate = true;
  6444. return 0;
  6445. }
  6446. var cur,
  6447. i = 0,
  6448. aup = a.parentNode,
  6449. bup = b.parentNode,
  6450. ap = [ a ],
  6451. bp = [ b ];
  6452. // Parentless nodes are either documents or disconnected
  6453. if ( !aup || !bup ) {
  6454. // Support: IE 11+, Edge 17 - 18+
  6455. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6456. // two documents; shallow comparisons work.
  6457. /* eslint-disable eqeqeq */
  6458. return a == document ? -1 :
  6459. b == document ? 1 :
  6460. /* eslint-enable eqeqeq */
  6461. aup ? -1 :
  6462. bup ? 1 :
  6463. sortInput ?
  6464. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6465. 0;
  6466. // If the nodes are siblings, we can do a quick check
  6467. } else if ( aup === bup ) {
  6468. return siblingCheck( a, b );
  6469. }
  6470. // Otherwise we need full lists of their ancestors for comparison
  6471. cur = a;
  6472. while ( ( cur = cur.parentNode ) ) {
  6473. ap.unshift( cur );
  6474. }
  6475. cur = b;
  6476. while ( ( cur = cur.parentNode ) ) {
  6477. bp.unshift( cur );
  6478. }
  6479. // Walk down the tree looking for a discrepancy
  6480. while ( ap[ i ] === bp[ i ] ) {
  6481. i++;
  6482. }
  6483. return i ?
  6484. // Do a sibling check if the nodes have a common ancestor
  6485. siblingCheck( ap[ i ], bp[ i ] ) :
  6486. // Otherwise nodes in our document sort first
  6487. // Support: IE 11+, Edge 17 - 18+
  6488. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6489. // two documents; shallow comparisons work.
  6490. /* eslint-disable eqeqeq */
  6491. ap[ i ] == preferredDoc ? -1 :
  6492. bp[ i ] == preferredDoc ? 1 :
  6493. /* eslint-enable eqeqeq */
  6494. 0;
  6495. };
  6496. return document;
  6497. };
  6498. Sizzle.matches = function( expr, elements ) {
  6499. return Sizzle( expr, null, null, elements );
  6500. };
  6501. Sizzle.matchesSelector = function( elem, expr ) {
  6502. setDocument( elem );
  6503. if ( support.matchesSelector && documentIsHTML &&
  6504. !nonnativeSelectorCache[ expr + " " ] &&
  6505. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  6506. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  6507. try {
  6508. var ret = matches.call( elem, expr );
  6509. // IE 9's matchesSelector returns false on disconnected nodes
  6510. if ( ret || support.disconnectedMatch ||
  6511. // As well, disconnected nodes are said to be in a document
  6512. // fragment in IE 9
  6513. elem.document && elem.document.nodeType !== 11 ) {
  6514. return ret;
  6515. }
  6516. } catch ( e ) {
  6517. nonnativeSelectorCache( expr, true );
  6518. }
  6519. }
  6520. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  6521. };
  6522. Sizzle.contains = function( context, elem ) {
  6523. // Set document vars if needed
  6524. // Support: IE 11+, Edge 17 - 18+
  6525. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6526. // two documents; shallow comparisons work.
  6527. // eslint-disable-next-line eqeqeq
  6528. if ( ( context.ownerDocument || context ) != document ) {
  6529. setDocument( context );
  6530. }
  6531. return contains( context, elem );
  6532. };
  6533. Sizzle.attr = function( elem, name ) {
  6534. // Set document vars if needed
  6535. // Support: IE 11+, Edge 17 - 18+
  6536. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6537. // two documents; shallow comparisons work.
  6538. // eslint-disable-next-line eqeqeq
  6539. if ( ( elem.ownerDocument || elem ) != document ) {
  6540. setDocument( elem );
  6541. }
  6542. var fn = Expr.attrHandle[ name.toLowerCase() ],
  6543. // Don't get fooled by Object.prototype properties (jQuery #13807)
  6544. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  6545. fn( elem, name, !documentIsHTML ) :
  6546. undefined;
  6547. return val !== undefined ?
  6548. val :
  6549. support.attributes || !documentIsHTML ?
  6550. elem.getAttribute( name ) :
  6551. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  6552. val.value :
  6553. null;
  6554. };
  6555. Sizzle.escape = function( sel ) {
  6556. return ( sel + "" ).replace( rcssescape, fcssescape );
  6557. };
  6558. Sizzle.error = function( msg ) {
  6559. throw new Error( "Syntax error, unrecognized expression: " + msg );
  6560. };
  6561. /**
  6562. * Document sorting and removing duplicates
  6563. * @param {ArrayLike} results
  6564. */
  6565. Sizzle.uniqueSort = function( results ) {
  6566. var elem,
  6567. duplicates = [],
  6568. j = 0,
  6569. i = 0;
  6570. // Unless we *know* we can detect duplicates, assume their presence
  6571. hasDuplicate = !support.detectDuplicates;
  6572. sortInput = !support.sortStable && results.slice( 0 );
  6573. results.sort( sortOrder );
  6574. if ( hasDuplicate ) {
  6575. while ( ( elem = results[ i++ ] ) ) {
  6576. if ( elem === results[ i ] ) {
  6577. j = duplicates.push( i );
  6578. }
  6579. }
  6580. while ( j-- ) {
  6581. results.splice( duplicates[ j ], 1 );
  6582. }
  6583. }
  6584. // Clear input after sorting to release objects
  6585. // See https://github.com/jquery/sizzle/pull/225
  6586. sortInput = null;
  6587. return results;
  6588. };
  6589. /**
  6590. * Utility function for retrieving the text value of an array of DOM nodes
  6591. * @param {Array|Element} elem
  6592. */
  6593. getText = Sizzle.getText = function( elem ) {
  6594. var node,
  6595. ret = "",
  6596. i = 0,
  6597. nodeType = elem.nodeType;
  6598. if ( !nodeType ) {
  6599. // If no nodeType, this is expected to be an array
  6600. while ( ( node = elem[ i++ ] ) ) {
  6601. // Do not traverse comment nodes
  6602. ret += getText( node );
  6603. }
  6604. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  6605. // Use textContent for elements
  6606. // innerText usage removed for consistency of new lines (jQuery #11153)
  6607. if ( typeof elem.textContent === "string" ) {
  6608. return elem.textContent;
  6609. } else {
  6610. // Traverse its children
  6611. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6612. ret += getText( elem );
  6613. }
  6614. }
  6615. } else if ( nodeType === 3 || nodeType === 4 ) {
  6616. return elem.nodeValue;
  6617. }
  6618. // Do not include comment or processing instruction nodes
  6619. return ret;
  6620. };
  6621. Expr = Sizzle.selectors = {
  6622. // Can be adjusted by the user
  6623. cacheLength: 50,
  6624. createPseudo: markFunction,
  6625. match: matchExpr,
  6626. attrHandle: {},
  6627. find: {},
  6628. relative: {
  6629. ">": { dir: "parentNode", first: true },
  6630. " ": { dir: "parentNode" },
  6631. "+": { dir: "previousSibling", first: true },
  6632. "~": { dir: "previousSibling" }
  6633. },
  6634. preFilter: {
  6635. "ATTR": function( match ) {
  6636. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  6637. // Move the given value to match[3] whether quoted or unquoted
  6638. match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
  6639. match[ 5 ] || "" ).replace( runescape, funescape );
  6640. if ( match[ 2 ] === "~=" ) {
  6641. match[ 3 ] = " " + match[ 3 ] + " ";
  6642. }
  6643. return match.slice( 0, 4 );
  6644. },
  6645. "CHILD": function( match ) {
  6646. /* matches from matchExpr["CHILD"]
  6647. 1 type (only|nth|...)
  6648. 2 what (child|of-type)
  6649. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  6650. 4 xn-component of xn+y argument ([+-]?\d*n|)
  6651. 5 sign of xn-component
  6652. 6 x of xn-component
  6653. 7 sign of y-component
  6654. 8 y of y-component
  6655. */
  6656. match[ 1 ] = match[ 1 ].toLowerCase();
  6657. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  6658. // nth-* requires argument
  6659. if ( !match[ 3 ] ) {
  6660. Sizzle.error( match[ 0 ] );
  6661. }
  6662. // numeric x and y parameters for Expr.filter.CHILD
  6663. // remember that false/true cast respectively to 0/1
  6664. match[ 4 ] = +( match[ 4 ] ?
  6665. match[ 5 ] + ( match[ 6 ] || 1 ) :
  6666. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
  6667. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  6668. // other types prohibit arguments
  6669. } else if ( match[ 3 ] ) {
  6670. Sizzle.error( match[ 0 ] );
  6671. }
  6672. return match;
  6673. },
  6674. "PSEUDO": function( match ) {
  6675. var excess,
  6676. unquoted = !match[ 6 ] && match[ 2 ];
  6677. if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
  6678. return null;
  6679. }
  6680. // Accept quoted arguments as-is
  6681. if ( match[ 3 ] ) {
  6682. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  6683. // Strip excess characters from unquoted arguments
  6684. } else if ( unquoted && rpseudo.test( unquoted ) &&
  6685. // Get excess from tokenize (recursively)
  6686. ( excess = tokenize( unquoted, true ) ) &&
  6687. // advance to the next closing parenthesis
  6688. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  6689. // excess is a negative index
  6690. match[ 0 ] = match[ 0 ].slice( 0, excess );
  6691. match[ 2 ] = unquoted.slice( 0, excess );
  6692. }
  6693. // Return only captures needed by the pseudo filter method (type and argument)
  6694. return match.slice( 0, 3 );
  6695. }
  6696. },
  6697. filter: {
  6698. "TAG": function( nodeNameSelector ) {
  6699. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  6700. return nodeNameSelector === "*" ?
  6701. function() {
  6702. return true;
  6703. } :
  6704. function( elem ) {
  6705. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  6706. };
  6707. },
  6708. "CLASS": function( className ) {
  6709. var pattern = classCache[ className + " " ];
  6710. return pattern ||
  6711. ( pattern = new RegExp( "(^|" + whitespace +
  6712. ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
  6713. className, function( elem ) {
  6714. return pattern.test(
  6715. typeof elem.className === "string" && elem.className ||
  6716. typeof elem.getAttribute !== "undefined" &&
  6717. elem.getAttribute( "class" ) ||
  6718. ""
  6719. );
  6720. } );
  6721. },
  6722. "ATTR": function( name, operator, check ) {
  6723. return function( elem ) {
  6724. var result = Sizzle.attr( elem, name );
  6725. if ( result == null ) {
  6726. return operator === "!=";
  6727. }
  6728. if ( !operator ) {
  6729. return true;
  6730. }
  6731. result += "";
  6732. /* eslint-disable max-len */
  6733. return operator === "=" ? result === check :
  6734. operator === "!=" ? result !== check :
  6735. operator === "^=" ? check && result.indexOf( check ) === 0 :
  6736. operator === "*=" ? check && result.indexOf( check ) > -1 :
  6737. operator === "$=" ? check && result.slice( -check.length ) === check :
  6738. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  6739. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  6740. false;
  6741. /* eslint-enable max-len */
  6742. };
  6743. },
  6744. "CHILD": function( type, what, _argument, first, last ) {
  6745. var simple = type.slice( 0, 3 ) !== "nth",
  6746. forward = type.slice( -4 ) !== "last",
  6747. ofType = what === "of-type";
  6748. return first === 1 && last === 0 ?
  6749. // Shortcut for :nth-*(n)
  6750. function( elem ) {
  6751. return !!elem.parentNode;
  6752. } :
  6753. function( elem, _context, xml ) {
  6754. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  6755. dir = simple !== forward ? "nextSibling" : "previousSibling",
  6756. parent = elem.parentNode,
  6757. name = ofType && elem.nodeName.toLowerCase(),
  6758. useCache = !xml && !ofType,
  6759. diff = false;
  6760. if ( parent ) {
  6761. // :(first|last|only)-(child|of-type)
  6762. if ( simple ) {
  6763. while ( dir ) {
  6764. node = elem;
  6765. while ( ( node = node[ dir ] ) ) {
  6766. if ( ofType ?
  6767. node.nodeName.toLowerCase() === name :
  6768. node.nodeType === 1 ) {
  6769. return false;
  6770. }
  6771. }
  6772. // Reverse direction for :only-* (if we haven't yet done so)
  6773. start = dir = type === "only" && !start && "nextSibling";
  6774. }
  6775. return true;
  6776. }
  6777. start = [ forward ? parent.firstChild : parent.lastChild ];
  6778. // non-xml :nth-child(...) stores cache data on `parent`
  6779. if ( forward && useCache ) {
  6780. // Seek `elem` from a previously-cached index
  6781. // ...in a gzip-friendly way
  6782. node = parent;
  6783. outerCache = node[ expando ] || ( node[ expando ] = {} );
  6784. // Support: IE <9 only
  6785. // Defend against cloned attroperties (jQuery gh-1709)
  6786. uniqueCache = outerCache[ node.uniqueID ] ||
  6787. ( outerCache[ node.uniqueID ] = {} );
  6788. cache = uniqueCache[ type ] || [];
  6789. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6790. diff = nodeIndex && cache[ 2 ];
  6791. node = nodeIndex && parent.childNodes[ nodeIndex ];
  6792. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  6793. // Fallback to seeking `elem` from the start
  6794. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  6795. // When found, cache indexes on `parent` and break
  6796. if ( node.nodeType === 1 && ++diff && node === elem ) {
  6797. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  6798. break;
  6799. }
  6800. }
  6801. } else {
  6802. // Use previously-cached element index if available
  6803. if ( useCache ) {
  6804. // ...in a gzip-friendly way
  6805. node = elem;
  6806. outerCache = node[ expando ] || ( node[ expando ] = {} );
  6807. // Support: IE <9 only
  6808. // Defend against cloned attroperties (jQuery gh-1709)
  6809. uniqueCache = outerCache[ node.uniqueID ] ||
  6810. ( outerCache[ node.uniqueID ] = {} );
  6811. cache = uniqueCache[ type ] || [];
  6812. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6813. diff = nodeIndex;
  6814. }
  6815. // xml :nth-child(...)
  6816. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  6817. if ( diff === false ) {
  6818. // Use the same loop as above to seek `elem` from the start
  6819. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  6820. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  6821. if ( ( ofType ?
  6822. node.nodeName.toLowerCase() === name :
  6823. node.nodeType === 1 ) &&
  6824. ++diff ) {
  6825. // Cache the index of each encountered element
  6826. if ( useCache ) {
  6827. outerCache = node[ expando ] ||
  6828. ( node[ expando ] = {} );
  6829. // Support: IE <9 only
  6830. // Defend against cloned attroperties (jQuery gh-1709)
  6831. uniqueCache = outerCache[ node.uniqueID ] ||
  6832. ( outerCache[ node.uniqueID ] = {} );
  6833. uniqueCache[ type ] = [ dirruns, diff ];
  6834. }
  6835. if ( node === elem ) {
  6836. break;
  6837. }
  6838. }
  6839. }
  6840. }
  6841. }
  6842. // Incorporate the offset, then check against cycle size
  6843. diff -= last;
  6844. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  6845. }
  6846. };
  6847. },
  6848. "PSEUDO": function( pseudo, argument ) {
  6849. // pseudo-class names are case-insensitive
  6850. // http://www.w3.org/TR/selectors/#pseudo-classes
  6851. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  6852. // Remember that setFilters inherits from pseudos
  6853. var args,
  6854. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  6855. Sizzle.error( "unsupported pseudo: " + pseudo );
  6856. // The user may use createPseudo to indicate that
  6857. // arguments are needed to create the filter function
  6858. // just as Sizzle does
  6859. if ( fn[ expando ] ) {
  6860. return fn( argument );
  6861. }
  6862. // But maintain support for old signatures
  6863. if ( fn.length > 1 ) {
  6864. args = [ pseudo, pseudo, "", argument ];
  6865. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  6866. markFunction( function( seed, matches ) {
  6867. var idx,
  6868. matched = fn( seed, argument ),
  6869. i = matched.length;
  6870. while ( i-- ) {
  6871. idx = indexOf( seed, matched[ i ] );
  6872. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  6873. }
  6874. } ) :
  6875. function( elem ) {
  6876. return fn( elem, 0, args );
  6877. };
  6878. }
  6879. return fn;
  6880. }
  6881. },
  6882. pseudos: {
  6883. // Potentially complex pseudos
  6884. "not": markFunction( function( selector ) {
  6885. // Trim the selector passed to compile
  6886. // to avoid treating leading and trailing
  6887. // spaces as combinators
  6888. var input = [],
  6889. results = [],
  6890. matcher = compile( selector.replace( rtrim, "$1" ) );
  6891. return matcher[ expando ] ?
  6892. markFunction( function( seed, matches, _context, xml ) {
  6893. var elem,
  6894. unmatched = matcher( seed, null, xml, [] ),
  6895. i = seed.length;
  6896. // Match elements unmatched by `matcher`
  6897. while ( i-- ) {
  6898. if ( ( elem = unmatched[ i ] ) ) {
  6899. seed[ i ] = !( matches[ i ] = elem );
  6900. }
  6901. }
  6902. } ) :
  6903. function( elem, _context, xml ) {
  6904. input[ 0 ] = elem;
  6905. matcher( input, null, xml, results );
  6906. // Don't keep the element (issue #299)
  6907. input[ 0 ] = null;
  6908. return !results.pop();
  6909. };
  6910. } ),
  6911. "has": markFunction( function( selector ) {
  6912. return function( elem ) {
  6913. return Sizzle( selector, elem ).length > 0;
  6914. };
  6915. } ),
  6916. "contains": markFunction( function( text ) {
  6917. text = text.replace( runescape, funescape );
  6918. return function( elem ) {
  6919. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  6920. };
  6921. } ),
  6922. // "Whether an element is represented by a :lang() selector
  6923. // is based solely on the element's language value
  6924. // being equal to the identifier C,
  6925. // or beginning with the identifier C immediately followed by "-".
  6926. // The matching of C against the element's language value is performed case-insensitively.
  6927. // The identifier C does not have to be a valid language name."
  6928. // http://www.w3.org/TR/selectors/#lang-pseudo
  6929. "lang": markFunction( function( lang ) {
  6930. // lang value must be a valid identifier
  6931. if ( !ridentifier.test( lang || "" ) ) {
  6932. Sizzle.error( "unsupported lang: " + lang );
  6933. }
  6934. lang = lang.replace( runescape, funescape ).toLowerCase();
  6935. return function( elem ) {
  6936. var elemLang;
  6937. do {
  6938. if ( ( elemLang = documentIsHTML ?
  6939. elem.lang :
  6940. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  6941. elemLang = elemLang.toLowerCase();
  6942. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  6943. }
  6944. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  6945. return false;
  6946. };
  6947. } ),
  6948. // Miscellaneous
  6949. "target": function( elem ) {
  6950. var hash = window.location && window.location.hash;
  6951. return hash && hash.slice( 1 ) === elem.id;
  6952. },
  6953. "root": function( elem ) {
  6954. return elem === docElem;
  6955. },
  6956. "focus": function( elem ) {
  6957. return elem === document.activeElement &&
  6958. ( !document.hasFocus || document.hasFocus() ) &&
  6959. !!( elem.type || elem.href || ~elem.tabIndex );
  6960. },
  6961. // Boolean properties
  6962. "enabled": createDisabledPseudo( false ),
  6963. "disabled": createDisabledPseudo( true ),
  6964. "checked": function( elem ) {
  6965. // In CSS3, :checked should return both checked and selected elements
  6966. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6967. var nodeName = elem.nodeName.toLowerCase();
  6968. return ( nodeName === "input" && !!elem.checked ) ||
  6969. ( nodeName === "option" && !!elem.selected );
  6970. },
  6971. "selected": function( elem ) {
  6972. // Accessing this property makes selected-by-default
  6973. // options in Safari work properly
  6974. if ( elem.parentNode ) {
  6975. // eslint-disable-next-line no-unused-expressions
  6976. elem.parentNode.selectedIndex;
  6977. }
  6978. return elem.selected === true;
  6979. },
  6980. // Contents
  6981. "empty": function( elem ) {
  6982. // http://www.w3.org/TR/selectors/#empty-pseudo
  6983. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  6984. // but not by others (comment: 8; processing instruction: 7; etc.)
  6985. // nodeType < 6 works because attributes (2) do not appear as children
  6986. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6987. if ( elem.nodeType < 6 ) {
  6988. return false;
  6989. }
  6990. }
  6991. return true;
  6992. },
  6993. "parent": function( elem ) {
  6994. return !Expr.pseudos[ "empty" ]( elem );
  6995. },
  6996. // Element/input types
  6997. "header": function( elem ) {
  6998. return rheader.test( elem.nodeName );
  6999. },
  7000. "input": function( elem ) {
  7001. return rinputs.test( elem.nodeName );
  7002. },
  7003. "button": function( elem ) {
  7004. var name = elem.nodeName.toLowerCase();
  7005. return name === "input" && elem.type === "button" || name === "button";
  7006. },
  7007. "text": function( elem ) {
  7008. var attr;
  7009. return elem.nodeName.toLowerCase() === "input" &&
  7010. elem.type === "text" &&
  7011. // Support: IE<8
  7012. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  7013. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  7014. attr.toLowerCase() === "text" );
  7015. },
  7016. // Position-in-collection
  7017. "first": createPositionalPseudo( function() {
  7018. return [ 0 ];
  7019. } ),
  7020. "last": createPositionalPseudo( function( _matchIndexes, length ) {
  7021. return [ length - 1 ];
  7022. } ),
  7023. "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
  7024. return [ argument < 0 ? argument + length : argument ];
  7025. } ),
  7026. "even": createPositionalPseudo( function( matchIndexes, length ) {
  7027. var i = 0;
  7028. for ( ; i < length; i += 2 ) {
  7029. matchIndexes.push( i );
  7030. }
  7031. return matchIndexes;
  7032. } ),
  7033. "odd": createPositionalPseudo( function( matchIndexes, length ) {
  7034. var i = 1;
  7035. for ( ; i < length; i += 2 ) {
  7036. matchIndexes.push( i );
  7037. }
  7038. return matchIndexes;
  7039. } ),
  7040. "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  7041. var i = argument < 0 ?
  7042. argument + length :
  7043. argument > length ?
  7044. length :
  7045. argument;
  7046. for ( ; --i >= 0; ) {
  7047. matchIndexes.push( i );
  7048. }
  7049. return matchIndexes;
  7050. } ),
  7051. "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  7052. var i = argument < 0 ? argument + length : argument;
  7053. for ( ; ++i < length; ) {
  7054. matchIndexes.push( i );
  7055. }
  7056. return matchIndexes;
  7057. } )
  7058. }
  7059. };
  7060. Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
  7061. // Add button/input type pseudos
  7062. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  7063. Expr.pseudos[ i ] = createInputPseudo( i );
  7064. }
  7065. for ( i in { submit: true, reset: true } ) {
  7066. Expr.pseudos[ i ] = createButtonPseudo( i );
  7067. }
  7068. // Easy API for creating new setFilters
  7069. function setFilters() {}
  7070. setFilters.prototype = Expr.filters = Expr.pseudos;
  7071. Expr.setFilters = new setFilters();
  7072. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  7073. var matched, match, tokens, type,
  7074. soFar, groups, preFilters,
  7075. cached = tokenCache[ selector + " " ];
  7076. if ( cached ) {
  7077. return parseOnly ? 0 : cached.slice( 0 );
  7078. }
  7079. soFar = selector;
  7080. groups = [];
  7081. preFilters = Expr.preFilter;
  7082. while ( soFar ) {
  7083. // Comma and first run
  7084. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  7085. if ( match ) {
  7086. // Don't consume trailing commas as valid
  7087. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  7088. }
  7089. groups.push( ( tokens = [] ) );
  7090. }
  7091. matched = false;
  7092. // Combinators
  7093. if ( ( match = rcombinators.exec( soFar ) ) ) {
  7094. matched = match.shift();
  7095. tokens.push( {
  7096. value: matched,
  7097. // Cast descendant combinators to space
  7098. type: match[ 0 ].replace( rtrim, " " )
  7099. } );
  7100. soFar = soFar.slice( matched.length );
  7101. }
  7102. // Filters
  7103. for ( type in Expr.filter ) {
  7104. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  7105. ( match = preFilters[ type ]( match ) ) ) ) {
  7106. matched = match.shift();
  7107. tokens.push( {
  7108. value: matched,
  7109. type: type,
  7110. matches: match
  7111. } );
  7112. soFar = soFar.slice( matched.length );
  7113. }
  7114. }
  7115. if ( !matched ) {
  7116. break;
  7117. }
  7118. }
  7119. // Return the length of the invalid excess
  7120. // if we're just parsing
  7121. // Otherwise, throw an error or return tokens
  7122. return parseOnly ?
  7123. soFar.length :
  7124. soFar ?
  7125. Sizzle.error( selector ) :
  7126. // Cache the tokens
  7127. tokenCache( selector, groups ).slice( 0 );
  7128. };
  7129. function toSelector( tokens ) {
  7130. var i = 0,
  7131. len = tokens.length,
  7132. selector = "";
  7133. for ( ; i < len; i++ ) {
  7134. selector += tokens[ i ].value;
  7135. }
  7136. return selector;
  7137. }
  7138. function addCombinator( matcher, combinator, base ) {
  7139. var dir = combinator.dir,
  7140. skip = combinator.next,
  7141. key = skip || dir,
  7142. checkNonElements = base && key === "parentNode",
  7143. doneName = done++;
  7144. return combinator.first ?
  7145. // Check against closest ancestor/preceding element
  7146. function( elem, context, xml ) {
  7147. while ( ( elem = elem[ dir ] ) ) {
  7148. if ( elem.nodeType === 1 || checkNonElements ) {
  7149. return matcher( elem, context, xml );
  7150. }
  7151. }
  7152. return false;
  7153. } :
  7154. // Check against all ancestor/preceding elements
  7155. function( elem, context, xml ) {
  7156. var oldCache, uniqueCache, outerCache,
  7157. newCache = [ dirruns, doneName ];
  7158. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  7159. if ( xml ) {
  7160. while ( ( elem = elem[ dir ] ) ) {
  7161. if ( elem.nodeType === 1 || checkNonElements ) {
  7162. if ( matcher( elem, context, xml ) ) {
  7163. return true;
  7164. }
  7165. }
  7166. }
  7167. } else {
  7168. while ( ( elem = elem[ dir ] ) ) {
  7169. if ( elem.nodeType === 1 || checkNonElements ) {
  7170. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  7171. // Support: IE <9 only
  7172. // Defend against cloned attroperties (jQuery gh-1709)
  7173. uniqueCache = outerCache[ elem.uniqueID ] ||
  7174. ( outerCache[ elem.uniqueID ] = {} );
  7175. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  7176. elem = elem[ dir ] || elem;
  7177. } else if ( ( oldCache = uniqueCache[ key ] ) &&
  7178. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  7179. // Assign to newCache so results back-propagate to previous elements
  7180. return ( newCache[ 2 ] = oldCache[ 2 ] );
  7181. } else {
  7182. // Reuse newcache so results back-propagate to previous elements
  7183. uniqueCache[ key ] = newCache;
  7184. // A match means we're done; a fail means we have to keep checking
  7185. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  7186. return true;
  7187. }
  7188. }
  7189. }
  7190. }
  7191. }
  7192. return false;
  7193. };
  7194. }
  7195. function elementMatcher( matchers ) {
  7196. return matchers.length > 1 ?
  7197. function( elem, context, xml ) {
  7198. var i = matchers.length;
  7199. while ( i-- ) {
  7200. if ( !matchers[ i ]( elem, context, xml ) ) {
  7201. return false;
  7202. }
  7203. }
  7204. return true;
  7205. } :
  7206. matchers[ 0 ];
  7207. }
  7208. function multipleContexts( selector, contexts, results ) {
  7209. var i = 0,
  7210. len = contexts.length;
  7211. for ( ; i < len; i++ ) {
  7212. Sizzle( selector, contexts[ i ], results );
  7213. }
  7214. return results;
  7215. }
  7216. function condense( unmatched, map, filter, context, xml ) {
  7217. var elem,
  7218. newUnmatched = [],
  7219. i = 0,
  7220. len = unmatched.length,
  7221. mapped = map != null;
  7222. for ( ; i < len; i++ ) {
  7223. if ( ( elem = unmatched[ i ] ) ) {
  7224. if ( !filter || filter( elem, context, xml ) ) {
  7225. newUnmatched.push( elem );
  7226. if ( mapped ) {
  7227. map.push( i );
  7228. }
  7229. }
  7230. }
  7231. }
  7232. return newUnmatched;
  7233. }
  7234. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  7235. if ( postFilter && !postFilter[ expando ] ) {
  7236. postFilter = setMatcher( postFilter );
  7237. }
  7238. if ( postFinder && !postFinder[ expando ] ) {
  7239. postFinder = setMatcher( postFinder, postSelector );
  7240. }
  7241. return markFunction( function( seed, results, context, xml ) {
  7242. var temp, i, elem,
  7243. preMap = [],
  7244. postMap = [],
  7245. preexisting = results.length,
  7246. // Get initial elements from seed or context
  7247. elems = seed || multipleContexts(
  7248. selector || "*",
  7249. context.nodeType ? [ context ] : context,
  7250. []
  7251. ),
  7252. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  7253. matcherIn = preFilter && ( seed || !selector ) ?
  7254. condense( elems, preMap, preFilter, context, xml ) :
  7255. elems,
  7256. matcherOut = matcher ?
  7257. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  7258. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  7259. // ...intermediate processing is necessary
  7260. [] :
  7261. // ...otherwise use results directly
  7262. results :
  7263. matcherIn;
  7264. // Find primary matches
  7265. if ( matcher ) {
  7266. matcher( matcherIn, matcherOut, context, xml );
  7267. }
  7268. // Apply postFilter
  7269. if ( postFilter ) {
  7270. temp = condense( matcherOut, postMap );
  7271. postFilter( temp, [], context, xml );
  7272. // Un-match failing elements by moving them back to matcherIn
  7273. i = temp.length;
  7274. while ( i-- ) {
  7275. if ( ( elem = temp[ i ] ) ) {
  7276. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  7277. }
  7278. }
  7279. }
  7280. if ( seed ) {
  7281. if ( postFinder || preFilter ) {
  7282. if ( postFinder ) {
  7283. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  7284. temp = [];
  7285. i = matcherOut.length;
  7286. while ( i-- ) {
  7287. if ( ( elem = matcherOut[ i ] ) ) {
  7288. // Restore matcherIn since elem is not yet a final match
  7289. temp.push( ( matcherIn[ i ] = elem ) );
  7290. }
  7291. }
  7292. postFinder( null, ( matcherOut = [] ), temp, xml );
  7293. }
  7294. // Move matched elements from seed to results to keep them synchronized
  7295. i = matcherOut.length;
  7296. while ( i-- ) {
  7297. if ( ( elem = matcherOut[ i ] ) &&
  7298. ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
  7299. seed[ temp ] = !( results[ temp ] = elem );
  7300. }
  7301. }
  7302. }
  7303. // Add elements to results, through postFinder if defined
  7304. } else {
  7305. matcherOut = condense(
  7306. matcherOut === results ?
  7307. matcherOut.splice( preexisting, matcherOut.length ) :
  7308. matcherOut
  7309. );
  7310. if ( postFinder ) {
  7311. postFinder( null, results, matcherOut, xml );
  7312. } else {
  7313. push.apply( results, matcherOut );
  7314. }
  7315. }
  7316. } );
  7317. }
  7318. function matcherFromTokens( tokens ) {
  7319. var checkContext, matcher, j,
  7320. len = tokens.length,
  7321. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  7322. implicitRelative = leadingRelative || Expr.relative[ " " ],
  7323. i = leadingRelative ? 1 : 0,
  7324. // The foundational matcher ensures that elements are reachable from top-level context(s)
  7325. matchContext = addCombinator( function( elem ) {
  7326. return elem === checkContext;
  7327. }, implicitRelative, true ),
  7328. matchAnyContext = addCombinator( function( elem ) {
  7329. return indexOf( checkContext, elem ) > -1;
  7330. }, implicitRelative, true ),
  7331. matchers = [ function( elem, context, xml ) {
  7332. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  7333. ( checkContext = context ).nodeType ?
  7334. matchContext( elem, context, xml ) :
  7335. matchAnyContext( elem, context, xml ) );
  7336. // Avoid hanging onto element (issue #299)
  7337. checkContext = null;
  7338. return ret;
  7339. } ];
  7340. for ( ; i < len; i++ ) {
  7341. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  7342. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  7343. } else {
  7344. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  7345. // Return special upon seeing a positional matcher
  7346. if ( matcher[ expando ] ) {
  7347. // Find the next relative operator (if any) for proper handling
  7348. j = ++i;
  7349. for ( ; j < len; j++ ) {
  7350. if ( Expr.relative[ tokens[ j ].type ] ) {
  7351. break;
  7352. }
  7353. }
  7354. return setMatcher(
  7355. i > 1 && elementMatcher( matchers ),
  7356. i > 1 && toSelector(
  7357. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  7358. tokens
  7359. .slice( 0, i - 1 )
  7360. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  7361. ).replace( rtrim, "$1" ),
  7362. matcher,
  7363. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  7364. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  7365. j < len && toSelector( tokens )
  7366. );
  7367. }
  7368. matchers.push( matcher );
  7369. }
  7370. }
  7371. return elementMatcher( matchers );
  7372. }
  7373. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  7374. var bySet = setMatchers.length > 0,
  7375. byElement = elementMatchers.length > 0,
  7376. superMatcher = function( seed, context, xml, results, outermost ) {
  7377. var elem, j, matcher,
  7378. matchedCount = 0,
  7379. i = "0",
  7380. unmatched = seed && [],
  7381. setMatched = [],
  7382. contextBackup = outermostContext,
  7383. // We must always have either seed elements or outermost context
  7384. elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
  7385. // Use integer dirruns iff this is the outermost matcher
  7386. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  7387. len = elems.length;
  7388. if ( outermost ) {
  7389. // Support: IE 11+, Edge 17 - 18+
  7390. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  7391. // two documents; shallow comparisons work.
  7392. // eslint-disable-next-line eqeqeq
  7393. outermostContext = context == document || context || outermost;
  7394. }
  7395. // Add elements passing elementMatchers directly to results
  7396. // Support: IE<9, Safari
  7397. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  7398. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  7399. if ( byElement && elem ) {
  7400. j = 0;
  7401. // Support: IE 11+, Edge 17 - 18+
  7402. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  7403. // two documents; shallow comparisons work.
  7404. // eslint-disable-next-line eqeqeq
  7405. if ( !context && elem.ownerDocument != document ) {
  7406. setDocument( elem );
  7407. xml = !documentIsHTML;
  7408. }
  7409. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  7410. if ( matcher( elem, context || document, xml ) ) {
  7411. results.push( elem );
  7412. break;
  7413. }
  7414. }
  7415. if ( outermost ) {
  7416. dirruns = dirrunsUnique;
  7417. }
  7418. }
  7419. // Track unmatched elements for set filters
  7420. if ( bySet ) {
  7421. // They will have gone through all possible matchers
  7422. if ( ( elem = !matcher && elem ) ) {
  7423. matchedCount--;
  7424. }
  7425. // Lengthen the array for every element, matched or not
  7426. if ( seed ) {
  7427. unmatched.push( elem );
  7428. }
  7429. }
  7430. }
  7431. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  7432. // makes the latter nonnegative.
  7433. matchedCount += i;
  7434. // Apply set filters to unmatched elements
  7435. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  7436. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  7437. // no element matchers and no seed.
  7438. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  7439. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  7440. // numerically zero.
  7441. if ( bySet && i !== matchedCount ) {
  7442. j = 0;
  7443. while ( ( matcher = setMatchers[ j++ ] ) ) {
  7444. matcher( unmatched, setMatched, context, xml );
  7445. }
  7446. if ( seed ) {
  7447. // Reintegrate element matches to eliminate the need for sorting
  7448. if ( matchedCount > 0 ) {
  7449. while ( i-- ) {
  7450. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  7451. setMatched[ i ] = pop.call( results );
  7452. }
  7453. }
  7454. }
  7455. // Discard index placeholder values to get only actual matches
  7456. setMatched = condense( setMatched );
  7457. }
  7458. // Add matches to results
  7459. push.apply( results, setMatched );
  7460. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  7461. if ( outermost && !seed && setMatched.length > 0 &&
  7462. ( matchedCount + setMatchers.length ) > 1 ) {
  7463. Sizzle.uniqueSort( results );
  7464. }
  7465. }
  7466. // Override manipulation of globals by nested matchers
  7467. if ( outermost ) {
  7468. dirruns = dirrunsUnique;
  7469. outermostContext = contextBackup;
  7470. }
  7471. return unmatched;
  7472. };
  7473. return bySet ?
  7474. markFunction( superMatcher ) :
  7475. superMatcher;
  7476. }
  7477. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  7478. var i,
  7479. setMatchers = [],
  7480. elementMatchers = [],
  7481. cached = compilerCache[ selector + " " ];
  7482. if ( !cached ) {
  7483. // Generate a function of recursive functions that can be used to check each element
  7484. if ( !match ) {
  7485. match = tokenize( selector );
  7486. }
  7487. i = match.length;
  7488. while ( i-- ) {
  7489. cached = matcherFromTokens( match[ i ] );
  7490. if ( cached[ expando ] ) {
  7491. setMatchers.push( cached );
  7492. } else {
  7493. elementMatchers.push( cached );
  7494. }
  7495. }
  7496. // Cache the compiled function
  7497. cached = compilerCache(
  7498. selector,
  7499. matcherFromGroupMatchers( elementMatchers, setMatchers )
  7500. );
  7501. // Save selector and tokenization
  7502. cached.selector = selector;
  7503. }
  7504. return cached;
  7505. };
  7506. /**
  7507. * A low-level selection function that works with Sizzle's compiled
  7508. * selector functions
  7509. * @param {String|Function} selector A selector or a pre-compiled
  7510. * selector function built with Sizzle.compile
  7511. * @param {Element} context
  7512. * @param {Array} [results]
  7513. * @param {Array} [seed] A set of elements to match against
  7514. */
  7515. select = Sizzle.select = function( selector, context, results, seed ) {
  7516. var i, tokens, token, type, find,
  7517. compiled = typeof selector === "function" && selector,
  7518. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  7519. results = results || [];
  7520. // Try to minimize operations if there is only one selector in the list and no seed
  7521. // (the latter of which guarantees us context)
  7522. if ( match.length === 1 ) {
  7523. // Reduce context if the leading compound selector is an ID
  7524. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  7525. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  7526. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  7527. context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
  7528. .replace( runescape, funescape ), context ) || [] )[ 0 ];
  7529. if ( !context ) {
  7530. return results;
  7531. // Precompiled matchers will still verify ancestry, so step up a level
  7532. } else if ( compiled ) {
  7533. context = context.parentNode;
  7534. }
  7535. selector = selector.slice( tokens.shift().value.length );
  7536. }
  7537. // Fetch a seed set for right-to-left matching
  7538. i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
  7539. while ( i-- ) {
  7540. token = tokens[ i ];
  7541. // Abort if we hit a combinator
  7542. if ( Expr.relative[ ( type = token.type ) ] ) {
  7543. break;
  7544. }
  7545. if ( ( find = Expr.find[ type ] ) ) {
  7546. // Search, expanding context for leading sibling combinators
  7547. if ( ( seed = find(
  7548. token.matches[ 0 ].replace( runescape, funescape ),
  7549. rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
  7550. context
  7551. ) ) ) {
  7552. // If seed is empty or no tokens remain, we can return early
  7553. tokens.splice( i, 1 );
  7554. selector = seed.length && toSelector( tokens );
  7555. if ( !selector ) {
  7556. push.apply( results, seed );
  7557. return results;
  7558. }
  7559. break;
  7560. }
  7561. }
  7562. }
  7563. }
  7564. // Compile and execute a filtering function if one is not provided
  7565. // Provide `match` to avoid retokenization if we modified the selector above
  7566. ( compiled || compile( selector, match ) )(
  7567. seed,
  7568. context,
  7569. !documentIsHTML,
  7570. results,
  7571. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  7572. );
  7573. return results;
  7574. };
  7575. // One-time assignments
  7576. // Sort stability
  7577. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  7578. // Support: Chrome 14-35+
  7579. // Always assume duplicates if they aren't passed to the comparison function
  7580. support.detectDuplicates = !!hasDuplicate;
  7581. // Initialize against the default document
  7582. setDocument();
  7583. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  7584. // Detached nodes confoundingly follow *each other*
  7585. support.sortDetached = assert( function( el ) {
  7586. // Should return 1, but returns 4 (following)
  7587. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  7588. } );
  7589. // Support: IE<8
  7590. // Prevent attribute/property "interpolation"
  7591. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7592. if ( !assert( function( el ) {
  7593. el.innerHTML = "<a href='#'></a>";
  7594. return el.firstChild.getAttribute( "href" ) === "#";
  7595. } ) ) {
  7596. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  7597. if ( !isXML ) {
  7598. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  7599. }
  7600. } );
  7601. }
  7602. // Support: IE<9
  7603. // Use defaultValue in place of getAttribute("value")
  7604. if ( !support.attributes || !assert( function( el ) {
  7605. el.innerHTML = "<input/>";
  7606. el.firstChild.setAttribute( "value", "" );
  7607. return el.firstChild.getAttribute( "value" ) === "";
  7608. } ) ) {
  7609. addHandle( "value", function( elem, _name, isXML ) {
  7610. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  7611. return elem.defaultValue;
  7612. }
  7613. } );
  7614. }
  7615. // Support: IE<9
  7616. // Use getAttributeNode to fetch booleans when getAttribute lies
  7617. if ( !assert( function( el ) {
  7618. return el.getAttribute( "disabled" ) == null;
  7619. } ) ) {
  7620. addHandle( booleans, function( elem, name, isXML ) {
  7621. var val;
  7622. if ( !isXML ) {
  7623. return elem[ name ] === true ? name.toLowerCase() :
  7624. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  7625. val.value :
  7626. null;
  7627. }
  7628. } );
  7629. }
  7630. return Sizzle;
  7631. } )( window );
  7632. jQuery.find = Sizzle;
  7633. jQuery.expr = Sizzle.selectors;
  7634. // Deprecated
  7635. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  7636. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  7637. jQuery.text = Sizzle.getText;
  7638. jQuery.isXMLDoc = Sizzle.isXML;
  7639. jQuery.contains = Sizzle.contains;
  7640. jQuery.escapeSelector = Sizzle.escape;
  7641. var dir = function( elem, dir, until ) {
  7642. var matched = [],
  7643. truncate = until !== undefined;
  7644. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  7645. if ( elem.nodeType === 1 ) {
  7646. if ( truncate && jQuery( elem ).is( until ) ) {
  7647. break;
  7648. }
  7649. matched.push( elem );
  7650. }
  7651. }
  7652. return matched;
  7653. };
  7654. var siblings = function( n, elem ) {
  7655. var matched = [];
  7656. for ( ; n; n = n.nextSibling ) {
  7657. if ( n.nodeType === 1 && n !== elem ) {
  7658. matched.push( n );
  7659. }
  7660. }
  7661. return matched;
  7662. };
  7663. var rneedsContext = jQuery.expr.match.needsContext;
  7664. function nodeName( elem, name ) {
  7665. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  7666. };
  7667. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  7668. // Implement the identical functionality for filter and not
  7669. function winnow( elements, qualifier, not ) {
  7670. if ( isFunction( qualifier ) ) {
  7671. return jQuery.grep( elements, function( elem, i ) {
  7672. return !!qualifier.call( elem, i, elem ) !== not;
  7673. } );
  7674. }
  7675. // Single element
  7676. if ( qualifier.nodeType ) {
  7677. return jQuery.grep( elements, function( elem ) {
  7678. return ( elem === qualifier ) !== not;
  7679. } );
  7680. }
  7681. // Arraylike of elements (jQuery, arguments, Array)
  7682. if ( typeof qualifier !== "string" ) {
  7683. return jQuery.grep( elements, function( elem ) {
  7684. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  7685. } );
  7686. }
  7687. // Filtered directly for both simple and complex selectors
  7688. return jQuery.filter( qualifier, elements, not );
  7689. }
  7690. jQuery.filter = function( expr, elems, not ) {
  7691. var elem = elems[ 0 ];
  7692. if ( not ) {
  7693. expr = ":not(" + expr + ")";
  7694. }
  7695. if ( elems.length === 1 && elem.nodeType === 1 ) {
  7696. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  7697. }
  7698. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  7699. return elem.nodeType === 1;
  7700. } ) );
  7701. };
  7702. jQuery.fn.extend( {
  7703. find: function( selector ) {
  7704. var i, ret,
  7705. len = this.length,
  7706. self = this;
  7707. if ( typeof selector !== "string" ) {
  7708. return this.pushStack( jQuery( selector ).filter( function() {
  7709. for ( i = 0; i < len; i++ ) {
  7710. if ( jQuery.contains( self[ i ], this ) ) {
  7711. return true;
  7712. }
  7713. }
  7714. } ) );
  7715. }
  7716. ret = this.pushStack( [] );
  7717. for ( i = 0; i < len; i++ ) {
  7718. jQuery.find( selector, self[ i ], ret );
  7719. }
  7720. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  7721. },
  7722. filter: function( selector ) {
  7723. return this.pushStack( winnow( this, selector || [], false ) );
  7724. },
  7725. not: function( selector ) {
  7726. return this.pushStack( winnow( this, selector || [], true ) );
  7727. },
  7728. is: function( selector ) {
  7729. return !!winnow(
  7730. this,
  7731. // If this is a positional/relative selector, check membership in the returned set
  7732. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  7733. typeof selector === "string" && rneedsContext.test( selector ) ?
  7734. jQuery( selector ) :
  7735. selector || [],
  7736. false
  7737. ).length;
  7738. }
  7739. } );
  7740. // Initialize a jQuery object
  7741. // A central reference to the root jQuery(document)
  7742. var rootjQuery,
  7743. // A simple way to check for HTML strings
  7744. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  7745. // Strict HTML recognition (#11290: must start with <)
  7746. // Shortcut simple #id case for speed
  7747. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  7748. init = jQuery.fn.init = function( selector, context, root ) {
  7749. var match, elem;
  7750. // HANDLE: $(""), $(null), $(undefined), $(false)
  7751. if ( !selector ) {
  7752. return this;
  7753. }
  7754. // Method init() accepts an alternate rootjQuery
  7755. // so migrate can support jQuery.sub (gh-2101)
  7756. root = root || rootjQuery;
  7757. // Handle HTML strings
  7758. if ( typeof selector === "string" ) {
  7759. if ( selector[ 0 ] === "<" &&
  7760. selector[ selector.length - 1 ] === ">" &&
  7761. selector.length >= 3 ) {
  7762. // Assume that strings that start and end with <> are HTML and skip the regex check
  7763. match = [ null, selector, null ];
  7764. } else {
  7765. match = rquickExpr.exec( selector );
  7766. }
  7767. // Match html or make sure no context is specified for #id
  7768. if ( match && ( match[ 1 ] || !context ) ) {
  7769. // HANDLE: $(html) -> $(array)
  7770. if ( match[ 1 ] ) {
  7771. context = context instanceof jQuery ? context[ 0 ] : context;
  7772. // Option to run scripts is true for back-compat
  7773. // Intentionally let the error be thrown if parseHTML is not present
  7774. jQuery.merge( this, jQuery.parseHTML(
  7775. match[ 1 ],
  7776. context && context.nodeType ? context.ownerDocument || context : document,
  7777. true
  7778. ) );
  7779. // HANDLE: $(html, props)
  7780. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  7781. for ( match in context ) {
  7782. // Properties of context are called as methods if possible
  7783. if ( isFunction( this[ match ] ) ) {
  7784. this[ match ]( context[ match ] );
  7785. // ...and otherwise set as attributes
  7786. } else {
  7787. this.attr( match, context[ match ] );
  7788. }
  7789. }
  7790. }
  7791. return this;
  7792. // HANDLE: $(#id)
  7793. } else {
  7794. elem = document.getElementById( match[ 2 ] );
  7795. if ( elem ) {
  7796. // Inject the element directly into the jQuery object
  7797. this[ 0 ] = elem;
  7798. this.length = 1;
  7799. }
  7800. return this;
  7801. }
  7802. // HANDLE: $(expr, $(...))
  7803. } else if ( !context || context.jquery ) {
  7804. return ( context || root ).find( selector );
  7805. // HANDLE: $(expr, context)
  7806. // (which is just equivalent to: $(context).find(expr)
  7807. } else {
  7808. return this.constructor( context ).find( selector );
  7809. }
  7810. // HANDLE: $(DOMElement)
  7811. } else if ( selector.nodeType ) {
  7812. this[ 0 ] = selector;
  7813. this.length = 1;
  7814. return this;
  7815. // HANDLE: $(function)
  7816. // Shortcut for document ready
  7817. } else if ( isFunction( selector ) ) {
  7818. return root.ready !== undefined ?
  7819. root.ready( selector ) :
  7820. // Execute immediately if ready is not present
  7821. selector( jQuery );
  7822. }
  7823. return jQuery.makeArray( selector, this );
  7824. };
  7825. // Give the init function the jQuery prototype for later instantiation
  7826. init.prototype = jQuery.fn;
  7827. // Initialize central reference
  7828. rootjQuery = jQuery( document );
  7829. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  7830. // Methods guaranteed to produce a unique set when starting from a unique set
  7831. guaranteedUnique = {
  7832. children: true,
  7833. contents: true,
  7834. next: true,
  7835. prev: true
  7836. };
  7837. jQuery.fn.extend( {
  7838. has: function( target ) {
  7839. var targets = jQuery( target, this ),
  7840. l = targets.length;
  7841. return this.filter( function() {
  7842. var i = 0;
  7843. for ( ; i < l; i++ ) {
  7844. if ( jQuery.contains( this, targets[ i ] ) ) {
  7845. return true;
  7846. }
  7847. }
  7848. } );
  7849. },
  7850. closest: function( selectors, context ) {
  7851. var cur,
  7852. i = 0,
  7853. l = this.length,
  7854. matched = [],
  7855. targets = typeof selectors !== "string" && jQuery( selectors );
  7856. // Positional selectors never match, since there's no _selection_ context
  7857. if ( !rneedsContext.test( selectors ) ) {
  7858. for ( ; i < l; i++ ) {
  7859. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  7860. // Always skip document fragments
  7861. if ( cur.nodeType < 11 && ( targets ?
  7862. targets.index( cur ) > -1 :
  7863. // Don't pass non-elements to Sizzle
  7864. cur.nodeType === 1 &&
  7865. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  7866. matched.push( cur );
  7867. break;
  7868. }
  7869. }
  7870. }
  7871. }
  7872. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  7873. },
  7874. // Determine the position of an element within the set
  7875. index: function( elem ) {
  7876. // No argument, return index in parent
  7877. if ( !elem ) {
  7878. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  7879. }
  7880. // Index in selector
  7881. if ( typeof elem === "string" ) {
  7882. return indexOf.call( jQuery( elem ), this[ 0 ] );
  7883. }
  7884. // Locate the position of the desired element
  7885. return indexOf.call( this,
  7886. // If it receives a jQuery object, the first element is used
  7887. elem.jquery ? elem[ 0 ] : elem
  7888. );
  7889. },
  7890. add: function( selector, context ) {
  7891. return this.pushStack(
  7892. jQuery.uniqueSort(
  7893. jQuery.merge( this.get(), jQuery( selector, context ) )
  7894. )
  7895. );
  7896. },
  7897. addBack: function( selector ) {
  7898. return this.add( selector == null ?
  7899. this.prevObject : this.prevObject.filter( selector )
  7900. );
  7901. }
  7902. } );
  7903. function sibling( cur, dir ) {
  7904. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  7905. return cur;
  7906. }
  7907. jQuery.each( {
  7908. parent: function( elem ) {
  7909. var parent = elem.parentNode;
  7910. return parent && parent.nodeType !== 11 ? parent : null;
  7911. },
  7912. parents: function( elem ) {
  7913. return dir( elem, "parentNode" );
  7914. },
  7915. parentsUntil: function( elem, _i, until ) {
  7916. return dir( elem, "parentNode", until );
  7917. },
  7918. next: function( elem ) {
  7919. return sibling( elem, "nextSibling" );
  7920. },
  7921. prev: function( elem ) {
  7922. return sibling( elem, "previousSibling" );
  7923. },
  7924. nextAll: function( elem ) {
  7925. return dir( elem, "nextSibling" );
  7926. },
  7927. prevAll: function( elem ) {
  7928. return dir( elem, "previousSibling" );
  7929. },
  7930. nextUntil: function( elem, _i, until ) {
  7931. return dir( elem, "nextSibling", until );
  7932. },
  7933. prevUntil: function( elem, _i, until ) {
  7934. return dir( elem, "previousSibling", until );
  7935. },
  7936. siblings: function( elem ) {
  7937. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  7938. },
  7939. children: function( elem ) {
  7940. return siblings( elem.firstChild );
  7941. },
  7942. contents: function( elem ) {
  7943. if ( elem.contentDocument != null &&
  7944. // Support: IE 11+
  7945. // <object> elements with no `data` attribute has an object
  7946. // `contentDocument` with a `null` prototype.
  7947. getProto( elem.contentDocument ) ) {
  7948. return elem.contentDocument;
  7949. }
  7950. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  7951. // Treat the template element as a regular one in browsers that
  7952. // don't support it.
  7953. if ( nodeName( elem, "template" ) ) {
  7954. elem = elem.content || elem;
  7955. }
  7956. return jQuery.merge( [], elem.childNodes );
  7957. }
  7958. }, function( name, fn ) {
  7959. jQuery.fn[ name ] = function( until, selector ) {
  7960. var matched = jQuery.map( this, fn, until );
  7961. if ( name.slice( -5 ) !== "Until" ) {
  7962. selector = until;
  7963. }
  7964. if ( selector && typeof selector === "string" ) {
  7965. matched = jQuery.filter( selector, matched );
  7966. }
  7967. if ( this.length > 1 ) {
  7968. // Remove duplicates
  7969. if ( !guaranteedUnique[ name ] ) {
  7970. jQuery.uniqueSort( matched );
  7971. }
  7972. // Reverse order for parents* and prev-derivatives
  7973. if ( rparentsprev.test( name ) ) {
  7974. matched.reverse();
  7975. }
  7976. }
  7977. return this.pushStack( matched );
  7978. };
  7979. } );
  7980. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  7981. // Convert String-formatted options into Object-formatted ones
  7982. function createOptions( options ) {
  7983. var object = {};
  7984. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  7985. object[ flag ] = true;
  7986. } );
  7987. return object;
  7988. }
  7989. /*
  7990. * Create a callback list using the following parameters:
  7991. *
  7992. * options: an optional list of space-separated options that will change how
  7993. * the callback list behaves or a more traditional option object
  7994. *
  7995. * By default a callback list will act like an event callback list and can be
  7996. * "fired" multiple times.
  7997. *
  7998. * Possible options:
  7999. *
  8000. * once: will ensure the callback list can only be fired once (like a Deferred)
  8001. *
  8002. * memory: will keep track of previous values and will call any callback added
  8003. * after the list has been fired right away with the latest "memorized"
  8004. * values (like a Deferred)
  8005. *
  8006. * unique: will ensure a callback can only be added once (no duplicate in the list)
  8007. *
  8008. * stopOnFalse: interrupt callings when a callback returns false
  8009. *
  8010. */
  8011. jQuery.Callbacks = function( options ) {
  8012. // Convert options from String-formatted to Object-formatted if needed
  8013. // (we check in cache first)
  8014. options = typeof options === "string" ?
  8015. createOptions( options ) :
  8016. jQuery.extend( {}, options );
  8017. var // Flag to know if list is currently firing
  8018. firing,
  8019. // Last fire value for non-forgettable lists
  8020. memory,
  8021. // Flag to know if list was already fired
  8022. fired,
  8023. // Flag to prevent firing
  8024. locked,
  8025. // Actual callback list
  8026. list = [],
  8027. // Queue of execution data for repeatable lists
  8028. queue = [],
  8029. // Index of currently firing callback (modified by add/remove as needed)
  8030. firingIndex = -1,
  8031. // Fire callbacks
  8032. fire = function() {
  8033. // Enforce single-firing
  8034. locked = locked || options.once;
  8035. // Execute callbacks for all pending executions,
  8036. // respecting firingIndex overrides and runtime changes
  8037. fired = firing = true;
  8038. for ( ; queue.length; firingIndex = -1 ) {
  8039. memory = queue.shift();
  8040. while ( ++firingIndex < list.length ) {
  8041. // Run callback and check for early termination
  8042. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  8043. options.stopOnFalse ) {
  8044. // Jump to end and forget the data so .add doesn't re-fire
  8045. firingIndex = list.length;
  8046. memory = false;
  8047. }
  8048. }
  8049. }
  8050. // Forget the data if we're done with it
  8051. if ( !options.memory ) {
  8052. memory = false;
  8053. }
  8054. firing = false;
  8055. // Clean up if we're done firing for good
  8056. if ( locked ) {
  8057. // Keep an empty list if we have data for future add calls
  8058. if ( memory ) {
  8059. list = [];
  8060. // Otherwise, this object is spent
  8061. } else {
  8062. list = "";
  8063. }
  8064. }
  8065. },
  8066. // Actual Callbacks object
  8067. self = {
  8068. // Add a callback or a collection of callbacks to the list
  8069. add: function() {
  8070. if ( list ) {
  8071. // If we have memory from a past run, we should fire after adding
  8072. if ( memory && !firing ) {
  8073. firingIndex = list.length - 1;
  8074. queue.push( memory );
  8075. }
  8076. ( function add( args ) {
  8077. jQuery.each( args, function( _, arg ) {
  8078. if ( isFunction( arg ) ) {
  8079. if ( !options.unique || !self.has( arg ) ) {
  8080. list.push( arg );
  8081. }
  8082. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  8083. // Inspect recursively
  8084. add( arg );
  8085. }
  8086. } );
  8087. } )( arguments );
  8088. if ( memory && !firing ) {
  8089. fire();
  8090. }
  8091. }
  8092. return this;
  8093. },
  8094. // Remove a callback from the list
  8095. remove: function() {
  8096. jQuery.each( arguments, function( _, arg ) {
  8097. var index;
  8098. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  8099. list.splice( index, 1 );
  8100. // Handle firing indexes
  8101. if ( index <= firingIndex ) {
  8102. firingIndex--;
  8103. }
  8104. }
  8105. } );
  8106. return this;
  8107. },
  8108. // Check if a given callback is in the list.
  8109. // If no argument is given, return whether or not list has callbacks attached.
  8110. has: function( fn ) {
  8111. return fn ?
  8112. jQuery.inArray( fn, list ) > -1 :
  8113. list.length > 0;
  8114. },
  8115. // Remove all callbacks from the list
  8116. empty: function() {
  8117. if ( list ) {
  8118. list = [];
  8119. }
  8120. return this;
  8121. },
  8122. // Disable .fire and .add
  8123. // Abort any current/pending executions
  8124. // Clear all callbacks and values
  8125. disable: function() {
  8126. locked = queue = [];
  8127. list = memory = "";
  8128. return this;
  8129. },
  8130. disabled: function() {
  8131. return !list;
  8132. },
  8133. // Disable .fire
  8134. // Also disable .add unless we have memory (since it would have no effect)
  8135. // Abort any pending executions
  8136. lock: function() {
  8137. locked = queue = [];
  8138. if ( !memory && !firing ) {
  8139. list = memory = "";
  8140. }
  8141. return this;
  8142. },
  8143. locked: function() {
  8144. return !!locked;
  8145. },
  8146. // Call all callbacks with the given context and arguments
  8147. fireWith: function( context, args ) {
  8148. if ( !locked ) {
  8149. args = args || [];
  8150. args = [ context, args.slice ? args.slice() : args ];
  8151. queue.push( args );
  8152. if ( !firing ) {
  8153. fire();
  8154. }
  8155. }
  8156. return this;
  8157. },
  8158. // Call all the callbacks with the given arguments
  8159. fire: function() {
  8160. self.fireWith( this, arguments );
  8161. return this;
  8162. },
  8163. // To know if the callbacks have already been called at least once
  8164. fired: function() {
  8165. return !!fired;
  8166. }
  8167. };
  8168. return self;
  8169. };
  8170. function Identity( v ) {
  8171. return v;
  8172. }
  8173. function Thrower( ex ) {
  8174. throw ex;
  8175. }
  8176. function adoptValue( value, resolve, reject, noValue ) {
  8177. var method;
  8178. try {
  8179. // Check for promise aspect first to privilege synchronous behavior
  8180. if ( value && isFunction( ( method = value.promise ) ) ) {
  8181. method.call( value ).done( resolve ).fail( reject );
  8182. // Other thenables
  8183. } else if ( value && isFunction( ( method = value.then ) ) ) {
  8184. method.call( value, resolve, reject );
  8185. // Other non-thenables
  8186. } else {
  8187. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  8188. // * false: [ value ].slice( 0 ) => resolve( value )
  8189. // * true: [ value ].slice( 1 ) => resolve()
  8190. resolve.apply( undefined, [ value ].slice( noValue ) );
  8191. }
  8192. // For Promises/A+, convert exceptions into rejections
  8193. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  8194. // Deferred#then to conditionally suppress rejection.
  8195. } catch ( value ) {
  8196. // Support: Android 4.0 only
  8197. // Strict mode functions invoked without .call/.apply get global-object context
  8198. reject.apply( undefined, [ value ] );
  8199. }
  8200. }
  8201. jQuery.extend( {
  8202. Deferred: function( func ) {
  8203. var tuples = [
  8204. // action, add listener, callbacks,
  8205. // ... .then handlers, argument index, [final state]
  8206. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  8207. jQuery.Callbacks( "memory" ), 2 ],
  8208. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  8209. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  8210. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  8211. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  8212. ],
  8213. state = "pending",
  8214. promise = {
  8215. state: function() {
  8216. return state;
  8217. },
  8218. always: function() {
  8219. deferred.done( arguments ).fail( arguments );
  8220. return this;
  8221. },
  8222. "catch": function( fn ) {
  8223. return promise.then( null, fn );
  8224. },
  8225. // Keep pipe for back-compat
  8226. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  8227. var fns = arguments;
  8228. return jQuery.Deferred( function( newDefer ) {
  8229. jQuery.each( tuples, function( _i, tuple ) {
  8230. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  8231. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  8232. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  8233. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  8234. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  8235. deferred[ tuple[ 1 ] ]( function() {
  8236. var returned = fn && fn.apply( this, arguments );
  8237. if ( returned && isFunction( returned.promise ) ) {
  8238. returned.promise()
  8239. .progress( newDefer.notify )
  8240. .done( newDefer.resolve )
  8241. .fail( newDefer.reject );
  8242. } else {
  8243. newDefer[ tuple[ 0 ] + "With" ](
  8244. this,
  8245. fn ? [ returned ] : arguments
  8246. );
  8247. }
  8248. } );
  8249. } );
  8250. fns = null;
  8251. } ).promise();
  8252. },
  8253. then: function( onFulfilled, onRejected, onProgress ) {
  8254. var maxDepth = 0;
  8255. function resolve( depth, deferred, handler, special ) {
  8256. return function() {
  8257. var that = this,
  8258. args = arguments,
  8259. mightThrow = function() {
  8260. var returned, then;
  8261. // Support: Promises/A+ section 2.3.3.3.3
  8262. // https://promisesaplus.com/#point-59
  8263. // Ignore double-resolution attempts
  8264. if ( depth < maxDepth ) {
  8265. return;
  8266. }
  8267. returned = handler.apply( that, args );
  8268. // Support: Promises/A+ section 2.3.1
  8269. // https://promisesaplus.com/#point-48
  8270. if ( returned === deferred.promise() ) {
  8271. throw new TypeError( "Thenable self-resolution" );
  8272. }
  8273. // Support: Promises/A+ sections 2.3.3.1, 3.5
  8274. // https://promisesaplus.com/#point-54
  8275. // https://promisesaplus.com/#point-75
  8276. // Retrieve `then` only once
  8277. then = returned &&
  8278. // Support: Promises/A+ section 2.3.4
  8279. // https://promisesaplus.com/#point-64
  8280. // Only check objects and functions for thenability
  8281. ( typeof returned === "object" ||
  8282. typeof returned === "function" ) &&
  8283. returned.then;
  8284. // Handle a returned thenable
  8285. if ( isFunction( then ) ) {
  8286. // Special processors (notify) just wait for resolution
  8287. if ( special ) {
  8288. then.call(
  8289. returned,
  8290. resolve( maxDepth, deferred, Identity, special ),
  8291. resolve( maxDepth, deferred, Thrower, special )
  8292. );
  8293. // Normal processors (resolve) also hook into progress
  8294. } else {
  8295. // ...and disregard older resolution values
  8296. maxDepth++;
  8297. then.call(
  8298. returned,
  8299. resolve( maxDepth, deferred, Identity, special ),
  8300. resolve( maxDepth, deferred, Thrower, special ),
  8301. resolve( maxDepth, deferred, Identity,
  8302. deferred.notifyWith )
  8303. );
  8304. }
  8305. // Handle all other returned values
  8306. } else {
  8307. // Only substitute handlers pass on context
  8308. // and multiple values (non-spec behavior)
  8309. if ( handler !== Identity ) {
  8310. that = undefined;
  8311. args = [ returned ];
  8312. }
  8313. // Process the value(s)
  8314. // Default process is resolve
  8315. ( special || deferred.resolveWith )( that, args );
  8316. }
  8317. },
  8318. // Only normal processors (resolve) catch and reject exceptions
  8319. process = special ?
  8320. mightThrow :
  8321. function() {
  8322. try {
  8323. mightThrow();
  8324. } catch ( e ) {
  8325. if ( jQuery.Deferred.exceptionHook ) {
  8326. jQuery.Deferred.exceptionHook( e,
  8327. process.stackTrace );
  8328. }
  8329. // Support: Promises/A+ section 2.3.3.3.4.1
  8330. // https://promisesaplus.com/#point-61
  8331. // Ignore post-resolution exceptions
  8332. if ( depth + 1 >= maxDepth ) {
  8333. // Only substitute handlers pass on context
  8334. // and multiple values (non-spec behavior)
  8335. if ( handler !== Thrower ) {
  8336. that = undefined;
  8337. args = [ e ];
  8338. }
  8339. deferred.rejectWith( that, args );
  8340. }
  8341. }
  8342. };
  8343. // Support: Promises/A+ section 2.3.3.3.1
  8344. // https://promisesaplus.com/#point-57
  8345. // Re-resolve promises immediately to dodge false rejection from
  8346. // subsequent errors
  8347. if ( depth ) {
  8348. process();
  8349. } else {
  8350. // Call an optional hook to record the stack, in case of exception
  8351. // since it's otherwise lost when execution goes async
  8352. if ( jQuery.Deferred.getStackHook ) {
  8353. process.stackTrace = jQuery.Deferred.getStackHook();
  8354. }
  8355. window.setTimeout( process );
  8356. }
  8357. };
  8358. }
  8359. return jQuery.Deferred( function( newDefer ) {
  8360. // progress_handlers.add( ... )
  8361. tuples[ 0 ][ 3 ].add(
  8362. resolve(
  8363. 0,
  8364. newDefer,
  8365. isFunction( onProgress ) ?
  8366. onProgress :
  8367. Identity,
  8368. newDefer.notifyWith
  8369. )
  8370. );
  8371. // fulfilled_handlers.add( ... )
  8372. tuples[ 1 ][ 3 ].add(
  8373. resolve(
  8374. 0,
  8375. newDefer,
  8376. isFunction( onFulfilled ) ?
  8377. onFulfilled :
  8378. Identity
  8379. )
  8380. );
  8381. // rejected_handlers.add( ... )
  8382. tuples[ 2 ][ 3 ].add(
  8383. resolve(
  8384. 0,
  8385. newDefer,
  8386. isFunction( onRejected ) ?
  8387. onRejected :
  8388. Thrower
  8389. )
  8390. );
  8391. } ).promise();
  8392. },
  8393. // Get a promise for this deferred
  8394. // If obj is provided, the promise aspect is added to the object
  8395. promise: function( obj ) {
  8396. return obj != null ? jQuery.extend( obj, promise ) : promise;
  8397. }
  8398. },
  8399. deferred = {};
  8400. // Add list-specific methods
  8401. jQuery.each( tuples, function( i, tuple ) {
  8402. var list = tuple[ 2 ],
  8403. stateString = tuple[ 5 ];
  8404. // promise.progress = list.add
  8405. // promise.done = list.add
  8406. // promise.fail = list.add
  8407. promise[ tuple[ 1 ] ] = list.add;
  8408. // Handle state
  8409. if ( stateString ) {
  8410. list.add(
  8411. function() {
  8412. // state = "resolved" (i.e., fulfilled)
  8413. // state = "rejected"
  8414. state = stateString;
  8415. },
  8416. // rejected_callbacks.disable
  8417. // fulfilled_callbacks.disable
  8418. tuples[ 3 - i ][ 2 ].disable,
  8419. // rejected_handlers.disable
  8420. // fulfilled_handlers.disable
  8421. tuples[ 3 - i ][ 3 ].disable,
  8422. // progress_callbacks.lock
  8423. tuples[ 0 ][ 2 ].lock,
  8424. // progress_handlers.lock
  8425. tuples[ 0 ][ 3 ].lock
  8426. );
  8427. }
  8428. // progress_handlers.fire
  8429. // fulfilled_handlers.fire
  8430. // rejected_handlers.fire
  8431. list.add( tuple[ 3 ].fire );
  8432. // deferred.notify = function() { deferred.notifyWith(...) }
  8433. // deferred.resolve = function() { deferred.resolveWith(...) }
  8434. // deferred.reject = function() { deferred.rejectWith(...) }
  8435. deferred[ tuple[ 0 ] ] = function() {
  8436. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  8437. return this;
  8438. };
  8439. // deferred.notifyWith = list.fireWith
  8440. // deferred.resolveWith = list.fireWith
  8441. // deferred.rejectWith = list.fireWith
  8442. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  8443. } );
  8444. // Make the deferred a promise
  8445. promise.promise( deferred );
  8446. // Call given func if any
  8447. if ( func ) {
  8448. func.call( deferred, deferred );
  8449. }
  8450. // All done!
  8451. return deferred;
  8452. },
  8453. // Deferred helper
  8454. when: function( singleValue ) {
  8455. var
  8456. // count of uncompleted subordinates
  8457. remaining = arguments.length,
  8458. // count of unprocessed arguments
  8459. i = remaining,
  8460. // subordinate fulfillment data
  8461. resolveContexts = Array( i ),
  8462. resolveValues = slice.call( arguments ),
  8463. // the master Deferred
  8464. master = jQuery.Deferred(),
  8465. // subordinate callback factory
  8466. updateFunc = function( i ) {
  8467. return function( value ) {
  8468. resolveContexts[ i ] = this;
  8469. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  8470. if ( !( --remaining ) ) {
  8471. master.resolveWith( resolveContexts, resolveValues );
  8472. }
  8473. };
  8474. };
  8475. // Single- and empty arguments are adopted like Promise.resolve
  8476. if ( remaining <= 1 ) {
  8477. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  8478. !remaining );
  8479. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  8480. if ( master.state() === "pending" ||
  8481. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  8482. return master.then();
  8483. }
  8484. }
  8485. // Multiple arguments are aggregated like Promise.all array elements
  8486. while ( i-- ) {
  8487. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  8488. }
  8489. return master.promise();
  8490. }
  8491. } );
  8492. // These usually indicate a programmer mistake during development,
  8493. // warn about them ASAP rather than swallowing them by default.
  8494. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  8495. jQuery.Deferred.exceptionHook = function( error, stack ) {
  8496. // Support: IE 8 - 9 only
  8497. // Console exists when dev tools are open, which can happen at any time
  8498. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  8499. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  8500. }
  8501. };
  8502. jQuery.readyException = function( error ) {
  8503. window.setTimeout( function() {
  8504. throw error;
  8505. } );
  8506. };
  8507. // The deferred used on DOM ready
  8508. var readyList = jQuery.Deferred();
  8509. jQuery.fn.ready = function( fn ) {
  8510. readyList
  8511. .then( fn )
  8512. // Wrap jQuery.readyException in a function so that the lookup
  8513. // happens at the time of error handling instead of callback
  8514. // registration.
  8515. .catch( function( error ) {
  8516. jQuery.readyException( error );
  8517. } );
  8518. return this;
  8519. };
  8520. jQuery.extend( {
  8521. // Is the DOM ready to be used? Set to true once it occurs.
  8522. isReady: false,
  8523. // A counter to track how many items to wait for before
  8524. // the ready event fires. See #6781
  8525. readyWait: 1,
  8526. // Handle when the DOM is ready
  8527. ready: function( wait ) {
  8528. // Abort if there are pending holds or we're already ready
  8529. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  8530. return;
  8531. }
  8532. // Remember that the DOM is ready
  8533. jQuery.isReady = true;
  8534. // If a normal DOM Ready event fired, decrement, and wait if need be
  8535. if ( wait !== true && --jQuery.readyWait > 0 ) {
  8536. return;
  8537. }
  8538. // If there are functions bound, to execute
  8539. readyList.resolveWith( document, [ jQuery ] );
  8540. }
  8541. } );
  8542. jQuery.ready.then = readyList.then;
  8543. // The ready event handler and self cleanup method
  8544. function completed() {
  8545. document.removeEventListener( "DOMContentLoaded", completed );
  8546. window.removeEventListener( "load", completed );
  8547. jQuery.ready();
  8548. }
  8549. // Catch cases where $(document).ready() is called
  8550. // after the browser event has already occurred.
  8551. // Support: IE <=9 - 10 only
  8552. // Older IE sometimes signals "interactive" too soon
  8553. if ( document.readyState === "complete" ||
  8554. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  8555. // Handle it asynchronously to allow scripts the opportunity to delay ready
  8556. window.setTimeout( jQuery.ready );
  8557. } else {
  8558. // Use the handy event callback
  8559. document.addEventListener( "DOMContentLoaded", completed );
  8560. // A fallback to window.onload, that will always work
  8561. window.addEventListener( "load", completed );
  8562. }
  8563. // Multifunctional method to get and set values of a collection
  8564. // The value/s can optionally be executed if it's a function
  8565. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  8566. var i = 0,
  8567. len = elems.length,
  8568. bulk = key == null;
  8569. // Sets many values
  8570. if ( toType( key ) === "object" ) {
  8571. chainable = true;
  8572. for ( i in key ) {
  8573. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  8574. }
  8575. // Sets one value
  8576. } else if ( value !== undefined ) {
  8577. chainable = true;
  8578. if ( !isFunction( value ) ) {
  8579. raw = true;
  8580. }
  8581. if ( bulk ) {
  8582. // Bulk operations run against the entire set
  8583. if ( raw ) {
  8584. fn.call( elems, value );
  8585. fn = null;
  8586. // ...except when executing function values
  8587. } else {
  8588. bulk = fn;
  8589. fn = function( elem, _key, value ) {
  8590. return bulk.call( jQuery( elem ), value );
  8591. };
  8592. }
  8593. }
  8594. if ( fn ) {
  8595. for ( ; i < len; i++ ) {
  8596. fn(
  8597. elems[ i ], key, raw ?
  8598. value :
  8599. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  8600. );
  8601. }
  8602. }
  8603. }
  8604. if ( chainable ) {
  8605. return elems;
  8606. }
  8607. // Gets
  8608. if ( bulk ) {
  8609. return fn.call( elems );
  8610. }
  8611. return len ? fn( elems[ 0 ], key ) : emptyGet;
  8612. };
  8613. // Matches dashed string for camelizing
  8614. var rmsPrefix = /^-ms-/,
  8615. rdashAlpha = /-([a-z])/g;
  8616. // Used by camelCase as callback to replace()
  8617. function fcamelCase( _all, letter ) {
  8618. return letter.toUpperCase();
  8619. }
  8620. // Convert dashed to camelCase; used by the css and data modules
  8621. // Support: IE <=9 - 11, Edge 12 - 15
  8622. // Microsoft forgot to hump their vendor prefix (#9572)
  8623. function camelCase( string ) {
  8624. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  8625. }
  8626. var acceptData = function( owner ) {
  8627. // Accepts only:
  8628. // - Node
  8629. // - Node.ELEMENT_NODE
  8630. // - Node.DOCUMENT_NODE
  8631. // - Object
  8632. // - Any
  8633. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  8634. };
  8635. function Data() {
  8636. this.expando = jQuery.expando + Data.uid++;
  8637. }
  8638. Data.uid = 1;
  8639. Data.prototype = {
  8640. cache: function( owner ) {
  8641. // Check if the owner object already has a cache
  8642. var value = owner[ this.expando ];
  8643. // If not, create one
  8644. if ( !value ) {
  8645. value = {};
  8646. // We can accept data for non-element nodes in modern browsers,
  8647. // but we should not, see #8335.
  8648. // Always return an empty object.
  8649. if ( acceptData( owner ) ) {
  8650. // If it is a node unlikely to be stringify-ed or looped over
  8651. // use plain assignment
  8652. if ( owner.nodeType ) {
  8653. owner[ this.expando ] = value;
  8654. // Otherwise secure it in a non-enumerable property
  8655. // configurable must be true to allow the property to be
  8656. // deleted when data is removed
  8657. } else {
  8658. Object.defineProperty( owner, this.expando, {
  8659. value: value,
  8660. configurable: true
  8661. } );
  8662. }
  8663. }
  8664. }
  8665. return value;
  8666. },
  8667. set: function( owner, data, value ) {
  8668. var prop,
  8669. cache = this.cache( owner );
  8670. // Handle: [ owner, key, value ] args
  8671. // Always use camelCase key (gh-2257)
  8672. if ( typeof data === "string" ) {
  8673. cache[ camelCase( data ) ] = value;
  8674. // Handle: [ owner, { properties } ] args
  8675. } else {
  8676. // Copy the properties one-by-one to the cache object
  8677. for ( prop in data ) {
  8678. cache[ camelCase( prop ) ] = data[ prop ];
  8679. }
  8680. }
  8681. return cache;
  8682. },
  8683. get: function( owner, key ) {
  8684. return key === undefined ?
  8685. this.cache( owner ) :
  8686. // Always use camelCase key (gh-2257)
  8687. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  8688. },
  8689. access: function( owner, key, value ) {
  8690. // In cases where either:
  8691. //
  8692. // 1. No key was specified
  8693. // 2. A string key was specified, but no value provided
  8694. //
  8695. // Take the "read" path and allow the get method to determine
  8696. // which value to return, respectively either:
  8697. //
  8698. // 1. The entire cache object
  8699. // 2. The data stored at the key
  8700. //
  8701. if ( key === undefined ||
  8702. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  8703. return this.get( owner, key );
  8704. }
  8705. // When the key is not a string, or both a key and value
  8706. // are specified, set or extend (existing objects) with either:
  8707. //
  8708. // 1. An object of properties
  8709. // 2. A key and value
  8710. //
  8711. this.set( owner, key, value );
  8712. // Since the "set" path can have two possible entry points
  8713. // return the expected data based on which path was taken[*]
  8714. return value !== undefined ? value : key;
  8715. },
  8716. remove: function( owner, key ) {
  8717. var i,
  8718. cache = owner[ this.expando ];
  8719. if ( cache === undefined ) {
  8720. return;
  8721. }
  8722. if ( key !== undefined ) {
  8723. // Support array or space separated string of keys
  8724. if ( Array.isArray( key ) ) {
  8725. // If key is an array of keys...
  8726. // We always set camelCase keys, so remove that.
  8727. key = key.map( camelCase );
  8728. } else {
  8729. key = camelCase( key );
  8730. // If a key with the spaces exists, use it.
  8731. // Otherwise, create an array by matching non-whitespace
  8732. key = key in cache ?
  8733. [ key ] :
  8734. ( key.match( rnothtmlwhite ) || [] );
  8735. }
  8736. i = key.length;
  8737. while ( i-- ) {
  8738. delete cache[ key[ i ] ];
  8739. }
  8740. }
  8741. // Remove the expando if there's no more data
  8742. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  8743. // Support: Chrome <=35 - 45
  8744. // Webkit & Blink performance suffers when deleting properties
  8745. // from DOM nodes, so set to undefined instead
  8746. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  8747. if ( owner.nodeType ) {
  8748. owner[ this.expando ] = undefined;
  8749. } else {
  8750. delete owner[ this.expando ];
  8751. }
  8752. }
  8753. },
  8754. hasData: function( owner ) {
  8755. var cache = owner[ this.expando ];
  8756. return cache !== undefined && !jQuery.isEmptyObject( cache );
  8757. }
  8758. };
  8759. var dataPriv = new Data();
  8760. var dataUser = new Data();
  8761. // Implementation Summary
  8762. //
  8763. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  8764. // 2. Improve the module's maintainability by reducing the storage
  8765. // paths to a single mechanism.
  8766. // 3. Use the same single mechanism to support "private" and "user" data.
  8767. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  8768. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  8769. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  8770. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  8771. rmultiDash = /[A-Z]/g;
  8772. function getData( data ) {
  8773. if ( data === "true" ) {
  8774. return true;
  8775. }
  8776. if ( data === "false" ) {
  8777. return false;
  8778. }
  8779. if ( data === "null" ) {
  8780. return null;
  8781. }
  8782. // Only convert to a number if it doesn't change the string
  8783. if ( data === +data + "" ) {
  8784. return +data;
  8785. }
  8786. if ( rbrace.test( data ) ) {
  8787. return JSON.parse( data );
  8788. }
  8789. return data;
  8790. }
  8791. function dataAttr( elem, key, data ) {
  8792. var name;
  8793. // If nothing was found internally, try to fetch any
  8794. // data from the HTML5 data-* attribute
  8795. if ( data === undefined && elem.nodeType === 1 ) {
  8796. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  8797. data = elem.getAttribute( name );
  8798. if ( typeof data === "string" ) {
  8799. try {
  8800. data = getData( data );
  8801. } catch ( e ) {}
  8802. // Make sure we set the data so it isn't changed later
  8803. dataUser.set( elem, key, data );
  8804. } else {
  8805. data = undefined;
  8806. }
  8807. }
  8808. return data;
  8809. }
  8810. jQuery.extend( {
  8811. hasData: function( elem ) {
  8812. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  8813. },
  8814. data: function( elem, name, data ) {
  8815. return dataUser.access( elem, name, data );
  8816. },
  8817. removeData: function( elem, name ) {
  8818. dataUser.remove( elem, name );
  8819. },
  8820. // TODO: Now that all calls to _data and _removeData have been replaced
  8821. // with direct calls to dataPriv methods, these can be deprecated.
  8822. _data: function( elem, name, data ) {
  8823. return dataPriv.access( elem, name, data );
  8824. },
  8825. _removeData: function( elem, name ) {
  8826. dataPriv.remove( elem, name );
  8827. }
  8828. } );
  8829. jQuery.fn.extend( {
  8830. data: function( key, value ) {
  8831. var i, name, data,
  8832. elem = this[ 0 ],
  8833. attrs = elem && elem.attributes;
  8834. // Gets all values
  8835. if ( key === undefined ) {
  8836. if ( this.length ) {
  8837. data = dataUser.get( elem );
  8838. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  8839. i = attrs.length;
  8840. while ( i-- ) {
  8841. // Support: IE 11 only
  8842. // The attrs elements can be null (#14894)
  8843. if ( attrs[ i ] ) {
  8844. name = attrs[ i ].name;
  8845. if ( name.indexOf( "data-" ) === 0 ) {
  8846. name = camelCase( name.slice( 5 ) );
  8847. dataAttr( elem, name, data[ name ] );
  8848. }
  8849. }
  8850. }
  8851. dataPriv.set( elem, "hasDataAttrs", true );
  8852. }
  8853. }
  8854. return data;
  8855. }
  8856. // Sets multiple values
  8857. if ( typeof key === "object" ) {
  8858. return this.each( function() {
  8859. dataUser.set( this, key );
  8860. } );
  8861. }
  8862. return access( this, function( value ) {
  8863. var data;
  8864. // The calling jQuery object (element matches) is not empty
  8865. // (and therefore has an element appears at this[ 0 ]) and the
  8866. // `value` parameter was not undefined. An empty jQuery object
  8867. // will result in `undefined` for elem = this[ 0 ] which will
  8868. // throw an exception if an attempt to read a data cache is made.
  8869. if ( elem && value === undefined ) {
  8870. // Attempt to get data from the cache
  8871. // The key will always be camelCased in Data
  8872. data = dataUser.get( elem, key );
  8873. if ( data !== undefined ) {
  8874. return data;
  8875. }
  8876. // Attempt to "discover" the data in
  8877. // HTML5 custom data-* attrs
  8878. data = dataAttr( elem, key );
  8879. if ( data !== undefined ) {
  8880. return data;
  8881. }
  8882. // We tried really hard, but the data doesn't exist.
  8883. return;
  8884. }
  8885. // Set the data...
  8886. this.each( function() {
  8887. // We always store the camelCased key
  8888. dataUser.set( this, key, value );
  8889. } );
  8890. }, null, value, arguments.length > 1, null, true );
  8891. },
  8892. removeData: function( key ) {
  8893. return this.each( function() {
  8894. dataUser.remove( this, key );
  8895. } );
  8896. }
  8897. } );
  8898. jQuery.extend( {
  8899. queue: function( elem, type, data ) {
  8900. var queue;
  8901. if ( elem ) {
  8902. type = ( type || "fx" ) + "queue";
  8903. queue = dataPriv.get( elem, type );
  8904. // Speed up dequeue by getting out quickly if this is just a lookup
  8905. if ( data ) {
  8906. if ( !queue || Array.isArray( data ) ) {
  8907. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  8908. } else {
  8909. queue.push( data );
  8910. }
  8911. }
  8912. return queue || [];
  8913. }
  8914. },
  8915. dequeue: function( elem, type ) {
  8916. type = type || "fx";
  8917. var queue = jQuery.queue( elem, type ),
  8918. startLength = queue.length,
  8919. fn = queue.shift(),
  8920. hooks = jQuery._queueHooks( elem, type ),
  8921. next = function() {
  8922. jQuery.dequeue( elem, type );
  8923. };
  8924. // If the fx queue is dequeued, always remove the progress sentinel
  8925. if ( fn === "inprogress" ) {
  8926. fn = queue.shift();
  8927. startLength--;
  8928. }
  8929. if ( fn ) {
  8930. // Add a progress sentinel to prevent the fx queue from being
  8931. // automatically dequeued
  8932. if ( type === "fx" ) {
  8933. queue.unshift( "inprogress" );
  8934. }
  8935. // Clear up the last queue stop function
  8936. delete hooks.stop;
  8937. fn.call( elem, next, hooks );
  8938. }
  8939. if ( !startLength && hooks ) {
  8940. hooks.empty.fire();
  8941. }
  8942. },
  8943. // Not public - generate a queueHooks object, or return the current one
  8944. _queueHooks: function( elem, type ) {
  8945. var key = type + "queueHooks";
  8946. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  8947. empty: jQuery.Callbacks( "once memory" ).add( function() {
  8948. dataPriv.remove( elem, [ type + "queue", key ] );
  8949. } )
  8950. } );
  8951. }
  8952. } );
  8953. jQuery.fn.extend( {
  8954. queue: function( type, data ) {
  8955. var setter = 2;
  8956. if ( typeof type !== "string" ) {
  8957. data = type;
  8958. type = "fx";
  8959. setter--;
  8960. }
  8961. if ( arguments.length < setter ) {
  8962. return jQuery.queue( this[ 0 ], type );
  8963. }
  8964. return data === undefined ?
  8965. this :
  8966. this.each( function() {
  8967. var queue = jQuery.queue( this, type, data );
  8968. // Ensure a hooks for this queue
  8969. jQuery._queueHooks( this, type );
  8970. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  8971. jQuery.dequeue( this, type );
  8972. }
  8973. } );
  8974. },
  8975. dequeue: function( type ) {
  8976. return this.each( function() {
  8977. jQuery.dequeue( this, type );
  8978. } );
  8979. },
  8980. clearQueue: function( type ) {
  8981. return this.queue( type || "fx", [] );
  8982. },
  8983. // Get a promise resolved when queues of a certain type
  8984. // are emptied (fx is the type by default)
  8985. promise: function( type, obj ) {
  8986. var tmp,
  8987. count = 1,
  8988. defer = jQuery.Deferred(),
  8989. elements = this,
  8990. i = this.length,
  8991. resolve = function() {
  8992. if ( !( --count ) ) {
  8993. defer.resolveWith( elements, [ elements ] );
  8994. }
  8995. };
  8996. if ( typeof type !== "string" ) {
  8997. obj = type;
  8998. type = undefined;
  8999. }
  9000. type = type || "fx";
  9001. while ( i-- ) {
  9002. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  9003. if ( tmp && tmp.empty ) {
  9004. count++;
  9005. tmp.empty.add( resolve );
  9006. }
  9007. }
  9008. resolve();
  9009. return defer.promise( obj );
  9010. }
  9011. } );
  9012. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  9013. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  9014. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  9015. var documentElement = document.documentElement;
  9016. var isAttached = function( elem ) {
  9017. return jQuery.contains( elem.ownerDocument, elem );
  9018. },
  9019. composed = { composed: true };
  9020. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  9021. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  9022. // Support: iOS 10.0-10.2 only
  9023. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  9024. // leading to errors. We need to check for `getRootNode`.
  9025. if ( documentElement.getRootNode ) {
  9026. isAttached = function( elem ) {
  9027. return jQuery.contains( elem.ownerDocument, elem ) ||
  9028. elem.getRootNode( composed ) === elem.ownerDocument;
  9029. };
  9030. }
  9031. var isHiddenWithinTree = function( elem, el ) {
  9032. // isHiddenWithinTree might be called from jQuery#filter function;
  9033. // in that case, element will be second argument
  9034. elem = el || elem;
  9035. // Inline style trumps all
  9036. return elem.style.display === "none" ||
  9037. elem.style.display === "" &&
  9038. // Otherwise, check computed style
  9039. // Support: Firefox <=43 - 45
  9040. // Disconnected elements can have computed display: none, so first confirm that elem is
  9041. // in the document.
  9042. isAttached( elem ) &&
  9043. jQuery.css( elem, "display" ) === "none";
  9044. };
  9045. function adjustCSS( elem, prop, valueParts, tween ) {
  9046. var adjusted, scale,
  9047. maxIterations = 20,
  9048. currentValue = tween ?
  9049. function() {
  9050. return tween.cur();
  9051. } :
  9052. function() {
  9053. return jQuery.css( elem, prop, "" );
  9054. },
  9055. initial = currentValue(),
  9056. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  9057. // Starting value computation is required for potential unit mismatches
  9058. initialInUnit = elem.nodeType &&
  9059. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  9060. rcssNum.exec( jQuery.css( elem, prop ) );
  9061. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  9062. // Support: Firefox <=54
  9063. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  9064. initial = initial / 2;
  9065. // Trust units reported by jQuery.css
  9066. unit = unit || initialInUnit[ 3 ];
  9067. // Iteratively approximate from a nonzero starting point
  9068. initialInUnit = +initial || 1;
  9069. while ( maxIterations-- ) {
  9070. // Evaluate and update our best guess (doubling guesses that zero out).
  9071. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  9072. jQuery.style( elem, prop, initialInUnit + unit );
  9073. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  9074. maxIterations = 0;
  9075. }
  9076. initialInUnit = initialInUnit / scale;
  9077. }
  9078. initialInUnit = initialInUnit * 2;
  9079. jQuery.style( elem, prop, initialInUnit + unit );
  9080. // Make sure we update the tween properties later on
  9081. valueParts = valueParts || [];
  9082. }
  9083. if ( valueParts ) {
  9084. initialInUnit = +initialInUnit || +initial || 0;
  9085. // Apply relative offset (+=/-=) if specified
  9086. adjusted = valueParts[ 1 ] ?
  9087. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  9088. +valueParts[ 2 ];
  9089. if ( tween ) {
  9090. tween.unit = unit;
  9091. tween.start = initialInUnit;
  9092. tween.end = adjusted;
  9093. }
  9094. }
  9095. return adjusted;
  9096. }
  9097. var defaultDisplayMap = {};
  9098. function getDefaultDisplay( elem ) {
  9099. var temp,
  9100. doc = elem.ownerDocument,
  9101. nodeName = elem.nodeName,
  9102. display = defaultDisplayMap[ nodeName ];
  9103. if ( display ) {
  9104. return display;
  9105. }
  9106. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  9107. display = jQuery.css( temp, "display" );
  9108. temp.parentNode.removeChild( temp );
  9109. if ( display === "none" ) {
  9110. display = "block";
  9111. }
  9112. defaultDisplayMap[ nodeName ] = display;
  9113. return display;
  9114. }
  9115. function showHide( elements, show ) {
  9116. var display, elem,
  9117. values = [],
  9118. index = 0,
  9119. length = elements.length;
  9120. // Determine new display value for elements that need to change
  9121. for ( ; index < length; index++ ) {
  9122. elem = elements[ index ];
  9123. if ( !elem.style ) {
  9124. continue;
  9125. }
  9126. display = elem.style.display;
  9127. if ( show ) {
  9128. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  9129. // check is required in this first loop unless we have a nonempty display value (either
  9130. // inline or about-to-be-restored)
  9131. if ( display === "none" ) {
  9132. values[ index ] = dataPriv.get( elem, "display" ) || null;
  9133. if ( !values[ index ] ) {
  9134. elem.style.display = "";
  9135. }
  9136. }
  9137. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  9138. values[ index ] = getDefaultDisplay( elem );
  9139. }
  9140. } else {
  9141. if ( display !== "none" ) {
  9142. values[ index ] = "none";
  9143. // Remember what we're overwriting
  9144. dataPriv.set( elem, "display", display );
  9145. }
  9146. }
  9147. }
  9148. // Set the display of the elements in a second loop to avoid constant reflow
  9149. for ( index = 0; index < length; index++ ) {
  9150. if ( values[ index ] != null ) {
  9151. elements[ index ].style.display = values[ index ];
  9152. }
  9153. }
  9154. return elements;
  9155. }
  9156. jQuery.fn.extend( {
  9157. show: function() {
  9158. return showHide( this, true );
  9159. },
  9160. hide: function() {
  9161. return showHide( this );
  9162. },
  9163. toggle: function( state ) {
  9164. if ( typeof state === "boolean" ) {
  9165. return state ? this.show() : this.hide();
  9166. }
  9167. return this.each( function() {
  9168. if ( isHiddenWithinTree( this ) ) {
  9169. jQuery( this ).show();
  9170. } else {
  9171. jQuery( this ).hide();
  9172. }
  9173. } );
  9174. }
  9175. } );
  9176. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  9177. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  9178. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  9179. ( function() {
  9180. var fragment = document.createDocumentFragment(),
  9181. div = fragment.appendChild( document.createElement( "div" ) ),
  9182. input = document.createElement( "input" );
  9183. // Support: Android 4.0 - 4.3 only
  9184. // Check state lost if the name is set (#11217)
  9185. // Support: Windows Web Apps (WWA)
  9186. // `name` and `type` must use .setAttribute for WWA (#14901)
  9187. input.setAttribute( "type", "radio" );
  9188. input.setAttribute( "checked", "checked" );
  9189. input.setAttribute( "name", "t" );
  9190. div.appendChild( input );
  9191. // Support: Android <=4.1 only
  9192. // Older WebKit doesn't clone checked state correctly in fragments
  9193. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  9194. // Support: IE <=11 only
  9195. // Make sure textarea (and checkbox) defaultValue is properly cloned
  9196. div.innerHTML = "<textarea>x</textarea>";
  9197. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  9198. // Support: IE <=9 only
  9199. // IE <=9 replaces <option> tags with their contents when inserted outside of
  9200. // the select element.
  9201. div.innerHTML = "<option></option>";
  9202. support.option = !!div.lastChild;
  9203. } )();
  9204. // We have to close these tags to support XHTML (#13200)
  9205. var wrapMap = {
  9206. // XHTML parsers do not magically insert elements in the
  9207. // same way that tag soup parsers do. So we cannot shorten
  9208. // this by omitting <tbody> or other required elements.
  9209. thead: [ 1, "<table>", "</table>" ],
  9210. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  9211. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  9212. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  9213. _default: [ 0, "", "" ]
  9214. };
  9215. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  9216. wrapMap.th = wrapMap.td;
  9217. // Support: IE <=9 only
  9218. if ( !support.option ) {
  9219. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  9220. }
  9221. function getAll( context, tag ) {
  9222. // Support: IE <=9 - 11 only
  9223. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  9224. var ret;
  9225. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9226. ret = context.getElementsByTagName( tag || "*" );
  9227. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  9228. ret = context.querySelectorAll( tag || "*" );
  9229. } else {
  9230. ret = [];
  9231. }
  9232. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  9233. return jQuery.merge( [ context ], ret );
  9234. }
  9235. return ret;
  9236. }
  9237. // Mark scripts as having already been evaluated
  9238. function setGlobalEval( elems, refElements ) {
  9239. var i = 0,
  9240. l = elems.length;
  9241. for ( ; i < l; i++ ) {
  9242. dataPriv.set(
  9243. elems[ i ],
  9244. "globalEval",
  9245. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  9246. );
  9247. }
  9248. }
  9249. var rhtml = /<|&#?\w+;/;
  9250. function buildFragment( elems, context, scripts, selection, ignored ) {
  9251. var elem, tmp, tag, wrap, attached, j,
  9252. fragment = context.createDocumentFragment(),
  9253. nodes = [],
  9254. i = 0,
  9255. l = elems.length;
  9256. for ( ; i < l; i++ ) {
  9257. elem = elems[ i ];
  9258. if ( elem || elem === 0 ) {
  9259. // Add nodes directly
  9260. if ( toType( elem ) === "object" ) {
  9261. // Support: Android <=4.0 only, PhantomJS 1 only
  9262. // push.apply(_, arraylike) throws on ancient WebKit
  9263. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  9264. // Convert non-html into a text node
  9265. } else if ( !rhtml.test( elem ) ) {
  9266. nodes.push( context.createTextNode( elem ) );
  9267. // Convert html into DOM nodes
  9268. } else {
  9269. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  9270. // Deserialize a standard representation
  9271. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  9272. wrap = wrapMap[ tag ] || wrapMap._default;
  9273. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  9274. // Descend through wrappers to the right content
  9275. j = wrap[ 0 ];
  9276. while ( j-- ) {
  9277. tmp = tmp.lastChild;
  9278. }
  9279. // Support: Android <=4.0 only, PhantomJS 1 only
  9280. // push.apply(_, arraylike) throws on ancient WebKit
  9281. jQuery.merge( nodes, tmp.childNodes );
  9282. // Remember the top-level container
  9283. tmp = fragment.firstChild;
  9284. // Ensure the created nodes are orphaned (#12392)
  9285. tmp.textContent = "";
  9286. }
  9287. }
  9288. }
  9289. // Remove wrapper from fragment
  9290. fragment.textContent = "";
  9291. i = 0;
  9292. while ( ( elem = nodes[ i++ ] ) ) {
  9293. // Skip elements already in the context collection (trac-4087)
  9294. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  9295. if ( ignored ) {
  9296. ignored.push( elem );
  9297. }
  9298. continue;
  9299. }
  9300. attached = isAttached( elem );
  9301. // Append to fragment
  9302. tmp = getAll( fragment.appendChild( elem ), "script" );
  9303. // Preserve script evaluation history
  9304. if ( attached ) {
  9305. setGlobalEval( tmp );
  9306. }
  9307. // Capture executables
  9308. if ( scripts ) {
  9309. j = 0;
  9310. while ( ( elem = tmp[ j++ ] ) ) {
  9311. if ( rscriptType.test( elem.type || "" ) ) {
  9312. scripts.push( elem );
  9313. }
  9314. }
  9315. }
  9316. }
  9317. return fragment;
  9318. }
  9319. var
  9320. rkeyEvent = /^key/,
  9321. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  9322. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  9323. function returnTrue() {
  9324. return true;
  9325. }
  9326. function returnFalse() {
  9327. return false;
  9328. }
  9329. // Support: IE <=9 - 11+
  9330. // focus() and blur() are asynchronous, except when they are no-op.
  9331. // So expect focus to be synchronous when the element is already active,
  9332. // and blur to be synchronous when the element is not already active.
  9333. // (focus and blur are always synchronous in other supported browsers,
  9334. // this just defines when we can count on it).
  9335. function expectSync( elem, type ) {
  9336. return ( elem === safeActiveElement() ) === ( type === "focus" );
  9337. }
  9338. // Support: IE <=9 only
  9339. // Accessing document.activeElement can throw unexpectedly
  9340. // https://bugs.jquery.com/ticket/13393
  9341. function safeActiveElement() {
  9342. try {
  9343. return document.activeElement;
  9344. } catch ( err ) { }
  9345. }
  9346. function on( elem, types, selector, data, fn, one ) {
  9347. var origFn, type;
  9348. // Types can be a map of types/handlers
  9349. if ( typeof types === "object" ) {
  9350. // ( types-Object, selector, data )
  9351. if ( typeof selector !== "string" ) {
  9352. // ( types-Object, data )
  9353. data = data || selector;
  9354. selector = undefined;
  9355. }
  9356. for ( type in types ) {
  9357. on( elem, type, selector, data, types[ type ], one );
  9358. }
  9359. return elem;
  9360. }
  9361. if ( data == null && fn == null ) {
  9362. // ( types, fn )
  9363. fn = selector;
  9364. data = selector = undefined;
  9365. } else if ( fn == null ) {
  9366. if ( typeof selector === "string" ) {
  9367. // ( types, selector, fn )
  9368. fn = data;
  9369. data = undefined;
  9370. } else {
  9371. // ( types, data, fn )
  9372. fn = data;
  9373. data = selector;
  9374. selector = undefined;
  9375. }
  9376. }
  9377. if ( fn === false ) {
  9378. fn = returnFalse;
  9379. } else if ( !fn ) {
  9380. return elem;
  9381. }
  9382. if ( one === 1 ) {
  9383. origFn = fn;
  9384. fn = function( event ) {
  9385. // Can use an empty set, since event contains the info
  9386. jQuery().off( event );
  9387. return origFn.apply( this, arguments );
  9388. };
  9389. // Use same guid so caller can remove using origFn
  9390. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  9391. }
  9392. return elem.each( function() {
  9393. jQuery.event.add( this, types, fn, data, selector );
  9394. } );
  9395. }
  9396. /*
  9397. * Helper functions for managing events -- not part of the public interface.
  9398. * Props to Dean Edwards' addEvent library for many of the ideas.
  9399. */
  9400. jQuery.event = {
  9401. global: {},
  9402. add: function( elem, types, handler, data, selector ) {
  9403. var handleObjIn, eventHandle, tmp,
  9404. events, t, handleObj,
  9405. special, handlers, type, namespaces, origType,
  9406. elemData = dataPriv.get( elem );
  9407. // Only attach events to objects that accept data
  9408. if ( !acceptData( elem ) ) {
  9409. return;
  9410. }
  9411. // Caller can pass in an object of custom data in lieu of the handler
  9412. if ( handler.handler ) {
  9413. handleObjIn = handler;
  9414. handler = handleObjIn.handler;
  9415. selector = handleObjIn.selector;
  9416. }
  9417. // Ensure that invalid selectors throw exceptions at attach time
  9418. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  9419. if ( selector ) {
  9420. jQuery.find.matchesSelector( documentElement, selector );
  9421. }
  9422. // Make sure that the handler has a unique ID, used to find/remove it later
  9423. if ( !handler.guid ) {
  9424. handler.guid = jQuery.guid++;
  9425. }
  9426. // Init the element's event structure and main handler, if this is the first
  9427. if ( !( events = elemData.events ) ) {
  9428. events = elemData.events = Object.create( null );
  9429. }
  9430. if ( !( eventHandle = elemData.handle ) ) {
  9431. eventHandle = elemData.handle = function( e ) {
  9432. // Discard the second event of a jQuery.event.trigger() and
  9433. // when an event is called after a page has unloaded
  9434. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  9435. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  9436. };
  9437. }
  9438. // Handle multiple events separated by a space
  9439. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9440. t = types.length;
  9441. while ( t-- ) {
  9442. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9443. type = origType = tmp[ 1 ];
  9444. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9445. // There *must* be a type, no attaching namespace-only handlers
  9446. if ( !type ) {
  9447. continue;
  9448. }
  9449. // If event changes its type, use the special event handlers for the changed type
  9450. special = jQuery.event.special[ type ] || {};
  9451. // If selector defined, determine special event api type, otherwise given type
  9452. type = ( selector ? special.delegateType : special.bindType ) || type;
  9453. // Update special based on newly reset type
  9454. special = jQuery.event.special[ type ] || {};
  9455. // handleObj is passed to all event handlers
  9456. handleObj = jQuery.extend( {
  9457. type: type,
  9458. origType: origType,
  9459. data: data,
  9460. handler: handler,
  9461. guid: handler.guid,
  9462. selector: selector,
  9463. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  9464. namespace: namespaces.join( "." )
  9465. }, handleObjIn );
  9466. // Init the event handler queue if we're the first
  9467. if ( !( handlers = events[ type ] ) ) {
  9468. handlers = events[ type ] = [];
  9469. handlers.delegateCount = 0;
  9470. // Only use addEventListener if the special events handler returns false
  9471. if ( !special.setup ||
  9472. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  9473. if ( elem.addEventListener ) {
  9474. elem.addEventListener( type, eventHandle );
  9475. }
  9476. }
  9477. }
  9478. if ( special.add ) {
  9479. special.add.call( elem, handleObj );
  9480. if ( !handleObj.handler.guid ) {
  9481. handleObj.handler.guid = handler.guid;
  9482. }
  9483. }
  9484. // Add to the element's handler list, delegates in front
  9485. if ( selector ) {
  9486. handlers.splice( handlers.delegateCount++, 0, handleObj );
  9487. } else {
  9488. handlers.push( handleObj );
  9489. }
  9490. // Keep track of which events have ever been used, for event optimization
  9491. jQuery.event.global[ type ] = true;
  9492. }
  9493. },
  9494. // Detach an event or set of events from an element
  9495. remove: function( elem, types, handler, selector, mappedTypes ) {
  9496. var j, origCount, tmp,
  9497. events, t, handleObj,
  9498. special, handlers, type, namespaces, origType,
  9499. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  9500. if ( !elemData || !( events = elemData.events ) ) {
  9501. return;
  9502. }
  9503. // Once for each type.namespace in types; type may be omitted
  9504. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9505. t = types.length;
  9506. while ( t-- ) {
  9507. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9508. type = origType = tmp[ 1 ];
  9509. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9510. // Unbind all events (on this namespace, if provided) for the element
  9511. if ( !type ) {
  9512. for ( type in events ) {
  9513. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  9514. }
  9515. continue;
  9516. }
  9517. special = jQuery.event.special[ type ] || {};
  9518. type = ( selector ? special.delegateType : special.bindType ) || type;
  9519. handlers = events[ type ] || [];
  9520. tmp = tmp[ 2 ] &&
  9521. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  9522. // Remove matching events
  9523. origCount = j = handlers.length;
  9524. while ( j-- ) {
  9525. handleObj = handlers[ j ];
  9526. if ( ( mappedTypes || origType === handleObj.origType ) &&
  9527. ( !handler || handler.guid === handleObj.guid ) &&
  9528. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  9529. ( !selector || selector === handleObj.selector ||
  9530. selector === "**" && handleObj.selector ) ) {
  9531. handlers.splice( j, 1 );
  9532. if ( handleObj.selector ) {
  9533. handlers.delegateCount--;
  9534. }
  9535. if ( special.remove ) {
  9536. special.remove.call( elem, handleObj );
  9537. }
  9538. }
  9539. }
  9540. // Remove generic event handler if we removed something and no more handlers exist
  9541. // (avoids potential for endless recursion during removal of special event handlers)
  9542. if ( origCount && !handlers.length ) {
  9543. if ( !special.teardown ||
  9544. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  9545. jQuery.removeEvent( elem, type, elemData.handle );
  9546. }
  9547. delete events[ type ];
  9548. }
  9549. }
  9550. // Remove data and the expando if it's no longer used
  9551. if ( jQuery.isEmptyObject( events ) ) {
  9552. dataPriv.remove( elem, "handle events" );
  9553. }
  9554. },
  9555. dispatch: function( nativeEvent ) {
  9556. var i, j, ret, matched, handleObj, handlerQueue,
  9557. args = new Array( arguments.length ),
  9558. // Make a writable jQuery.Event from the native event object
  9559. event = jQuery.event.fix( nativeEvent ),
  9560. handlers = (
  9561. dataPriv.get( this, "events" ) || Object.create( null )
  9562. )[ event.type ] || [],
  9563. special = jQuery.event.special[ event.type ] || {};
  9564. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  9565. args[ 0 ] = event;
  9566. for ( i = 1; i < arguments.length; i++ ) {
  9567. args[ i ] = arguments[ i ];
  9568. }
  9569. event.delegateTarget = this;
  9570. // Call the preDispatch hook for the mapped type, and let it bail if desired
  9571. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  9572. return;
  9573. }
  9574. // Determine handlers
  9575. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  9576. // Run delegates first; they may want to stop propagation beneath us
  9577. i = 0;
  9578. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  9579. event.currentTarget = matched.elem;
  9580. j = 0;
  9581. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  9582. !event.isImmediatePropagationStopped() ) {
  9583. // If the event is namespaced, then each handler is only invoked if it is
  9584. // specially universal or its namespaces are a superset of the event's.
  9585. if ( !event.rnamespace || handleObj.namespace === false ||
  9586. event.rnamespace.test( handleObj.namespace ) ) {
  9587. event.handleObj = handleObj;
  9588. event.data = handleObj.data;
  9589. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  9590. handleObj.handler ).apply( matched.elem, args );
  9591. if ( ret !== undefined ) {
  9592. if ( ( event.result = ret ) === false ) {
  9593. event.preventDefault();
  9594. event.stopPropagation();
  9595. }
  9596. }
  9597. }
  9598. }
  9599. }
  9600. // Call the postDispatch hook for the mapped type
  9601. if ( special.postDispatch ) {
  9602. special.postDispatch.call( this, event );
  9603. }
  9604. return event.result;
  9605. },
  9606. handlers: function( event, handlers ) {
  9607. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  9608. handlerQueue = [],
  9609. delegateCount = handlers.delegateCount,
  9610. cur = event.target;
  9611. // Find delegate handlers
  9612. if ( delegateCount &&
  9613. // Support: IE <=9
  9614. // Black-hole SVG <use> instance trees (trac-13180)
  9615. cur.nodeType &&
  9616. // Support: Firefox <=42
  9617. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  9618. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  9619. // Support: IE 11 only
  9620. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  9621. !( event.type === "click" && event.button >= 1 ) ) {
  9622. for ( ; cur !== this; cur = cur.parentNode || this ) {
  9623. // Don't check non-elements (#13208)
  9624. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  9625. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  9626. matchedHandlers = [];
  9627. matchedSelectors = {};
  9628. for ( i = 0; i < delegateCount; i++ ) {
  9629. handleObj = handlers[ i ];
  9630. // Don't conflict with Object.prototype properties (#13203)
  9631. sel = handleObj.selector + " ";
  9632. if ( matchedSelectors[ sel ] === undefined ) {
  9633. matchedSelectors[ sel ] = handleObj.needsContext ?
  9634. jQuery( sel, this ).index( cur ) > -1 :
  9635. jQuery.find( sel, this, null, [ cur ] ).length;
  9636. }
  9637. if ( matchedSelectors[ sel ] ) {
  9638. matchedHandlers.push( handleObj );
  9639. }
  9640. }
  9641. if ( matchedHandlers.length ) {
  9642. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  9643. }
  9644. }
  9645. }
  9646. }
  9647. // Add the remaining (directly-bound) handlers
  9648. cur = this;
  9649. if ( delegateCount < handlers.length ) {
  9650. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  9651. }
  9652. return handlerQueue;
  9653. },
  9654. addProp: function( name, hook ) {
  9655. Object.defineProperty( jQuery.Event.prototype, name, {
  9656. enumerable: true,
  9657. configurable: true,
  9658. get: isFunction( hook ) ?
  9659. function() {
  9660. if ( this.originalEvent ) {
  9661. return hook( this.originalEvent );
  9662. }
  9663. } :
  9664. function() {
  9665. if ( this.originalEvent ) {
  9666. return this.originalEvent[ name ];
  9667. }
  9668. },
  9669. set: function( value ) {
  9670. Object.defineProperty( this, name, {
  9671. enumerable: true,
  9672. configurable: true,
  9673. writable: true,
  9674. value: value
  9675. } );
  9676. }
  9677. } );
  9678. },
  9679. fix: function( originalEvent ) {
  9680. return originalEvent[ jQuery.expando ] ?
  9681. originalEvent :
  9682. new jQuery.Event( originalEvent );
  9683. },
  9684. special: {
  9685. load: {
  9686. // Prevent triggered image.load events from bubbling to window.load
  9687. noBubble: true
  9688. },
  9689. click: {
  9690. // Utilize native event to ensure correct state for checkable inputs
  9691. setup: function( data ) {
  9692. // For mutual compressibility with _default, replace `this` access with a local var.
  9693. // `|| data` is dead code meant only to preserve the variable through minification.
  9694. var el = this || data;
  9695. // Claim the first handler
  9696. if ( rcheckableType.test( el.type ) &&
  9697. el.click && nodeName( el, "input" ) ) {
  9698. // dataPriv.set( el, "click", ... )
  9699. leverageNative( el, "click", returnTrue );
  9700. }
  9701. // Return false to allow normal processing in the caller
  9702. return false;
  9703. },
  9704. trigger: function( data ) {
  9705. // For mutual compressibility with _default, replace `this` access with a local var.
  9706. // `|| data` is dead code meant only to preserve the variable through minification.
  9707. var el = this || data;
  9708. // Force setup before triggering a click
  9709. if ( rcheckableType.test( el.type ) &&
  9710. el.click && nodeName( el, "input" ) ) {
  9711. leverageNative( el, "click" );
  9712. }
  9713. // Return non-false to allow normal event-path propagation
  9714. return true;
  9715. },
  9716. // For cross-browser consistency, suppress native .click() on links
  9717. // Also prevent it if we're currently inside a leveraged native-event stack
  9718. _default: function( event ) {
  9719. var target = event.target;
  9720. return rcheckableType.test( target.type ) &&
  9721. target.click && nodeName( target, "input" ) &&
  9722. dataPriv.get( target, "click" ) ||
  9723. nodeName( target, "a" );
  9724. }
  9725. },
  9726. beforeunload: {
  9727. postDispatch: function( event ) {
  9728. // Support: Firefox 20+
  9729. // Firefox doesn't alert if the returnValue field is not set.
  9730. if ( event.result !== undefined && event.originalEvent ) {
  9731. event.originalEvent.returnValue = event.result;
  9732. }
  9733. }
  9734. }
  9735. }
  9736. };
  9737. // Ensure the presence of an event listener that handles manually-triggered
  9738. // synthetic events by interrupting progress until reinvoked in response to
  9739. // *native* events that it fires directly, ensuring that state changes have
  9740. // already occurred before other listeners are invoked.
  9741. function leverageNative( el, type, expectSync ) {
  9742. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  9743. if ( !expectSync ) {
  9744. if ( dataPriv.get( el, type ) === undefined ) {
  9745. jQuery.event.add( el, type, returnTrue );
  9746. }
  9747. return;
  9748. }
  9749. // Register the controller as a special universal handler for all event namespaces
  9750. dataPriv.set( el, type, false );
  9751. jQuery.event.add( el, type, {
  9752. namespace: false,
  9753. handler: function( event ) {
  9754. var notAsync, result,
  9755. saved = dataPriv.get( this, type );
  9756. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  9757. // Interrupt processing of the outer synthetic .trigger()ed event
  9758. // Saved data should be false in such cases, but might be a leftover capture object
  9759. // from an async native handler (gh-4350)
  9760. if ( !saved.length ) {
  9761. // Store arguments for use when handling the inner native event
  9762. // There will always be at least one argument (an event object), so this array
  9763. // will not be confused with a leftover capture object.
  9764. saved = slice.call( arguments );
  9765. dataPriv.set( this, type, saved );
  9766. // Trigger the native event and capture its result
  9767. // Support: IE <=9 - 11+
  9768. // focus() and blur() are asynchronous
  9769. notAsync = expectSync( this, type );
  9770. this[ type ]();
  9771. result = dataPriv.get( this, type );
  9772. if ( saved !== result || notAsync ) {
  9773. dataPriv.set( this, type, false );
  9774. } else {
  9775. result = {};
  9776. }
  9777. if ( saved !== result ) {
  9778. // Cancel the outer synthetic event
  9779. event.stopImmediatePropagation();
  9780. event.preventDefault();
  9781. return result.value;
  9782. }
  9783. // If this is an inner synthetic event for an event with a bubbling surrogate
  9784. // (focus or blur), assume that the surrogate already propagated from triggering the
  9785. // native event and prevent that from happening again here.
  9786. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  9787. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  9788. // less bad than duplication.
  9789. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  9790. event.stopPropagation();
  9791. }
  9792. // If this is a native event triggered above, everything is now in order
  9793. // Fire an inner synthetic event with the original arguments
  9794. } else if ( saved.length ) {
  9795. // ...and capture the result
  9796. dataPriv.set( this, type, {
  9797. value: jQuery.event.trigger(
  9798. // Support: IE <=9 - 11+
  9799. // Extend with the prototype to reset the above stopImmediatePropagation()
  9800. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  9801. saved.slice( 1 ),
  9802. this
  9803. )
  9804. } );
  9805. // Abort handling of the native event
  9806. event.stopImmediatePropagation();
  9807. }
  9808. }
  9809. } );
  9810. }
  9811. jQuery.removeEvent = function( elem, type, handle ) {
  9812. // This "if" is needed for plain objects
  9813. if ( elem.removeEventListener ) {
  9814. elem.removeEventListener( type, handle );
  9815. }
  9816. };
  9817. jQuery.Event = function( src, props ) {
  9818. // Allow instantiation without the 'new' keyword
  9819. if ( !( this instanceof jQuery.Event ) ) {
  9820. return new jQuery.Event( src, props );
  9821. }
  9822. // Event object
  9823. if ( src && src.type ) {
  9824. this.originalEvent = src;
  9825. this.type = src.type;
  9826. // Events bubbling up the document may have been marked as prevented
  9827. // by a handler lower down the tree; reflect the correct value.
  9828. this.isDefaultPrevented = src.defaultPrevented ||
  9829. src.defaultPrevented === undefined &&
  9830. // Support: Android <=2.3 only
  9831. src.returnValue === false ?
  9832. returnTrue :
  9833. returnFalse;
  9834. // Create target properties
  9835. // Support: Safari <=6 - 7 only
  9836. // Target should not be a text node (#504, #13143)
  9837. this.target = ( src.target && src.target.nodeType === 3 ) ?
  9838. src.target.parentNode :
  9839. src.target;
  9840. this.currentTarget = src.currentTarget;
  9841. this.relatedTarget = src.relatedTarget;
  9842. // Event type
  9843. } else {
  9844. this.type = src;
  9845. }
  9846. // Put explicitly provided properties onto the event object
  9847. if ( props ) {
  9848. jQuery.extend( this, props );
  9849. }
  9850. // Create a timestamp if incoming event doesn't have one
  9851. this.timeStamp = src && src.timeStamp || Date.now();
  9852. // Mark it as fixed
  9853. this[ jQuery.expando ] = true;
  9854. };
  9855. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  9856. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  9857. jQuery.Event.prototype = {
  9858. constructor: jQuery.Event,
  9859. isDefaultPrevented: returnFalse,
  9860. isPropagationStopped: returnFalse,
  9861. isImmediatePropagationStopped: returnFalse,
  9862. isSimulated: false,
  9863. preventDefault: function() {
  9864. var e = this.originalEvent;
  9865. this.isDefaultPrevented = returnTrue;
  9866. if ( e && !this.isSimulated ) {
  9867. e.preventDefault();
  9868. }
  9869. },
  9870. stopPropagation: function() {
  9871. var e = this.originalEvent;
  9872. this.isPropagationStopped = returnTrue;
  9873. if ( e && !this.isSimulated ) {
  9874. e.stopPropagation();
  9875. }
  9876. },
  9877. stopImmediatePropagation: function() {
  9878. var e = this.originalEvent;
  9879. this.isImmediatePropagationStopped = returnTrue;
  9880. if ( e && !this.isSimulated ) {
  9881. e.stopImmediatePropagation();
  9882. }
  9883. this.stopPropagation();
  9884. }
  9885. };
  9886. // Includes all common event props including KeyEvent and MouseEvent specific props
  9887. jQuery.each( {
  9888. altKey: true,
  9889. bubbles: true,
  9890. cancelable: true,
  9891. changedTouches: true,
  9892. ctrlKey: true,
  9893. detail: true,
  9894. eventPhase: true,
  9895. metaKey: true,
  9896. pageX: true,
  9897. pageY: true,
  9898. shiftKey: true,
  9899. view: true,
  9900. "char": true,
  9901. code: true,
  9902. charCode: true,
  9903. key: true,
  9904. keyCode: true,
  9905. button: true,
  9906. buttons: true,
  9907. clientX: true,
  9908. clientY: true,
  9909. offsetX: true,
  9910. offsetY: true,
  9911. pointerId: true,
  9912. pointerType: true,
  9913. screenX: true,
  9914. screenY: true,
  9915. targetTouches: true,
  9916. toElement: true,
  9917. touches: true,
  9918. which: function( event ) {
  9919. var button = event.button;
  9920. // Add which for key events
  9921. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  9922. return event.charCode != null ? event.charCode : event.keyCode;
  9923. }
  9924. // Add which for click: 1 === left; 2 === middle; 3 === right
  9925. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  9926. if ( button & 1 ) {
  9927. return 1;
  9928. }
  9929. if ( button & 2 ) {
  9930. return 3;
  9931. }
  9932. if ( button & 4 ) {
  9933. return 2;
  9934. }
  9935. return 0;
  9936. }
  9937. return event.which;
  9938. }
  9939. }, jQuery.event.addProp );
  9940. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  9941. jQuery.event.special[ type ] = {
  9942. // Utilize native event if possible so blur/focus sequence is correct
  9943. setup: function() {
  9944. // Claim the first handler
  9945. // dataPriv.set( this, "focus", ... )
  9946. // dataPriv.set( this, "blur", ... )
  9947. leverageNative( this, type, expectSync );
  9948. // Return false to allow normal processing in the caller
  9949. return false;
  9950. },
  9951. trigger: function() {
  9952. // Force setup before trigger
  9953. leverageNative( this, type );
  9954. // Return non-false to allow normal event-path propagation
  9955. return true;
  9956. },
  9957. delegateType: delegateType
  9958. };
  9959. } );
  9960. // Create mouseenter/leave events using mouseover/out and event-time checks
  9961. // so that event delegation works in jQuery.
  9962. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  9963. //
  9964. // Support: Safari 7 only
  9965. // Safari sends mouseenter too often; see:
  9966. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  9967. // for the description of the bug (it existed in older Chrome versions as well).
  9968. jQuery.each( {
  9969. mouseenter: "mouseover",
  9970. mouseleave: "mouseout",
  9971. pointerenter: "pointerover",
  9972. pointerleave: "pointerout"
  9973. }, function( orig, fix ) {
  9974. jQuery.event.special[ orig ] = {
  9975. delegateType: fix,
  9976. bindType: fix,
  9977. handle: function( event ) {
  9978. var ret,
  9979. target = this,
  9980. related = event.relatedTarget,
  9981. handleObj = event.handleObj;
  9982. // For mouseenter/leave call the handler if related is outside the target.
  9983. // NB: No relatedTarget if the mouse left/entered the browser window
  9984. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  9985. event.type = handleObj.origType;
  9986. ret = handleObj.handler.apply( this, arguments );
  9987. event.type = fix;
  9988. }
  9989. return ret;
  9990. }
  9991. };
  9992. } );
  9993. jQuery.fn.extend( {
  9994. on: function( types, selector, data, fn ) {
  9995. return on( this, types, selector, data, fn );
  9996. },
  9997. one: function( types, selector, data, fn ) {
  9998. return on( this, types, selector, data, fn, 1 );
  9999. },
  10000. off: function( types, selector, fn ) {
  10001. var handleObj, type;
  10002. if ( types && types.preventDefault && types.handleObj ) {
  10003. // ( event ) dispatched jQuery.Event
  10004. handleObj = types.handleObj;
  10005. jQuery( types.delegateTarget ).off(
  10006. handleObj.namespace ?
  10007. handleObj.origType + "." + handleObj.namespace :
  10008. handleObj.origType,
  10009. handleObj.selector,
  10010. handleObj.handler
  10011. );
  10012. return this;
  10013. }
  10014. if ( typeof types === "object" ) {
  10015. // ( types-object [, selector] )
  10016. for ( type in types ) {
  10017. this.off( type, selector, types[ type ] );
  10018. }
  10019. return this;
  10020. }
  10021. if ( selector === false || typeof selector === "function" ) {
  10022. // ( types [, fn] )
  10023. fn = selector;
  10024. selector = undefined;
  10025. }
  10026. if ( fn === false ) {
  10027. fn = returnFalse;
  10028. }
  10029. return this.each( function() {
  10030. jQuery.event.remove( this, types, fn, selector );
  10031. } );
  10032. }
  10033. } );
  10034. var
  10035. // Support: IE <=10 - 11, Edge 12 - 13 only
  10036. // In IE/Edge using regex groups here causes severe slowdowns.
  10037. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  10038. rnoInnerhtml = /<script|<style|<link/i,
  10039. // checked="checked" or checked
  10040. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  10041. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  10042. // Prefer a tbody over its parent table for containing new rows
  10043. function manipulationTarget( elem, content ) {
  10044. if ( nodeName( elem, "table" ) &&
  10045. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  10046. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  10047. }
  10048. return elem;
  10049. }
  10050. // Replace/restore the type attribute of script elements for safe DOM manipulation
  10051. function disableScript( elem ) {
  10052. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  10053. return elem;
  10054. }
  10055. function restoreScript( elem ) {
  10056. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  10057. elem.type = elem.type.slice( 5 );
  10058. } else {
  10059. elem.removeAttribute( "type" );
  10060. }
  10061. return elem;
  10062. }
  10063. function cloneCopyEvent( src, dest ) {
  10064. var i, l, type, pdataOld, udataOld, udataCur, events;
  10065. if ( dest.nodeType !== 1 ) {
  10066. return;
  10067. }
  10068. // 1. Copy private data: events, handlers, etc.
  10069. if ( dataPriv.hasData( src ) ) {
  10070. pdataOld = dataPriv.get( src );
  10071. events = pdataOld.events;
  10072. if ( events ) {
  10073. dataPriv.remove( dest, "handle events" );
  10074. for ( type in events ) {
  10075. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  10076. jQuery.event.add( dest, type, events[ type ][ i ] );
  10077. }
  10078. }
  10079. }
  10080. }
  10081. // 2. Copy user data
  10082. if ( dataUser.hasData( src ) ) {
  10083. udataOld = dataUser.access( src );
  10084. udataCur = jQuery.extend( {}, udataOld );
  10085. dataUser.set( dest, udataCur );
  10086. }
  10087. }
  10088. // Fix IE bugs, see support tests
  10089. function fixInput( src, dest ) {
  10090. var nodeName = dest.nodeName.toLowerCase();
  10091. // Fails to persist the checked state of a cloned checkbox or radio button.
  10092. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  10093. dest.checked = src.checked;
  10094. // Fails to return the selected option to the default selected state when cloning options
  10095. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  10096. dest.defaultValue = src.defaultValue;
  10097. }
  10098. }
  10099. function domManip( collection, args, callback, ignored ) {
  10100. // Flatten any nested arrays
  10101. args = flat( args );
  10102. var fragment, first, scripts, hasScripts, node, doc,
  10103. i = 0,
  10104. l = collection.length,
  10105. iNoClone = l - 1,
  10106. value = args[ 0 ],
  10107. valueIsFunction = isFunction( value );
  10108. // We can't cloneNode fragments that contain checked, in WebKit
  10109. if ( valueIsFunction ||
  10110. ( l > 1 && typeof value === "string" &&
  10111. !support.checkClone && rchecked.test( value ) ) ) {
  10112. return collection.each( function( index ) {
  10113. var self = collection.eq( index );
  10114. if ( valueIsFunction ) {
  10115. args[ 0 ] = value.call( this, index, self.html() );
  10116. }
  10117. domManip( self, args, callback, ignored );
  10118. } );
  10119. }
  10120. if ( l ) {
  10121. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  10122. first = fragment.firstChild;
  10123. if ( fragment.childNodes.length === 1 ) {
  10124. fragment = first;
  10125. }
  10126. // Require either new content or an interest in ignored elements to invoke the callback
  10127. if ( first || ignored ) {
  10128. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  10129. hasScripts = scripts.length;
  10130. // Use the original fragment for the last item
  10131. // instead of the first because it can end up
  10132. // being emptied incorrectly in certain situations (#8070).
  10133. for ( ; i < l; i++ ) {
  10134. node = fragment;
  10135. if ( i !== iNoClone ) {
  10136. node = jQuery.clone( node, true, true );
  10137. // Keep references to cloned scripts for later restoration
  10138. if ( hasScripts ) {
  10139. // Support: Android <=4.0 only, PhantomJS 1 only
  10140. // push.apply(_, arraylike) throws on ancient WebKit
  10141. jQuery.merge( scripts, getAll( node, "script" ) );
  10142. }
  10143. }
  10144. callback.call( collection[ i ], node, i );
  10145. }
  10146. if ( hasScripts ) {
  10147. doc = scripts[ scripts.length - 1 ].ownerDocument;
  10148. // Reenable scripts
  10149. jQuery.map( scripts, restoreScript );
  10150. // Evaluate executable scripts on first document insertion
  10151. for ( i = 0; i < hasScripts; i++ ) {
  10152. node = scripts[ i ];
  10153. if ( rscriptType.test( node.type || "" ) &&
  10154. !dataPriv.access( node, "globalEval" ) &&
  10155. jQuery.contains( doc, node ) ) {
  10156. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  10157. // Optional AJAX dependency, but won't run scripts if not present
  10158. if ( jQuery._evalUrl && !node.noModule ) {
  10159. jQuery._evalUrl( node.src, {
  10160. nonce: node.nonce || node.getAttribute( "nonce" )
  10161. }, doc );
  10162. }
  10163. } else {
  10164. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  10165. }
  10166. }
  10167. }
  10168. }
  10169. }
  10170. }
  10171. return collection;
  10172. }
  10173. function remove( elem, selector, keepData ) {
  10174. var node,
  10175. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  10176. i = 0;
  10177. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  10178. if ( !keepData && node.nodeType === 1 ) {
  10179. jQuery.cleanData( getAll( node ) );
  10180. }
  10181. if ( node.parentNode ) {
  10182. if ( keepData && isAttached( node ) ) {
  10183. setGlobalEval( getAll( node, "script" ) );
  10184. }
  10185. node.parentNode.removeChild( node );
  10186. }
  10187. }
  10188. return elem;
  10189. }
  10190. jQuery.extend( {
  10191. htmlPrefilter: function( html ) {
  10192. return html;
  10193. },
  10194. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  10195. var i, l, srcElements, destElements,
  10196. clone = elem.cloneNode( true ),
  10197. inPage = isAttached( elem );
  10198. // Fix IE cloning issues
  10199. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  10200. !jQuery.isXMLDoc( elem ) ) {
  10201. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  10202. destElements = getAll( clone );
  10203. srcElements = getAll( elem );
  10204. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10205. fixInput( srcElements[ i ], destElements[ i ] );
  10206. }
  10207. }
  10208. // Copy the events from the original to the clone
  10209. if ( dataAndEvents ) {
  10210. if ( deepDataAndEvents ) {
  10211. srcElements = srcElements || getAll( elem );
  10212. destElements = destElements || getAll( clone );
  10213. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10214. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  10215. }
  10216. } else {
  10217. cloneCopyEvent( elem, clone );
  10218. }
  10219. }
  10220. // Preserve script evaluation history
  10221. destElements = getAll( clone, "script" );
  10222. if ( destElements.length > 0 ) {
  10223. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  10224. }
  10225. // Return the cloned set
  10226. return clone;
  10227. },
  10228. cleanData: function( elems ) {
  10229. var data, elem, type,
  10230. special = jQuery.event.special,
  10231. i = 0;
  10232. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  10233. if ( acceptData( elem ) ) {
  10234. if ( ( data = elem[ dataPriv.expando ] ) ) {
  10235. if ( data.events ) {
  10236. for ( type in data.events ) {
  10237. if ( special[ type ] ) {
  10238. jQuery.event.remove( elem, type );
  10239. // This is a shortcut to avoid jQuery.event.remove's overhead
  10240. } else {
  10241. jQuery.removeEvent( elem, type, data.handle );
  10242. }
  10243. }
  10244. }
  10245. // Support: Chrome <=35 - 45+
  10246. // Assign undefined instead of using delete, see Data#remove
  10247. elem[ dataPriv.expando ] = undefined;
  10248. }
  10249. if ( elem[ dataUser.expando ] ) {
  10250. // Support: Chrome <=35 - 45+
  10251. // Assign undefined instead of using delete, see Data#remove
  10252. elem[ dataUser.expando ] = undefined;
  10253. }
  10254. }
  10255. }
  10256. }
  10257. } );
  10258. jQuery.fn.extend( {
  10259. detach: function( selector ) {
  10260. return remove( this, selector, true );
  10261. },
  10262. remove: function( selector ) {
  10263. return remove( this, selector );
  10264. },
  10265. text: function( value ) {
  10266. return access( this, function( value ) {
  10267. return value === undefined ?
  10268. jQuery.text( this ) :
  10269. this.empty().each( function() {
  10270. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10271. this.textContent = value;
  10272. }
  10273. } );
  10274. }, null, value, arguments.length );
  10275. },
  10276. append: function() {
  10277. return domManip( this, arguments, function( elem ) {
  10278. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10279. var target = manipulationTarget( this, elem );
  10280. target.appendChild( elem );
  10281. }
  10282. } );
  10283. },
  10284. prepend: function() {
  10285. return domManip( this, arguments, function( elem ) {
  10286. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10287. var target = manipulationTarget( this, elem );
  10288. target.insertBefore( elem, target.firstChild );
  10289. }
  10290. } );
  10291. },
  10292. before: function() {
  10293. return domManip( this, arguments, function( elem ) {
  10294. if ( this.parentNode ) {
  10295. this.parentNode.insertBefore( elem, this );
  10296. }
  10297. } );
  10298. },
  10299. after: function() {
  10300. return domManip( this, arguments, function( elem ) {
  10301. if ( this.parentNode ) {
  10302. this.parentNode.insertBefore( elem, this.nextSibling );
  10303. }
  10304. } );
  10305. },
  10306. empty: function() {
  10307. var elem,
  10308. i = 0;
  10309. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  10310. if ( elem.nodeType === 1 ) {
  10311. // Prevent memory leaks
  10312. jQuery.cleanData( getAll( elem, false ) );
  10313. // Remove any remaining nodes
  10314. elem.textContent = "";
  10315. }
  10316. }
  10317. return this;
  10318. },
  10319. clone: function( dataAndEvents, deepDataAndEvents ) {
  10320. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  10321. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  10322. return this.map( function() {
  10323. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  10324. } );
  10325. },
  10326. html: function( value ) {
  10327. return access( this, function( value ) {
  10328. var elem = this[ 0 ] || {},
  10329. i = 0,
  10330. l = this.length;
  10331. if ( value === undefined && elem.nodeType === 1 ) {
  10332. return elem.innerHTML;
  10333. }
  10334. // See if we can take a shortcut and just use innerHTML
  10335. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  10336. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  10337. value = jQuery.htmlPrefilter( value );
  10338. try {
  10339. for ( ; i < l; i++ ) {
  10340. elem = this[ i ] || {};
  10341. // Remove element nodes and prevent memory leaks
  10342. if ( elem.nodeType === 1 ) {
  10343. jQuery.cleanData( getAll( elem, false ) );
  10344. elem.innerHTML = value;
  10345. }
  10346. }
  10347. elem = 0;
  10348. // If using innerHTML throws an exception, use the fallback method
  10349. } catch ( e ) {}
  10350. }
  10351. if ( elem ) {
  10352. this.empty().append( value );
  10353. }
  10354. }, null, value, arguments.length );
  10355. },
  10356. replaceWith: function() {
  10357. var ignored = [];
  10358. // Make the changes, replacing each non-ignored context element with the new content
  10359. return domManip( this, arguments, function( elem ) {
  10360. var parent = this.parentNode;
  10361. if ( jQuery.inArray( this, ignored ) < 0 ) {
  10362. jQuery.cleanData( getAll( this ) );
  10363. if ( parent ) {
  10364. parent.replaceChild( elem, this );
  10365. }
  10366. }
  10367. // Force callback invocation
  10368. }, ignored );
  10369. }
  10370. } );
  10371. jQuery.each( {
  10372. appendTo: "append",
  10373. prependTo: "prepend",
  10374. insertBefore: "before",
  10375. insertAfter: "after",
  10376. replaceAll: "replaceWith"
  10377. }, function( name, original ) {
  10378. jQuery.fn[ name ] = function( selector ) {
  10379. var elems,
  10380. ret = [],
  10381. insert = jQuery( selector ),
  10382. last = insert.length - 1,
  10383. i = 0;
  10384. for ( ; i <= last; i++ ) {
  10385. elems = i === last ? this : this.clone( true );
  10386. jQuery( insert[ i ] )[ original ]( elems );
  10387. // Support: Android <=4.0 only, PhantomJS 1 only
  10388. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  10389. push.apply( ret, elems.get() );
  10390. }
  10391. return this.pushStack( ret );
  10392. };
  10393. } );
  10394. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  10395. var getStyles = function( elem ) {
  10396. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  10397. // IE throws on elements created in popups
  10398. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  10399. var view = elem.ownerDocument.defaultView;
  10400. if ( !view || !view.opener ) {
  10401. view = window;
  10402. }
  10403. return view.getComputedStyle( elem );
  10404. };
  10405. var swap = function( elem, options, callback ) {
  10406. var ret, name,
  10407. old = {};
  10408. // Remember the old values, and insert the new ones
  10409. for ( name in options ) {
  10410. old[ name ] = elem.style[ name ];
  10411. elem.style[ name ] = options[ name ];
  10412. }
  10413. ret = callback.call( elem );
  10414. // Revert the old values
  10415. for ( name in options ) {
  10416. elem.style[ name ] = old[ name ];
  10417. }
  10418. return ret;
  10419. };
  10420. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  10421. ( function() {
  10422. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  10423. // so they're executed at the same time to save the second computation.
  10424. function computeStyleTests() {
  10425. // This is a singleton, we need to execute it only once
  10426. if ( !div ) {
  10427. return;
  10428. }
  10429. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  10430. "margin-top:1px;padding:0;border:0";
  10431. div.style.cssText =
  10432. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  10433. "margin:auto;border:1px;padding:1px;" +
  10434. "width:60%;top:1%";
  10435. documentElement.appendChild( container ).appendChild( div );
  10436. var divStyle = window.getComputedStyle( div );
  10437. pixelPositionVal = divStyle.top !== "1%";
  10438. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  10439. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  10440. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  10441. // Some styles come back with percentage values, even though they shouldn't
  10442. div.style.right = "60%";
  10443. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  10444. // Support: IE 9 - 11 only
  10445. // Detect misreporting of content dimensions for box-sizing:border-box elements
  10446. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  10447. // Support: IE 9 only
  10448. // Detect overflow:scroll screwiness (gh-3699)
  10449. // Support: Chrome <=64
  10450. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  10451. div.style.position = "absolute";
  10452. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  10453. documentElement.removeChild( container );
  10454. // Nullify the div so it wouldn't be stored in the memory and
  10455. // it will also be a sign that checks already performed
  10456. div = null;
  10457. }
  10458. function roundPixelMeasures( measure ) {
  10459. return Math.round( parseFloat( measure ) );
  10460. }
  10461. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  10462. reliableTrDimensionsVal, reliableMarginLeftVal,
  10463. container = document.createElement( "div" ),
  10464. div = document.createElement( "div" );
  10465. // Finish early in limited (non-browser) environments
  10466. if ( !div.style ) {
  10467. return;
  10468. }
  10469. // Support: IE <=9 - 11 only
  10470. // Style of cloned element affects source element cloned (#8908)
  10471. div.style.backgroundClip = "content-box";
  10472. div.cloneNode( true ).style.backgroundClip = "";
  10473. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  10474. jQuery.extend( support, {
  10475. boxSizingReliable: function() {
  10476. computeStyleTests();
  10477. return boxSizingReliableVal;
  10478. },
  10479. pixelBoxStyles: function() {
  10480. computeStyleTests();
  10481. return pixelBoxStylesVal;
  10482. },
  10483. pixelPosition: function() {
  10484. computeStyleTests();
  10485. return pixelPositionVal;
  10486. },
  10487. reliableMarginLeft: function() {
  10488. computeStyleTests();
  10489. return reliableMarginLeftVal;
  10490. },
  10491. scrollboxSize: function() {
  10492. computeStyleTests();
  10493. return scrollboxSizeVal;
  10494. },
  10495. // Support: IE 9 - 11+, Edge 15 - 18+
  10496. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  10497. // set in CSS while `offset*` properties report correct values.
  10498. // Behavior in IE 9 is more subtle than in newer versions & it passes
  10499. // some versions of this test; make sure not to make it pass there!
  10500. reliableTrDimensions: function() {
  10501. var table, tr, trChild, trStyle;
  10502. if ( reliableTrDimensionsVal == null ) {
  10503. table = document.createElement( "table" );
  10504. tr = document.createElement( "tr" );
  10505. trChild = document.createElement( "div" );
  10506. table.style.cssText = "position:absolute;left:-11111px";
  10507. tr.style.height = "1px";
  10508. trChild.style.height = "9px";
  10509. documentElement
  10510. .appendChild( table )
  10511. .appendChild( tr )
  10512. .appendChild( trChild );
  10513. trStyle = window.getComputedStyle( tr );
  10514. reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
  10515. documentElement.removeChild( table );
  10516. }
  10517. return reliableTrDimensionsVal;
  10518. }
  10519. } );
  10520. } )();
  10521. function curCSS( elem, name, computed ) {
  10522. var width, minWidth, maxWidth, ret,
  10523. // Support: Firefox 51+
  10524. // Retrieving style before computed somehow
  10525. // fixes an issue with getting wrong values
  10526. // on detached elements
  10527. style = elem.style;
  10528. computed = computed || getStyles( elem );
  10529. // getPropertyValue is needed for:
  10530. // .css('filter') (IE 9 only, #12537)
  10531. // .css('--customProperty) (#3144)
  10532. if ( computed ) {
  10533. ret = computed.getPropertyValue( name ) || computed[ name ];
  10534. if ( ret === "" && !isAttached( elem ) ) {
  10535. ret = jQuery.style( elem, name );
  10536. }
  10537. // A tribute to the "awesome hack by Dean Edwards"
  10538. // Android Browser returns percentage for some values,
  10539. // but width seems to be reliably pixels.
  10540. // This is against the CSSOM draft spec:
  10541. // https://drafts.csswg.org/cssom/#resolved-values
  10542. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  10543. // Remember the original values
  10544. width = style.width;
  10545. minWidth = style.minWidth;
  10546. maxWidth = style.maxWidth;
  10547. // Put in the new values to get a computed value out
  10548. style.minWidth = style.maxWidth = style.width = ret;
  10549. ret = computed.width;
  10550. // Revert the changed values
  10551. style.width = width;
  10552. style.minWidth = minWidth;
  10553. style.maxWidth = maxWidth;
  10554. }
  10555. }
  10556. return ret !== undefined ?
  10557. // Support: IE <=9 - 11 only
  10558. // IE returns zIndex value as an integer.
  10559. ret + "" :
  10560. ret;
  10561. }
  10562. function addGetHookIf( conditionFn, hookFn ) {
  10563. // Define the hook, we'll check on the first run if it's really needed.
  10564. return {
  10565. get: function() {
  10566. if ( conditionFn() ) {
  10567. // Hook not needed (or it's not possible to use it due
  10568. // to missing dependency), remove it.
  10569. delete this.get;
  10570. return;
  10571. }
  10572. // Hook needed; redefine it so that the support test is not executed again.
  10573. return ( this.get = hookFn ).apply( this, arguments );
  10574. }
  10575. };
  10576. }
  10577. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  10578. emptyStyle = document.createElement( "div" ).style,
  10579. vendorProps = {};
  10580. // Return a vendor-prefixed property or undefined
  10581. function vendorPropName( name ) {
  10582. // Check for vendor prefixed names
  10583. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  10584. i = cssPrefixes.length;
  10585. while ( i-- ) {
  10586. name = cssPrefixes[ i ] + capName;
  10587. if ( name in emptyStyle ) {
  10588. return name;
  10589. }
  10590. }
  10591. }
  10592. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  10593. function finalPropName( name ) {
  10594. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  10595. if ( final ) {
  10596. return final;
  10597. }
  10598. if ( name in emptyStyle ) {
  10599. return name;
  10600. }
  10601. return vendorProps[ name ] = vendorPropName( name ) || name;
  10602. }
  10603. var
  10604. // Swappable if display is none or starts with table
  10605. // except "table", "table-cell", or "table-caption"
  10606. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  10607. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  10608. rcustomProp = /^--/,
  10609. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  10610. cssNormalTransform = {
  10611. letterSpacing: "0",
  10612. fontWeight: "400"
  10613. };
  10614. function setPositiveNumber( _elem, value, subtract ) {
  10615. // Any relative (+/-) values have already been
  10616. // normalized at this point
  10617. var matches = rcssNum.exec( value );
  10618. return matches ?
  10619. // Guard against undefined "subtract", e.g., when used as in cssHooks
  10620. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  10621. value;
  10622. }
  10623. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  10624. var i = dimension === "width" ? 1 : 0,
  10625. extra = 0,
  10626. delta = 0;
  10627. // Adjustment may not be necessary
  10628. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  10629. return 0;
  10630. }
  10631. for ( ; i < 4; i += 2 ) {
  10632. // Both box models exclude margin
  10633. if ( box === "margin" ) {
  10634. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  10635. }
  10636. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  10637. if ( !isBorderBox ) {
  10638. // Add padding
  10639. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10640. // For "border" or "margin", add border
  10641. if ( box !== "padding" ) {
  10642. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10643. // But still keep track of it otherwise
  10644. } else {
  10645. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10646. }
  10647. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  10648. // "padding" or "margin"
  10649. } else {
  10650. // For "content", subtract padding
  10651. if ( box === "content" ) {
  10652. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10653. }
  10654. // For "content" or "padding", subtract border
  10655. if ( box !== "margin" ) {
  10656. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10657. }
  10658. }
  10659. }
  10660. // Account for positive content-box scroll gutter when requested by providing computedVal
  10661. if ( !isBorderBox && computedVal >= 0 ) {
  10662. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  10663. // Assuming integer scroll gutter, subtract the rest and round down
  10664. delta += Math.max( 0, Math.ceil(
  10665. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10666. computedVal -
  10667. delta -
  10668. extra -
  10669. 0.5
  10670. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  10671. // Use an explicit zero to avoid NaN (gh-3964)
  10672. ) ) || 0;
  10673. }
  10674. return delta;
  10675. }
  10676. function getWidthOrHeight( elem, dimension, extra ) {
  10677. // Start with computed style
  10678. var styles = getStyles( elem ),
  10679. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  10680. // Fake content-box until we know it's needed to know the true value.
  10681. boxSizingNeeded = !support.boxSizingReliable() || extra,
  10682. isBorderBox = boxSizingNeeded &&
  10683. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10684. valueIsBorderBox = isBorderBox,
  10685. val = curCSS( elem, dimension, styles ),
  10686. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  10687. // Support: Firefox <=54
  10688. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  10689. if ( rnumnonpx.test( val ) ) {
  10690. if ( !extra ) {
  10691. return val;
  10692. }
  10693. val = "auto";
  10694. }
  10695. // Support: IE 9 - 11 only
  10696. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  10697. // In those cases, the computed value can be trusted to be border-box.
  10698. if ( ( !support.boxSizingReliable() && isBorderBox ||
  10699. // Support: IE 10 - 11+, Edge 15 - 18+
  10700. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  10701. // set in CSS while `offset*` properties report correct values.
  10702. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  10703. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  10704. // Fall back to offsetWidth/offsetHeight when value is "auto"
  10705. // This happens for inline elements with no explicit setting (gh-3571)
  10706. val === "auto" ||
  10707. // Support: Android <=4.1 - 4.3 only
  10708. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  10709. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  10710. // Make sure the element is visible & connected
  10711. elem.getClientRects().length ) {
  10712. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  10713. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  10714. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  10715. // retrieved value as a content box dimension.
  10716. valueIsBorderBox = offsetProp in elem;
  10717. if ( valueIsBorderBox ) {
  10718. val = elem[ offsetProp ];
  10719. }
  10720. }
  10721. // Normalize "" and auto
  10722. val = parseFloat( val ) || 0;
  10723. // Adjust for the element's box model
  10724. return ( val +
  10725. boxModelAdjustment(
  10726. elem,
  10727. dimension,
  10728. extra || ( isBorderBox ? "border" : "content" ),
  10729. valueIsBorderBox,
  10730. styles,
  10731. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  10732. val
  10733. )
  10734. ) + "px";
  10735. }
  10736. jQuery.extend( {
  10737. // Add in style property hooks for overriding the default
  10738. // behavior of getting and setting a style property
  10739. cssHooks: {
  10740. opacity: {
  10741. get: function( elem, computed ) {
  10742. if ( computed ) {
  10743. // We should always get a number back from opacity
  10744. var ret = curCSS( elem, "opacity" );
  10745. return ret === "" ? "1" : ret;
  10746. }
  10747. }
  10748. }
  10749. },
  10750. // Don't automatically add "px" to these possibly-unitless properties
  10751. cssNumber: {
  10752. "animationIterationCount": true,
  10753. "columnCount": true,
  10754. "fillOpacity": true,
  10755. "flexGrow": true,
  10756. "flexShrink": true,
  10757. "fontWeight": true,
  10758. "gridArea": true,
  10759. "gridColumn": true,
  10760. "gridColumnEnd": true,
  10761. "gridColumnStart": true,
  10762. "gridRow": true,
  10763. "gridRowEnd": true,
  10764. "gridRowStart": true,
  10765. "lineHeight": true,
  10766. "opacity": true,
  10767. "order": true,
  10768. "orphans": true,
  10769. "widows": true,
  10770. "zIndex": true,
  10771. "zoom": true
  10772. },
  10773. // Add in properties whose names you wish to fix before
  10774. // setting or getting the value
  10775. cssProps: {},
  10776. // Get and set the style property on a DOM Node
  10777. style: function( elem, name, value, extra ) {
  10778. // Don't set styles on text and comment nodes
  10779. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  10780. return;
  10781. }
  10782. // Make sure that we're working with the right name
  10783. var ret, type, hooks,
  10784. origName = camelCase( name ),
  10785. isCustomProp = rcustomProp.test( name ),
  10786. style = elem.style;
  10787. // Make sure that we're working with the right name. We don't
  10788. // want to query the value if it is a CSS custom property
  10789. // since they are user-defined.
  10790. if ( !isCustomProp ) {
  10791. name = finalPropName( origName );
  10792. }
  10793. // Gets hook for the prefixed version, then unprefixed version
  10794. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10795. // Check if we're setting a value
  10796. if ( value !== undefined ) {
  10797. type = typeof value;
  10798. // Convert "+=" or "-=" to relative numbers (#7345)
  10799. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  10800. value = adjustCSS( elem, name, ret );
  10801. // Fixes bug #9237
  10802. type = "number";
  10803. }
  10804. // Make sure that null and NaN values aren't set (#7116)
  10805. if ( value == null || value !== value ) {
  10806. return;
  10807. }
  10808. // If a number was passed in, add the unit (except for certain CSS properties)
  10809. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  10810. // "px" to a few hardcoded values.
  10811. if ( type === "number" && !isCustomProp ) {
  10812. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  10813. }
  10814. // background-* props affect original clone's values
  10815. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  10816. style[ name ] = "inherit";
  10817. }
  10818. // If a hook was provided, use that value, otherwise just set the specified value
  10819. if ( !hooks || !( "set" in hooks ) ||
  10820. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  10821. if ( isCustomProp ) {
  10822. style.setProperty( name, value );
  10823. } else {
  10824. style[ name ] = value;
  10825. }
  10826. }
  10827. } else {
  10828. // If a hook was provided get the non-computed value from there
  10829. if ( hooks && "get" in hooks &&
  10830. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  10831. return ret;
  10832. }
  10833. // Otherwise just get the value from the style object
  10834. return style[ name ];
  10835. }
  10836. },
  10837. css: function( elem, name, extra, styles ) {
  10838. var val, num, hooks,
  10839. origName = camelCase( name ),
  10840. isCustomProp = rcustomProp.test( name );
  10841. // Make sure that we're working with the right name. We don't
  10842. // want to modify the value if it is a CSS custom property
  10843. // since they are user-defined.
  10844. if ( !isCustomProp ) {
  10845. name = finalPropName( origName );
  10846. }
  10847. // Try prefixed name followed by the unprefixed name
  10848. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10849. // If a hook was provided get the computed value from there
  10850. if ( hooks && "get" in hooks ) {
  10851. val = hooks.get( elem, true, extra );
  10852. }
  10853. // Otherwise, if a way to get the computed value exists, use that
  10854. if ( val === undefined ) {
  10855. val = curCSS( elem, name, styles );
  10856. }
  10857. // Convert "normal" to computed value
  10858. if ( val === "normal" && name in cssNormalTransform ) {
  10859. val = cssNormalTransform[ name ];
  10860. }
  10861. // Make numeric if forced or a qualifier was provided and val looks numeric
  10862. if ( extra === "" || extra ) {
  10863. num = parseFloat( val );
  10864. return extra === true || isFinite( num ) ? num || 0 : val;
  10865. }
  10866. return val;
  10867. }
  10868. } );
  10869. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  10870. jQuery.cssHooks[ dimension ] = {
  10871. get: function( elem, computed, extra ) {
  10872. if ( computed ) {
  10873. // Certain elements can have dimension info if we invisibly show them
  10874. // but it must have a current display style that would benefit
  10875. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  10876. // Support: Safari 8+
  10877. // Table columns in Safari have non-zero offsetWidth & zero
  10878. // getBoundingClientRect().width unless display is changed.
  10879. // Support: IE <=11 only
  10880. // Running getBoundingClientRect on a disconnected node
  10881. // in IE throws an error.
  10882. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  10883. swap( elem, cssShow, function() {
  10884. return getWidthOrHeight( elem, dimension, extra );
  10885. } ) :
  10886. getWidthOrHeight( elem, dimension, extra );
  10887. }
  10888. },
  10889. set: function( elem, value, extra ) {
  10890. var matches,
  10891. styles = getStyles( elem ),
  10892. // Only read styles.position if the test has a chance to fail
  10893. // to avoid forcing a reflow.
  10894. scrollboxSizeBuggy = !support.scrollboxSize() &&
  10895. styles.position === "absolute",
  10896. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  10897. boxSizingNeeded = scrollboxSizeBuggy || extra,
  10898. isBorderBox = boxSizingNeeded &&
  10899. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10900. subtract = extra ?
  10901. boxModelAdjustment(
  10902. elem,
  10903. dimension,
  10904. extra,
  10905. isBorderBox,
  10906. styles
  10907. ) :
  10908. 0;
  10909. // Account for unreliable border-box dimensions by comparing offset* to computed and
  10910. // faking a content-box to get border and padding (gh-3699)
  10911. if ( isBorderBox && scrollboxSizeBuggy ) {
  10912. subtract -= Math.ceil(
  10913. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10914. parseFloat( styles[ dimension ] ) -
  10915. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  10916. 0.5
  10917. );
  10918. }
  10919. // Convert to pixels if value adjustment is needed
  10920. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  10921. ( matches[ 3 ] || "px" ) !== "px" ) {
  10922. elem.style[ dimension ] = value;
  10923. value = jQuery.css( elem, dimension );
  10924. }
  10925. return setPositiveNumber( elem, value, subtract );
  10926. }
  10927. };
  10928. } );
  10929. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  10930. function( elem, computed ) {
  10931. if ( computed ) {
  10932. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  10933. elem.getBoundingClientRect().left -
  10934. swap( elem, { marginLeft: 0 }, function() {
  10935. return elem.getBoundingClientRect().left;
  10936. } )
  10937. ) + "px";
  10938. }
  10939. }
  10940. );
  10941. // These hooks are used by animate to expand properties
  10942. jQuery.each( {
  10943. margin: "",
  10944. padding: "",
  10945. border: "Width"
  10946. }, function( prefix, suffix ) {
  10947. jQuery.cssHooks[ prefix + suffix ] = {
  10948. expand: function( value ) {
  10949. var i = 0,
  10950. expanded = {},
  10951. // Assumes a single number if not a string
  10952. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  10953. for ( ; i < 4; i++ ) {
  10954. expanded[ prefix + cssExpand[ i ] + suffix ] =
  10955. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  10956. }
  10957. return expanded;
  10958. }
  10959. };
  10960. if ( prefix !== "margin" ) {
  10961. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  10962. }
  10963. } );
  10964. jQuery.fn.extend( {
  10965. css: function( name, value ) {
  10966. return access( this, function( elem, name, value ) {
  10967. var styles, len,
  10968. map = {},
  10969. i = 0;
  10970. if ( Array.isArray( name ) ) {
  10971. styles = getStyles( elem );
  10972. len = name.length;
  10973. for ( ; i < len; i++ ) {
  10974. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  10975. }
  10976. return map;
  10977. }
  10978. return value !== undefined ?
  10979. jQuery.style( elem, name, value ) :
  10980. jQuery.css( elem, name );
  10981. }, name, value, arguments.length > 1 );
  10982. }
  10983. } );
  10984. function Tween( elem, options, prop, end, easing ) {
  10985. return new Tween.prototype.init( elem, options, prop, end, easing );
  10986. }
  10987. jQuery.Tween = Tween;
  10988. Tween.prototype = {
  10989. constructor: Tween,
  10990. init: function( elem, options, prop, end, easing, unit ) {
  10991. this.elem = elem;
  10992. this.prop = prop;
  10993. this.easing = easing || jQuery.easing._default;
  10994. this.options = options;
  10995. this.start = this.now = this.cur();
  10996. this.end = end;
  10997. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  10998. },
  10999. cur: function() {
  11000. var hooks = Tween.propHooks[ this.prop ];
  11001. return hooks && hooks.get ?
  11002. hooks.get( this ) :
  11003. Tween.propHooks._default.get( this );
  11004. },
  11005. run: function( percent ) {
  11006. var eased,
  11007. hooks = Tween.propHooks[ this.prop ];
  11008. if ( this.options.duration ) {
  11009. this.pos = eased = jQuery.easing[ this.easing ](
  11010. percent, this.options.duration * percent, 0, 1, this.options.duration
  11011. );
  11012. } else {
  11013. this.pos = eased = percent;
  11014. }
  11015. this.now = ( this.end - this.start ) * eased + this.start;
  11016. if ( this.options.step ) {
  11017. this.options.step.call( this.elem, this.now, this );
  11018. }
  11019. if ( hooks && hooks.set ) {
  11020. hooks.set( this );
  11021. } else {
  11022. Tween.propHooks._default.set( this );
  11023. }
  11024. return this;
  11025. }
  11026. };
  11027. Tween.prototype.init.prototype = Tween.prototype;
  11028. Tween.propHooks = {
  11029. _default: {
  11030. get: function( tween ) {
  11031. var result;
  11032. // Use a property on the element directly when it is not a DOM element,
  11033. // or when there is no matching style property that exists.
  11034. if ( tween.elem.nodeType !== 1 ||
  11035. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  11036. return tween.elem[ tween.prop ];
  11037. }
  11038. // Passing an empty string as a 3rd parameter to .css will automatically
  11039. // attempt a parseFloat and fallback to a string if the parse fails.
  11040. // Simple values such as "10px" are parsed to Float;
  11041. // complex values such as "rotate(1rad)" are returned as-is.
  11042. result = jQuery.css( tween.elem, tween.prop, "" );
  11043. // Empty strings, null, undefined and "auto" are converted to 0.
  11044. return !result || result === "auto" ? 0 : result;
  11045. },
  11046. set: function( tween ) {
  11047. // Use step hook for back compat.
  11048. // Use cssHook if its there.
  11049. // Use .style if available and use plain properties where available.
  11050. if ( jQuery.fx.step[ tween.prop ] ) {
  11051. jQuery.fx.step[ tween.prop ]( tween );
  11052. } else if ( tween.elem.nodeType === 1 && (
  11053. jQuery.cssHooks[ tween.prop ] ||
  11054. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  11055. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  11056. } else {
  11057. tween.elem[ tween.prop ] = tween.now;
  11058. }
  11059. }
  11060. }
  11061. };
  11062. // Support: IE <=9 only
  11063. // Panic based approach to setting things on disconnected nodes
  11064. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  11065. set: function( tween ) {
  11066. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  11067. tween.elem[ tween.prop ] = tween.now;
  11068. }
  11069. }
  11070. };
  11071. jQuery.easing = {
  11072. linear: function( p ) {
  11073. return p;
  11074. },
  11075. swing: function( p ) {
  11076. return 0.5 - Math.cos( p * Math.PI ) / 2;
  11077. },
  11078. _default: "swing"
  11079. };
  11080. jQuery.fx = Tween.prototype.init;
  11081. // Back compat <1.8 extension point
  11082. jQuery.fx.step = {};
  11083. var
  11084. fxNow, inProgress,
  11085. rfxtypes = /^(?:toggle|show|hide)$/,
  11086. rrun = /queueHooks$/;
  11087. function schedule() {
  11088. if ( inProgress ) {
  11089. if ( document.hidden === false && window.requestAnimationFrame ) {
  11090. window.requestAnimationFrame( schedule );
  11091. } else {
  11092. window.setTimeout( schedule, jQuery.fx.interval );
  11093. }
  11094. jQuery.fx.tick();
  11095. }
  11096. }
  11097. // Animations created synchronously will run synchronously
  11098. function createFxNow() {
  11099. window.setTimeout( function() {
  11100. fxNow = undefined;
  11101. } );
  11102. return ( fxNow = Date.now() );
  11103. }
  11104. // Generate parameters to create a standard animation
  11105. function genFx( type, includeWidth ) {
  11106. var which,
  11107. i = 0,
  11108. attrs = { height: type };
  11109. // If we include width, step value is 1 to do all cssExpand values,
  11110. // otherwise step value is 2 to skip over Left and Right
  11111. includeWidth = includeWidth ? 1 : 0;
  11112. for ( ; i < 4; i += 2 - includeWidth ) {
  11113. which = cssExpand[ i ];
  11114. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  11115. }
  11116. if ( includeWidth ) {
  11117. attrs.opacity = attrs.width = type;
  11118. }
  11119. return attrs;
  11120. }
  11121. function createTween( value, prop, animation ) {
  11122. var tween,
  11123. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  11124. index = 0,
  11125. length = collection.length;
  11126. for ( ; index < length; index++ ) {
  11127. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  11128. // We're done with this property
  11129. return tween;
  11130. }
  11131. }
  11132. }
  11133. function defaultPrefilter( elem, props, opts ) {
  11134. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  11135. isBox = "width" in props || "height" in props,
  11136. anim = this,
  11137. orig = {},
  11138. style = elem.style,
  11139. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  11140. dataShow = dataPriv.get( elem, "fxshow" );
  11141. // Queue-skipping animations hijack the fx hooks
  11142. if ( !opts.queue ) {
  11143. hooks = jQuery._queueHooks( elem, "fx" );
  11144. if ( hooks.unqueued == null ) {
  11145. hooks.unqueued = 0;
  11146. oldfire = hooks.empty.fire;
  11147. hooks.empty.fire = function() {
  11148. if ( !hooks.unqueued ) {
  11149. oldfire();
  11150. }
  11151. };
  11152. }
  11153. hooks.unqueued++;
  11154. anim.always( function() {
  11155. // Ensure the complete handler is called before this completes
  11156. anim.always( function() {
  11157. hooks.unqueued--;
  11158. if ( !jQuery.queue( elem, "fx" ).length ) {
  11159. hooks.empty.fire();
  11160. }
  11161. } );
  11162. } );
  11163. }
  11164. // Detect show/hide animations
  11165. for ( prop in props ) {
  11166. value = props[ prop ];
  11167. if ( rfxtypes.test( value ) ) {
  11168. delete props[ prop ];
  11169. toggle = toggle || value === "toggle";
  11170. if ( value === ( hidden ? "hide" : "show" ) ) {
  11171. // Pretend to be hidden if this is a "show" and
  11172. // there is still data from a stopped show/hide
  11173. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  11174. hidden = true;
  11175. // Ignore all other no-op show/hide data
  11176. } else {
  11177. continue;
  11178. }
  11179. }
  11180. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  11181. }
  11182. }
  11183. // Bail out if this is a no-op like .hide().hide()
  11184. propTween = !jQuery.isEmptyObject( props );
  11185. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  11186. return;
  11187. }
  11188. // Restrict "overflow" and "display" styles during box animations
  11189. if ( isBox && elem.nodeType === 1 ) {
  11190. // Support: IE <=9 - 11, Edge 12 - 15
  11191. // Record all 3 overflow attributes because IE does not infer the shorthand
  11192. // from identically-valued overflowX and overflowY and Edge just mirrors
  11193. // the overflowX value there.
  11194. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  11195. // Identify a display type, preferring old show/hide data over the CSS cascade
  11196. restoreDisplay = dataShow && dataShow.display;
  11197. if ( restoreDisplay == null ) {
  11198. restoreDisplay = dataPriv.get( elem, "display" );
  11199. }
  11200. display = jQuery.css( elem, "display" );
  11201. if ( display === "none" ) {
  11202. if ( restoreDisplay ) {
  11203. display = restoreDisplay;
  11204. } else {
  11205. // Get nonempty value(s) by temporarily forcing visibility
  11206. showHide( [ elem ], true );
  11207. restoreDisplay = elem.style.display || restoreDisplay;
  11208. display = jQuery.css( elem, "display" );
  11209. showHide( [ elem ] );
  11210. }
  11211. }
  11212. // Animate inline elements as inline-block
  11213. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  11214. if ( jQuery.css( elem, "float" ) === "none" ) {
  11215. // Restore the original display value at the end of pure show/hide animations
  11216. if ( !propTween ) {
  11217. anim.done( function() {
  11218. style.display = restoreDisplay;
  11219. } );
  11220. if ( restoreDisplay == null ) {
  11221. display = style.display;
  11222. restoreDisplay = display === "none" ? "" : display;
  11223. }
  11224. }
  11225. style.display = "inline-block";
  11226. }
  11227. }
  11228. }
  11229. if ( opts.overflow ) {
  11230. style.overflow = "hidden";
  11231. anim.always( function() {
  11232. style.overflow = opts.overflow[ 0 ];
  11233. style.overflowX = opts.overflow[ 1 ];
  11234. style.overflowY = opts.overflow[ 2 ];
  11235. } );
  11236. }
  11237. // Implement show/hide animations
  11238. propTween = false;
  11239. for ( prop in orig ) {
  11240. // General show/hide setup for this element animation
  11241. if ( !propTween ) {
  11242. if ( dataShow ) {
  11243. if ( "hidden" in dataShow ) {
  11244. hidden = dataShow.hidden;
  11245. }
  11246. } else {
  11247. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  11248. }
  11249. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  11250. if ( toggle ) {
  11251. dataShow.hidden = !hidden;
  11252. }
  11253. // Show elements before animating them
  11254. if ( hidden ) {
  11255. showHide( [ elem ], true );
  11256. }
  11257. /* eslint-disable no-loop-func */
  11258. anim.done( function() {
  11259. /* eslint-enable no-loop-func */
  11260. // The final step of a "hide" animation is actually hiding the element
  11261. if ( !hidden ) {
  11262. showHide( [ elem ] );
  11263. }
  11264. dataPriv.remove( elem, "fxshow" );
  11265. for ( prop in orig ) {
  11266. jQuery.style( elem, prop, orig[ prop ] );
  11267. }
  11268. } );
  11269. }
  11270. // Per-property setup
  11271. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  11272. if ( !( prop in dataShow ) ) {
  11273. dataShow[ prop ] = propTween.start;
  11274. if ( hidden ) {
  11275. propTween.end = propTween.start;
  11276. propTween.start = 0;
  11277. }
  11278. }
  11279. }
  11280. }
  11281. function propFilter( props, specialEasing ) {
  11282. var index, name, easing, value, hooks;
  11283. // camelCase, specialEasing and expand cssHook pass
  11284. for ( index in props ) {
  11285. name = camelCase( index );
  11286. easing = specialEasing[ name ];
  11287. value = props[ index ];
  11288. if ( Array.isArray( value ) ) {
  11289. easing = value[ 1 ];
  11290. value = props[ index ] = value[ 0 ];
  11291. }
  11292. if ( index !== name ) {
  11293. props[ name ] = value;
  11294. delete props[ index ];
  11295. }
  11296. hooks = jQuery.cssHooks[ name ];
  11297. if ( hooks && "expand" in hooks ) {
  11298. value = hooks.expand( value );
  11299. delete props[ name ];
  11300. // Not quite $.extend, this won't overwrite existing keys.
  11301. // Reusing 'index' because we have the correct "name"
  11302. for ( index in value ) {
  11303. if ( !( index in props ) ) {
  11304. props[ index ] = value[ index ];
  11305. specialEasing[ index ] = easing;
  11306. }
  11307. }
  11308. } else {
  11309. specialEasing[ name ] = easing;
  11310. }
  11311. }
  11312. }
  11313. function Animation( elem, properties, options ) {
  11314. var result,
  11315. stopped,
  11316. index = 0,
  11317. length = Animation.prefilters.length,
  11318. deferred = jQuery.Deferred().always( function() {
  11319. // Don't match elem in the :animated selector
  11320. delete tick.elem;
  11321. } ),
  11322. tick = function() {
  11323. if ( stopped ) {
  11324. return false;
  11325. }
  11326. var currentTime = fxNow || createFxNow(),
  11327. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  11328. // Support: Android 2.3 only
  11329. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  11330. temp = remaining / animation.duration || 0,
  11331. percent = 1 - temp,
  11332. index = 0,
  11333. length = animation.tweens.length;
  11334. for ( ; index < length; index++ ) {
  11335. animation.tweens[ index ].run( percent );
  11336. }
  11337. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  11338. // If there's more to do, yield
  11339. if ( percent < 1 && length ) {
  11340. return remaining;
  11341. }
  11342. // If this was an empty animation, synthesize a final progress notification
  11343. if ( !length ) {
  11344. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11345. }
  11346. // Resolve the animation and report its conclusion
  11347. deferred.resolveWith( elem, [ animation ] );
  11348. return false;
  11349. },
  11350. animation = deferred.promise( {
  11351. elem: elem,
  11352. props: jQuery.extend( {}, properties ),
  11353. opts: jQuery.extend( true, {
  11354. specialEasing: {},
  11355. easing: jQuery.easing._default
  11356. }, options ),
  11357. originalProperties: properties,
  11358. originalOptions: options,
  11359. startTime: fxNow || createFxNow(),
  11360. duration: options.duration,
  11361. tweens: [],
  11362. createTween: function( prop, end ) {
  11363. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  11364. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  11365. animation.tweens.push( tween );
  11366. return tween;
  11367. },
  11368. stop: function( gotoEnd ) {
  11369. var index = 0,
  11370. // If we are going to the end, we want to run all the tweens
  11371. // otherwise we skip this part
  11372. length = gotoEnd ? animation.tweens.length : 0;
  11373. if ( stopped ) {
  11374. return this;
  11375. }
  11376. stopped = true;
  11377. for ( ; index < length; index++ ) {
  11378. animation.tweens[ index ].run( 1 );
  11379. }
  11380. // Resolve when we played the last frame; otherwise, reject
  11381. if ( gotoEnd ) {
  11382. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11383. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  11384. } else {
  11385. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  11386. }
  11387. return this;
  11388. }
  11389. } ),
  11390. props = animation.props;
  11391. propFilter( props, animation.opts.specialEasing );
  11392. for ( ; index < length; index++ ) {
  11393. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  11394. if ( result ) {
  11395. if ( isFunction( result.stop ) ) {
  11396. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  11397. result.stop.bind( result );
  11398. }
  11399. return result;
  11400. }
  11401. }
  11402. jQuery.map( props, createTween, animation );
  11403. if ( isFunction( animation.opts.start ) ) {
  11404. animation.opts.start.call( elem, animation );
  11405. }
  11406. // Attach callbacks from options
  11407. animation
  11408. .progress( animation.opts.progress )
  11409. .done( animation.opts.done, animation.opts.complete )
  11410. .fail( animation.opts.fail )
  11411. .always( animation.opts.always );
  11412. jQuery.fx.timer(
  11413. jQuery.extend( tick, {
  11414. elem: elem,
  11415. anim: animation,
  11416. queue: animation.opts.queue
  11417. } )
  11418. );
  11419. return animation;
  11420. }
  11421. jQuery.Animation = jQuery.extend( Animation, {
  11422. tweeners: {
  11423. "*": [ function( prop, value ) {
  11424. var tween = this.createTween( prop, value );
  11425. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  11426. return tween;
  11427. } ]
  11428. },
  11429. tweener: function( props, callback ) {
  11430. if ( isFunction( props ) ) {
  11431. callback = props;
  11432. props = [ "*" ];
  11433. } else {
  11434. props = props.match( rnothtmlwhite );
  11435. }
  11436. var prop,
  11437. index = 0,
  11438. length = props.length;
  11439. for ( ; index < length; index++ ) {
  11440. prop = props[ index ];
  11441. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  11442. Animation.tweeners[ prop ].unshift( callback );
  11443. }
  11444. },
  11445. prefilters: [ defaultPrefilter ],
  11446. prefilter: function( callback, prepend ) {
  11447. if ( prepend ) {
  11448. Animation.prefilters.unshift( callback );
  11449. } else {
  11450. Animation.prefilters.push( callback );
  11451. }
  11452. }
  11453. } );
  11454. jQuery.speed = function( speed, easing, fn ) {
  11455. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  11456. complete: fn || !fn && easing ||
  11457. isFunction( speed ) && speed,
  11458. duration: speed,
  11459. easing: fn && easing || easing && !isFunction( easing ) && easing
  11460. };
  11461. // Go to the end state if fx are off
  11462. if ( jQuery.fx.off ) {
  11463. opt.duration = 0;
  11464. } else {
  11465. if ( typeof opt.duration !== "number" ) {
  11466. if ( opt.duration in jQuery.fx.speeds ) {
  11467. opt.duration = jQuery.fx.speeds[ opt.duration ];
  11468. } else {
  11469. opt.duration = jQuery.fx.speeds._default;
  11470. }
  11471. }
  11472. }
  11473. // Normalize opt.queue - true/undefined/null -> "fx"
  11474. if ( opt.queue == null || opt.queue === true ) {
  11475. opt.queue = "fx";
  11476. }
  11477. // Queueing
  11478. opt.old = opt.complete;
  11479. opt.complete = function() {
  11480. if ( isFunction( opt.old ) ) {
  11481. opt.old.call( this );
  11482. }
  11483. if ( opt.queue ) {
  11484. jQuery.dequeue( this, opt.queue );
  11485. }
  11486. };
  11487. return opt;
  11488. };
  11489. jQuery.fn.extend( {
  11490. fadeTo: function( speed, to, easing, callback ) {
  11491. // Show any hidden elements after setting opacity to 0
  11492. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  11493. // Animate to the value specified
  11494. .end().animate( { opacity: to }, speed, easing, callback );
  11495. },
  11496. animate: function( prop, speed, easing, callback ) {
  11497. var empty = jQuery.isEmptyObject( prop ),
  11498. optall = jQuery.speed( speed, easing, callback ),
  11499. doAnimation = function() {
  11500. // Operate on a copy of prop so per-property easing won't be lost
  11501. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  11502. // Empty animations, or finishing resolves immediately
  11503. if ( empty || dataPriv.get( this, "finish" ) ) {
  11504. anim.stop( true );
  11505. }
  11506. };
  11507. doAnimation.finish = doAnimation;
  11508. return empty || optall.queue === false ?
  11509. this.each( doAnimation ) :
  11510. this.queue( optall.queue, doAnimation );
  11511. },
  11512. stop: function( type, clearQueue, gotoEnd ) {
  11513. var stopQueue = function( hooks ) {
  11514. var stop = hooks.stop;
  11515. delete hooks.stop;
  11516. stop( gotoEnd );
  11517. };
  11518. if ( typeof type !== "string" ) {
  11519. gotoEnd = clearQueue;
  11520. clearQueue = type;
  11521. type = undefined;
  11522. }
  11523. if ( clearQueue ) {
  11524. this.queue( type || "fx", [] );
  11525. }
  11526. return this.each( function() {
  11527. var dequeue = true,
  11528. index = type != null && type + "queueHooks",
  11529. timers = jQuery.timers,
  11530. data = dataPriv.get( this );
  11531. if ( index ) {
  11532. if ( data[ index ] && data[ index ].stop ) {
  11533. stopQueue( data[ index ] );
  11534. }
  11535. } else {
  11536. for ( index in data ) {
  11537. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  11538. stopQueue( data[ index ] );
  11539. }
  11540. }
  11541. }
  11542. for ( index = timers.length; index--; ) {
  11543. if ( timers[ index ].elem === this &&
  11544. ( type == null || timers[ index ].queue === type ) ) {
  11545. timers[ index ].anim.stop( gotoEnd );
  11546. dequeue = false;
  11547. timers.splice( index, 1 );
  11548. }
  11549. }
  11550. // Start the next in the queue if the last step wasn't forced.
  11551. // Timers currently will call their complete callbacks, which
  11552. // will dequeue but only if they were gotoEnd.
  11553. if ( dequeue || !gotoEnd ) {
  11554. jQuery.dequeue( this, type );
  11555. }
  11556. } );
  11557. },
  11558. finish: function( type ) {
  11559. if ( type !== false ) {
  11560. type = type || "fx";
  11561. }
  11562. return this.each( function() {
  11563. var index,
  11564. data = dataPriv.get( this ),
  11565. queue = data[ type + "queue" ],
  11566. hooks = data[ type + "queueHooks" ],
  11567. timers = jQuery.timers,
  11568. length = queue ? queue.length : 0;
  11569. // Enable finishing flag on private data
  11570. data.finish = true;
  11571. // Empty the queue first
  11572. jQuery.queue( this, type, [] );
  11573. if ( hooks && hooks.stop ) {
  11574. hooks.stop.call( this, true );
  11575. }
  11576. // Look for any active animations, and finish them
  11577. for ( index = timers.length; index--; ) {
  11578. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  11579. timers[ index ].anim.stop( true );
  11580. timers.splice( index, 1 );
  11581. }
  11582. }
  11583. // Look for any animations in the old queue and finish them
  11584. for ( index = 0; index < length; index++ ) {
  11585. if ( queue[ index ] && queue[ index ].finish ) {
  11586. queue[ index ].finish.call( this );
  11587. }
  11588. }
  11589. // Turn off finishing flag
  11590. delete data.finish;
  11591. } );
  11592. }
  11593. } );
  11594. jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
  11595. var cssFn = jQuery.fn[ name ];
  11596. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11597. return speed == null || typeof speed === "boolean" ?
  11598. cssFn.apply( this, arguments ) :
  11599. this.animate( genFx( name, true ), speed, easing, callback );
  11600. };
  11601. } );
  11602. // Generate shortcuts for custom animations
  11603. jQuery.each( {
  11604. slideDown: genFx( "show" ),
  11605. slideUp: genFx( "hide" ),
  11606. slideToggle: genFx( "toggle" ),
  11607. fadeIn: { opacity: "show" },
  11608. fadeOut: { opacity: "hide" },
  11609. fadeToggle: { opacity: "toggle" }
  11610. }, function( name, props ) {
  11611. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11612. return this.animate( props, speed, easing, callback );
  11613. };
  11614. } );
  11615. jQuery.timers = [];
  11616. jQuery.fx.tick = function() {
  11617. var timer,
  11618. i = 0,
  11619. timers = jQuery.timers;
  11620. fxNow = Date.now();
  11621. for ( ; i < timers.length; i++ ) {
  11622. timer = timers[ i ];
  11623. // Run the timer and safely remove it when done (allowing for external removal)
  11624. if ( !timer() && timers[ i ] === timer ) {
  11625. timers.splice( i--, 1 );
  11626. }
  11627. }
  11628. if ( !timers.length ) {
  11629. jQuery.fx.stop();
  11630. }
  11631. fxNow = undefined;
  11632. };
  11633. jQuery.fx.timer = function( timer ) {
  11634. jQuery.timers.push( timer );
  11635. jQuery.fx.start();
  11636. };
  11637. jQuery.fx.interval = 13;
  11638. jQuery.fx.start = function() {
  11639. if ( inProgress ) {
  11640. return;
  11641. }
  11642. inProgress = true;
  11643. schedule();
  11644. };
  11645. jQuery.fx.stop = function() {
  11646. inProgress = null;
  11647. };
  11648. jQuery.fx.speeds = {
  11649. slow: 600,
  11650. fast: 200,
  11651. // Default speed
  11652. _default: 400
  11653. };
  11654. // Based off of the plugin by Clint Helfers, with permission.
  11655. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  11656. jQuery.fn.delay = function( time, type ) {
  11657. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  11658. type = type || "fx";
  11659. return this.queue( type, function( next, hooks ) {
  11660. var timeout = window.setTimeout( next, time );
  11661. hooks.stop = function() {
  11662. window.clearTimeout( timeout );
  11663. };
  11664. } );
  11665. };
  11666. ( function() {
  11667. var input = document.createElement( "input" ),
  11668. select = document.createElement( "select" ),
  11669. opt = select.appendChild( document.createElement( "option" ) );
  11670. input.type = "checkbox";
  11671. // Support: Android <=4.3 only
  11672. // Default value for a checkbox should be "on"
  11673. support.checkOn = input.value !== "";
  11674. // Support: IE <=11 only
  11675. // Must access selectedIndex to make default options select
  11676. support.optSelected = opt.selected;
  11677. // Support: IE <=11 only
  11678. // An input loses its value after becoming a radio
  11679. input = document.createElement( "input" );
  11680. input.value = "t";
  11681. input.type = "radio";
  11682. support.radioValue = input.value === "t";
  11683. } )();
  11684. var boolHook,
  11685. attrHandle = jQuery.expr.attrHandle;
  11686. jQuery.fn.extend( {
  11687. attr: function( name, value ) {
  11688. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  11689. },
  11690. removeAttr: function( name ) {
  11691. return this.each( function() {
  11692. jQuery.removeAttr( this, name );
  11693. } );
  11694. }
  11695. } );
  11696. jQuery.extend( {
  11697. attr: function( elem, name, value ) {
  11698. var ret, hooks,
  11699. nType = elem.nodeType;
  11700. // Don't get/set attributes on text, comment and attribute nodes
  11701. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11702. return;
  11703. }
  11704. // Fallback to prop when attributes are not supported
  11705. if ( typeof elem.getAttribute === "undefined" ) {
  11706. return jQuery.prop( elem, name, value );
  11707. }
  11708. // Attribute hooks are determined by the lowercase version
  11709. // Grab necessary hook if one is defined
  11710. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11711. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  11712. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  11713. }
  11714. if ( value !== undefined ) {
  11715. if ( value === null ) {
  11716. jQuery.removeAttr( elem, name );
  11717. return;
  11718. }
  11719. if ( hooks && "set" in hooks &&
  11720. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11721. return ret;
  11722. }
  11723. elem.setAttribute( name, value + "" );
  11724. return value;
  11725. }
  11726. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11727. return ret;
  11728. }
  11729. ret = jQuery.find.attr( elem, name );
  11730. // Non-existent attributes return null, we normalize to undefined
  11731. return ret == null ? undefined : ret;
  11732. },
  11733. attrHooks: {
  11734. type: {
  11735. set: function( elem, value ) {
  11736. if ( !support.radioValue && value === "radio" &&
  11737. nodeName( elem, "input" ) ) {
  11738. var val = elem.value;
  11739. elem.setAttribute( "type", value );
  11740. if ( val ) {
  11741. elem.value = val;
  11742. }
  11743. return value;
  11744. }
  11745. }
  11746. }
  11747. },
  11748. removeAttr: function( elem, value ) {
  11749. var name,
  11750. i = 0,
  11751. // Attribute names can contain non-HTML whitespace characters
  11752. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  11753. attrNames = value && value.match( rnothtmlwhite );
  11754. if ( attrNames && elem.nodeType === 1 ) {
  11755. while ( ( name = attrNames[ i++ ] ) ) {
  11756. elem.removeAttribute( name );
  11757. }
  11758. }
  11759. }
  11760. } );
  11761. // Hooks for boolean attributes
  11762. boolHook = {
  11763. set: function( elem, value, name ) {
  11764. if ( value === false ) {
  11765. // Remove boolean attributes when set to false
  11766. jQuery.removeAttr( elem, name );
  11767. } else {
  11768. elem.setAttribute( name, name );
  11769. }
  11770. return name;
  11771. }
  11772. };
  11773. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  11774. var getter = attrHandle[ name ] || jQuery.find.attr;
  11775. attrHandle[ name ] = function( elem, name, isXML ) {
  11776. var ret, handle,
  11777. lowercaseName = name.toLowerCase();
  11778. if ( !isXML ) {
  11779. // Avoid an infinite loop by temporarily removing this function from the getter
  11780. handle = attrHandle[ lowercaseName ];
  11781. attrHandle[ lowercaseName ] = ret;
  11782. ret = getter( elem, name, isXML ) != null ?
  11783. lowercaseName :
  11784. null;
  11785. attrHandle[ lowercaseName ] = handle;
  11786. }
  11787. return ret;
  11788. };
  11789. } );
  11790. var rfocusable = /^(?:input|select|textarea|button)$/i,
  11791. rclickable = /^(?:a|area)$/i;
  11792. jQuery.fn.extend( {
  11793. prop: function( name, value ) {
  11794. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  11795. },
  11796. removeProp: function( name ) {
  11797. return this.each( function() {
  11798. delete this[ jQuery.propFix[ name ] || name ];
  11799. } );
  11800. }
  11801. } );
  11802. jQuery.extend( {
  11803. prop: function( elem, name, value ) {
  11804. var ret, hooks,
  11805. nType = elem.nodeType;
  11806. // Don't get/set properties on text, comment and attribute nodes
  11807. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11808. return;
  11809. }
  11810. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11811. // Fix name and attach hooks
  11812. name = jQuery.propFix[ name ] || name;
  11813. hooks = jQuery.propHooks[ name ];
  11814. }
  11815. if ( value !== undefined ) {
  11816. if ( hooks && "set" in hooks &&
  11817. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11818. return ret;
  11819. }
  11820. return ( elem[ name ] = value );
  11821. }
  11822. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11823. return ret;
  11824. }
  11825. return elem[ name ];
  11826. },
  11827. propHooks: {
  11828. tabIndex: {
  11829. get: function( elem ) {
  11830. // Support: IE <=9 - 11 only
  11831. // elem.tabIndex doesn't always return the
  11832. // correct value when it hasn't been explicitly set
  11833. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  11834. // Use proper attribute retrieval(#12072)
  11835. var tabindex = jQuery.find.attr( elem, "tabindex" );
  11836. if ( tabindex ) {
  11837. return parseInt( tabindex, 10 );
  11838. }
  11839. if (
  11840. rfocusable.test( elem.nodeName ) ||
  11841. rclickable.test( elem.nodeName ) &&
  11842. elem.href
  11843. ) {
  11844. return 0;
  11845. }
  11846. return -1;
  11847. }
  11848. }
  11849. },
  11850. propFix: {
  11851. "for": "htmlFor",
  11852. "class": "className"
  11853. }
  11854. } );
  11855. // Support: IE <=11 only
  11856. // Accessing the selectedIndex property
  11857. // forces the browser to respect setting selected
  11858. // on the option
  11859. // The getter ensures a default option is selected
  11860. // when in an optgroup
  11861. // eslint rule "no-unused-expressions" is disabled for this code
  11862. // since it considers such accessions noop
  11863. if ( !support.optSelected ) {
  11864. jQuery.propHooks.selected = {
  11865. get: function( elem ) {
  11866. /* eslint no-unused-expressions: "off" */
  11867. var parent = elem.parentNode;
  11868. if ( parent && parent.parentNode ) {
  11869. parent.parentNode.selectedIndex;
  11870. }
  11871. return null;
  11872. },
  11873. set: function( elem ) {
  11874. /* eslint no-unused-expressions: "off" */
  11875. var parent = elem.parentNode;
  11876. if ( parent ) {
  11877. parent.selectedIndex;
  11878. if ( parent.parentNode ) {
  11879. parent.parentNode.selectedIndex;
  11880. }
  11881. }
  11882. }
  11883. };
  11884. }
  11885. jQuery.each( [
  11886. "tabIndex",
  11887. "readOnly",
  11888. "maxLength",
  11889. "cellSpacing",
  11890. "cellPadding",
  11891. "rowSpan",
  11892. "colSpan",
  11893. "useMap",
  11894. "frameBorder",
  11895. "contentEditable"
  11896. ], function() {
  11897. jQuery.propFix[ this.toLowerCase() ] = this;
  11898. } );
  11899. // Strip and collapse whitespace according to HTML spec
  11900. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  11901. function stripAndCollapse( value ) {
  11902. var tokens = value.match( rnothtmlwhite ) || [];
  11903. return tokens.join( " " );
  11904. }
  11905. function getClass( elem ) {
  11906. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  11907. }
  11908. function classesToArray( value ) {
  11909. if ( Array.isArray( value ) ) {
  11910. return value;
  11911. }
  11912. if ( typeof value === "string" ) {
  11913. return value.match( rnothtmlwhite ) || [];
  11914. }
  11915. return [];
  11916. }
  11917. jQuery.fn.extend( {
  11918. addClass: function( value ) {
  11919. var classes, elem, cur, curValue, clazz, j, finalValue,
  11920. i = 0;
  11921. if ( isFunction( value ) ) {
  11922. return this.each( function( j ) {
  11923. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  11924. } );
  11925. }
  11926. classes = classesToArray( value );
  11927. if ( classes.length ) {
  11928. while ( ( elem = this[ i++ ] ) ) {
  11929. curValue = getClass( elem );
  11930. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11931. if ( cur ) {
  11932. j = 0;
  11933. while ( ( clazz = classes[ j++ ] ) ) {
  11934. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  11935. cur += clazz + " ";
  11936. }
  11937. }
  11938. // Only assign if different to avoid unneeded rendering.
  11939. finalValue = stripAndCollapse( cur );
  11940. if ( curValue !== finalValue ) {
  11941. elem.setAttribute( "class", finalValue );
  11942. }
  11943. }
  11944. }
  11945. }
  11946. return this;
  11947. },
  11948. removeClass: function( value ) {
  11949. var classes, elem, cur, curValue, clazz, j, finalValue,
  11950. i = 0;
  11951. if ( isFunction( value ) ) {
  11952. return this.each( function( j ) {
  11953. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  11954. } );
  11955. }
  11956. if ( !arguments.length ) {
  11957. return this.attr( "class", "" );
  11958. }
  11959. classes = classesToArray( value );
  11960. if ( classes.length ) {
  11961. while ( ( elem = this[ i++ ] ) ) {
  11962. curValue = getClass( elem );
  11963. // This expression is here for better compressibility (see addClass)
  11964. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11965. if ( cur ) {
  11966. j = 0;
  11967. while ( ( clazz = classes[ j++ ] ) ) {
  11968. // Remove *all* instances
  11969. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  11970. cur = cur.replace( " " + clazz + " ", " " );
  11971. }
  11972. }
  11973. // Only assign if different to avoid unneeded rendering.
  11974. finalValue = stripAndCollapse( cur );
  11975. if ( curValue !== finalValue ) {
  11976. elem.setAttribute( "class", finalValue );
  11977. }
  11978. }
  11979. }
  11980. }
  11981. return this;
  11982. },
  11983. toggleClass: function( value, stateVal ) {
  11984. var type = typeof value,
  11985. isValidValue = type === "string" || Array.isArray( value );
  11986. if ( typeof stateVal === "boolean" && isValidValue ) {
  11987. return stateVal ? this.addClass( value ) : this.removeClass( value );
  11988. }
  11989. if ( isFunction( value ) ) {
  11990. return this.each( function( i ) {
  11991. jQuery( this ).toggleClass(
  11992. value.call( this, i, getClass( this ), stateVal ),
  11993. stateVal
  11994. );
  11995. } );
  11996. }
  11997. return this.each( function() {
  11998. var className, i, self, classNames;
  11999. if ( isValidValue ) {
  12000. // Toggle individual class names
  12001. i = 0;
  12002. self = jQuery( this );
  12003. classNames = classesToArray( value );
  12004. while ( ( className = classNames[ i++ ] ) ) {
  12005. // Check each className given, space separated list
  12006. if ( self.hasClass( className ) ) {
  12007. self.removeClass( className );
  12008. } else {
  12009. self.addClass( className );
  12010. }
  12011. }
  12012. // Toggle whole class name
  12013. } else if ( value === undefined || type === "boolean" ) {
  12014. className = getClass( this );
  12015. if ( className ) {
  12016. // Store className if set
  12017. dataPriv.set( this, "__className__", className );
  12018. }
  12019. // If the element has a class name or if we're passed `false`,
  12020. // then remove the whole classname (if there was one, the above saved it).
  12021. // Otherwise bring back whatever was previously saved (if anything),
  12022. // falling back to the empty string if nothing was stored.
  12023. if ( this.setAttribute ) {
  12024. this.setAttribute( "class",
  12025. className || value === false ?
  12026. "" :
  12027. dataPriv.get( this, "__className__" ) || ""
  12028. );
  12029. }
  12030. }
  12031. } );
  12032. },
  12033. hasClass: function( selector ) {
  12034. var className, elem,
  12035. i = 0;
  12036. className = " " + selector + " ";
  12037. while ( ( elem = this[ i++ ] ) ) {
  12038. if ( elem.nodeType === 1 &&
  12039. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  12040. return true;
  12041. }
  12042. }
  12043. return false;
  12044. }
  12045. } );
  12046. var rreturn = /\r/g;
  12047. jQuery.fn.extend( {
  12048. val: function( value ) {
  12049. var hooks, ret, valueIsFunction,
  12050. elem = this[ 0 ];
  12051. if ( !arguments.length ) {
  12052. if ( elem ) {
  12053. hooks = jQuery.valHooks[ elem.type ] ||
  12054. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  12055. if ( hooks &&
  12056. "get" in hooks &&
  12057. ( ret = hooks.get( elem, "value" ) ) !== undefined
  12058. ) {
  12059. return ret;
  12060. }
  12061. ret = elem.value;
  12062. // Handle most common string cases
  12063. if ( typeof ret === "string" ) {
  12064. return ret.replace( rreturn, "" );
  12065. }
  12066. // Handle cases where value is null/undef or number
  12067. return ret == null ? "" : ret;
  12068. }
  12069. return;
  12070. }
  12071. valueIsFunction = isFunction( value );
  12072. return this.each( function( i ) {
  12073. var val;
  12074. if ( this.nodeType !== 1 ) {
  12075. return;
  12076. }
  12077. if ( valueIsFunction ) {
  12078. val = value.call( this, i, jQuery( this ).val() );
  12079. } else {
  12080. val = value;
  12081. }
  12082. // Treat null/undefined as ""; convert numbers to string
  12083. if ( val == null ) {
  12084. val = "";
  12085. } else if ( typeof val === "number" ) {
  12086. val += "";
  12087. } else if ( Array.isArray( val ) ) {
  12088. val = jQuery.map( val, function( value ) {
  12089. return value == null ? "" : value + "";
  12090. } );
  12091. }
  12092. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  12093. // If set returns undefined, fall back to normal setting
  12094. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  12095. this.value = val;
  12096. }
  12097. } );
  12098. }
  12099. } );
  12100. jQuery.extend( {
  12101. valHooks: {
  12102. option: {
  12103. get: function( elem ) {
  12104. var val = jQuery.find.attr( elem, "value" );
  12105. return val != null ?
  12106. val :
  12107. // Support: IE <=10 - 11 only
  12108. // option.text throws exceptions (#14686, #14858)
  12109. // Strip and collapse whitespace
  12110. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  12111. stripAndCollapse( jQuery.text( elem ) );
  12112. }
  12113. },
  12114. select: {
  12115. get: function( elem ) {
  12116. var value, option, i,
  12117. options = elem.options,
  12118. index = elem.selectedIndex,
  12119. one = elem.type === "select-one",
  12120. values = one ? null : [],
  12121. max = one ? index + 1 : options.length;
  12122. if ( index < 0 ) {
  12123. i = max;
  12124. } else {
  12125. i = one ? index : 0;
  12126. }
  12127. // Loop through all the selected options
  12128. for ( ; i < max; i++ ) {
  12129. option = options[ i ];
  12130. // Support: IE <=9 only
  12131. // IE8-9 doesn't update selected after form reset (#2551)
  12132. if ( ( option.selected || i === index ) &&
  12133. // Don't return options that are disabled or in a disabled optgroup
  12134. !option.disabled &&
  12135. ( !option.parentNode.disabled ||
  12136. !nodeName( option.parentNode, "optgroup" ) ) ) {
  12137. // Get the specific value for the option
  12138. value = jQuery( option ).val();
  12139. // We don't need an array for one selects
  12140. if ( one ) {
  12141. return value;
  12142. }
  12143. // Multi-Selects return an array
  12144. values.push( value );
  12145. }
  12146. }
  12147. return values;
  12148. },
  12149. set: function( elem, value ) {
  12150. var optionSet, option,
  12151. options = elem.options,
  12152. values = jQuery.makeArray( value ),
  12153. i = options.length;
  12154. while ( i-- ) {
  12155. option = options[ i ];
  12156. /* eslint-disable no-cond-assign */
  12157. if ( option.selected =
  12158. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  12159. ) {
  12160. optionSet = true;
  12161. }
  12162. /* eslint-enable no-cond-assign */
  12163. }
  12164. // Force browsers to behave consistently when non-matching value is set
  12165. if ( !optionSet ) {
  12166. elem.selectedIndex = -1;
  12167. }
  12168. return values;
  12169. }
  12170. }
  12171. }
  12172. } );
  12173. // Radios and checkboxes getter/setter
  12174. jQuery.each( [ "radio", "checkbox" ], function() {
  12175. jQuery.valHooks[ this ] = {
  12176. set: function( elem, value ) {
  12177. if ( Array.isArray( value ) ) {
  12178. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  12179. }
  12180. }
  12181. };
  12182. if ( !support.checkOn ) {
  12183. jQuery.valHooks[ this ].get = function( elem ) {
  12184. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  12185. };
  12186. }
  12187. } );
  12188. // Return jQuery for attributes-only inclusion
  12189. support.focusin = "onfocusin" in window;
  12190. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  12191. stopPropagationCallback = function( e ) {
  12192. e.stopPropagation();
  12193. };
  12194. jQuery.extend( jQuery.event, {
  12195. trigger: function( event, data, elem, onlyHandlers ) {
  12196. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  12197. eventPath = [ elem || document ],
  12198. type = hasOwn.call( event, "type" ) ? event.type : event,
  12199. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  12200. cur = lastElement = tmp = elem = elem || document;
  12201. // Don't do events on text and comment nodes
  12202. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  12203. return;
  12204. }
  12205. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  12206. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  12207. return;
  12208. }
  12209. if ( type.indexOf( "." ) > -1 ) {
  12210. // Namespaced trigger; create a regexp to match event type in handle()
  12211. namespaces = type.split( "." );
  12212. type = namespaces.shift();
  12213. namespaces.sort();
  12214. }
  12215. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  12216. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  12217. event = event[ jQuery.expando ] ?
  12218. event :
  12219. new jQuery.Event( type, typeof event === "object" && event );
  12220. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  12221. event.isTrigger = onlyHandlers ? 2 : 3;
  12222. event.namespace = namespaces.join( "." );
  12223. event.rnamespace = event.namespace ?
  12224. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  12225. null;
  12226. // Clean up the event in case it is being reused
  12227. event.result = undefined;
  12228. if ( !event.target ) {
  12229. event.target = elem;
  12230. }
  12231. // Clone any incoming data and prepend the event, creating the handler arg list
  12232. data = data == null ?
  12233. [ event ] :
  12234. jQuery.makeArray( data, [ event ] );
  12235. // Allow special events to draw outside the lines
  12236. special = jQuery.event.special[ type ] || {};
  12237. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  12238. return;
  12239. }
  12240. // Determine event propagation path in advance, per W3C events spec (#9951)
  12241. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  12242. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  12243. bubbleType = special.delegateType || type;
  12244. if ( !rfocusMorph.test( bubbleType + type ) ) {
  12245. cur = cur.parentNode;
  12246. }
  12247. for ( ; cur; cur = cur.parentNode ) {
  12248. eventPath.push( cur );
  12249. tmp = cur;
  12250. }
  12251. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  12252. if ( tmp === ( elem.ownerDocument || document ) ) {
  12253. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  12254. }
  12255. }
  12256. // Fire handlers on the event path
  12257. i = 0;
  12258. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  12259. lastElement = cur;
  12260. event.type = i > 1 ?
  12261. bubbleType :
  12262. special.bindType || type;
  12263. // jQuery handler
  12264. handle = (
  12265. dataPriv.get( cur, "events" ) || Object.create( null )
  12266. )[ event.type ] &&
  12267. dataPriv.get( cur, "handle" );
  12268. if ( handle ) {
  12269. handle.apply( cur, data );
  12270. }
  12271. // Native handler
  12272. handle = ontype && cur[ ontype ];
  12273. if ( handle && handle.apply && acceptData( cur ) ) {
  12274. event.result = handle.apply( cur, data );
  12275. if ( event.result === false ) {
  12276. event.preventDefault();
  12277. }
  12278. }
  12279. }
  12280. event.type = type;
  12281. // If nobody prevented the default action, do it now
  12282. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  12283. if ( ( !special._default ||
  12284. special._default.apply( eventPath.pop(), data ) === false ) &&
  12285. acceptData( elem ) ) {
  12286. // Call a native DOM method on the target with the same name as the event.
  12287. // Don't do default actions on window, that's where global variables be (#6170)
  12288. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  12289. // Don't re-trigger an onFOO event when we call its FOO() method
  12290. tmp = elem[ ontype ];
  12291. if ( tmp ) {
  12292. elem[ ontype ] = null;
  12293. }
  12294. // Prevent re-triggering of the same event, since we already bubbled it above
  12295. jQuery.event.triggered = type;
  12296. if ( event.isPropagationStopped() ) {
  12297. lastElement.addEventListener( type, stopPropagationCallback );
  12298. }
  12299. elem[ type ]();
  12300. if ( event.isPropagationStopped() ) {
  12301. lastElement.removeEventListener( type, stopPropagationCallback );
  12302. }
  12303. jQuery.event.triggered = undefined;
  12304. if ( tmp ) {
  12305. elem[ ontype ] = tmp;
  12306. }
  12307. }
  12308. }
  12309. }
  12310. return event.result;
  12311. },
  12312. // Piggyback on a donor event to simulate a different one
  12313. // Used only for `focus(in | out)` events
  12314. simulate: function( type, elem, event ) {
  12315. var e = jQuery.extend(
  12316. new jQuery.Event(),
  12317. event,
  12318. {
  12319. type: type,
  12320. isSimulated: true
  12321. }
  12322. );
  12323. jQuery.event.trigger( e, null, elem );
  12324. }
  12325. } );
  12326. jQuery.fn.extend( {
  12327. trigger: function( type, data ) {
  12328. return this.each( function() {
  12329. jQuery.event.trigger( type, data, this );
  12330. } );
  12331. },
  12332. triggerHandler: function( type, data ) {
  12333. var elem = this[ 0 ];
  12334. if ( elem ) {
  12335. return jQuery.event.trigger( type, data, elem, true );
  12336. }
  12337. }
  12338. } );
  12339. // Support: Firefox <=44
  12340. // Firefox doesn't have focus(in | out) events
  12341. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  12342. //
  12343. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  12344. // focus(in | out) events fire after focus & blur events,
  12345. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  12346. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  12347. if ( !support.focusin ) {
  12348. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  12349. // Attach a single capturing handler on the document while someone wants focusin/focusout
  12350. var handler = function( event ) {
  12351. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  12352. };
  12353. jQuery.event.special[ fix ] = {
  12354. setup: function() {
  12355. // Handle: regular nodes (via `this.ownerDocument`), window
  12356. // (via `this.document`) & document (via `this`).
  12357. var doc = this.ownerDocument || this.document || this,
  12358. attaches = dataPriv.access( doc, fix );
  12359. if ( !attaches ) {
  12360. doc.addEventListener( orig, handler, true );
  12361. }
  12362. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  12363. },
  12364. teardown: function() {
  12365. var doc = this.ownerDocument || this.document || this,
  12366. attaches = dataPriv.access( doc, fix ) - 1;
  12367. if ( !attaches ) {
  12368. doc.removeEventListener( orig, handler, true );
  12369. dataPriv.remove( doc, fix );
  12370. } else {
  12371. dataPriv.access( doc, fix, attaches );
  12372. }
  12373. }
  12374. };
  12375. } );
  12376. }
  12377. var location = window.location;
  12378. var nonce = { guid: Date.now() };
  12379. var rquery = ( /\?/ );
  12380. // Cross-browser xml parsing
  12381. jQuery.parseXML = function( data ) {
  12382. var xml;
  12383. if ( !data || typeof data !== "string" ) {
  12384. return null;
  12385. }
  12386. // Support: IE 9 - 11 only
  12387. // IE throws on parseFromString with invalid input.
  12388. try {
  12389. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  12390. } catch ( e ) {
  12391. xml = undefined;
  12392. }
  12393. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  12394. jQuery.error( "Invalid XML: " + data );
  12395. }
  12396. return xml;
  12397. };
  12398. var
  12399. rbracket = /\[\]$/,
  12400. rCRLF = /\r?\n/g,
  12401. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  12402. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  12403. function buildParams( prefix, obj, traditional, add ) {
  12404. var name;
  12405. if ( Array.isArray( obj ) ) {
  12406. // Serialize array item.
  12407. jQuery.each( obj, function( i, v ) {
  12408. if ( traditional || rbracket.test( prefix ) ) {
  12409. // Treat each array item as a scalar.
  12410. add( prefix, v );
  12411. } else {
  12412. // Item is non-scalar (array or object), encode its numeric index.
  12413. buildParams(
  12414. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  12415. v,
  12416. traditional,
  12417. add
  12418. );
  12419. }
  12420. } );
  12421. } else if ( !traditional && toType( obj ) === "object" ) {
  12422. // Serialize object item.
  12423. for ( name in obj ) {
  12424. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  12425. }
  12426. } else {
  12427. // Serialize scalar item.
  12428. add( prefix, obj );
  12429. }
  12430. }
  12431. // Serialize an array of form elements or a set of
  12432. // key/values into a query string
  12433. jQuery.param = function( a, traditional ) {
  12434. var prefix,
  12435. s = [],
  12436. add = function( key, valueOrFunction ) {
  12437. // If value is a function, invoke it and use its return value
  12438. var value = isFunction( valueOrFunction ) ?
  12439. valueOrFunction() :
  12440. valueOrFunction;
  12441. s[ s.length ] = encodeURIComponent( key ) + "=" +
  12442. encodeURIComponent( value == null ? "" : value );
  12443. };
  12444. if ( a == null ) {
  12445. return "";
  12446. }
  12447. // If an array was passed in, assume that it is an array of form elements.
  12448. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  12449. // Serialize the form elements
  12450. jQuery.each( a, function() {
  12451. add( this.name, this.value );
  12452. } );
  12453. } else {
  12454. // If traditional, encode the "old" way (the way 1.3.2 or older
  12455. // did it), otherwise encode params recursively.
  12456. for ( prefix in a ) {
  12457. buildParams( prefix, a[ prefix ], traditional, add );
  12458. }
  12459. }
  12460. // Return the resulting serialization
  12461. return s.join( "&" );
  12462. };
  12463. jQuery.fn.extend( {
  12464. serialize: function() {
  12465. return jQuery.param( this.serializeArray() );
  12466. },
  12467. serializeArray: function() {
  12468. return this.map( function() {
  12469. // Can add propHook for "elements" to filter or add form elements
  12470. var elements = jQuery.prop( this, "elements" );
  12471. return elements ? jQuery.makeArray( elements ) : this;
  12472. } )
  12473. .filter( function() {
  12474. var type = this.type;
  12475. // Use .is( ":disabled" ) so that fieldset[disabled] works
  12476. return this.name && !jQuery( this ).is( ":disabled" ) &&
  12477. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  12478. ( this.checked || !rcheckableType.test( type ) );
  12479. } )
  12480. .map( function( _i, elem ) {
  12481. var val = jQuery( this ).val();
  12482. if ( val == null ) {
  12483. return null;
  12484. }
  12485. if ( Array.isArray( val ) ) {
  12486. return jQuery.map( val, function( val ) {
  12487. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12488. } );
  12489. }
  12490. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12491. } ).get();
  12492. }
  12493. } );
  12494. var
  12495. r20 = /%20/g,
  12496. rhash = /#.*$/,
  12497. rantiCache = /([?&])_=[^&]*/,
  12498. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  12499. // #7653, #8125, #8152: local protocol detection
  12500. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  12501. rnoContent = /^(?:GET|HEAD)$/,
  12502. rprotocol = /^\/\//,
  12503. /* Prefilters
  12504. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  12505. * 2) These are called:
  12506. * - BEFORE asking for a transport
  12507. * - AFTER param serialization (s.data is a string if s.processData is true)
  12508. * 3) key is the dataType
  12509. * 4) the catchall symbol "*" can be used
  12510. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  12511. */
  12512. prefilters = {},
  12513. /* Transports bindings
  12514. * 1) key is the dataType
  12515. * 2) the catchall symbol "*" can be used
  12516. * 3) selection will start with transport dataType and THEN go to "*" if needed
  12517. */
  12518. transports = {},
  12519. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  12520. allTypes = "*/".concat( "*" ),
  12521. // Anchor tag for parsing the document origin
  12522. originAnchor = document.createElement( "a" );
  12523. originAnchor.href = location.href;
  12524. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  12525. function addToPrefiltersOrTransports( structure ) {
  12526. // dataTypeExpression is optional and defaults to "*"
  12527. return function( dataTypeExpression, func ) {
  12528. if ( typeof dataTypeExpression !== "string" ) {
  12529. func = dataTypeExpression;
  12530. dataTypeExpression = "*";
  12531. }
  12532. var dataType,
  12533. i = 0,
  12534. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  12535. if ( isFunction( func ) ) {
  12536. // For each dataType in the dataTypeExpression
  12537. while ( ( dataType = dataTypes[ i++ ] ) ) {
  12538. // Prepend if requested
  12539. if ( dataType[ 0 ] === "+" ) {
  12540. dataType = dataType.slice( 1 ) || "*";
  12541. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  12542. // Otherwise append
  12543. } else {
  12544. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  12545. }
  12546. }
  12547. }
  12548. };
  12549. }
  12550. // Base inspection function for prefilters and transports
  12551. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  12552. var inspected = {},
  12553. seekingTransport = ( structure === transports );
  12554. function inspect( dataType ) {
  12555. var selected;
  12556. inspected[ dataType ] = true;
  12557. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  12558. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  12559. if ( typeof dataTypeOrTransport === "string" &&
  12560. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  12561. options.dataTypes.unshift( dataTypeOrTransport );
  12562. inspect( dataTypeOrTransport );
  12563. return false;
  12564. } else if ( seekingTransport ) {
  12565. return !( selected = dataTypeOrTransport );
  12566. }
  12567. } );
  12568. return selected;
  12569. }
  12570. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  12571. }
  12572. // A special extend for ajax options
  12573. // that takes "flat" options (not to be deep extended)
  12574. // Fixes #9887
  12575. function ajaxExtend( target, src ) {
  12576. var key, deep,
  12577. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  12578. for ( key in src ) {
  12579. if ( src[ key ] !== undefined ) {
  12580. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  12581. }
  12582. }
  12583. if ( deep ) {
  12584. jQuery.extend( true, target, deep );
  12585. }
  12586. return target;
  12587. }
  12588. /* Handles responses to an ajax request:
  12589. * - finds the right dataType (mediates between content-type and expected dataType)
  12590. * - returns the corresponding response
  12591. */
  12592. function ajaxHandleResponses( s, jqXHR, responses ) {
  12593. var ct, type, finalDataType, firstDataType,
  12594. contents = s.contents,
  12595. dataTypes = s.dataTypes;
  12596. // Remove auto dataType and get content-type in the process
  12597. while ( dataTypes[ 0 ] === "*" ) {
  12598. dataTypes.shift();
  12599. if ( ct === undefined ) {
  12600. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  12601. }
  12602. }
  12603. // Check if we're dealing with a known content-type
  12604. if ( ct ) {
  12605. for ( type in contents ) {
  12606. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  12607. dataTypes.unshift( type );
  12608. break;
  12609. }
  12610. }
  12611. }
  12612. // Check to see if we have a response for the expected dataType
  12613. if ( dataTypes[ 0 ] in responses ) {
  12614. finalDataType = dataTypes[ 0 ];
  12615. } else {
  12616. // Try convertible dataTypes
  12617. for ( type in responses ) {
  12618. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  12619. finalDataType = type;
  12620. break;
  12621. }
  12622. if ( !firstDataType ) {
  12623. firstDataType = type;
  12624. }
  12625. }
  12626. // Or just use first one
  12627. finalDataType = finalDataType || firstDataType;
  12628. }
  12629. // If we found a dataType
  12630. // We add the dataType to the list if needed
  12631. // and return the corresponding response
  12632. if ( finalDataType ) {
  12633. if ( finalDataType !== dataTypes[ 0 ] ) {
  12634. dataTypes.unshift( finalDataType );
  12635. }
  12636. return responses[ finalDataType ];
  12637. }
  12638. }
  12639. /* Chain conversions given the request and the original response
  12640. * Also sets the responseXXX fields on the jqXHR instance
  12641. */
  12642. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  12643. var conv2, current, conv, tmp, prev,
  12644. converters = {},
  12645. // Work with a copy of dataTypes in case we need to modify it for conversion
  12646. dataTypes = s.dataTypes.slice();
  12647. // Create converters map with lowercased keys
  12648. if ( dataTypes[ 1 ] ) {
  12649. for ( conv in s.converters ) {
  12650. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  12651. }
  12652. }
  12653. current = dataTypes.shift();
  12654. // Convert to each sequential dataType
  12655. while ( current ) {
  12656. if ( s.responseFields[ current ] ) {
  12657. jqXHR[ s.responseFields[ current ] ] = response;
  12658. }
  12659. // Apply the dataFilter if provided
  12660. if ( !prev && isSuccess && s.dataFilter ) {
  12661. response = s.dataFilter( response, s.dataType );
  12662. }
  12663. prev = current;
  12664. current = dataTypes.shift();
  12665. if ( current ) {
  12666. // There's only work to do if current dataType is non-auto
  12667. if ( current === "*" ) {
  12668. current = prev;
  12669. // Convert response if prev dataType is non-auto and differs from current
  12670. } else if ( prev !== "*" && prev !== current ) {
  12671. // Seek a direct converter
  12672. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  12673. // If none found, seek a pair
  12674. if ( !conv ) {
  12675. for ( conv2 in converters ) {
  12676. // If conv2 outputs current
  12677. tmp = conv2.split( " " );
  12678. if ( tmp[ 1 ] === current ) {
  12679. // If prev can be converted to accepted input
  12680. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  12681. converters[ "* " + tmp[ 0 ] ];
  12682. if ( conv ) {
  12683. // Condense equivalence converters
  12684. if ( conv === true ) {
  12685. conv = converters[ conv2 ];
  12686. // Otherwise, insert the intermediate dataType
  12687. } else if ( converters[ conv2 ] !== true ) {
  12688. current = tmp[ 0 ];
  12689. dataTypes.unshift( tmp[ 1 ] );
  12690. }
  12691. break;
  12692. }
  12693. }
  12694. }
  12695. }
  12696. // Apply converter (if not an equivalence)
  12697. if ( conv !== true ) {
  12698. // Unless errors are allowed to bubble, catch and return them
  12699. if ( conv && s.throws ) {
  12700. response = conv( response );
  12701. } else {
  12702. try {
  12703. response = conv( response );
  12704. } catch ( e ) {
  12705. return {
  12706. state: "parsererror",
  12707. error: conv ? e : "No conversion from " + prev + " to " + current
  12708. };
  12709. }
  12710. }
  12711. }
  12712. }
  12713. }
  12714. }
  12715. return { state: "success", data: response };
  12716. }
  12717. jQuery.extend( {
  12718. // Counter for holding the number of active queries
  12719. active: 0,
  12720. // Last-Modified header cache for next request
  12721. lastModified: {},
  12722. etag: {},
  12723. ajaxSettings: {
  12724. url: location.href,
  12725. type: "GET",
  12726. isLocal: rlocalProtocol.test( location.protocol ),
  12727. global: true,
  12728. processData: true,
  12729. async: true,
  12730. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  12731. /*
  12732. timeout: 0,
  12733. data: null,
  12734. dataType: null,
  12735. username: null,
  12736. password: null,
  12737. cache: null,
  12738. throws: false,
  12739. traditional: false,
  12740. headers: {},
  12741. */
  12742. accepts: {
  12743. "*": allTypes,
  12744. text: "text/plain",
  12745. html: "text/html",
  12746. xml: "application/xml, text/xml",
  12747. json: "application/json, text/javascript"
  12748. },
  12749. contents: {
  12750. xml: /\bxml\b/,
  12751. html: /\bhtml/,
  12752. json: /\bjson\b/
  12753. },
  12754. responseFields: {
  12755. xml: "responseXML",
  12756. text: "responseText",
  12757. json: "responseJSON"
  12758. },
  12759. // Data converters
  12760. // Keys separate source (or catchall "*") and destination types with a single space
  12761. converters: {
  12762. // Convert anything to text
  12763. "* text": String,
  12764. // Text to html (true = no transformation)
  12765. "text html": true,
  12766. // Evaluate text as a json expression
  12767. "text json": JSON.parse,
  12768. // Parse text as xml
  12769. "text xml": jQuery.parseXML
  12770. },
  12771. // For options that shouldn't be deep extended:
  12772. // you can add your own custom options here if
  12773. // and when you create one that shouldn't be
  12774. // deep extended (see ajaxExtend)
  12775. flatOptions: {
  12776. url: true,
  12777. context: true
  12778. }
  12779. },
  12780. // Creates a full fledged settings object into target
  12781. // with both ajaxSettings and settings fields.
  12782. // If target is omitted, writes into ajaxSettings.
  12783. ajaxSetup: function( target, settings ) {
  12784. return settings ?
  12785. // Building a settings object
  12786. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  12787. // Extending ajaxSettings
  12788. ajaxExtend( jQuery.ajaxSettings, target );
  12789. },
  12790. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  12791. ajaxTransport: addToPrefiltersOrTransports( transports ),
  12792. // Main method
  12793. ajax: function( url, options ) {
  12794. // If url is an object, simulate pre-1.5 signature
  12795. if ( typeof url === "object" ) {
  12796. options = url;
  12797. url = undefined;
  12798. }
  12799. // Force options to be an object
  12800. options = options || {};
  12801. var transport,
  12802. // URL without anti-cache param
  12803. cacheURL,
  12804. // Response headers
  12805. responseHeadersString,
  12806. responseHeaders,
  12807. // timeout handle
  12808. timeoutTimer,
  12809. // Url cleanup var
  12810. urlAnchor,
  12811. // Request state (becomes false upon send and true upon completion)
  12812. completed,
  12813. // To know if global events are to be dispatched
  12814. fireGlobals,
  12815. // Loop variable
  12816. i,
  12817. // uncached part of the url
  12818. uncached,
  12819. // Create the final options object
  12820. s = jQuery.ajaxSetup( {}, options ),
  12821. // Callbacks context
  12822. callbackContext = s.context || s,
  12823. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  12824. globalEventContext = s.context &&
  12825. ( callbackContext.nodeType || callbackContext.jquery ) ?
  12826. jQuery( callbackContext ) :
  12827. jQuery.event,
  12828. // Deferreds
  12829. deferred = jQuery.Deferred(),
  12830. completeDeferred = jQuery.Callbacks( "once memory" ),
  12831. // Status-dependent callbacks
  12832. statusCode = s.statusCode || {},
  12833. // Headers (they are sent all at once)
  12834. requestHeaders = {},
  12835. requestHeadersNames = {},
  12836. // Default abort message
  12837. strAbort = "canceled",
  12838. // Fake xhr
  12839. jqXHR = {
  12840. readyState: 0,
  12841. // Builds headers hashtable if needed
  12842. getResponseHeader: function( key ) {
  12843. var match;
  12844. if ( completed ) {
  12845. if ( !responseHeaders ) {
  12846. responseHeaders = {};
  12847. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  12848. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  12849. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  12850. .concat( match[ 2 ] );
  12851. }
  12852. }
  12853. match = responseHeaders[ key.toLowerCase() + " " ];
  12854. }
  12855. return match == null ? null : match.join( ", " );
  12856. },
  12857. // Raw string
  12858. getAllResponseHeaders: function() {
  12859. return completed ? responseHeadersString : null;
  12860. },
  12861. // Caches the header
  12862. setRequestHeader: function( name, value ) {
  12863. if ( completed == null ) {
  12864. name = requestHeadersNames[ name.toLowerCase() ] =
  12865. requestHeadersNames[ name.toLowerCase() ] || name;
  12866. requestHeaders[ name ] = value;
  12867. }
  12868. return this;
  12869. },
  12870. // Overrides response content-type header
  12871. overrideMimeType: function( type ) {
  12872. if ( completed == null ) {
  12873. s.mimeType = type;
  12874. }
  12875. return this;
  12876. },
  12877. // Status-dependent callbacks
  12878. statusCode: function( map ) {
  12879. var code;
  12880. if ( map ) {
  12881. if ( completed ) {
  12882. // Execute the appropriate callbacks
  12883. jqXHR.always( map[ jqXHR.status ] );
  12884. } else {
  12885. // Lazy-add the new callbacks in a way that preserves old ones
  12886. for ( code in map ) {
  12887. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  12888. }
  12889. }
  12890. }
  12891. return this;
  12892. },
  12893. // Cancel the request
  12894. abort: function( statusText ) {
  12895. var finalText = statusText || strAbort;
  12896. if ( transport ) {
  12897. transport.abort( finalText );
  12898. }
  12899. done( 0, finalText );
  12900. return this;
  12901. }
  12902. };
  12903. // Attach deferreds
  12904. deferred.promise( jqXHR );
  12905. // Add protocol if not provided (prefilters might expect it)
  12906. // Handle falsy url in the settings object (#10093: consistency with old signature)
  12907. // We also use the url parameter if available
  12908. s.url = ( ( url || s.url || location.href ) + "" )
  12909. .replace( rprotocol, location.protocol + "//" );
  12910. // Alias method option to type as per ticket #12004
  12911. s.type = options.method || options.type || s.method || s.type;
  12912. // Extract dataTypes list
  12913. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  12914. // A cross-domain request is in order when the origin doesn't match the current origin.
  12915. if ( s.crossDomain == null ) {
  12916. urlAnchor = document.createElement( "a" );
  12917. // Support: IE <=8 - 11, Edge 12 - 15
  12918. // IE throws exception on accessing the href property if url is malformed,
  12919. // e.g. http://example.com:80x/
  12920. try {
  12921. urlAnchor.href = s.url;
  12922. // Support: IE <=8 - 11 only
  12923. // Anchor's host property isn't correctly set when s.url is relative
  12924. urlAnchor.href = urlAnchor.href;
  12925. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  12926. urlAnchor.protocol + "//" + urlAnchor.host;
  12927. } catch ( e ) {
  12928. // If there is an error parsing the URL, assume it is crossDomain,
  12929. // it can be rejected by the transport if it is invalid
  12930. s.crossDomain = true;
  12931. }
  12932. }
  12933. // Convert data if not already a string
  12934. if ( s.data && s.processData && typeof s.data !== "string" ) {
  12935. s.data = jQuery.param( s.data, s.traditional );
  12936. }
  12937. // Apply prefilters
  12938. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  12939. // If request was aborted inside a prefilter, stop there
  12940. if ( completed ) {
  12941. return jqXHR;
  12942. }
  12943. // We can fire global events as of now if asked to
  12944. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  12945. fireGlobals = jQuery.event && s.global;
  12946. // Watch for a new set of requests
  12947. if ( fireGlobals && jQuery.active++ === 0 ) {
  12948. jQuery.event.trigger( "ajaxStart" );
  12949. }
  12950. // Uppercase the type
  12951. s.type = s.type.toUpperCase();
  12952. // Determine if request has content
  12953. s.hasContent = !rnoContent.test( s.type );
  12954. // Save the URL in case we're toying with the If-Modified-Since
  12955. // and/or If-None-Match header later on
  12956. // Remove hash to simplify url manipulation
  12957. cacheURL = s.url.replace( rhash, "" );
  12958. // More options handling for requests with no content
  12959. if ( !s.hasContent ) {
  12960. // Remember the hash so we can put it back
  12961. uncached = s.url.slice( cacheURL.length );
  12962. // If data is available and should be processed, append data to url
  12963. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  12964. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  12965. // #9682: remove data so that it's not used in an eventual retry
  12966. delete s.data;
  12967. }
  12968. // Add or update anti-cache param if needed
  12969. if ( s.cache === false ) {
  12970. cacheURL = cacheURL.replace( rantiCache, "$1" );
  12971. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
  12972. uncached;
  12973. }
  12974. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  12975. s.url = cacheURL + uncached;
  12976. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  12977. } else if ( s.data && s.processData &&
  12978. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  12979. s.data = s.data.replace( r20, "+" );
  12980. }
  12981. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12982. if ( s.ifModified ) {
  12983. if ( jQuery.lastModified[ cacheURL ] ) {
  12984. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  12985. }
  12986. if ( jQuery.etag[ cacheURL ] ) {
  12987. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  12988. }
  12989. }
  12990. // Set the correct header, if data is being sent
  12991. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  12992. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  12993. }
  12994. // Set the Accepts header for the server, depending on the dataType
  12995. jqXHR.setRequestHeader(
  12996. "Accept",
  12997. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  12998. s.accepts[ s.dataTypes[ 0 ] ] +
  12999. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  13000. s.accepts[ "*" ]
  13001. );
  13002. // Check for headers option
  13003. for ( i in s.headers ) {
  13004. jqXHR.setRequestHeader( i, s.headers[ i ] );
  13005. }
  13006. // Allow custom headers/mimetypes and early abort
  13007. if ( s.beforeSend &&
  13008. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  13009. // Abort if not done already and return
  13010. return jqXHR.abort();
  13011. }
  13012. // Aborting is no longer a cancellation
  13013. strAbort = "abort";
  13014. // Install callbacks on deferreds
  13015. completeDeferred.add( s.complete );
  13016. jqXHR.done( s.success );
  13017. jqXHR.fail( s.error );
  13018. // Get transport
  13019. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  13020. // If no transport, we auto-abort
  13021. if ( !transport ) {
  13022. done( -1, "No Transport" );
  13023. } else {
  13024. jqXHR.readyState = 1;
  13025. // Send global event
  13026. if ( fireGlobals ) {
  13027. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  13028. }
  13029. // If request was aborted inside ajaxSend, stop there
  13030. if ( completed ) {
  13031. return jqXHR;
  13032. }
  13033. // Timeout
  13034. if ( s.async && s.timeout > 0 ) {
  13035. timeoutTimer = window.setTimeout( function() {
  13036. jqXHR.abort( "timeout" );
  13037. }, s.timeout );
  13038. }
  13039. try {
  13040. completed = false;
  13041. transport.send( requestHeaders, done );
  13042. } catch ( e ) {
  13043. // Rethrow post-completion exceptions
  13044. if ( completed ) {
  13045. throw e;
  13046. }
  13047. // Propagate others as results
  13048. done( -1, e );
  13049. }
  13050. }
  13051. // Callback for when everything is done
  13052. function done( status, nativeStatusText, responses, headers ) {
  13053. var isSuccess, success, error, response, modified,
  13054. statusText = nativeStatusText;
  13055. // Ignore repeat invocations
  13056. if ( completed ) {
  13057. return;
  13058. }
  13059. completed = true;
  13060. // Clear timeout if it exists
  13061. if ( timeoutTimer ) {
  13062. window.clearTimeout( timeoutTimer );
  13063. }
  13064. // Dereference transport for early garbage collection
  13065. // (no matter how long the jqXHR object will be used)
  13066. transport = undefined;
  13067. // Cache response headers
  13068. responseHeadersString = headers || "";
  13069. // Set readyState
  13070. jqXHR.readyState = status > 0 ? 4 : 0;
  13071. // Determine if successful
  13072. isSuccess = status >= 200 && status < 300 || status === 304;
  13073. // Get response data
  13074. if ( responses ) {
  13075. response = ajaxHandleResponses( s, jqXHR, responses );
  13076. }
  13077. // Use a noop converter for missing script
  13078. if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
  13079. s.converters[ "text script" ] = function() {};
  13080. }
  13081. // Convert no matter what (that way responseXXX fields are always set)
  13082. response = ajaxConvert( s, response, jqXHR, isSuccess );
  13083. // If successful, handle type chaining
  13084. if ( isSuccess ) {
  13085. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  13086. if ( s.ifModified ) {
  13087. modified = jqXHR.getResponseHeader( "Last-Modified" );
  13088. if ( modified ) {
  13089. jQuery.lastModified[ cacheURL ] = modified;
  13090. }
  13091. modified = jqXHR.getResponseHeader( "etag" );
  13092. if ( modified ) {
  13093. jQuery.etag[ cacheURL ] = modified;
  13094. }
  13095. }
  13096. // if no content
  13097. if ( status === 204 || s.type === "HEAD" ) {
  13098. statusText = "nocontent";
  13099. // if not modified
  13100. } else if ( status === 304 ) {
  13101. statusText = "notmodified";
  13102. // If we have data, let's convert it
  13103. } else {
  13104. statusText = response.state;
  13105. success = response.data;
  13106. error = response.error;
  13107. isSuccess = !error;
  13108. }
  13109. } else {
  13110. // Extract error from statusText and normalize for non-aborts
  13111. error = statusText;
  13112. if ( status || !statusText ) {
  13113. statusText = "error";
  13114. if ( status < 0 ) {
  13115. status = 0;
  13116. }
  13117. }
  13118. }
  13119. // Set data for the fake xhr object
  13120. jqXHR.status = status;
  13121. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  13122. // Success/Error
  13123. if ( isSuccess ) {
  13124. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  13125. } else {
  13126. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  13127. }
  13128. // Status-dependent callbacks
  13129. jqXHR.statusCode( statusCode );
  13130. statusCode = undefined;
  13131. if ( fireGlobals ) {
  13132. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  13133. [ jqXHR, s, isSuccess ? success : error ] );
  13134. }
  13135. // Complete
  13136. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  13137. if ( fireGlobals ) {
  13138. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  13139. // Handle the global AJAX counter
  13140. if ( !( --jQuery.active ) ) {
  13141. jQuery.event.trigger( "ajaxStop" );
  13142. }
  13143. }
  13144. }
  13145. return jqXHR;
  13146. },
  13147. getJSON: function( url, data, callback ) {
  13148. return jQuery.get( url, data, callback, "json" );
  13149. },
  13150. getScript: function( url, callback ) {
  13151. return jQuery.get( url, undefined, callback, "script" );
  13152. }
  13153. } );
  13154. jQuery.each( [ "get", "post" ], function( _i, method ) {
  13155. jQuery[ method ] = function( url, data, callback, type ) {
  13156. // Shift arguments if data argument was omitted
  13157. if ( isFunction( data ) ) {
  13158. type = type || callback;
  13159. callback = data;
  13160. data = undefined;
  13161. }
  13162. // The url can be an options object (which then must have .url)
  13163. return jQuery.ajax( jQuery.extend( {
  13164. url: url,
  13165. type: method,
  13166. dataType: type,
  13167. data: data,
  13168. success: callback
  13169. }, jQuery.isPlainObject( url ) && url ) );
  13170. };
  13171. } );
  13172. jQuery.ajaxPrefilter( function( s ) {
  13173. var i;
  13174. for ( i in s.headers ) {
  13175. if ( i.toLowerCase() === "content-type" ) {
  13176. s.contentType = s.headers[ i ] || "";
  13177. }
  13178. }
  13179. } );
  13180. jQuery._evalUrl = function( url, options, doc ) {
  13181. return jQuery.ajax( {
  13182. url: url,
  13183. // Make this explicit, since user can override this through ajaxSetup (#11264)
  13184. type: "GET",
  13185. dataType: "script",
  13186. cache: true,
  13187. async: false,
  13188. global: false,
  13189. // Only evaluate the response if it is successful (gh-4126)
  13190. // dataFilter is not invoked for failure responses, so using it instead
  13191. // of the default converter is kludgy but it works.
  13192. converters: {
  13193. "text script": function() {}
  13194. },
  13195. dataFilter: function( response ) {
  13196. jQuery.globalEval( response, options, doc );
  13197. }
  13198. } );
  13199. };
  13200. jQuery.fn.extend( {
  13201. wrapAll: function( html ) {
  13202. var wrap;
  13203. if ( this[ 0 ] ) {
  13204. if ( isFunction( html ) ) {
  13205. html = html.call( this[ 0 ] );
  13206. }
  13207. // The elements to wrap the target around
  13208. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  13209. if ( this[ 0 ].parentNode ) {
  13210. wrap.insertBefore( this[ 0 ] );
  13211. }
  13212. wrap.map( function() {
  13213. var elem = this;
  13214. while ( elem.firstElementChild ) {
  13215. elem = elem.firstElementChild;
  13216. }
  13217. return elem;
  13218. } ).append( this );
  13219. }
  13220. return this;
  13221. },
  13222. wrapInner: function( html ) {
  13223. if ( isFunction( html ) ) {
  13224. return this.each( function( i ) {
  13225. jQuery( this ).wrapInner( html.call( this, i ) );
  13226. } );
  13227. }
  13228. return this.each( function() {
  13229. var self = jQuery( this ),
  13230. contents = self.contents();
  13231. if ( contents.length ) {
  13232. contents.wrapAll( html );
  13233. } else {
  13234. self.append( html );
  13235. }
  13236. } );
  13237. },
  13238. wrap: function( html ) {
  13239. var htmlIsFunction = isFunction( html );
  13240. return this.each( function( i ) {
  13241. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  13242. } );
  13243. },
  13244. unwrap: function( selector ) {
  13245. this.parent( selector ).not( "body" ).each( function() {
  13246. jQuery( this ).replaceWith( this.childNodes );
  13247. } );
  13248. return this;
  13249. }
  13250. } );
  13251. jQuery.expr.pseudos.hidden = function( elem ) {
  13252. return !jQuery.expr.pseudos.visible( elem );
  13253. };
  13254. jQuery.expr.pseudos.visible = function( elem ) {
  13255. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  13256. };
  13257. jQuery.ajaxSettings.xhr = function() {
  13258. try {
  13259. return new window.XMLHttpRequest();
  13260. } catch ( e ) {}
  13261. };
  13262. var xhrSuccessStatus = {
  13263. // File protocol always yields status code 0, assume 200
  13264. 0: 200,
  13265. // Support: IE <=9 only
  13266. // #1450: sometimes IE returns 1223 when it should be 204
  13267. 1223: 204
  13268. },
  13269. xhrSupported = jQuery.ajaxSettings.xhr();
  13270. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  13271. support.ajax = xhrSupported = !!xhrSupported;
  13272. jQuery.ajaxTransport( function( options ) {
  13273. var callback, errorCallback;
  13274. // Cross domain only allowed if supported through XMLHttpRequest
  13275. if ( support.cors || xhrSupported && !options.crossDomain ) {
  13276. return {
  13277. send: function( headers, complete ) {
  13278. var i,
  13279. xhr = options.xhr();
  13280. xhr.open(
  13281. options.type,
  13282. options.url,
  13283. options.async,
  13284. options.username,
  13285. options.password
  13286. );
  13287. // Apply custom fields if provided
  13288. if ( options.xhrFields ) {
  13289. for ( i in options.xhrFields ) {
  13290. xhr[ i ] = options.xhrFields[ i ];
  13291. }
  13292. }
  13293. // Override mime type if needed
  13294. if ( options.mimeType && xhr.overrideMimeType ) {
  13295. xhr.overrideMimeType( options.mimeType );
  13296. }
  13297. // X-Requested-With header
  13298. // For cross-domain requests, seeing as conditions for a preflight are
  13299. // akin to a jigsaw puzzle, we simply never set it to be sure.
  13300. // (it can always be set on a per-request basis or even using ajaxSetup)
  13301. // For same-domain requests, won't change header if already provided.
  13302. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  13303. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  13304. }
  13305. // Set headers
  13306. for ( i in headers ) {
  13307. xhr.setRequestHeader( i, headers[ i ] );
  13308. }
  13309. // Callback
  13310. callback = function( type ) {
  13311. return function() {
  13312. if ( callback ) {
  13313. callback = errorCallback = xhr.onload =
  13314. xhr.onerror = xhr.onabort = xhr.ontimeout =
  13315. xhr.onreadystatechange = null;
  13316. if ( type === "abort" ) {
  13317. xhr.abort();
  13318. } else if ( type === "error" ) {
  13319. // Support: IE <=9 only
  13320. // On a manual native abort, IE9 throws
  13321. // errors on any property access that is not readyState
  13322. if ( typeof xhr.status !== "number" ) {
  13323. complete( 0, "error" );
  13324. } else {
  13325. complete(
  13326. // File: protocol always yields status 0; see #8605, #14207
  13327. xhr.status,
  13328. xhr.statusText
  13329. );
  13330. }
  13331. } else {
  13332. complete(
  13333. xhrSuccessStatus[ xhr.status ] || xhr.status,
  13334. xhr.statusText,
  13335. // Support: IE <=9 only
  13336. // IE9 has no XHR2 but throws on binary (trac-11426)
  13337. // For XHR2 non-text, let the caller handle it (gh-2498)
  13338. ( xhr.responseType || "text" ) !== "text" ||
  13339. typeof xhr.responseText !== "string" ?
  13340. { binary: xhr.response } :
  13341. { text: xhr.responseText },
  13342. xhr.getAllResponseHeaders()
  13343. );
  13344. }
  13345. }
  13346. };
  13347. };
  13348. // Listen to events
  13349. xhr.onload = callback();
  13350. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  13351. // Support: IE 9 only
  13352. // Use onreadystatechange to replace onabort
  13353. // to handle uncaught aborts
  13354. if ( xhr.onabort !== undefined ) {
  13355. xhr.onabort = errorCallback;
  13356. } else {
  13357. xhr.onreadystatechange = function() {
  13358. // Check readyState before timeout as it changes
  13359. if ( xhr.readyState === 4 ) {
  13360. // Allow onerror to be called first,
  13361. // but that will not handle a native abort
  13362. // Also, save errorCallback to a variable
  13363. // as xhr.onerror cannot be accessed
  13364. window.setTimeout( function() {
  13365. if ( callback ) {
  13366. errorCallback();
  13367. }
  13368. } );
  13369. }
  13370. };
  13371. }
  13372. // Create the abort callback
  13373. callback = callback( "abort" );
  13374. try {
  13375. // Do send the request (this may raise an exception)
  13376. xhr.send( options.hasContent && options.data || null );
  13377. } catch ( e ) {
  13378. // #14683: Only rethrow if this hasn't been notified as an error yet
  13379. if ( callback ) {
  13380. throw e;
  13381. }
  13382. }
  13383. },
  13384. abort: function() {
  13385. if ( callback ) {
  13386. callback();
  13387. }
  13388. }
  13389. };
  13390. }
  13391. } );
  13392. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  13393. jQuery.ajaxPrefilter( function( s ) {
  13394. if ( s.crossDomain ) {
  13395. s.contents.script = false;
  13396. }
  13397. } );
  13398. // Install script dataType
  13399. jQuery.ajaxSetup( {
  13400. accepts: {
  13401. script: "text/javascript, application/javascript, " +
  13402. "application/ecmascript, application/x-ecmascript"
  13403. },
  13404. contents: {
  13405. script: /\b(?:java|ecma)script\b/
  13406. },
  13407. converters: {
  13408. "text script": function( text ) {
  13409. jQuery.globalEval( text );
  13410. return text;
  13411. }
  13412. }
  13413. } );
  13414. // Handle cache's special case and crossDomain
  13415. jQuery.ajaxPrefilter( "script", function( s ) {
  13416. if ( s.cache === undefined ) {
  13417. s.cache = false;
  13418. }
  13419. if ( s.crossDomain ) {
  13420. s.type = "GET";
  13421. }
  13422. } );
  13423. // Bind script tag hack transport
  13424. jQuery.ajaxTransport( "script", function( s ) {
  13425. // This transport only deals with cross domain or forced-by-attrs requests
  13426. if ( s.crossDomain || s.scriptAttrs ) {
  13427. var script, callback;
  13428. return {
  13429. send: function( _, complete ) {
  13430. script = jQuery( "<script>" )
  13431. .attr( s.scriptAttrs || {} )
  13432. .prop( { charset: s.scriptCharset, src: s.url } )
  13433. .on( "load error", callback = function( evt ) {
  13434. script.remove();
  13435. callback = null;
  13436. if ( evt ) {
  13437. complete( evt.type === "error" ? 404 : 200, evt.type );
  13438. }
  13439. } );
  13440. // Use native DOM manipulation to avoid our domManip AJAX trickery
  13441. document.head.appendChild( script[ 0 ] );
  13442. },
  13443. abort: function() {
  13444. if ( callback ) {
  13445. callback();
  13446. }
  13447. }
  13448. };
  13449. }
  13450. } );
  13451. var oldCallbacks = [],
  13452. rjsonp = /(=)\?(?=&|$)|\?\?/;
  13453. // Default jsonp settings
  13454. jQuery.ajaxSetup( {
  13455. jsonp: "callback",
  13456. jsonpCallback: function() {
  13457. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
  13458. this[ callback ] = true;
  13459. return callback;
  13460. }
  13461. } );
  13462. // Detect, normalize options and install callbacks for jsonp requests
  13463. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  13464. var callbackName, overwritten, responseContainer,
  13465. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  13466. "url" :
  13467. typeof s.data === "string" &&
  13468. ( s.contentType || "" )
  13469. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  13470. rjsonp.test( s.data ) && "data"
  13471. );
  13472. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  13473. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  13474. // Get callback name, remembering preexisting value associated with it
  13475. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  13476. s.jsonpCallback() :
  13477. s.jsonpCallback;
  13478. // Insert callback into url or form data
  13479. if ( jsonProp ) {
  13480. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  13481. } else if ( s.jsonp !== false ) {
  13482. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  13483. }
  13484. // Use data converter to retrieve json after script execution
  13485. s.converters[ "script json" ] = function() {
  13486. if ( !responseContainer ) {
  13487. jQuery.error( callbackName + " was not called" );
  13488. }
  13489. return responseContainer[ 0 ];
  13490. };
  13491. // Force json dataType
  13492. s.dataTypes[ 0 ] = "json";
  13493. // Install callback
  13494. overwritten = window[ callbackName ];
  13495. window[ callbackName ] = function() {
  13496. responseContainer = arguments;
  13497. };
  13498. // Clean-up function (fires after converters)
  13499. jqXHR.always( function() {
  13500. // If previous value didn't exist - remove it
  13501. if ( overwritten === undefined ) {
  13502. jQuery( window ).removeProp( callbackName );
  13503. // Otherwise restore preexisting value
  13504. } else {
  13505. window[ callbackName ] = overwritten;
  13506. }
  13507. // Save back as free
  13508. if ( s[ callbackName ] ) {
  13509. // Make sure that re-using the options doesn't screw things around
  13510. s.jsonpCallback = originalSettings.jsonpCallback;
  13511. // Save the callback name for future use
  13512. oldCallbacks.push( callbackName );
  13513. }
  13514. // Call if it was a function and we have a response
  13515. if ( responseContainer && isFunction( overwritten ) ) {
  13516. overwritten( responseContainer[ 0 ] );
  13517. }
  13518. responseContainer = overwritten = undefined;
  13519. } );
  13520. // Delegate to script
  13521. return "script";
  13522. }
  13523. } );
  13524. // Support: Safari 8 only
  13525. // In Safari 8 documents created via document.implementation.createHTMLDocument
  13526. // collapse sibling forms: the second one becomes a child of the first one.
  13527. // Because of that, this security measure has to be disabled in Safari 8.
  13528. // https://bugs.webkit.org/show_bug.cgi?id=137337
  13529. support.createHTMLDocument = ( function() {
  13530. var body = document.implementation.createHTMLDocument( "" ).body;
  13531. body.innerHTML = "<form></form><form></form>";
  13532. return body.childNodes.length === 2;
  13533. } )();
  13534. // Argument "data" should be string of html
  13535. // context (optional): If specified, the fragment will be created in this context,
  13536. // defaults to document
  13537. // keepScripts (optional): If true, will include scripts passed in the html string
  13538. jQuery.parseHTML = function( data, context, keepScripts ) {
  13539. if ( typeof data !== "string" ) {
  13540. return [];
  13541. }
  13542. if ( typeof context === "boolean" ) {
  13543. keepScripts = context;
  13544. context = false;
  13545. }
  13546. var base, parsed, scripts;
  13547. if ( !context ) {
  13548. // Stop scripts or inline event handlers from being executed immediately
  13549. // by using document.implementation
  13550. if ( support.createHTMLDocument ) {
  13551. context = document.implementation.createHTMLDocument( "" );
  13552. // Set the base href for the created document
  13553. // so any parsed elements with URLs
  13554. // are based on the document's URL (gh-2965)
  13555. base = context.createElement( "base" );
  13556. base.href = document.location.href;
  13557. context.head.appendChild( base );
  13558. } else {
  13559. context = document;
  13560. }
  13561. }
  13562. parsed = rsingleTag.exec( data );
  13563. scripts = !keepScripts && [];
  13564. // Single tag
  13565. if ( parsed ) {
  13566. return [ context.createElement( parsed[ 1 ] ) ];
  13567. }
  13568. parsed = buildFragment( [ data ], context, scripts );
  13569. if ( scripts && scripts.length ) {
  13570. jQuery( scripts ).remove();
  13571. }
  13572. return jQuery.merge( [], parsed.childNodes );
  13573. };
  13574. /**
  13575. * Load a url into a page
  13576. */
  13577. jQuery.fn.load = function( url, params, callback ) {
  13578. var selector, type, response,
  13579. self = this,
  13580. off = url.indexOf( " " );
  13581. if ( off > -1 ) {
  13582. selector = stripAndCollapse( url.slice( off ) );
  13583. url = url.slice( 0, off );
  13584. }
  13585. // If it's a function
  13586. if ( isFunction( params ) ) {
  13587. // We assume that it's the callback
  13588. callback = params;
  13589. params = undefined;
  13590. // Otherwise, build a param string
  13591. } else if ( params && typeof params === "object" ) {
  13592. type = "POST";
  13593. }
  13594. // If we have elements to modify, make the request
  13595. if ( self.length > 0 ) {
  13596. jQuery.ajax( {
  13597. url: url,
  13598. // If "type" variable is undefined, then "GET" method will be used.
  13599. // Make value of this field explicit since
  13600. // user can override it through ajaxSetup method
  13601. type: type || "GET",
  13602. dataType: "html",
  13603. data: params
  13604. } ).done( function( responseText ) {
  13605. // Save response for use in complete callback
  13606. response = arguments;
  13607. self.html( selector ?
  13608. // If a selector was specified, locate the right elements in a dummy div
  13609. // Exclude scripts to avoid IE 'Permission Denied' errors
  13610. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  13611. // Otherwise use the full result
  13612. responseText );
  13613. // If the request succeeds, this function gets "data", "status", "jqXHR"
  13614. // but they are ignored because response was set above.
  13615. // If it fails, this function gets "jqXHR", "status", "error"
  13616. } ).always( callback && function( jqXHR, status ) {
  13617. self.each( function() {
  13618. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  13619. } );
  13620. } );
  13621. }
  13622. return this;
  13623. };
  13624. jQuery.expr.pseudos.animated = function( elem ) {
  13625. return jQuery.grep( jQuery.timers, function( fn ) {
  13626. return elem === fn.elem;
  13627. } ).length;
  13628. };
  13629. jQuery.offset = {
  13630. setOffset: function( elem, options, i ) {
  13631. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  13632. position = jQuery.css( elem, "position" ),
  13633. curElem = jQuery( elem ),
  13634. props = {};
  13635. // Set position first, in-case top/left are set even on static elem
  13636. if ( position === "static" ) {
  13637. elem.style.position = "relative";
  13638. }
  13639. curOffset = curElem.offset();
  13640. curCSSTop = jQuery.css( elem, "top" );
  13641. curCSSLeft = jQuery.css( elem, "left" );
  13642. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  13643. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  13644. // Need to be able to calculate position if either
  13645. // top or left is auto and position is either absolute or fixed
  13646. if ( calculatePosition ) {
  13647. curPosition = curElem.position();
  13648. curTop = curPosition.top;
  13649. curLeft = curPosition.left;
  13650. } else {
  13651. curTop = parseFloat( curCSSTop ) || 0;
  13652. curLeft = parseFloat( curCSSLeft ) || 0;
  13653. }
  13654. if ( isFunction( options ) ) {
  13655. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  13656. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  13657. }
  13658. if ( options.top != null ) {
  13659. props.top = ( options.top - curOffset.top ) + curTop;
  13660. }
  13661. if ( options.left != null ) {
  13662. props.left = ( options.left - curOffset.left ) + curLeft;
  13663. }
  13664. if ( "using" in options ) {
  13665. options.using.call( elem, props );
  13666. } else {
  13667. if ( typeof props.top === "number" ) {
  13668. props.top += "px";
  13669. }
  13670. if ( typeof props.left === "number" ) {
  13671. props.left += "px";
  13672. }
  13673. curElem.css( props );
  13674. }
  13675. }
  13676. };
  13677. jQuery.fn.extend( {
  13678. // offset() relates an element's border box to the document origin
  13679. offset: function( options ) {
  13680. // Preserve chaining for setter
  13681. if ( arguments.length ) {
  13682. return options === undefined ?
  13683. this :
  13684. this.each( function( i ) {
  13685. jQuery.offset.setOffset( this, options, i );
  13686. } );
  13687. }
  13688. var rect, win,
  13689. elem = this[ 0 ];
  13690. if ( !elem ) {
  13691. return;
  13692. }
  13693. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  13694. // Support: IE <=11 only
  13695. // Running getBoundingClientRect on a
  13696. // disconnected node in IE throws an error
  13697. if ( !elem.getClientRects().length ) {
  13698. return { top: 0, left: 0 };
  13699. }
  13700. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  13701. rect = elem.getBoundingClientRect();
  13702. win = elem.ownerDocument.defaultView;
  13703. return {
  13704. top: rect.top + win.pageYOffset,
  13705. left: rect.left + win.pageXOffset
  13706. };
  13707. },
  13708. // position() relates an element's margin box to its offset parent's padding box
  13709. // This corresponds to the behavior of CSS absolute positioning
  13710. position: function() {
  13711. if ( !this[ 0 ] ) {
  13712. return;
  13713. }
  13714. var offsetParent, offset, doc,
  13715. elem = this[ 0 ],
  13716. parentOffset = { top: 0, left: 0 };
  13717. // position:fixed elements are offset from the viewport, which itself always has zero offset
  13718. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  13719. // Assume position:fixed implies availability of getBoundingClientRect
  13720. offset = elem.getBoundingClientRect();
  13721. } else {
  13722. offset = this.offset();
  13723. // Account for the *real* offset parent, which can be the document or its root element
  13724. // when a statically positioned element is identified
  13725. doc = elem.ownerDocument;
  13726. offsetParent = elem.offsetParent || doc.documentElement;
  13727. while ( offsetParent &&
  13728. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  13729. jQuery.css( offsetParent, "position" ) === "static" ) {
  13730. offsetParent = offsetParent.parentNode;
  13731. }
  13732. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  13733. // Incorporate borders into its offset, since they are outside its content origin
  13734. parentOffset = jQuery( offsetParent ).offset();
  13735. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  13736. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  13737. }
  13738. }
  13739. // Subtract parent offsets and element margins
  13740. return {
  13741. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  13742. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  13743. };
  13744. },
  13745. // This method will return documentElement in the following cases:
  13746. // 1) For the element inside the iframe without offsetParent, this method will return
  13747. // documentElement of the parent window
  13748. // 2) For the hidden or detached element
  13749. // 3) For body or html element, i.e. in case of the html node - it will return itself
  13750. //
  13751. // but those exceptions were never presented as a real life use-cases
  13752. // and might be considered as more preferable results.
  13753. //
  13754. // This logic, however, is not guaranteed and can change at any point in the future
  13755. offsetParent: function() {
  13756. return this.map( function() {
  13757. var offsetParent = this.offsetParent;
  13758. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  13759. offsetParent = offsetParent.offsetParent;
  13760. }
  13761. return offsetParent || documentElement;
  13762. } );
  13763. }
  13764. } );
  13765. // Create scrollLeft and scrollTop methods
  13766. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  13767. var top = "pageYOffset" === prop;
  13768. jQuery.fn[ method ] = function( val ) {
  13769. return access( this, function( elem, method, val ) {
  13770. // Coalesce documents and windows
  13771. var win;
  13772. if ( isWindow( elem ) ) {
  13773. win = elem;
  13774. } else if ( elem.nodeType === 9 ) {
  13775. win = elem.defaultView;
  13776. }
  13777. if ( val === undefined ) {
  13778. return win ? win[ prop ] : elem[ method ];
  13779. }
  13780. if ( win ) {
  13781. win.scrollTo(
  13782. !top ? val : win.pageXOffset,
  13783. top ? val : win.pageYOffset
  13784. );
  13785. } else {
  13786. elem[ method ] = val;
  13787. }
  13788. }, method, val, arguments.length );
  13789. };
  13790. } );
  13791. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  13792. // Add the top/left cssHooks using jQuery.fn.position
  13793. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  13794. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  13795. // getComputedStyle returns percent when specified for top/left/bottom/right;
  13796. // rather than make the css module depend on the offset module, just check for it here
  13797. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  13798. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  13799. function( elem, computed ) {
  13800. if ( computed ) {
  13801. computed = curCSS( elem, prop );
  13802. // If curCSS returns percentage, fallback to offset
  13803. return rnumnonpx.test( computed ) ?
  13804. jQuery( elem ).position()[ prop ] + "px" :
  13805. computed;
  13806. }
  13807. }
  13808. );
  13809. } );
  13810. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  13811. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  13812. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  13813. function( defaultExtra, funcName ) {
  13814. // Margin is only for outerHeight, outerWidth
  13815. jQuery.fn[ funcName ] = function( margin, value ) {
  13816. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  13817. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  13818. return access( this, function( elem, type, value ) {
  13819. var doc;
  13820. if ( isWindow( elem ) ) {
  13821. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  13822. return funcName.indexOf( "outer" ) === 0 ?
  13823. elem[ "inner" + name ] :
  13824. elem.document.documentElement[ "client" + name ];
  13825. }
  13826. // Get document width or height
  13827. if ( elem.nodeType === 9 ) {
  13828. doc = elem.documentElement;
  13829. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  13830. // whichever is greatest
  13831. return Math.max(
  13832. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  13833. elem.body[ "offset" + name ], doc[ "offset" + name ],
  13834. doc[ "client" + name ]
  13835. );
  13836. }
  13837. return value === undefined ?
  13838. // Get width or height on the element, requesting but not forcing parseFloat
  13839. jQuery.css( elem, type, extra ) :
  13840. // Set width or height on the element
  13841. jQuery.style( elem, type, value, extra );
  13842. }, type, chainable ? margin : undefined, chainable );
  13843. };
  13844. } );
  13845. } );
  13846. jQuery.each( [
  13847. "ajaxStart",
  13848. "ajaxStop",
  13849. "ajaxComplete",
  13850. "ajaxError",
  13851. "ajaxSuccess",
  13852. "ajaxSend"
  13853. ], function( _i, type ) {
  13854. jQuery.fn[ type ] = function( fn ) {
  13855. return this.on( type, fn );
  13856. };
  13857. } );
  13858. jQuery.fn.extend( {
  13859. bind: function( types, data, fn ) {
  13860. return this.on( types, null, data, fn );
  13861. },
  13862. unbind: function( types, fn ) {
  13863. return this.off( types, null, fn );
  13864. },
  13865. delegate: function( selector, types, data, fn ) {
  13866. return this.on( types, selector, data, fn );
  13867. },
  13868. undelegate: function( selector, types, fn ) {
  13869. // ( namespace ) or ( selector, types [, fn] )
  13870. return arguments.length === 1 ?
  13871. this.off( selector, "**" ) :
  13872. this.off( types, selector || "**", fn );
  13873. },
  13874. hover: function( fnOver, fnOut ) {
  13875. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  13876. }
  13877. } );
  13878. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  13879. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  13880. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13881. function( _i, name ) {
  13882. // Handle event binding
  13883. jQuery.fn[ name ] = function( data, fn ) {
  13884. return arguments.length > 0 ?
  13885. this.on( name, null, data, fn ) :
  13886. this.trigger( name );
  13887. };
  13888. } );
  13889. // Support: Android <=4.0 only
  13890. // Make sure we trim BOM and NBSP
  13891. var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  13892. // Bind a function to a context, optionally partially applying any
  13893. // arguments.
  13894. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  13895. // However, it is not slated for removal any time soon
  13896. jQuery.proxy = function( fn, context ) {
  13897. var tmp, args, proxy;
  13898. if ( typeof context === "string" ) {
  13899. tmp = fn[ context ];
  13900. context = fn;
  13901. fn = tmp;
  13902. }
  13903. // Quick check to determine if target is callable, in the spec
  13904. // this throws a TypeError, but we will just return undefined.
  13905. if ( !isFunction( fn ) ) {
  13906. return undefined;
  13907. }
  13908. // Simulated bind
  13909. args = slice.call( arguments, 2 );
  13910. proxy = function() {
  13911. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  13912. };
  13913. // Set the guid of unique handler to the same of original handler, so it can be removed
  13914. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  13915. return proxy;
  13916. };
  13917. jQuery.holdReady = function( hold ) {
  13918. if ( hold ) {
  13919. jQuery.readyWait++;
  13920. } else {
  13921. jQuery.ready( true );
  13922. }
  13923. };
  13924. jQuery.isArray = Array.isArray;
  13925. jQuery.parseJSON = JSON.parse;
  13926. jQuery.nodeName = nodeName;
  13927. jQuery.isFunction = isFunction;
  13928. jQuery.isWindow = isWindow;
  13929. jQuery.camelCase = camelCase;
  13930. jQuery.type = toType;
  13931. jQuery.now = Date.now;
  13932. jQuery.isNumeric = function( obj ) {
  13933. // As of jQuery 3.0, isNumeric is limited to
  13934. // strings and numbers (primitives or objects)
  13935. // that can be coerced to finite numbers (gh-2662)
  13936. var type = jQuery.type( obj );
  13937. return ( type === "number" || type === "string" ) &&
  13938. // parseFloat NaNs numeric-cast false positives ("")
  13939. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  13940. // subtraction forces infinities to NaN
  13941. !isNaN( obj - parseFloat( obj ) );
  13942. };
  13943. jQuery.trim = function( text ) {
  13944. return text == null ?
  13945. "" :
  13946. ( text + "" ).replace( rtrim, "" );
  13947. };
  13948. // Register as a named AMD module, since jQuery can be concatenated with other
  13949. // files that may use define, but not via a proper concatenation script that
  13950. // understands anonymous AMD modules. A named AMD is safest and most robust
  13951. // way to register. Lowercase jquery is used because AMD module names are
  13952. // derived from file names, and jQuery is normally delivered in a lowercase
  13953. // file name. Do this after creating the global so that if an AMD module wants
  13954. // to call noConflict to hide this version of jQuery, it will work.
  13955. // Note that for maximum portability, libraries that are not jQuery should
  13956. // declare themselves as anonymous modules, and avoid setting a global if an
  13957. // AMD loader is present. jQuery is a special case. For more information, see
  13958. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  13959. if ( true ) {
  13960. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  13961. return jQuery;
  13962. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  13963. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13964. }
  13965. var
  13966. // Map over jQuery in case of overwrite
  13967. _jQuery = window.jQuery,
  13968. // Map over the $ in case of overwrite
  13969. _$ = window.$;
  13970. jQuery.noConflict = function( deep ) {
  13971. if ( window.$ === jQuery ) {
  13972. window.$ = _$;
  13973. }
  13974. if ( deep && window.jQuery === jQuery ) {
  13975. window.jQuery = _jQuery;
  13976. }
  13977. return jQuery;
  13978. };
  13979. // Expose jQuery and $ identifiers, even in AMD
  13980. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  13981. // and CommonJS for browser emulators (#13566)
  13982. if ( typeof noGlobal === "undefined" ) {
  13983. window.jQuery = window.$ = jQuery;
  13984. }
  13985. return jQuery;
  13986. } );
  13987. /***/ }),
  13988. /***/ "./node_modules/lodash/lodash.js":
  13989. /*!***************************************!*\
  13990. !*** ./node_modules/lodash/lodash.js ***!
  13991. \***************************************/
  13992. /*! no static exports found */
  13993. /***/ (function(module, exports, __webpack_require__) {
  13994. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  13995. * @license
  13996. * Lodash <https://lodash.com/>
  13997. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  13998. * Released under MIT license <https://lodash.com/license>
  13999. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  14000. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  14001. */
  14002. ;(function() {
  14003. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  14004. var undefined;
  14005. /** Used as the semantic version number. */
  14006. var VERSION = '4.17.20';
  14007. /** Used as the size to enable large array optimizations. */
  14008. var LARGE_ARRAY_SIZE = 200;
  14009. /** Error message constants. */
  14010. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  14011. FUNC_ERROR_TEXT = 'Expected a function';
  14012. /** Used to stand-in for `undefined` hash values. */
  14013. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  14014. /** Used as the maximum memoize cache size. */
  14015. var MAX_MEMOIZE_SIZE = 500;
  14016. /** Used as the internal argument placeholder. */
  14017. var PLACEHOLDER = '__lodash_placeholder__';
  14018. /** Used to compose bitmasks for cloning. */
  14019. var CLONE_DEEP_FLAG = 1,
  14020. CLONE_FLAT_FLAG = 2,
  14021. CLONE_SYMBOLS_FLAG = 4;
  14022. /** Used to compose bitmasks for value comparisons. */
  14023. var COMPARE_PARTIAL_FLAG = 1,
  14024. COMPARE_UNORDERED_FLAG = 2;
  14025. /** Used to compose bitmasks for function metadata. */
  14026. var WRAP_BIND_FLAG = 1,
  14027. WRAP_BIND_KEY_FLAG = 2,
  14028. WRAP_CURRY_BOUND_FLAG = 4,
  14029. WRAP_CURRY_FLAG = 8,
  14030. WRAP_CURRY_RIGHT_FLAG = 16,
  14031. WRAP_PARTIAL_FLAG = 32,
  14032. WRAP_PARTIAL_RIGHT_FLAG = 64,
  14033. WRAP_ARY_FLAG = 128,
  14034. WRAP_REARG_FLAG = 256,
  14035. WRAP_FLIP_FLAG = 512;
  14036. /** Used as default options for `_.truncate`. */
  14037. var DEFAULT_TRUNC_LENGTH = 30,
  14038. DEFAULT_TRUNC_OMISSION = '...';
  14039. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  14040. var HOT_COUNT = 800,
  14041. HOT_SPAN = 16;
  14042. /** Used to indicate the type of lazy iteratees. */
  14043. var LAZY_FILTER_FLAG = 1,
  14044. LAZY_MAP_FLAG = 2,
  14045. LAZY_WHILE_FLAG = 3;
  14046. /** Used as references for various `Number` constants. */
  14047. var INFINITY = 1 / 0,
  14048. MAX_SAFE_INTEGER = 9007199254740991,
  14049. MAX_INTEGER = 1.7976931348623157e+308,
  14050. NAN = 0 / 0;
  14051. /** Used as references for the maximum length and index of an array. */
  14052. var MAX_ARRAY_LENGTH = 4294967295,
  14053. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  14054. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  14055. /** Used to associate wrap methods with their bit flags. */
  14056. var wrapFlags = [
  14057. ['ary', WRAP_ARY_FLAG],
  14058. ['bind', WRAP_BIND_FLAG],
  14059. ['bindKey', WRAP_BIND_KEY_FLAG],
  14060. ['curry', WRAP_CURRY_FLAG],
  14061. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  14062. ['flip', WRAP_FLIP_FLAG],
  14063. ['partial', WRAP_PARTIAL_FLAG],
  14064. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  14065. ['rearg', WRAP_REARG_FLAG]
  14066. ];
  14067. /** `Object#toString` result references. */
  14068. var argsTag = '[object Arguments]',
  14069. arrayTag = '[object Array]',
  14070. asyncTag = '[object AsyncFunction]',
  14071. boolTag = '[object Boolean]',
  14072. dateTag = '[object Date]',
  14073. domExcTag = '[object DOMException]',
  14074. errorTag = '[object Error]',
  14075. funcTag = '[object Function]',
  14076. genTag = '[object GeneratorFunction]',
  14077. mapTag = '[object Map]',
  14078. numberTag = '[object Number]',
  14079. nullTag = '[object Null]',
  14080. objectTag = '[object Object]',
  14081. promiseTag = '[object Promise]',
  14082. proxyTag = '[object Proxy]',
  14083. regexpTag = '[object RegExp]',
  14084. setTag = '[object Set]',
  14085. stringTag = '[object String]',
  14086. symbolTag = '[object Symbol]',
  14087. undefinedTag = '[object Undefined]',
  14088. weakMapTag = '[object WeakMap]',
  14089. weakSetTag = '[object WeakSet]';
  14090. var arrayBufferTag = '[object ArrayBuffer]',
  14091. dataViewTag = '[object DataView]',
  14092. float32Tag = '[object Float32Array]',
  14093. float64Tag = '[object Float64Array]',
  14094. int8Tag = '[object Int8Array]',
  14095. int16Tag = '[object Int16Array]',
  14096. int32Tag = '[object Int32Array]',
  14097. uint8Tag = '[object Uint8Array]',
  14098. uint8ClampedTag = '[object Uint8ClampedArray]',
  14099. uint16Tag = '[object Uint16Array]',
  14100. uint32Tag = '[object Uint32Array]';
  14101. /** Used to match empty string literals in compiled template source. */
  14102. var reEmptyStringLeading = /\b__p \+= '';/g,
  14103. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  14104. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  14105. /** Used to match HTML entities and HTML characters. */
  14106. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  14107. reUnescapedHtml = /[&<>"']/g,
  14108. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  14109. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  14110. /** Used to match template delimiters. */
  14111. var reEscape = /<%-([\s\S]+?)%>/g,
  14112. reEvaluate = /<%([\s\S]+?)%>/g,
  14113. reInterpolate = /<%=([\s\S]+?)%>/g;
  14114. /** Used to match property names within property paths. */
  14115. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  14116. reIsPlainProp = /^\w*$/,
  14117. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  14118. /**
  14119. * Used to match `RegExp`
  14120. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  14121. */
  14122. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  14123. reHasRegExpChar = RegExp(reRegExpChar.source);
  14124. /** Used to match leading and trailing whitespace. */
  14125. var reTrim = /^\s+|\s+$/g,
  14126. reTrimStart = /^\s+/,
  14127. reTrimEnd = /\s+$/;
  14128. /** Used to match wrap detail comments. */
  14129. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  14130. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  14131. reSplitDetails = /,? & /;
  14132. /** Used to match words composed of alphanumeric characters. */
  14133. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  14134. /** Used to match backslashes in property paths. */
  14135. var reEscapeChar = /\\(\\)?/g;
  14136. /**
  14137. * Used to match
  14138. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  14139. */
  14140. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  14141. /** Used to match `RegExp` flags from their coerced string values. */
  14142. var reFlags = /\w*$/;
  14143. /** Used to detect bad signed hexadecimal string values. */
  14144. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14145. /** Used to detect binary string values. */
  14146. var reIsBinary = /^0b[01]+$/i;
  14147. /** Used to detect host constructors (Safari). */
  14148. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14149. /** Used to detect octal string values. */
  14150. var reIsOctal = /^0o[0-7]+$/i;
  14151. /** Used to detect unsigned integer values. */
  14152. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14153. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  14154. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  14155. /** Used to ensure capturing order of template delimiters. */
  14156. var reNoMatch = /($^)/;
  14157. /** Used to match unescaped characters in compiled string literals. */
  14158. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  14159. /** Used to compose unicode character classes. */
  14160. var rsAstralRange = '\\ud800-\\udfff',
  14161. rsComboMarksRange = '\\u0300-\\u036f',
  14162. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  14163. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  14164. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  14165. rsDingbatRange = '\\u2700-\\u27bf',
  14166. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  14167. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  14168. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  14169. rsPunctuationRange = '\\u2000-\\u206f',
  14170. 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',
  14171. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  14172. rsVarRange = '\\ufe0e\\ufe0f',
  14173. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  14174. /** Used to compose unicode capture groups. */
  14175. var rsApos = "['\u2019]",
  14176. rsAstral = '[' + rsAstralRange + ']',
  14177. rsBreak = '[' + rsBreakRange + ']',
  14178. rsCombo = '[' + rsComboRange + ']',
  14179. rsDigits = '\\d+',
  14180. rsDingbat = '[' + rsDingbatRange + ']',
  14181. rsLower = '[' + rsLowerRange + ']',
  14182. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  14183. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  14184. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  14185. rsNonAstral = '[^' + rsAstralRange + ']',
  14186. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  14187. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  14188. rsUpper = '[' + rsUpperRange + ']',
  14189. rsZWJ = '\\u200d';
  14190. /** Used to compose unicode regexes. */
  14191. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  14192. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  14193. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  14194. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  14195. reOptMod = rsModifier + '?',
  14196. rsOptVar = '[' + rsVarRange + ']?',
  14197. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  14198. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  14199. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  14200. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  14201. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  14202. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  14203. /** Used to match apostrophes. */
  14204. var reApos = RegExp(rsApos, 'g');
  14205. /**
  14206. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  14207. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  14208. */
  14209. var reComboMark = RegExp(rsCombo, 'g');
  14210. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  14211. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  14212. /** Used to match complex or compound words. */
  14213. var reUnicodeWord = RegExp([
  14214. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  14215. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  14216. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  14217. rsUpper + '+' + rsOptContrUpper,
  14218. rsOrdUpper,
  14219. rsOrdLower,
  14220. rsDigits,
  14221. rsEmoji
  14222. ].join('|'), 'g');
  14223. /** 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/). */
  14224. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  14225. /** Used to detect strings that need a more robust regexp to match words. */
  14226. 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 ]/;
  14227. /** Used to assign default `context` object properties. */
  14228. var contextProps = [
  14229. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  14230. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  14231. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  14232. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  14233. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  14234. ];
  14235. /** Used to make template sourceURLs easier to identify. */
  14236. var templateCounter = -1;
  14237. /** Used to identify `toStringTag` values of typed arrays. */
  14238. var typedArrayTags = {};
  14239. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  14240. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  14241. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  14242. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  14243. typedArrayTags[uint32Tag] = true;
  14244. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  14245. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  14246. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  14247. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  14248. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  14249. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  14250. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  14251. typedArrayTags[weakMapTag] = false;
  14252. /** Used to identify `toStringTag` values supported by `_.clone`. */
  14253. var cloneableTags = {};
  14254. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  14255. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  14256. cloneableTags[boolTag] = cloneableTags[dateTag] =
  14257. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  14258. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  14259. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  14260. cloneableTags[numberTag] = cloneableTags[objectTag] =
  14261. cloneableTags[regexpTag] = cloneableTags[setTag] =
  14262. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  14263. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  14264. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  14265. cloneableTags[errorTag] = cloneableTags[funcTag] =
  14266. cloneableTags[weakMapTag] = false;
  14267. /** Used to map Latin Unicode letters to basic Latin letters. */
  14268. var deburredLetters = {
  14269. // Latin-1 Supplement block.
  14270. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  14271. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  14272. '\xc7': 'C', '\xe7': 'c',
  14273. '\xd0': 'D', '\xf0': 'd',
  14274. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  14275. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  14276. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  14277. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  14278. '\xd1': 'N', '\xf1': 'n',
  14279. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  14280. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  14281. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  14282. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  14283. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  14284. '\xc6': 'Ae', '\xe6': 'ae',
  14285. '\xde': 'Th', '\xfe': 'th',
  14286. '\xdf': 'ss',
  14287. // Latin Extended-A block.
  14288. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  14289. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  14290. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  14291. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  14292. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  14293. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  14294. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  14295. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  14296. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  14297. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  14298. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  14299. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  14300. '\u0134': 'J', '\u0135': 'j',
  14301. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  14302. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  14303. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  14304. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  14305. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  14306. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  14307. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  14308. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  14309. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  14310. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  14311. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  14312. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  14313. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  14314. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  14315. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  14316. '\u0174': 'W', '\u0175': 'w',
  14317. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  14318. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  14319. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  14320. '\u0132': 'IJ', '\u0133': 'ij',
  14321. '\u0152': 'Oe', '\u0153': 'oe',
  14322. '\u0149': "'n", '\u017f': 's'
  14323. };
  14324. /** Used to map characters to HTML entities. */
  14325. var htmlEscapes = {
  14326. '&': '&amp;',
  14327. '<': '&lt;',
  14328. '>': '&gt;',
  14329. '"': '&quot;',
  14330. "'": '&#39;'
  14331. };
  14332. /** Used to map HTML entities to characters. */
  14333. var htmlUnescapes = {
  14334. '&amp;': '&',
  14335. '&lt;': '<',
  14336. '&gt;': '>',
  14337. '&quot;': '"',
  14338. '&#39;': "'"
  14339. };
  14340. /** Used to escape characters for inclusion in compiled string literals. */
  14341. var stringEscapes = {
  14342. '\\': '\\',
  14343. "'": "'",
  14344. '\n': 'n',
  14345. '\r': 'r',
  14346. '\u2028': 'u2028',
  14347. '\u2029': 'u2029'
  14348. };
  14349. /** Built-in method references without a dependency on `root`. */
  14350. var freeParseFloat = parseFloat,
  14351. freeParseInt = parseInt;
  14352. /** Detect free variable `global` from Node.js. */
  14353. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  14354. /** Detect free variable `self`. */
  14355. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  14356. /** Used as a reference to the global object. */
  14357. var root = freeGlobal || freeSelf || Function('return this')();
  14358. /** Detect free variable `exports`. */
  14359. var freeExports = true && exports && !exports.nodeType && exports;
  14360. /** Detect free variable `module`. */
  14361. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  14362. /** Detect the popular CommonJS extension `module.exports`. */
  14363. var moduleExports = freeModule && freeModule.exports === freeExports;
  14364. /** Detect free variable `process` from Node.js. */
  14365. var freeProcess = moduleExports && freeGlobal.process;
  14366. /** Used to access faster Node.js helpers. */
  14367. var nodeUtil = (function() {
  14368. try {
  14369. // Use `util.types` for Node.js 10+.
  14370. var types = freeModule && freeModule.require && freeModule.require('util').types;
  14371. if (types) {
  14372. return types;
  14373. }
  14374. // Legacy `process.binding('util')` for Node.js < 10.
  14375. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  14376. } catch (e) {}
  14377. }());
  14378. /* Node.js helper references. */
  14379. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  14380. nodeIsDate = nodeUtil && nodeUtil.isDate,
  14381. nodeIsMap = nodeUtil && nodeUtil.isMap,
  14382. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  14383. nodeIsSet = nodeUtil && nodeUtil.isSet,
  14384. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  14385. /*--------------------------------------------------------------------------*/
  14386. /**
  14387. * A faster alternative to `Function#apply`, this function invokes `func`
  14388. * with the `this` binding of `thisArg` and the arguments of `args`.
  14389. *
  14390. * @private
  14391. * @param {Function} func The function to invoke.
  14392. * @param {*} thisArg The `this` binding of `func`.
  14393. * @param {Array} args The arguments to invoke `func` with.
  14394. * @returns {*} Returns the result of `func`.
  14395. */
  14396. function apply(func, thisArg, args) {
  14397. switch (args.length) {
  14398. case 0: return func.call(thisArg);
  14399. case 1: return func.call(thisArg, args[0]);
  14400. case 2: return func.call(thisArg, args[0], args[1]);
  14401. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  14402. }
  14403. return func.apply(thisArg, args);
  14404. }
  14405. /**
  14406. * A specialized version of `baseAggregator` for arrays.
  14407. *
  14408. * @private
  14409. * @param {Array} [array] The array to iterate over.
  14410. * @param {Function} setter The function to set `accumulator` values.
  14411. * @param {Function} iteratee The iteratee to transform keys.
  14412. * @param {Object} accumulator The initial aggregated object.
  14413. * @returns {Function} Returns `accumulator`.
  14414. */
  14415. function arrayAggregator(array, setter, iteratee, accumulator) {
  14416. var index = -1,
  14417. length = array == null ? 0 : array.length;
  14418. while (++index < length) {
  14419. var value = array[index];
  14420. setter(accumulator, value, iteratee(value), array);
  14421. }
  14422. return accumulator;
  14423. }
  14424. /**
  14425. * A specialized version of `_.forEach` for arrays without support for
  14426. * iteratee shorthands.
  14427. *
  14428. * @private
  14429. * @param {Array} [array] The array to iterate over.
  14430. * @param {Function} iteratee The function invoked per iteration.
  14431. * @returns {Array} Returns `array`.
  14432. */
  14433. function arrayEach(array, iteratee) {
  14434. var index = -1,
  14435. length = array == null ? 0 : array.length;
  14436. while (++index < length) {
  14437. if (iteratee(array[index], index, array) === false) {
  14438. break;
  14439. }
  14440. }
  14441. return array;
  14442. }
  14443. /**
  14444. * A specialized version of `_.forEachRight` for arrays without support for
  14445. * iteratee shorthands.
  14446. *
  14447. * @private
  14448. * @param {Array} [array] The array to iterate over.
  14449. * @param {Function} iteratee The function invoked per iteration.
  14450. * @returns {Array} Returns `array`.
  14451. */
  14452. function arrayEachRight(array, iteratee) {
  14453. var length = array == null ? 0 : array.length;
  14454. while (length--) {
  14455. if (iteratee(array[length], length, array) === false) {
  14456. break;
  14457. }
  14458. }
  14459. return array;
  14460. }
  14461. /**
  14462. * A specialized version of `_.every` for arrays without support for
  14463. * iteratee shorthands.
  14464. *
  14465. * @private
  14466. * @param {Array} [array] The array to iterate over.
  14467. * @param {Function} predicate The function invoked per iteration.
  14468. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14469. * else `false`.
  14470. */
  14471. function arrayEvery(array, predicate) {
  14472. var index = -1,
  14473. length = array == null ? 0 : array.length;
  14474. while (++index < length) {
  14475. if (!predicate(array[index], index, array)) {
  14476. return false;
  14477. }
  14478. }
  14479. return true;
  14480. }
  14481. /**
  14482. * A specialized version of `_.filter` for arrays without support for
  14483. * iteratee shorthands.
  14484. *
  14485. * @private
  14486. * @param {Array} [array] The array to iterate over.
  14487. * @param {Function} predicate The function invoked per iteration.
  14488. * @returns {Array} Returns the new filtered array.
  14489. */
  14490. function arrayFilter(array, predicate) {
  14491. var index = -1,
  14492. length = array == null ? 0 : array.length,
  14493. resIndex = 0,
  14494. result = [];
  14495. while (++index < length) {
  14496. var value = array[index];
  14497. if (predicate(value, index, array)) {
  14498. result[resIndex++] = value;
  14499. }
  14500. }
  14501. return result;
  14502. }
  14503. /**
  14504. * A specialized version of `_.includes` for arrays without support for
  14505. * specifying an index to search from.
  14506. *
  14507. * @private
  14508. * @param {Array} [array] The array to inspect.
  14509. * @param {*} target The value to search for.
  14510. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14511. */
  14512. function arrayIncludes(array, value) {
  14513. var length = array == null ? 0 : array.length;
  14514. return !!length && baseIndexOf(array, value, 0) > -1;
  14515. }
  14516. /**
  14517. * This function is like `arrayIncludes` except that it accepts a comparator.
  14518. *
  14519. * @private
  14520. * @param {Array} [array] The array to inspect.
  14521. * @param {*} target The value to search for.
  14522. * @param {Function} comparator The comparator invoked per element.
  14523. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14524. */
  14525. function arrayIncludesWith(array, value, comparator) {
  14526. var index = -1,
  14527. length = array == null ? 0 : array.length;
  14528. while (++index < length) {
  14529. if (comparator(value, array[index])) {
  14530. return true;
  14531. }
  14532. }
  14533. return false;
  14534. }
  14535. /**
  14536. * A specialized version of `_.map` for arrays without support for iteratee
  14537. * shorthands.
  14538. *
  14539. * @private
  14540. * @param {Array} [array] The array to iterate over.
  14541. * @param {Function} iteratee The function invoked per iteration.
  14542. * @returns {Array} Returns the new mapped array.
  14543. */
  14544. function arrayMap(array, iteratee) {
  14545. var index = -1,
  14546. length = array == null ? 0 : array.length,
  14547. result = Array(length);
  14548. while (++index < length) {
  14549. result[index] = iteratee(array[index], index, array);
  14550. }
  14551. return result;
  14552. }
  14553. /**
  14554. * Appends the elements of `values` to `array`.
  14555. *
  14556. * @private
  14557. * @param {Array} array The array to modify.
  14558. * @param {Array} values The values to append.
  14559. * @returns {Array} Returns `array`.
  14560. */
  14561. function arrayPush(array, values) {
  14562. var index = -1,
  14563. length = values.length,
  14564. offset = array.length;
  14565. while (++index < length) {
  14566. array[offset + index] = values[index];
  14567. }
  14568. return array;
  14569. }
  14570. /**
  14571. * A specialized version of `_.reduce` for arrays without support for
  14572. * iteratee shorthands.
  14573. *
  14574. * @private
  14575. * @param {Array} [array] The array to iterate over.
  14576. * @param {Function} iteratee The function invoked per iteration.
  14577. * @param {*} [accumulator] The initial value.
  14578. * @param {boolean} [initAccum] Specify using the first element of `array` as
  14579. * the initial value.
  14580. * @returns {*} Returns the accumulated value.
  14581. */
  14582. function arrayReduce(array, iteratee, accumulator, initAccum) {
  14583. var index = -1,
  14584. length = array == null ? 0 : array.length;
  14585. if (initAccum && length) {
  14586. accumulator = array[++index];
  14587. }
  14588. while (++index < length) {
  14589. accumulator = iteratee(accumulator, array[index], index, array);
  14590. }
  14591. return accumulator;
  14592. }
  14593. /**
  14594. * A specialized version of `_.reduceRight` for arrays without support for
  14595. * iteratee shorthands.
  14596. *
  14597. * @private
  14598. * @param {Array} [array] The array to iterate over.
  14599. * @param {Function} iteratee The function invoked per iteration.
  14600. * @param {*} [accumulator] The initial value.
  14601. * @param {boolean} [initAccum] Specify using the last element of `array` as
  14602. * the initial value.
  14603. * @returns {*} Returns the accumulated value.
  14604. */
  14605. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  14606. var length = array == null ? 0 : array.length;
  14607. if (initAccum && length) {
  14608. accumulator = array[--length];
  14609. }
  14610. while (length--) {
  14611. accumulator = iteratee(accumulator, array[length], length, array);
  14612. }
  14613. return accumulator;
  14614. }
  14615. /**
  14616. * A specialized version of `_.some` for arrays without support for iteratee
  14617. * shorthands.
  14618. *
  14619. * @private
  14620. * @param {Array} [array] The array to iterate over.
  14621. * @param {Function} predicate The function invoked per iteration.
  14622. * @returns {boolean} Returns `true` if any element passes the predicate check,
  14623. * else `false`.
  14624. */
  14625. function arraySome(array, predicate) {
  14626. var index = -1,
  14627. length = array == null ? 0 : array.length;
  14628. while (++index < length) {
  14629. if (predicate(array[index], index, array)) {
  14630. return true;
  14631. }
  14632. }
  14633. return false;
  14634. }
  14635. /**
  14636. * Gets the size of an ASCII `string`.
  14637. *
  14638. * @private
  14639. * @param {string} string The string inspect.
  14640. * @returns {number} Returns the string size.
  14641. */
  14642. var asciiSize = baseProperty('length');
  14643. /**
  14644. * Converts an ASCII `string` to an array.
  14645. *
  14646. * @private
  14647. * @param {string} string The string to convert.
  14648. * @returns {Array} Returns the converted array.
  14649. */
  14650. function asciiToArray(string) {
  14651. return string.split('');
  14652. }
  14653. /**
  14654. * Splits an ASCII `string` into an array of its words.
  14655. *
  14656. * @private
  14657. * @param {string} The string to inspect.
  14658. * @returns {Array} Returns the words of `string`.
  14659. */
  14660. function asciiWords(string) {
  14661. return string.match(reAsciiWord) || [];
  14662. }
  14663. /**
  14664. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  14665. * without support for iteratee shorthands, which iterates over `collection`
  14666. * using `eachFunc`.
  14667. *
  14668. * @private
  14669. * @param {Array|Object} collection The collection to inspect.
  14670. * @param {Function} predicate The function invoked per iteration.
  14671. * @param {Function} eachFunc The function to iterate over `collection`.
  14672. * @returns {*} Returns the found element or its key, else `undefined`.
  14673. */
  14674. function baseFindKey(collection, predicate, eachFunc) {
  14675. var result;
  14676. eachFunc(collection, function(value, key, collection) {
  14677. if (predicate(value, key, collection)) {
  14678. result = key;
  14679. return false;
  14680. }
  14681. });
  14682. return result;
  14683. }
  14684. /**
  14685. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  14686. * support for iteratee shorthands.
  14687. *
  14688. * @private
  14689. * @param {Array} array The array to inspect.
  14690. * @param {Function} predicate The function invoked per iteration.
  14691. * @param {number} fromIndex The index to search from.
  14692. * @param {boolean} [fromRight] Specify iterating from right to left.
  14693. * @returns {number} Returns the index of the matched value, else `-1`.
  14694. */
  14695. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  14696. var length = array.length,
  14697. index = fromIndex + (fromRight ? 1 : -1);
  14698. while ((fromRight ? index-- : ++index < length)) {
  14699. if (predicate(array[index], index, array)) {
  14700. return index;
  14701. }
  14702. }
  14703. return -1;
  14704. }
  14705. /**
  14706. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  14707. *
  14708. * @private
  14709. * @param {Array} array The array to inspect.
  14710. * @param {*} value The value to search for.
  14711. * @param {number} fromIndex The index to search from.
  14712. * @returns {number} Returns the index of the matched value, else `-1`.
  14713. */
  14714. function baseIndexOf(array, value, fromIndex) {
  14715. return value === value
  14716. ? strictIndexOf(array, value, fromIndex)
  14717. : baseFindIndex(array, baseIsNaN, fromIndex);
  14718. }
  14719. /**
  14720. * This function is like `baseIndexOf` except that it accepts a comparator.
  14721. *
  14722. * @private
  14723. * @param {Array} array The array to inspect.
  14724. * @param {*} value The value to search for.
  14725. * @param {number} fromIndex The index to search from.
  14726. * @param {Function} comparator The comparator invoked per element.
  14727. * @returns {number} Returns the index of the matched value, else `-1`.
  14728. */
  14729. function baseIndexOfWith(array, value, fromIndex, comparator) {
  14730. var index = fromIndex - 1,
  14731. length = array.length;
  14732. while (++index < length) {
  14733. if (comparator(array[index], value)) {
  14734. return index;
  14735. }
  14736. }
  14737. return -1;
  14738. }
  14739. /**
  14740. * The base implementation of `_.isNaN` without support for number objects.
  14741. *
  14742. * @private
  14743. * @param {*} value The value to check.
  14744. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  14745. */
  14746. function baseIsNaN(value) {
  14747. return value !== value;
  14748. }
  14749. /**
  14750. * The base implementation of `_.mean` and `_.meanBy` without support for
  14751. * iteratee shorthands.
  14752. *
  14753. * @private
  14754. * @param {Array} array The array to iterate over.
  14755. * @param {Function} iteratee The function invoked per iteration.
  14756. * @returns {number} Returns the mean.
  14757. */
  14758. function baseMean(array, iteratee) {
  14759. var length = array == null ? 0 : array.length;
  14760. return length ? (baseSum(array, iteratee) / length) : NAN;
  14761. }
  14762. /**
  14763. * The base implementation of `_.property` without support for deep paths.
  14764. *
  14765. * @private
  14766. * @param {string} key The key of the property to get.
  14767. * @returns {Function} Returns the new accessor function.
  14768. */
  14769. function baseProperty(key) {
  14770. return function(object) {
  14771. return object == null ? undefined : object[key];
  14772. };
  14773. }
  14774. /**
  14775. * The base implementation of `_.propertyOf` without support for deep paths.
  14776. *
  14777. * @private
  14778. * @param {Object} object The object to query.
  14779. * @returns {Function} Returns the new accessor function.
  14780. */
  14781. function basePropertyOf(object) {
  14782. return function(key) {
  14783. return object == null ? undefined : object[key];
  14784. };
  14785. }
  14786. /**
  14787. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  14788. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  14789. *
  14790. * @private
  14791. * @param {Array|Object} collection The collection to iterate over.
  14792. * @param {Function} iteratee The function invoked per iteration.
  14793. * @param {*} accumulator The initial value.
  14794. * @param {boolean} initAccum Specify using the first or last element of
  14795. * `collection` as the initial value.
  14796. * @param {Function} eachFunc The function to iterate over `collection`.
  14797. * @returns {*} Returns the accumulated value.
  14798. */
  14799. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  14800. eachFunc(collection, function(value, index, collection) {
  14801. accumulator = initAccum
  14802. ? (initAccum = false, value)
  14803. : iteratee(accumulator, value, index, collection);
  14804. });
  14805. return accumulator;
  14806. }
  14807. /**
  14808. * The base implementation of `_.sortBy` which uses `comparer` to define the
  14809. * sort order of `array` and replaces criteria objects with their corresponding
  14810. * values.
  14811. *
  14812. * @private
  14813. * @param {Array} array The array to sort.
  14814. * @param {Function} comparer The function to define sort order.
  14815. * @returns {Array} Returns `array`.
  14816. */
  14817. function baseSortBy(array, comparer) {
  14818. var length = array.length;
  14819. array.sort(comparer);
  14820. while (length--) {
  14821. array[length] = array[length].value;
  14822. }
  14823. return array;
  14824. }
  14825. /**
  14826. * The base implementation of `_.sum` and `_.sumBy` without support for
  14827. * iteratee shorthands.
  14828. *
  14829. * @private
  14830. * @param {Array} array The array to iterate over.
  14831. * @param {Function} iteratee The function invoked per iteration.
  14832. * @returns {number} Returns the sum.
  14833. */
  14834. function baseSum(array, iteratee) {
  14835. var result,
  14836. index = -1,
  14837. length = array.length;
  14838. while (++index < length) {
  14839. var current = iteratee(array[index]);
  14840. if (current !== undefined) {
  14841. result = result === undefined ? current : (result + current);
  14842. }
  14843. }
  14844. return result;
  14845. }
  14846. /**
  14847. * The base implementation of `_.times` without support for iteratee shorthands
  14848. * or max array length checks.
  14849. *
  14850. * @private
  14851. * @param {number} n The number of times to invoke `iteratee`.
  14852. * @param {Function} iteratee The function invoked per iteration.
  14853. * @returns {Array} Returns the array of results.
  14854. */
  14855. function baseTimes(n, iteratee) {
  14856. var index = -1,
  14857. result = Array(n);
  14858. while (++index < n) {
  14859. result[index] = iteratee(index);
  14860. }
  14861. return result;
  14862. }
  14863. /**
  14864. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  14865. * of key-value pairs for `object` corresponding to the property names of `props`.
  14866. *
  14867. * @private
  14868. * @param {Object} object The object to query.
  14869. * @param {Array} props The property names to get values for.
  14870. * @returns {Object} Returns the key-value pairs.
  14871. */
  14872. function baseToPairs(object, props) {
  14873. return arrayMap(props, function(key) {
  14874. return [key, object[key]];
  14875. });
  14876. }
  14877. /**
  14878. * The base implementation of `_.unary` without support for storing metadata.
  14879. *
  14880. * @private
  14881. * @param {Function} func The function to cap arguments for.
  14882. * @returns {Function} Returns the new capped function.
  14883. */
  14884. function baseUnary(func) {
  14885. return function(value) {
  14886. return func(value);
  14887. };
  14888. }
  14889. /**
  14890. * The base implementation of `_.values` and `_.valuesIn` which creates an
  14891. * array of `object` property values corresponding to the property names
  14892. * of `props`.
  14893. *
  14894. * @private
  14895. * @param {Object} object The object to query.
  14896. * @param {Array} props The property names to get values for.
  14897. * @returns {Object} Returns the array of property values.
  14898. */
  14899. function baseValues(object, props) {
  14900. return arrayMap(props, function(key) {
  14901. return object[key];
  14902. });
  14903. }
  14904. /**
  14905. * Checks if a `cache` value for `key` exists.
  14906. *
  14907. * @private
  14908. * @param {Object} cache The cache to query.
  14909. * @param {string} key The key of the entry to check.
  14910. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14911. */
  14912. function cacheHas(cache, key) {
  14913. return cache.has(key);
  14914. }
  14915. /**
  14916. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  14917. * that is not found in the character symbols.
  14918. *
  14919. * @private
  14920. * @param {Array} strSymbols The string symbols to inspect.
  14921. * @param {Array} chrSymbols The character symbols to find.
  14922. * @returns {number} Returns the index of the first unmatched string symbol.
  14923. */
  14924. function charsStartIndex(strSymbols, chrSymbols) {
  14925. var index = -1,
  14926. length = strSymbols.length;
  14927. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14928. return index;
  14929. }
  14930. /**
  14931. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  14932. * that is not found in the character symbols.
  14933. *
  14934. * @private
  14935. * @param {Array} strSymbols The string symbols to inspect.
  14936. * @param {Array} chrSymbols The character symbols to find.
  14937. * @returns {number} Returns the index of the last unmatched string symbol.
  14938. */
  14939. function charsEndIndex(strSymbols, chrSymbols) {
  14940. var index = strSymbols.length;
  14941. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14942. return index;
  14943. }
  14944. /**
  14945. * Gets the number of `placeholder` occurrences in `array`.
  14946. *
  14947. * @private
  14948. * @param {Array} array The array to inspect.
  14949. * @param {*} placeholder The placeholder to search for.
  14950. * @returns {number} Returns the placeholder count.
  14951. */
  14952. function countHolders(array, placeholder) {
  14953. var length = array.length,
  14954. result = 0;
  14955. while (length--) {
  14956. if (array[length] === placeholder) {
  14957. ++result;
  14958. }
  14959. }
  14960. return result;
  14961. }
  14962. /**
  14963. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  14964. * letters to basic Latin letters.
  14965. *
  14966. * @private
  14967. * @param {string} letter The matched letter to deburr.
  14968. * @returns {string} Returns the deburred letter.
  14969. */
  14970. var deburrLetter = basePropertyOf(deburredLetters);
  14971. /**
  14972. * Used by `_.escape` to convert characters to HTML entities.
  14973. *
  14974. * @private
  14975. * @param {string} chr The matched character to escape.
  14976. * @returns {string} Returns the escaped character.
  14977. */
  14978. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  14979. /**
  14980. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  14981. *
  14982. * @private
  14983. * @param {string} chr The matched character to escape.
  14984. * @returns {string} Returns the escaped character.
  14985. */
  14986. function escapeStringChar(chr) {
  14987. return '\\' + stringEscapes[chr];
  14988. }
  14989. /**
  14990. * Gets the value at `key` of `object`.
  14991. *
  14992. * @private
  14993. * @param {Object} [object] The object to query.
  14994. * @param {string} key The key of the property to get.
  14995. * @returns {*} Returns the property value.
  14996. */
  14997. function getValue(object, key) {
  14998. return object == null ? undefined : object[key];
  14999. }
  15000. /**
  15001. * Checks if `string` contains Unicode symbols.
  15002. *
  15003. * @private
  15004. * @param {string} string The string to inspect.
  15005. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  15006. */
  15007. function hasUnicode(string) {
  15008. return reHasUnicode.test(string);
  15009. }
  15010. /**
  15011. * Checks if `string` contains a word composed of Unicode symbols.
  15012. *
  15013. * @private
  15014. * @param {string} string The string to inspect.
  15015. * @returns {boolean} Returns `true` if a word is found, else `false`.
  15016. */
  15017. function hasUnicodeWord(string) {
  15018. return reHasUnicodeWord.test(string);
  15019. }
  15020. /**
  15021. * Converts `iterator` to an array.
  15022. *
  15023. * @private
  15024. * @param {Object} iterator The iterator to convert.
  15025. * @returns {Array} Returns the converted array.
  15026. */
  15027. function iteratorToArray(iterator) {
  15028. var data,
  15029. result = [];
  15030. while (!(data = iterator.next()).done) {
  15031. result.push(data.value);
  15032. }
  15033. return result;
  15034. }
  15035. /**
  15036. * Converts `map` to its key-value pairs.
  15037. *
  15038. * @private
  15039. * @param {Object} map The map to convert.
  15040. * @returns {Array} Returns the key-value pairs.
  15041. */
  15042. function mapToArray(map) {
  15043. var index = -1,
  15044. result = Array(map.size);
  15045. map.forEach(function(value, key) {
  15046. result[++index] = [key, value];
  15047. });
  15048. return result;
  15049. }
  15050. /**
  15051. * Creates a unary function that invokes `func` with its argument transformed.
  15052. *
  15053. * @private
  15054. * @param {Function} func The function to wrap.
  15055. * @param {Function} transform The argument transform.
  15056. * @returns {Function} Returns the new function.
  15057. */
  15058. function overArg(func, transform) {
  15059. return function(arg) {
  15060. return func(transform(arg));
  15061. };
  15062. }
  15063. /**
  15064. * Replaces all `placeholder` elements in `array` with an internal placeholder
  15065. * and returns an array of their indexes.
  15066. *
  15067. * @private
  15068. * @param {Array} array The array to modify.
  15069. * @param {*} placeholder The placeholder to replace.
  15070. * @returns {Array} Returns the new array of placeholder indexes.
  15071. */
  15072. function replaceHolders(array, placeholder) {
  15073. var index = -1,
  15074. length = array.length,
  15075. resIndex = 0,
  15076. result = [];
  15077. while (++index < length) {
  15078. var value = array[index];
  15079. if (value === placeholder || value === PLACEHOLDER) {
  15080. array[index] = PLACEHOLDER;
  15081. result[resIndex++] = index;
  15082. }
  15083. }
  15084. return result;
  15085. }
  15086. /**
  15087. * Converts `set` to an array of its values.
  15088. *
  15089. * @private
  15090. * @param {Object} set The set to convert.
  15091. * @returns {Array} Returns the values.
  15092. */
  15093. function setToArray(set) {
  15094. var index = -1,
  15095. result = Array(set.size);
  15096. set.forEach(function(value) {
  15097. result[++index] = value;
  15098. });
  15099. return result;
  15100. }
  15101. /**
  15102. * Converts `set` to its value-value pairs.
  15103. *
  15104. * @private
  15105. * @param {Object} set The set to convert.
  15106. * @returns {Array} Returns the value-value pairs.
  15107. */
  15108. function setToPairs(set) {
  15109. var index = -1,
  15110. result = Array(set.size);
  15111. set.forEach(function(value) {
  15112. result[++index] = [value, value];
  15113. });
  15114. return result;
  15115. }
  15116. /**
  15117. * A specialized version of `_.indexOf` which performs strict equality
  15118. * comparisons of values, i.e. `===`.
  15119. *
  15120. * @private
  15121. * @param {Array} array The array to inspect.
  15122. * @param {*} value The value to search for.
  15123. * @param {number} fromIndex The index to search from.
  15124. * @returns {number} Returns the index of the matched value, else `-1`.
  15125. */
  15126. function strictIndexOf(array, value, fromIndex) {
  15127. var index = fromIndex - 1,
  15128. length = array.length;
  15129. while (++index < length) {
  15130. if (array[index] === value) {
  15131. return index;
  15132. }
  15133. }
  15134. return -1;
  15135. }
  15136. /**
  15137. * A specialized version of `_.lastIndexOf` which performs strict equality
  15138. * comparisons of values, i.e. `===`.
  15139. *
  15140. * @private
  15141. * @param {Array} array The array to inspect.
  15142. * @param {*} value The value to search for.
  15143. * @param {number} fromIndex The index to search from.
  15144. * @returns {number} Returns the index of the matched value, else `-1`.
  15145. */
  15146. function strictLastIndexOf(array, value, fromIndex) {
  15147. var index = fromIndex + 1;
  15148. while (index--) {
  15149. if (array[index] === value) {
  15150. return index;
  15151. }
  15152. }
  15153. return index;
  15154. }
  15155. /**
  15156. * Gets the number of symbols in `string`.
  15157. *
  15158. * @private
  15159. * @param {string} string The string to inspect.
  15160. * @returns {number} Returns the string size.
  15161. */
  15162. function stringSize(string) {
  15163. return hasUnicode(string)
  15164. ? unicodeSize(string)
  15165. : asciiSize(string);
  15166. }
  15167. /**
  15168. * Converts `string` to an array.
  15169. *
  15170. * @private
  15171. * @param {string} string The string to convert.
  15172. * @returns {Array} Returns the converted array.
  15173. */
  15174. function stringToArray(string) {
  15175. return hasUnicode(string)
  15176. ? unicodeToArray(string)
  15177. : asciiToArray(string);
  15178. }
  15179. /**
  15180. * Used by `_.unescape` to convert HTML entities to characters.
  15181. *
  15182. * @private
  15183. * @param {string} chr The matched character to unescape.
  15184. * @returns {string} Returns the unescaped character.
  15185. */
  15186. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  15187. /**
  15188. * Gets the size of a Unicode `string`.
  15189. *
  15190. * @private
  15191. * @param {string} string The string inspect.
  15192. * @returns {number} Returns the string size.
  15193. */
  15194. function unicodeSize(string) {
  15195. var result = reUnicode.lastIndex = 0;
  15196. while (reUnicode.test(string)) {
  15197. ++result;
  15198. }
  15199. return result;
  15200. }
  15201. /**
  15202. * Converts a Unicode `string` to an array.
  15203. *
  15204. * @private
  15205. * @param {string} string The string to convert.
  15206. * @returns {Array} Returns the converted array.
  15207. */
  15208. function unicodeToArray(string) {
  15209. return string.match(reUnicode) || [];
  15210. }
  15211. /**
  15212. * Splits a Unicode `string` into an array of its words.
  15213. *
  15214. * @private
  15215. * @param {string} The string to inspect.
  15216. * @returns {Array} Returns the words of `string`.
  15217. */
  15218. function unicodeWords(string) {
  15219. return string.match(reUnicodeWord) || [];
  15220. }
  15221. /*--------------------------------------------------------------------------*/
  15222. /**
  15223. * Create a new pristine `lodash` function using the `context` object.
  15224. *
  15225. * @static
  15226. * @memberOf _
  15227. * @since 1.1.0
  15228. * @category Util
  15229. * @param {Object} [context=root] The context object.
  15230. * @returns {Function} Returns a new `lodash` function.
  15231. * @example
  15232. *
  15233. * _.mixin({ 'foo': _.constant('foo') });
  15234. *
  15235. * var lodash = _.runInContext();
  15236. * lodash.mixin({ 'bar': lodash.constant('bar') });
  15237. *
  15238. * _.isFunction(_.foo);
  15239. * // => true
  15240. * _.isFunction(_.bar);
  15241. * // => false
  15242. *
  15243. * lodash.isFunction(lodash.foo);
  15244. * // => false
  15245. * lodash.isFunction(lodash.bar);
  15246. * // => true
  15247. *
  15248. * // Create a suped-up `defer` in Node.js.
  15249. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  15250. */
  15251. var runInContext = (function runInContext(context) {
  15252. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  15253. /** Built-in constructor references. */
  15254. var Array = context.Array,
  15255. Date = context.Date,
  15256. Error = context.Error,
  15257. Function = context.Function,
  15258. Math = context.Math,
  15259. Object = context.Object,
  15260. RegExp = context.RegExp,
  15261. String = context.String,
  15262. TypeError = context.TypeError;
  15263. /** Used for built-in method references. */
  15264. var arrayProto = Array.prototype,
  15265. funcProto = Function.prototype,
  15266. objectProto = Object.prototype;
  15267. /** Used to detect overreaching core-js shims. */
  15268. var coreJsData = context['__core-js_shared__'];
  15269. /** Used to resolve the decompiled source of functions. */
  15270. var funcToString = funcProto.toString;
  15271. /** Used to check objects for own properties. */
  15272. var hasOwnProperty = objectProto.hasOwnProperty;
  15273. /** Used to generate unique IDs. */
  15274. var idCounter = 0;
  15275. /** Used to detect methods masquerading as native. */
  15276. var maskSrcKey = (function() {
  15277. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  15278. return uid ? ('Symbol(src)_1.' + uid) : '';
  15279. }());
  15280. /**
  15281. * Used to resolve the
  15282. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  15283. * of values.
  15284. */
  15285. var nativeObjectToString = objectProto.toString;
  15286. /** Used to infer the `Object` constructor. */
  15287. var objectCtorString = funcToString.call(Object);
  15288. /** Used to restore the original `_` reference in `_.noConflict`. */
  15289. var oldDash = root._;
  15290. /** Used to detect if a method is native. */
  15291. var reIsNative = RegExp('^' +
  15292. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  15293. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  15294. );
  15295. /** Built-in value references. */
  15296. var Buffer = moduleExports ? context.Buffer : undefined,
  15297. Symbol = context.Symbol,
  15298. Uint8Array = context.Uint8Array,
  15299. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  15300. getPrototype = overArg(Object.getPrototypeOf, Object),
  15301. objectCreate = Object.create,
  15302. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  15303. splice = arrayProto.splice,
  15304. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  15305. symIterator = Symbol ? Symbol.iterator : undefined,
  15306. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  15307. var defineProperty = (function() {
  15308. try {
  15309. var func = getNative(Object, 'defineProperty');
  15310. func({}, '', {});
  15311. return func;
  15312. } catch (e) {}
  15313. }());
  15314. /** Mocked built-ins. */
  15315. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  15316. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  15317. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  15318. /* Built-in method references for those with the same name as other `lodash` methods. */
  15319. var nativeCeil = Math.ceil,
  15320. nativeFloor = Math.floor,
  15321. nativeGetSymbols = Object.getOwnPropertySymbols,
  15322. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  15323. nativeIsFinite = context.isFinite,
  15324. nativeJoin = arrayProto.join,
  15325. nativeKeys = overArg(Object.keys, Object),
  15326. nativeMax = Math.max,
  15327. nativeMin = Math.min,
  15328. nativeNow = Date.now,
  15329. nativeParseInt = context.parseInt,
  15330. nativeRandom = Math.random,
  15331. nativeReverse = arrayProto.reverse;
  15332. /* Built-in method references that are verified to be native. */
  15333. var DataView = getNative(context, 'DataView'),
  15334. Map = getNative(context, 'Map'),
  15335. Promise = getNative(context, 'Promise'),
  15336. Set = getNative(context, 'Set'),
  15337. WeakMap = getNative(context, 'WeakMap'),
  15338. nativeCreate = getNative(Object, 'create');
  15339. /** Used to store function metadata. */
  15340. var metaMap = WeakMap && new WeakMap;
  15341. /** Used to lookup unminified function names. */
  15342. var realNames = {};
  15343. /** Used to detect maps, sets, and weakmaps. */
  15344. var dataViewCtorString = toSource(DataView),
  15345. mapCtorString = toSource(Map),
  15346. promiseCtorString = toSource(Promise),
  15347. setCtorString = toSource(Set),
  15348. weakMapCtorString = toSource(WeakMap);
  15349. /** Used to convert symbols to primitives and strings. */
  15350. var symbolProto = Symbol ? Symbol.prototype : undefined,
  15351. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  15352. symbolToString = symbolProto ? symbolProto.toString : undefined;
  15353. /*------------------------------------------------------------------------*/
  15354. /**
  15355. * Creates a `lodash` object which wraps `value` to enable implicit method
  15356. * chain sequences. Methods that operate on and return arrays, collections,
  15357. * and functions can be chained together. Methods that retrieve a single value
  15358. * or may return a primitive value will automatically end the chain sequence
  15359. * and return the unwrapped value. Otherwise, the value must be unwrapped
  15360. * with `_#value`.
  15361. *
  15362. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  15363. * enabled using `_.chain`.
  15364. *
  15365. * The execution of chained methods is lazy, that is, it's deferred until
  15366. * `_#value` is implicitly or explicitly called.
  15367. *
  15368. * Lazy evaluation allows several methods to support shortcut fusion.
  15369. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  15370. * the creation of intermediate arrays and can greatly reduce the number of
  15371. * iteratee executions. Sections of a chain sequence qualify for shortcut
  15372. * fusion if the section is applied to an array and iteratees accept only
  15373. * one argument. The heuristic for whether a section qualifies for shortcut
  15374. * fusion is subject to change.
  15375. *
  15376. * Chaining is supported in custom builds as long as the `_#value` method is
  15377. * directly or indirectly included in the build.
  15378. *
  15379. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  15380. *
  15381. * The wrapper `Array` methods are:
  15382. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  15383. *
  15384. * The wrapper `String` methods are:
  15385. * `replace` and `split`
  15386. *
  15387. * The wrapper methods that support shortcut fusion are:
  15388. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  15389. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  15390. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  15391. *
  15392. * The chainable wrapper methods are:
  15393. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  15394. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  15395. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  15396. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  15397. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  15398. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  15399. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  15400. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  15401. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  15402. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  15403. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  15404. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  15405. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  15406. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  15407. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  15408. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  15409. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  15410. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  15411. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  15412. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  15413. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  15414. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  15415. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  15416. * `zipObject`, `zipObjectDeep`, and `zipWith`
  15417. *
  15418. * The wrapper methods that are **not** chainable by default are:
  15419. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  15420. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  15421. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  15422. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  15423. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  15424. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  15425. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  15426. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  15427. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  15428. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  15429. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  15430. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  15431. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  15432. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  15433. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  15434. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  15435. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  15436. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  15437. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  15438. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  15439. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  15440. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  15441. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  15442. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  15443. * `upperFirst`, `value`, and `words`
  15444. *
  15445. * @name _
  15446. * @constructor
  15447. * @category Seq
  15448. * @param {*} value The value to wrap in a `lodash` instance.
  15449. * @returns {Object} Returns the new `lodash` wrapper instance.
  15450. * @example
  15451. *
  15452. * function square(n) {
  15453. * return n * n;
  15454. * }
  15455. *
  15456. * var wrapped = _([1, 2, 3]);
  15457. *
  15458. * // Returns an unwrapped value.
  15459. * wrapped.reduce(_.add);
  15460. * // => 6
  15461. *
  15462. * // Returns a wrapped value.
  15463. * var squares = wrapped.map(square);
  15464. *
  15465. * _.isArray(squares);
  15466. * // => false
  15467. *
  15468. * _.isArray(squares.value());
  15469. * // => true
  15470. */
  15471. function lodash(value) {
  15472. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  15473. if (value instanceof LodashWrapper) {
  15474. return value;
  15475. }
  15476. if (hasOwnProperty.call(value, '__wrapped__')) {
  15477. return wrapperClone(value);
  15478. }
  15479. }
  15480. return new LodashWrapper(value);
  15481. }
  15482. /**
  15483. * The base implementation of `_.create` without support for assigning
  15484. * properties to the created object.
  15485. *
  15486. * @private
  15487. * @param {Object} proto The object to inherit from.
  15488. * @returns {Object} Returns the new object.
  15489. */
  15490. var baseCreate = (function() {
  15491. function object() {}
  15492. return function(proto) {
  15493. if (!isObject(proto)) {
  15494. return {};
  15495. }
  15496. if (objectCreate) {
  15497. return objectCreate(proto);
  15498. }
  15499. object.prototype = proto;
  15500. var result = new object;
  15501. object.prototype = undefined;
  15502. return result;
  15503. };
  15504. }());
  15505. /**
  15506. * The function whose prototype chain sequence wrappers inherit from.
  15507. *
  15508. * @private
  15509. */
  15510. function baseLodash() {
  15511. // No operation performed.
  15512. }
  15513. /**
  15514. * The base constructor for creating `lodash` wrapper objects.
  15515. *
  15516. * @private
  15517. * @param {*} value The value to wrap.
  15518. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  15519. */
  15520. function LodashWrapper(value, chainAll) {
  15521. this.__wrapped__ = value;
  15522. this.__actions__ = [];
  15523. this.__chain__ = !!chainAll;
  15524. this.__index__ = 0;
  15525. this.__values__ = undefined;
  15526. }
  15527. /**
  15528. * By default, the template delimiters used by lodash are like those in
  15529. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  15530. * following template settings to use alternative delimiters.
  15531. *
  15532. * @static
  15533. * @memberOf _
  15534. * @type {Object}
  15535. */
  15536. lodash.templateSettings = {
  15537. /**
  15538. * Used to detect `data` property values to be HTML-escaped.
  15539. *
  15540. * @memberOf _.templateSettings
  15541. * @type {RegExp}
  15542. */
  15543. 'escape': reEscape,
  15544. /**
  15545. * Used to detect code to be evaluated.
  15546. *
  15547. * @memberOf _.templateSettings
  15548. * @type {RegExp}
  15549. */
  15550. 'evaluate': reEvaluate,
  15551. /**
  15552. * Used to detect `data` property values to inject.
  15553. *
  15554. * @memberOf _.templateSettings
  15555. * @type {RegExp}
  15556. */
  15557. 'interpolate': reInterpolate,
  15558. /**
  15559. * Used to reference the data object in the template text.
  15560. *
  15561. * @memberOf _.templateSettings
  15562. * @type {string}
  15563. */
  15564. 'variable': '',
  15565. /**
  15566. * Used to import variables into the compiled template.
  15567. *
  15568. * @memberOf _.templateSettings
  15569. * @type {Object}
  15570. */
  15571. 'imports': {
  15572. /**
  15573. * A reference to the `lodash` function.
  15574. *
  15575. * @memberOf _.templateSettings.imports
  15576. * @type {Function}
  15577. */
  15578. '_': lodash
  15579. }
  15580. };
  15581. // Ensure wrappers are instances of `baseLodash`.
  15582. lodash.prototype = baseLodash.prototype;
  15583. lodash.prototype.constructor = lodash;
  15584. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  15585. LodashWrapper.prototype.constructor = LodashWrapper;
  15586. /*------------------------------------------------------------------------*/
  15587. /**
  15588. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  15589. *
  15590. * @private
  15591. * @constructor
  15592. * @param {*} value The value to wrap.
  15593. */
  15594. function LazyWrapper(value) {
  15595. this.__wrapped__ = value;
  15596. this.__actions__ = [];
  15597. this.__dir__ = 1;
  15598. this.__filtered__ = false;
  15599. this.__iteratees__ = [];
  15600. this.__takeCount__ = MAX_ARRAY_LENGTH;
  15601. this.__views__ = [];
  15602. }
  15603. /**
  15604. * Creates a clone of the lazy wrapper object.
  15605. *
  15606. * @private
  15607. * @name clone
  15608. * @memberOf LazyWrapper
  15609. * @returns {Object} Returns the cloned `LazyWrapper` object.
  15610. */
  15611. function lazyClone() {
  15612. var result = new LazyWrapper(this.__wrapped__);
  15613. result.__actions__ = copyArray(this.__actions__);
  15614. result.__dir__ = this.__dir__;
  15615. result.__filtered__ = this.__filtered__;
  15616. result.__iteratees__ = copyArray(this.__iteratees__);
  15617. result.__takeCount__ = this.__takeCount__;
  15618. result.__views__ = copyArray(this.__views__);
  15619. return result;
  15620. }
  15621. /**
  15622. * Reverses the direction of lazy iteration.
  15623. *
  15624. * @private
  15625. * @name reverse
  15626. * @memberOf LazyWrapper
  15627. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  15628. */
  15629. function lazyReverse() {
  15630. if (this.__filtered__) {
  15631. var result = new LazyWrapper(this);
  15632. result.__dir__ = -1;
  15633. result.__filtered__ = true;
  15634. } else {
  15635. result = this.clone();
  15636. result.__dir__ *= -1;
  15637. }
  15638. return result;
  15639. }
  15640. /**
  15641. * Extracts the unwrapped value from its lazy wrapper.
  15642. *
  15643. * @private
  15644. * @name value
  15645. * @memberOf LazyWrapper
  15646. * @returns {*} Returns the unwrapped value.
  15647. */
  15648. function lazyValue() {
  15649. var array = this.__wrapped__.value(),
  15650. dir = this.__dir__,
  15651. isArr = isArray(array),
  15652. isRight = dir < 0,
  15653. arrLength = isArr ? array.length : 0,
  15654. view = getView(0, arrLength, this.__views__),
  15655. start = view.start,
  15656. end = view.end,
  15657. length = end - start,
  15658. index = isRight ? end : (start - 1),
  15659. iteratees = this.__iteratees__,
  15660. iterLength = iteratees.length,
  15661. resIndex = 0,
  15662. takeCount = nativeMin(length, this.__takeCount__);
  15663. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  15664. return baseWrapperValue(array, this.__actions__);
  15665. }
  15666. var result = [];
  15667. outer:
  15668. while (length-- && resIndex < takeCount) {
  15669. index += dir;
  15670. var iterIndex = -1,
  15671. value = array[index];
  15672. while (++iterIndex < iterLength) {
  15673. var data = iteratees[iterIndex],
  15674. iteratee = data.iteratee,
  15675. type = data.type,
  15676. computed = iteratee(value);
  15677. if (type == LAZY_MAP_FLAG) {
  15678. value = computed;
  15679. } else if (!computed) {
  15680. if (type == LAZY_FILTER_FLAG) {
  15681. continue outer;
  15682. } else {
  15683. break outer;
  15684. }
  15685. }
  15686. }
  15687. result[resIndex++] = value;
  15688. }
  15689. return result;
  15690. }
  15691. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  15692. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  15693. LazyWrapper.prototype.constructor = LazyWrapper;
  15694. /*------------------------------------------------------------------------*/
  15695. /**
  15696. * Creates a hash object.
  15697. *
  15698. * @private
  15699. * @constructor
  15700. * @param {Array} [entries] The key-value pairs to cache.
  15701. */
  15702. function Hash(entries) {
  15703. var index = -1,
  15704. length = entries == null ? 0 : entries.length;
  15705. this.clear();
  15706. while (++index < length) {
  15707. var entry = entries[index];
  15708. this.set(entry[0], entry[1]);
  15709. }
  15710. }
  15711. /**
  15712. * Removes all key-value entries from the hash.
  15713. *
  15714. * @private
  15715. * @name clear
  15716. * @memberOf Hash
  15717. */
  15718. function hashClear() {
  15719. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  15720. this.size = 0;
  15721. }
  15722. /**
  15723. * Removes `key` and its value from the hash.
  15724. *
  15725. * @private
  15726. * @name delete
  15727. * @memberOf Hash
  15728. * @param {Object} hash The hash to modify.
  15729. * @param {string} key The key of the value to remove.
  15730. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15731. */
  15732. function hashDelete(key) {
  15733. var result = this.has(key) && delete this.__data__[key];
  15734. this.size -= result ? 1 : 0;
  15735. return result;
  15736. }
  15737. /**
  15738. * Gets the hash value for `key`.
  15739. *
  15740. * @private
  15741. * @name get
  15742. * @memberOf Hash
  15743. * @param {string} key The key of the value to get.
  15744. * @returns {*} Returns the entry value.
  15745. */
  15746. function hashGet(key) {
  15747. var data = this.__data__;
  15748. if (nativeCreate) {
  15749. var result = data[key];
  15750. return result === HASH_UNDEFINED ? undefined : result;
  15751. }
  15752. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  15753. }
  15754. /**
  15755. * Checks if a hash value for `key` exists.
  15756. *
  15757. * @private
  15758. * @name has
  15759. * @memberOf Hash
  15760. * @param {string} key The key of the entry to check.
  15761. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15762. */
  15763. function hashHas(key) {
  15764. var data = this.__data__;
  15765. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  15766. }
  15767. /**
  15768. * Sets the hash `key` to `value`.
  15769. *
  15770. * @private
  15771. * @name set
  15772. * @memberOf Hash
  15773. * @param {string} key The key of the value to set.
  15774. * @param {*} value The value to set.
  15775. * @returns {Object} Returns the hash instance.
  15776. */
  15777. function hashSet(key, value) {
  15778. var data = this.__data__;
  15779. this.size += this.has(key) ? 0 : 1;
  15780. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  15781. return this;
  15782. }
  15783. // Add methods to `Hash`.
  15784. Hash.prototype.clear = hashClear;
  15785. Hash.prototype['delete'] = hashDelete;
  15786. Hash.prototype.get = hashGet;
  15787. Hash.prototype.has = hashHas;
  15788. Hash.prototype.set = hashSet;
  15789. /*------------------------------------------------------------------------*/
  15790. /**
  15791. * Creates an list cache object.
  15792. *
  15793. * @private
  15794. * @constructor
  15795. * @param {Array} [entries] The key-value pairs to cache.
  15796. */
  15797. function ListCache(entries) {
  15798. var index = -1,
  15799. length = entries == null ? 0 : entries.length;
  15800. this.clear();
  15801. while (++index < length) {
  15802. var entry = entries[index];
  15803. this.set(entry[0], entry[1]);
  15804. }
  15805. }
  15806. /**
  15807. * Removes all key-value entries from the list cache.
  15808. *
  15809. * @private
  15810. * @name clear
  15811. * @memberOf ListCache
  15812. */
  15813. function listCacheClear() {
  15814. this.__data__ = [];
  15815. this.size = 0;
  15816. }
  15817. /**
  15818. * Removes `key` and its value from the list cache.
  15819. *
  15820. * @private
  15821. * @name delete
  15822. * @memberOf ListCache
  15823. * @param {string} key The key of the value to remove.
  15824. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15825. */
  15826. function listCacheDelete(key) {
  15827. var data = this.__data__,
  15828. index = assocIndexOf(data, key);
  15829. if (index < 0) {
  15830. return false;
  15831. }
  15832. var lastIndex = data.length - 1;
  15833. if (index == lastIndex) {
  15834. data.pop();
  15835. } else {
  15836. splice.call(data, index, 1);
  15837. }
  15838. --this.size;
  15839. return true;
  15840. }
  15841. /**
  15842. * Gets the list cache value for `key`.
  15843. *
  15844. * @private
  15845. * @name get
  15846. * @memberOf ListCache
  15847. * @param {string} key The key of the value to get.
  15848. * @returns {*} Returns the entry value.
  15849. */
  15850. function listCacheGet(key) {
  15851. var data = this.__data__,
  15852. index = assocIndexOf(data, key);
  15853. return index < 0 ? undefined : data[index][1];
  15854. }
  15855. /**
  15856. * Checks if a list cache value for `key` exists.
  15857. *
  15858. * @private
  15859. * @name has
  15860. * @memberOf ListCache
  15861. * @param {string} key The key of the entry to check.
  15862. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15863. */
  15864. function listCacheHas(key) {
  15865. return assocIndexOf(this.__data__, key) > -1;
  15866. }
  15867. /**
  15868. * Sets the list cache `key` to `value`.
  15869. *
  15870. * @private
  15871. * @name set
  15872. * @memberOf ListCache
  15873. * @param {string} key The key of the value to set.
  15874. * @param {*} value The value to set.
  15875. * @returns {Object} Returns the list cache instance.
  15876. */
  15877. function listCacheSet(key, value) {
  15878. var data = this.__data__,
  15879. index = assocIndexOf(data, key);
  15880. if (index < 0) {
  15881. ++this.size;
  15882. data.push([key, value]);
  15883. } else {
  15884. data[index][1] = value;
  15885. }
  15886. return this;
  15887. }
  15888. // Add methods to `ListCache`.
  15889. ListCache.prototype.clear = listCacheClear;
  15890. ListCache.prototype['delete'] = listCacheDelete;
  15891. ListCache.prototype.get = listCacheGet;
  15892. ListCache.prototype.has = listCacheHas;
  15893. ListCache.prototype.set = listCacheSet;
  15894. /*------------------------------------------------------------------------*/
  15895. /**
  15896. * Creates a map cache object to store key-value pairs.
  15897. *
  15898. * @private
  15899. * @constructor
  15900. * @param {Array} [entries] The key-value pairs to cache.
  15901. */
  15902. function MapCache(entries) {
  15903. var index = -1,
  15904. length = entries == null ? 0 : entries.length;
  15905. this.clear();
  15906. while (++index < length) {
  15907. var entry = entries[index];
  15908. this.set(entry[0], entry[1]);
  15909. }
  15910. }
  15911. /**
  15912. * Removes all key-value entries from the map.
  15913. *
  15914. * @private
  15915. * @name clear
  15916. * @memberOf MapCache
  15917. */
  15918. function mapCacheClear() {
  15919. this.size = 0;
  15920. this.__data__ = {
  15921. 'hash': new Hash,
  15922. 'map': new (Map || ListCache),
  15923. 'string': new Hash
  15924. };
  15925. }
  15926. /**
  15927. * Removes `key` and its value from the map.
  15928. *
  15929. * @private
  15930. * @name delete
  15931. * @memberOf MapCache
  15932. * @param {string} key The key of the value to remove.
  15933. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15934. */
  15935. function mapCacheDelete(key) {
  15936. var result = getMapData(this, key)['delete'](key);
  15937. this.size -= result ? 1 : 0;
  15938. return result;
  15939. }
  15940. /**
  15941. * Gets the map value for `key`.
  15942. *
  15943. * @private
  15944. * @name get
  15945. * @memberOf MapCache
  15946. * @param {string} key The key of the value to get.
  15947. * @returns {*} Returns the entry value.
  15948. */
  15949. function mapCacheGet(key) {
  15950. return getMapData(this, key).get(key);
  15951. }
  15952. /**
  15953. * Checks if a map value for `key` exists.
  15954. *
  15955. * @private
  15956. * @name has
  15957. * @memberOf MapCache
  15958. * @param {string} key The key of the entry to check.
  15959. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15960. */
  15961. function mapCacheHas(key) {
  15962. return getMapData(this, key).has(key);
  15963. }
  15964. /**
  15965. * Sets the map `key` to `value`.
  15966. *
  15967. * @private
  15968. * @name set
  15969. * @memberOf MapCache
  15970. * @param {string} key The key of the value to set.
  15971. * @param {*} value The value to set.
  15972. * @returns {Object} Returns the map cache instance.
  15973. */
  15974. function mapCacheSet(key, value) {
  15975. var data = getMapData(this, key),
  15976. size = data.size;
  15977. data.set(key, value);
  15978. this.size += data.size == size ? 0 : 1;
  15979. return this;
  15980. }
  15981. // Add methods to `MapCache`.
  15982. MapCache.prototype.clear = mapCacheClear;
  15983. MapCache.prototype['delete'] = mapCacheDelete;
  15984. MapCache.prototype.get = mapCacheGet;
  15985. MapCache.prototype.has = mapCacheHas;
  15986. MapCache.prototype.set = mapCacheSet;
  15987. /*------------------------------------------------------------------------*/
  15988. /**
  15989. *
  15990. * Creates an array cache object to store unique values.
  15991. *
  15992. * @private
  15993. * @constructor
  15994. * @param {Array} [values] The values to cache.
  15995. */
  15996. function SetCache(values) {
  15997. var index = -1,
  15998. length = values == null ? 0 : values.length;
  15999. this.__data__ = new MapCache;
  16000. while (++index < length) {
  16001. this.add(values[index]);
  16002. }
  16003. }
  16004. /**
  16005. * Adds `value` to the array cache.
  16006. *
  16007. * @private
  16008. * @name add
  16009. * @memberOf SetCache
  16010. * @alias push
  16011. * @param {*} value The value to cache.
  16012. * @returns {Object} Returns the cache instance.
  16013. */
  16014. function setCacheAdd(value) {
  16015. this.__data__.set(value, HASH_UNDEFINED);
  16016. return this;
  16017. }
  16018. /**
  16019. * Checks if `value` is in the array cache.
  16020. *
  16021. * @private
  16022. * @name has
  16023. * @memberOf SetCache
  16024. * @param {*} value The value to search for.
  16025. * @returns {number} Returns `true` if `value` is found, else `false`.
  16026. */
  16027. function setCacheHas(value) {
  16028. return this.__data__.has(value);
  16029. }
  16030. // Add methods to `SetCache`.
  16031. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  16032. SetCache.prototype.has = setCacheHas;
  16033. /*------------------------------------------------------------------------*/
  16034. /**
  16035. * Creates a stack cache object to store key-value pairs.
  16036. *
  16037. * @private
  16038. * @constructor
  16039. * @param {Array} [entries] The key-value pairs to cache.
  16040. */
  16041. function Stack(entries) {
  16042. var data = this.__data__ = new ListCache(entries);
  16043. this.size = data.size;
  16044. }
  16045. /**
  16046. * Removes all key-value entries from the stack.
  16047. *
  16048. * @private
  16049. * @name clear
  16050. * @memberOf Stack
  16051. */
  16052. function stackClear() {
  16053. this.__data__ = new ListCache;
  16054. this.size = 0;
  16055. }
  16056. /**
  16057. * Removes `key` and its value from the stack.
  16058. *
  16059. * @private
  16060. * @name delete
  16061. * @memberOf Stack
  16062. * @param {string} key The key of the value to remove.
  16063. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  16064. */
  16065. function stackDelete(key) {
  16066. var data = this.__data__,
  16067. result = data['delete'](key);
  16068. this.size = data.size;
  16069. return result;
  16070. }
  16071. /**
  16072. * Gets the stack value for `key`.
  16073. *
  16074. * @private
  16075. * @name get
  16076. * @memberOf Stack
  16077. * @param {string} key The key of the value to get.
  16078. * @returns {*} Returns the entry value.
  16079. */
  16080. function stackGet(key) {
  16081. return this.__data__.get(key);
  16082. }
  16083. /**
  16084. * Checks if a stack value for `key` exists.
  16085. *
  16086. * @private
  16087. * @name has
  16088. * @memberOf Stack
  16089. * @param {string} key The key of the entry to check.
  16090. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  16091. */
  16092. function stackHas(key) {
  16093. return this.__data__.has(key);
  16094. }
  16095. /**
  16096. * Sets the stack `key` to `value`.
  16097. *
  16098. * @private
  16099. * @name set
  16100. * @memberOf Stack
  16101. * @param {string} key The key of the value to set.
  16102. * @param {*} value The value to set.
  16103. * @returns {Object} Returns the stack cache instance.
  16104. */
  16105. function stackSet(key, value) {
  16106. var data = this.__data__;
  16107. if (data instanceof ListCache) {
  16108. var pairs = data.__data__;
  16109. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  16110. pairs.push([key, value]);
  16111. this.size = ++data.size;
  16112. return this;
  16113. }
  16114. data = this.__data__ = new MapCache(pairs);
  16115. }
  16116. data.set(key, value);
  16117. this.size = data.size;
  16118. return this;
  16119. }
  16120. // Add methods to `Stack`.
  16121. Stack.prototype.clear = stackClear;
  16122. Stack.prototype['delete'] = stackDelete;
  16123. Stack.prototype.get = stackGet;
  16124. Stack.prototype.has = stackHas;
  16125. Stack.prototype.set = stackSet;
  16126. /*------------------------------------------------------------------------*/
  16127. /**
  16128. * Creates an array of the enumerable property names of the array-like `value`.
  16129. *
  16130. * @private
  16131. * @param {*} value The value to query.
  16132. * @param {boolean} inherited Specify returning inherited property names.
  16133. * @returns {Array} Returns the array of property names.
  16134. */
  16135. function arrayLikeKeys(value, inherited) {
  16136. var isArr = isArray(value),
  16137. isArg = !isArr && isArguments(value),
  16138. isBuff = !isArr && !isArg && isBuffer(value),
  16139. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  16140. skipIndexes = isArr || isArg || isBuff || isType,
  16141. result = skipIndexes ? baseTimes(value.length, String) : [],
  16142. length = result.length;
  16143. for (var key in value) {
  16144. if ((inherited || hasOwnProperty.call(value, key)) &&
  16145. !(skipIndexes && (
  16146. // Safari 9 has enumerable `arguments.length` in strict mode.
  16147. key == 'length' ||
  16148. // Node.js 0.10 has enumerable non-index properties on buffers.
  16149. (isBuff && (key == 'offset' || key == 'parent')) ||
  16150. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  16151. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  16152. // Skip index properties.
  16153. isIndex(key, length)
  16154. ))) {
  16155. result.push(key);
  16156. }
  16157. }
  16158. return result;
  16159. }
  16160. /**
  16161. * A specialized version of `_.sample` for arrays.
  16162. *
  16163. * @private
  16164. * @param {Array} array The array to sample.
  16165. * @returns {*} Returns the random element.
  16166. */
  16167. function arraySample(array) {
  16168. var length = array.length;
  16169. return length ? array[baseRandom(0, length - 1)] : undefined;
  16170. }
  16171. /**
  16172. * A specialized version of `_.sampleSize` for arrays.
  16173. *
  16174. * @private
  16175. * @param {Array} array The array to sample.
  16176. * @param {number} n The number of elements to sample.
  16177. * @returns {Array} Returns the random elements.
  16178. */
  16179. function arraySampleSize(array, n) {
  16180. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  16181. }
  16182. /**
  16183. * A specialized version of `_.shuffle` for arrays.
  16184. *
  16185. * @private
  16186. * @param {Array} array The array to shuffle.
  16187. * @returns {Array} Returns the new shuffled array.
  16188. */
  16189. function arrayShuffle(array) {
  16190. return shuffleSelf(copyArray(array));
  16191. }
  16192. /**
  16193. * This function is like `assignValue` except that it doesn't assign
  16194. * `undefined` values.
  16195. *
  16196. * @private
  16197. * @param {Object} object The object to modify.
  16198. * @param {string} key The key of the property to assign.
  16199. * @param {*} value The value to assign.
  16200. */
  16201. function assignMergeValue(object, key, value) {
  16202. if ((value !== undefined && !eq(object[key], value)) ||
  16203. (value === undefined && !(key in object))) {
  16204. baseAssignValue(object, key, value);
  16205. }
  16206. }
  16207. /**
  16208. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  16209. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16210. * for equality comparisons.
  16211. *
  16212. * @private
  16213. * @param {Object} object The object to modify.
  16214. * @param {string} key The key of the property to assign.
  16215. * @param {*} value The value to assign.
  16216. */
  16217. function assignValue(object, key, value) {
  16218. var objValue = object[key];
  16219. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  16220. (value === undefined && !(key in object))) {
  16221. baseAssignValue(object, key, value);
  16222. }
  16223. }
  16224. /**
  16225. * Gets the index at which the `key` is found in `array` of key-value pairs.
  16226. *
  16227. * @private
  16228. * @param {Array} array The array to inspect.
  16229. * @param {*} key The key to search for.
  16230. * @returns {number} Returns the index of the matched value, else `-1`.
  16231. */
  16232. function assocIndexOf(array, key) {
  16233. var length = array.length;
  16234. while (length--) {
  16235. if (eq(array[length][0], key)) {
  16236. return length;
  16237. }
  16238. }
  16239. return -1;
  16240. }
  16241. /**
  16242. * Aggregates elements of `collection` on `accumulator` with keys transformed
  16243. * by `iteratee` and values set by `setter`.
  16244. *
  16245. * @private
  16246. * @param {Array|Object} collection The collection to iterate over.
  16247. * @param {Function} setter The function to set `accumulator` values.
  16248. * @param {Function} iteratee The iteratee to transform keys.
  16249. * @param {Object} accumulator The initial aggregated object.
  16250. * @returns {Function} Returns `accumulator`.
  16251. */
  16252. function baseAggregator(collection, setter, iteratee, accumulator) {
  16253. baseEach(collection, function(value, key, collection) {
  16254. setter(accumulator, value, iteratee(value), collection);
  16255. });
  16256. return accumulator;
  16257. }
  16258. /**
  16259. * The base implementation of `_.assign` without support for multiple sources
  16260. * or `customizer` functions.
  16261. *
  16262. * @private
  16263. * @param {Object} object The destination object.
  16264. * @param {Object} source The source object.
  16265. * @returns {Object} Returns `object`.
  16266. */
  16267. function baseAssign(object, source) {
  16268. return object && copyObject(source, keys(source), object);
  16269. }
  16270. /**
  16271. * The base implementation of `_.assignIn` without support for multiple sources
  16272. * or `customizer` functions.
  16273. *
  16274. * @private
  16275. * @param {Object} object The destination object.
  16276. * @param {Object} source The source object.
  16277. * @returns {Object} Returns `object`.
  16278. */
  16279. function baseAssignIn(object, source) {
  16280. return object && copyObject(source, keysIn(source), object);
  16281. }
  16282. /**
  16283. * The base implementation of `assignValue` and `assignMergeValue` without
  16284. * value checks.
  16285. *
  16286. * @private
  16287. * @param {Object} object The object to modify.
  16288. * @param {string} key The key of the property to assign.
  16289. * @param {*} value The value to assign.
  16290. */
  16291. function baseAssignValue(object, key, value) {
  16292. if (key == '__proto__' && defineProperty) {
  16293. defineProperty(object, key, {
  16294. 'configurable': true,
  16295. 'enumerable': true,
  16296. 'value': value,
  16297. 'writable': true
  16298. });
  16299. } else {
  16300. object[key] = value;
  16301. }
  16302. }
  16303. /**
  16304. * The base implementation of `_.at` without support for individual paths.
  16305. *
  16306. * @private
  16307. * @param {Object} object The object to iterate over.
  16308. * @param {string[]} paths The property paths to pick.
  16309. * @returns {Array} Returns the picked elements.
  16310. */
  16311. function baseAt(object, paths) {
  16312. var index = -1,
  16313. length = paths.length,
  16314. result = Array(length),
  16315. skip = object == null;
  16316. while (++index < length) {
  16317. result[index] = skip ? undefined : get(object, paths[index]);
  16318. }
  16319. return result;
  16320. }
  16321. /**
  16322. * The base implementation of `_.clamp` which doesn't coerce arguments.
  16323. *
  16324. * @private
  16325. * @param {number} number The number to clamp.
  16326. * @param {number} [lower] The lower bound.
  16327. * @param {number} upper The upper bound.
  16328. * @returns {number} Returns the clamped number.
  16329. */
  16330. function baseClamp(number, lower, upper) {
  16331. if (number === number) {
  16332. if (upper !== undefined) {
  16333. number = number <= upper ? number : upper;
  16334. }
  16335. if (lower !== undefined) {
  16336. number = number >= lower ? number : lower;
  16337. }
  16338. }
  16339. return number;
  16340. }
  16341. /**
  16342. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  16343. * traversed objects.
  16344. *
  16345. * @private
  16346. * @param {*} value The value to clone.
  16347. * @param {boolean} bitmask The bitmask flags.
  16348. * 1 - Deep clone
  16349. * 2 - Flatten inherited properties
  16350. * 4 - Clone symbols
  16351. * @param {Function} [customizer] The function to customize cloning.
  16352. * @param {string} [key] The key of `value`.
  16353. * @param {Object} [object] The parent object of `value`.
  16354. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  16355. * @returns {*} Returns the cloned value.
  16356. */
  16357. function baseClone(value, bitmask, customizer, key, object, stack) {
  16358. var result,
  16359. isDeep = bitmask & CLONE_DEEP_FLAG,
  16360. isFlat = bitmask & CLONE_FLAT_FLAG,
  16361. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  16362. if (customizer) {
  16363. result = object ? customizer(value, key, object, stack) : customizer(value);
  16364. }
  16365. if (result !== undefined) {
  16366. return result;
  16367. }
  16368. if (!isObject(value)) {
  16369. return value;
  16370. }
  16371. var isArr = isArray(value);
  16372. if (isArr) {
  16373. result = initCloneArray(value);
  16374. if (!isDeep) {
  16375. return copyArray(value, result);
  16376. }
  16377. } else {
  16378. var tag = getTag(value),
  16379. isFunc = tag == funcTag || tag == genTag;
  16380. if (isBuffer(value)) {
  16381. return cloneBuffer(value, isDeep);
  16382. }
  16383. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  16384. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  16385. if (!isDeep) {
  16386. return isFlat
  16387. ? copySymbolsIn(value, baseAssignIn(result, value))
  16388. : copySymbols(value, baseAssign(result, value));
  16389. }
  16390. } else {
  16391. if (!cloneableTags[tag]) {
  16392. return object ? value : {};
  16393. }
  16394. result = initCloneByTag(value, tag, isDeep);
  16395. }
  16396. }
  16397. // Check for circular references and return its corresponding clone.
  16398. stack || (stack = new Stack);
  16399. var stacked = stack.get(value);
  16400. if (stacked) {
  16401. return stacked;
  16402. }
  16403. stack.set(value, result);
  16404. if (isSet(value)) {
  16405. value.forEach(function(subValue) {
  16406. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  16407. });
  16408. } else if (isMap(value)) {
  16409. value.forEach(function(subValue, key) {
  16410. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16411. });
  16412. }
  16413. var keysFunc = isFull
  16414. ? (isFlat ? getAllKeysIn : getAllKeys)
  16415. : (isFlat ? keysIn : keys);
  16416. var props = isArr ? undefined : keysFunc(value);
  16417. arrayEach(props || value, function(subValue, key) {
  16418. if (props) {
  16419. key = subValue;
  16420. subValue = value[key];
  16421. }
  16422. // Recursively populate clone (susceptible to call stack limits).
  16423. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16424. });
  16425. return result;
  16426. }
  16427. /**
  16428. * The base implementation of `_.conforms` which doesn't clone `source`.
  16429. *
  16430. * @private
  16431. * @param {Object} source The object of property predicates to conform to.
  16432. * @returns {Function} Returns the new spec function.
  16433. */
  16434. function baseConforms(source) {
  16435. var props = keys(source);
  16436. return function(object) {
  16437. return baseConformsTo(object, source, props);
  16438. };
  16439. }
  16440. /**
  16441. * The base implementation of `_.conformsTo` which accepts `props` to check.
  16442. *
  16443. * @private
  16444. * @param {Object} object The object to inspect.
  16445. * @param {Object} source The object of property predicates to conform to.
  16446. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  16447. */
  16448. function baseConformsTo(object, source, props) {
  16449. var length = props.length;
  16450. if (object == null) {
  16451. return !length;
  16452. }
  16453. object = Object(object);
  16454. while (length--) {
  16455. var key = props[length],
  16456. predicate = source[key],
  16457. value = object[key];
  16458. if ((value === undefined && !(key in object)) || !predicate(value)) {
  16459. return false;
  16460. }
  16461. }
  16462. return true;
  16463. }
  16464. /**
  16465. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  16466. * to provide to `func`.
  16467. *
  16468. * @private
  16469. * @param {Function} func The function to delay.
  16470. * @param {number} wait The number of milliseconds to delay invocation.
  16471. * @param {Array} args The arguments to provide to `func`.
  16472. * @returns {number|Object} Returns the timer id or timeout object.
  16473. */
  16474. function baseDelay(func, wait, args) {
  16475. if (typeof func != 'function') {
  16476. throw new TypeError(FUNC_ERROR_TEXT);
  16477. }
  16478. return setTimeout(function() { func.apply(undefined, args); }, wait);
  16479. }
  16480. /**
  16481. * The base implementation of methods like `_.difference` without support
  16482. * for excluding multiple arrays or iteratee shorthands.
  16483. *
  16484. * @private
  16485. * @param {Array} array The array to inspect.
  16486. * @param {Array} values The values to exclude.
  16487. * @param {Function} [iteratee] The iteratee invoked per element.
  16488. * @param {Function} [comparator] The comparator invoked per element.
  16489. * @returns {Array} Returns the new array of filtered values.
  16490. */
  16491. function baseDifference(array, values, iteratee, comparator) {
  16492. var index = -1,
  16493. includes = arrayIncludes,
  16494. isCommon = true,
  16495. length = array.length,
  16496. result = [],
  16497. valuesLength = values.length;
  16498. if (!length) {
  16499. return result;
  16500. }
  16501. if (iteratee) {
  16502. values = arrayMap(values, baseUnary(iteratee));
  16503. }
  16504. if (comparator) {
  16505. includes = arrayIncludesWith;
  16506. isCommon = false;
  16507. }
  16508. else if (values.length >= LARGE_ARRAY_SIZE) {
  16509. includes = cacheHas;
  16510. isCommon = false;
  16511. values = new SetCache(values);
  16512. }
  16513. outer:
  16514. while (++index < length) {
  16515. var value = array[index],
  16516. computed = iteratee == null ? value : iteratee(value);
  16517. value = (comparator || value !== 0) ? value : 0;
  16518. if (isCommon && computed === computed) {
  16519. var valuesIndex = valuesLength;
  16520. while (valuesIndex--) {
  16521. if (values[valuesIndex] === computed) {
  16522. continue outer;
  16523. }
  16524. }
  16525. result.push(value);
  16526. }
  16527. else if (!includes(values, computed, comparator)) {
  16528. result.push(value);
  16529. }
  16530. }
  16531. return result;
  16532. }
  16533. /**
  16534. * The base implementation of `_.forEach` without support for iteratee shorthands.
  16535. *
  16536. * @private
  16537. * @param {Array|Object} collection The collection to iterate over.
  16538. * @param {Function} iteratee The function invoked per iteration.
  16539. * @returns {Array|Object} Returns `collection`.
  16540. */
  16541. var baseEach = createBaseEach(baseForOwn);
  16542. /**
  16543. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  16544. *
  16545. * @private
  16546. * @param {Array|Object} collection The collection to iterate over.
  16547. * @param {Function} iteratee The function invoked per iteration.
  16548. * @returns {Array|Object} Returns `collection`.
  16549. */
  16550. var baseEachRight = createBaseEach(baseForOwnRight, true);
  16551. /**
  16552. * The base implementation of `_.every` without support for iteratee shorthands.
  16553. *
  16554. * @private
  16555. * @param {Array|Object} collection The collection to iterate over.
  16556. * @param {Function} predicate The function invoked per iteration.
  16557. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  16558. * else `false`
  16559. */
  16560. function baseEvery(collection, predicate) {
  16561. var result = true;
  16562. baseEach(collection, function(value, index, collection) {
  16563. result = !!predicate(value, index, collection);
  16564. return result;
  16565. });
  16566. return result;
  16567. }
  16568. /**
  16569. * The base implementation of methods like `_.max` and `_.min` which accepts a
  16570. * `comparator` to determine the extremum value.
  16571. *
  16572. * @private
  16573. * @param {Array} array The array to iterate over.
  16574. * @param {Function} iteratee The iteratee invoked per iteration.
  16575. * @param {Function} comparator The comparator used to compare values.
  16576. * @returns {*} Returns the extremum value.
  16577. */
  16578. function baseExtremum(array, iteratee, comparator) {
  16579. var index = -1,
  16580. length = array.length;
  16581. while (++index < length) {
  16582. var value = array[index],
  16583. current = iteratee(value);
  16584. if (current != null && (computed === undefined
  16585. ? (current === current && !isSymbol(current))
  16586. : comparator(current, computed)
  16587. )) {
  16588. var computed = current,
  16589. result = value;
  16590. }
  16591. }
  16592. return result;
  16593. }
  16594. /**
  16595. * The base implementation of `_.fill` without an iteratee call guard.
  16596. *
  16597. * @private
  16598. * @param {Array} array The array to fill.
  16599. * @param {*} value The value to fill `array` with.
  16600. * @param {number} [start=0] The start position.
  16601. * @param {number} [end=array.length] The end position.
  16602. * @returns {Array} Returns `array`.
  16603. */
  16604. function baseFill(array, value, start, end) {
  16605. var length = array.length;
  16606. start = toInteger(start);
  16607. if (start < 0) {
  16608. start = -start > length ? 0 : (length + start);
  16609. }
  16610. end = (end === undefined || end > length) ? length : toInteger(end);
  16611. if (end < 0) {
  16612. end += length;
  16613. }
  16614. end = start > end ? 0 : toLength(end);
  16615. while (start < end) {
  16616. array[start++] = value;
  16617. }
  16618. return array;
  16619. }
  16620. /**
  16621. * The base implementation of `_.filter` without support for iteratee shorthands.
  16622. *
  16623. * @private
  16624. * @param {Array|Object} collection The collection to iterate over.
  16625. * @param {Function} predicate The function invoked per iteration.
  16626. * @returns {Array} Returns the new filtered array.
  16627. */
  16628. function baseFilter(collection, predicate) {
  16629. var result = [];
  16630. baseEach(collection, function(value, index, collection) {
  16631. if (predicate(value, index, collection)) {
  16632. result.push(value);
  16633. }
  16634. });
  16635. return result;
  16636. }
  16637. /**
  16638. * The base implementation of `_.flatten` with support for restricting flattening.
  16639. *
  16640. * @private
  16641. * @param {Array} array The array to flatten.
  16642. * @param {number} depth The maximum recursion depth.
  16643. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  16644. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  16645. * @param {Array} [result=[]] The initial result value.
  16646. * @returns {Array} Returns the new flattened array.
  16647. */
  16648. function baseFlatten(array, depth, predicate, isStrict, result) {
  16649. var index = -1,
  16650. length = array.length;
  16651. predicate || (predicate = isFlattenable);
  16652. result || (result = []);
  16653. while (++index < length) {
  16654. var value = array[index];
  16655. if (depth > 0 && predicate(value)) {
  16656. if (depth > 1) {
  16657. // Recursively flatten arrays (susceptible to call stack limits).
  16658. baseFlatten(value, depth - 1, predicate, isStrict, result);
  16659. } else {
  16660. arrayPush(result, value);
  16661. }
  16662. } else if (!isStrict) {
  16663. result[result.length] = value;
  16664. }
  16665. }
  16666. return result;
  16667. }
  16668. /**
  16669. * The base implementation of `baseForOwn` which iterates over `object`
  16670. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  16671. * Iteratee functions may exit iteration early by explicitly returning `false`.
  16672. *
  16673. * @private
  16674. * @param {Object} object The object to iterate over.
  16675. * @param {Function} iteratee The function invoked per iteration.
  16676. * @param {Function} keysFunc The function to get the keys of `object`.
  16677. * @returns {Object} Returns `object`.
  16678. */
  16679. var baseFor = createBaseFor();
  16680. /**
  16681. * This function is like `baseFor` except that it iterates over properties
  16682. * in the opposite order.
  16683. *
  16684. * @private
  16685. * @param {Object} object The object to iterate over.
  16686. * @param {Function} iteratee The function invoked per iteration.
  16687. * @param {Function} keysFunc The function to get the keys of `object`.
  16688. * @returns {Object} Returns `object`.
  16689. */
  16690. var baseForRight = createBaseFor(true);
  16691. /**
  16692. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  16693. *
  16694. * @private
  16695. * @param {Object} object The object to iterate over.
  16696. * @param {Function} iteratee The function invoked per iteration.
  16697. * @returns {Object} Returns `object`.
  16698. */
  16699. function baseForOwn(object, iteratee) {
  16700. return object && baseFor(object, iteratee, keys);
  16701. }
  16702. /**
  16703. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  16704. *
  16705. * @private
  16706. * @param {Object} object The object to iterate over.
  16707. * @param {Function} iteratee The function invoked per iteration.
  16708. * @returns {Object} Returns `object`.
  16709. */
  16710. function baseForOwnRight(object, iteratee) {
  16711. return object && baseForRight(object, iteratee, keys);
  16712. }
  16713. /**
  16714. * The base implementation of `_.functions` which creates an array of
  16715. * `object` function property names filtered from `props`.
  16716. *
  16717. * @private
  16718. * @param {Object} object The object to inspect.
  16719. * @param {Array} props The property names to filter.
  16720. * @returns {Array} Returns the function names.
  16721. */
  16722. function baseFunctions(object, props) {
  16723. return arrayFilter(props, function(key) {
  16724. return isFunction(object[key]);
  16725. });
  16726. }
  16727. /**
  16728. * The base implementation of `_.get` without support for default values.
  16729. *
  16730. * @private
  16731. * @param {Object} object The object to query.
  16732. * @param {Array|string} path The path of the property to get.
  16733. * @returns {*} Returns the resolved value.
  16734. */
  16735. function baseGet(object, path) {
  16736. path = castPath(path, object);
  16737. var index = 0,
  16738. length = path.length;
  16739. while (object != null && index < length) {
  16740. object = object[toKey(path[index++])];
  16741. }
  16742. return (index && index == length) ? object : undefined;
  16743. }
  16744. /**
  16745. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  16746. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  16747. * symbols of `object`.
  16748. *
  16749. * @private
  16750. * @param {Object} object The object to query.
  16751. * @param {Function} keysFunc The function to get the keys of `object`.
  16752. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  16753. * @returns {Array} Returns the array of property names and symbols.
  16754. */
  16755. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  16756. var result = keysFunc(object);
  16757. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  16758. }
  16759. /**
  16760. * The base implementation of `getTag` without fallbacks for buggy environments.
  16761. *
  16762. * @private
  16763. * @param {*} value The value to query.
  16764. * @returns {string} Returns the `toStringTag`.
  16765. */
  16766. function baseGetTag(value) {
  16767. if (value == null) {
  16768. return value === undefined ? undefinedTag : nullTag;
  16769. }
  16770. return (symToStringTag && symToStringTag in Object(value))
  16771. ? getRawTag(value)
  16772. : objectToString(value);
  16773. }
  16774. /**
  16775. * The base implementation of `_.gt` which doesn't coerce arguments.
  16776. *
  16777. * @private
  16778. * @param {*} value The value to compare.
  16779. * @param {*} other The other value to compare.
  16780. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  16781. * else `false`.
  16782. */
  16783. function baseGt(value, other) {
  16784. return value > other;
  16785. }
  16786. /**
  16787. * The base implementation of `_.has` without support for deep paths.
  16788. *
  16789. * @private
  16790. * @param {Object} [object] The object to query.
  16791. * @param {Array|string} key The key to check.
  16792. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16793. */
  16794. function baseHas(object, key) {
  16795. return object != null && hasOwnProperty.call(object, key);
  16796. }
  16797. /**
  16798. * The base implementation of `_.hasIn` without support for deep paths.
  16799. *
  16800. * @private
  16801. * @param {Object} [object] The object to query.
  16802. * @param {Array|string} key The key to check.
  16803. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16804. */
  16805. function baseHasIn(object, key) {
  16806. return object != null && key in Object(object);
  16807. }
  16808. /**
  16809. * The base implementation of `_.inRange` which doesn't coerce arguments.
  16810. *
  16811. * @private
  16812. * @param {number} number The number to check.
  16813. * @param {number} start The start of the range.
  16814. * @param {number} end The end of the range.
  16815. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  16816. */
  16817. function baseInRange(number, start, end) {
  16818. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  16819. }
  16820. /**
  16821. * The base implementation of methods like `_.intersection`, without support
  16822. * for iteratee shorthands, that accepts an array of arrays to inspect.
  16823. *
  16824. * @private
  16825. * @param {Array} arrays The arrays to inspect.
  16826. * @param {Function} [iteratee] The iteratee invoked per element.
  16827. * @param {Function} [comparator] The comparator invoked per element.
  16828. * @returns {Array} Returns the new array of shared values.
  16829. */
  16830. function baseIntersection(arrays, iteratee, comparator) {
  16831. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  16832. length = arrays[0].length,
  16833. othLength = arrays.length,
  16834. othIndex = othLength,
  16835. caches = Array(othLength),
  16836. maxLength = Infinity,
  16837. result = [];
  16838. while (othIndex--) {
  16839. var array = arrays[othIndex];
  16840. if (othIndex && iteratee) {
  16841. array = arrayMap(array, baseUnary(iteratee));
  16842. }
  16843. maxLength = nativeMin(array.length, maxLength);
  16844. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  16845. ? new SetCache(othIndex && array)
  16846. : undefined;
  16847. }
  16848. array = arrays[0];
  16849. var index = -1,
  16850. seen = caches[0];
  16851. outer:
  16852. while (++index < length && result.length < maxLength) {
  16853. var value = array[index],
  16854. computed = iteratee ? iteratee(value) : value;
  16855. value = (comparator || value !== 0) ? value : 0;
  16856. if (!(seen
  16857. ? cacheHas(seen, computed)
  16858. : includes(result, computed, comparator)
  16859. )) {
  16860. othIndex = othLength;
  16861. while (--othIndex) {
  16862. var cache = caches[othIndex];
  16863. if (!(cache
  16864. ? cacheHas(cache, computed)
  16865. : includes(arrays[othIndex], computed, comparator))
  16866. ) {
  16867. continue outer;
  16868. }
  16869. }
  16870. if (seen) {
  16871. seen.push(computed);
  16872. }
  16873. result.push(value);
  16874. }
  16875. }
  16876. return result;
  16877. }
  16878. /**
  16879. * The base implementation of `_.invert` and `_.invertBy` which inverts
  16880. * `object` with values transformed by `iteratee` and set by `setter`.
  16881. *
  16882. * @private
  16883. * @param {Object} object The object to iterate over.
  16884. * @param {Function} setter The function to set `accumulator` values.
  16885. * @param {Function} iteratee The iteratee to transform values.
  16886. * @param {Object} accumulator The initial inverted object.
  16887. * @returns {Function} Returns `accumulator`.
  16888. */
  16889. function baseInverter(object, setter, iteratee, accumulator) {
  16890. baseForOwn(object, function(value, key, object) {
  16891. setter(accumulator, iteratee(value), key, object);
  16892. });
  16893. return accumulator;
  16894. }
  16895. /**
  16896. * The base implementation of `_.invoke` without support for individual
  16897. * method arguments.
  16898. *
  16899. * @private
  16900. * @param {Object} object The object to query.
  16901. * @param {Array|string} path The path of the method to invoke.
  16902. * @param {Array} args The arguments to invoke the method with.
  16903. * @returns {*} Returns the result of the invoked method.
  16904. */
  16905. function baseInvoke(object, path, args) {
  16906. path = castPath(path, object);
  16907. object = parent(object, path);
  16908. var func = object == null ? object : object[toKey(last(path))];
  16909. return func == null ? undefined : apply(func, object, args);
  16910. }
  16911. /**
  16912. * The base implementation of `_.isArguments`.
  16913. *
  16914. * @private
  16915. * @param {*} value The value to check.
  16916. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  16917. */
  16918. function baseIsArguments(value) {
  16919. return isObjectLike(value) && baseGetTag(value) == argsTag;
  16920. }
  16921. /**
  16922. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  16923. *
  16924. * @private
  16925. * @param {*} value The value to check.
  16926. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  16927. */
  16928. function baseIsArrayBuffer(value) {
  16929. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  16930. }
  16931. /**
  16932. * The base implementation of `_.isDate` without Node.js optimizations.
  16933. *
  16934. * @private
  16935. * @param {*} value The value to check.
  16936. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  16937. */
  16938. function baseIsDate(value) {
  16939. return isObjectLike(value) && baseGetTag(value) == dateTag;
  16940. }
  16941. /**
  16942. * The base implementation of `_.isEqual` which supports partial comparisons
  16943. * and tracks traversed objects.
  16944. *
  16945. * @private
  16946. * @param {*} value The value to compare.
  16947. * @param {*} other The other value to compare.
  16948. * @param {boolean} bitmask The bitmask flags.
  16949. * 1 - Unordered comparison
  16950. * 2 - Partial comparison
  16951. * @param {Function} [customizer] The function to customize comparisons.
  16952. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  16953. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16954. */
  16955. function baseIsEqual(value, other, bitmask, customizer, stack) {
  16956. if (value === other) {
  16957. return true;
  16958. }
  16959. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  16960. return value !== value && other !== other;
  16961. }
  16962. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  16963. }
  16964. /**
  16965. * A specialized version of `baseIsEqual` for arrays and objects which performs
  16966. * deep comparisons and tracks traversed objects enabling objects with circular
  16967. * references to be compared.
  16968. *
  16969. * @private
  16970. * @param {Object} object The object to compare.
  16971. * @param {Object} other The other object to compare.
  16972. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16973. * @param {Function} customizer The function to customize comparisons.
  16974. * @param {Function} equalFunc The function to determine equivalents of values.
  16975. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  16976. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16977. */
  16978. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  16979. var objIsArr = isArray(object),
  16980. othIsArr = isArray(other),
  16981. objTag = objIsArr ? arrayTag : getTag(object),
  16982. othTag = othIsArr ? arrayTag : getTag(other);
  16983. objTag = objTag == argsTag ? objectTag : objTag;
  16984. othTag = othTag == argsTag ? objectTag : othTag;
  16985. var objIsObj = objTag == objectTag,
  16986. othIsObj = othTag == objectTag,
  16987. isSameTag = objTag == othTag;
  16988. if (isSameTag && isBuffer(object)) {
  16989. if (!isBuffer(other)) {
  16990. return false;
  16991. }
  16992. objIsArr = true;
  16993. objIsObj = false;
  16994. }
  16995. if (isSameTag && !objIsObj) {
  16996. stack || (stack = new Stack);
  16997. return (objIsArr || isTypedArray(object))
  16998. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  16999. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  17000. }
  17001. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  17002. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  17003. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  17004. if (objIsWrapped || othIsWrapped) {
  17005. var objUnwrapped = objIsWrapped ? object.value() : object,
  17006. othUnwrapped = othIsWrapped ? other.value() : other;
  17007. stack || (stack = new Stack);
  17008. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  17009. }
  17010. }
  17011. if (!isSameTag) {
  17012. return false;
  17013. }
  17014. stack || (stack = new Stack);
  17015. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  17016. }
  17017. /**
  17018. * The base implementation of `_.isMap` without Node.js optimizations.
  17019. *
  17020. * @private
  17021. * @param {*} value The value to check.
  17022. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  17023. */
  17024. function baseIsMap(value) {
  17025. return isObjectLike(value) && getTag(value) == mapTag;
  17026. }
  17027. /**
  17028. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  17029. *
  17030. * @private
  17031. * @param {Object} object The object to inspect.
  17032. * @param {Object} source The object of property values to match.
  17033. * @param {Array} matchData The property names, values, and compare flags to match.
  17034. * @param {Function} [customizer] The function to customize comparisons.
  17035. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  17036. */
  17037. function baseIsMatch(object, source, matchData, customizer) {
  17038. var index = matchData.length,
  17039. length = index,
  17040. noCustomizer = !customizer;
  17041. if (object == null) {
  17042. return !length;
  17043. }
  17044. object = Object(object);
  17045. while (index--) {
  17046. var data = matchData[index];
  17047. if ((noCustomizer && data[2])
  17048. ? data[1] !== object[data[0]]
  17049. : !(data[0] in object)
  17050. ) {
  17051. return false;
  17052. }
  17053. }
  17054. while (++index < length) {
  17055. data = matchData[index];
  17056. var key = data[0],
  17057. objValue = object[key],
  17058. srcValue = data[1];
  17059. if (noCustomizer && data[2]) {
  17060. if (objValue === undefined && !(key in object)) {
  17061. return false;
  17062. }
  17063. } else {
  17064. var stack = new Stack;
  17065. if (customizer) {
  17066. var result = customizer(objValue, srcValue, key, object, source, stack);
  17067. }
  17068. if (!(result === undefined
  17069. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  17070. : result
  17071. )) {
  17072. return false;
  17073. }
  17074. }
  17075. }
  17076. return true;
  17077. }
  17078. /**
  17079. * The base implementation of `_.isNative` without bad shim checks.
  17080. *
  17081. * @private
  17082. * @param {*} value The value to check.
  17083. * @returns {boolean} Returns `true` if `value` is a native function,
  17084. * else `false`.
  17085. */
  17086. function baseIsNative(value) {
  17087. if (!isObject(value) || isMasked(value)) {
  17088. return false;
  17089. }
  17090. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  17091. return pattern.test(toSource(value));
  17092. }
  17093. /**
  17094. * The base implementation of `_.isRegExp` without Node.js optimizations.
  17095. *
  17096. * @private
  17097. * @param {*} value The value to check.
  17098. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  17099. */
  17100. function baseIsRegExp(value) {
  17101. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  17102. }
  17103. /**
  17104. * The base implementation of `_.isSet` without Node.js optimizations.
  17105. *
  17106. * @private
  17107. * @param {*} value The value to check.
  17108. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  17109. */
  17110. function baseIsSet(value) {
  17111. return isObjectLike(value) && getTag(value) == setTag;
  17112. }
  17113. /**
  17114. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  17115. *
  17116. * @private
  17117. * @param {*} value The value to check.
  17118. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  17119. */
  17120. function baseIsTypedArray(value) {
  17121. return isObjectLike(value) &&
  17122. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  17123. }
  17124. /**
  17125. * The base implementation of `_.iteratee`.
  17126. *
  17127. * @private
  17128. * @param {*} [value=_.identity] The value to convert to an iteratee.
  17129. * @returns {Function} Returns the iteratee.
  17130. */
  17131. function baseIteratee(value) {
  17132. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  17133. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  17134. if (typeof value == 'function') {
  17135. return value;
  17136. }
  17137. if (value == null) {
  17138. return identity;
  17139. }
  17140. if (typeof value == 'object') {
  17141. return isArray(value)
  17142. ? baseMatchesProperty(value[0], value[1])
  17143. : baseMatches(value);
  17144. }
  17145. return property(value);
  17146. }
  17147. /**
  17148. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  17149. *
  17150. * @private
  17151. * @param {Object} object The object to query.
  17152. * @returns {Array} Returns the array of property names.
  17153. */
  17154. function baseKeys(object) {
  17155. if (!isPrototype(object)) {
  17156. return nativeKeys(object);
  17157. }
  17158. var result = [];
  17159. for (var key in Object(object)) {
  17160. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  17161. result.push(key);
  17162. }
  17163. }
  17164. return result;
  17165. }
  17166. /**
  17167. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  17168. *
  17169. * @private
  17170. * @param {Object} object The object to query.
  17171. * @returns {Array} Returns the array of property names.
  17172. */
  17173. function baseKeysIn(object) {
  17174. if (!isObject(object)) {
  17175. return nativeKeysIn(object);
  17176. }
  17177. var isProto = isPrototype(object),
  17178. result = [];
  17179. for (var key in object) {
  17180. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  17181. result.push(key);
  17182. }
  17183. }
  17184. return result;
  17185. }
  17186. /**
  17187. * The base implementation of `_.lt` which doesn't coerce arguments.
  17188. *
  17189. * @private
  17190. * @param {*} value The value to compare.
  17191. * @param {*} other The other value to compare.
  17192. * @returns {boolean} Returns `true` if `value` is less than `other`,
  17193. * else `false`.
  17194. */
  17195. function baseLt(value, other) {
  17196. return value < other;
  17197. }
  17198. /**
  17199. * The base implementation of `_.map` without support for iteratee shorthands.
  17200. *
  17201. * @private
  17202. * @param {Array|Object} collection The collection to iterate over.
  17203. * @param {Function} iteratee The function invoked per iteration.
  17204. * @returns {Array} Returns the new mapped array.
  17205. */
  17206. function baseMap(collection, iteratee) {
  17207. var index = -1,
  17208. result = isArrayLike(collection) ? Array(collection.length) : [];
  17209. baseEach(collection, function(value, key, collection) {
  17210. result[++index] = iteratee(value, key, collection);
  17211. });
  17212. return result;
  17213. }
  17214. /**
  17215. * The base implementation of `_.matches` which doesn't clone `source`.
  17216. *
  17217. * @private
  17218. * @param {Object} source The object of property values to match.
  17219. * @returns {Function} Returns the new spec function.
  17220. */
  17221. function baseMatches(source) {
  17222. var matchData = getMatchData(source);
  17223. if (matchData.length == 1 && matchData[0][2]) {
  17224. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  17225. }
  17226. return function(object) {
  17227. return object === source || baseIsMatch(object, source, matchData);
  17228. };
  17229. }
  17230. /**
  17231. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  17232. *
  17233. * @private
  17234. * @param {string} path The path of the property to get.
  17235. * @param {*} srcValue The value to match.
  17236. * @returns {Function} Returns the new spec function.
  17237. */
  17238. function baseMatchesProperty(path, srcValue) {
  17239. if (isKey(path) && isStrictComparable(srcValue)) {
  17240. return matchesStrictComparable(toKey(path), srcValue);
  17241. }
  17242. return function(object) {
  17243. var objValue = get(object, path);
  17244. return (objValue === undefined && objValue === srcValue)
  17245. ? hasIn(object, path)
  17246. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  17247. };
  17248. }
  17249. /**
  17250. * The base implementation of `_.merge` without support for multiple sources.
  17251. *
  17252. * @private
  17253. * @param {Object} object The destination object.
  17254. * @param {Object} source The source object.
  17255. * @param {number} srcIndex The index of `source`.
  17256. * @param {Function} [customizer] The function to customize merged values.
  17257. * @param {Object} [stack] Tracks traversed source values and their merged
  17258. * counterparts.
  17259. */
  17260. function baseMerge(object, source, srcIndex, customizer, stack) {
  17261. if (object === source) {
  17262. return;
  17263. }
  17264. baseFor(source, function(srcValue, key) {
  17265. stack || (stack = new Stack);
  17266. if (isObject(srcValue)) {
  17267. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  17268. }
  17269. else {
  17270. var newValue = customizer
  17271. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  17272. : undefined;
  17273. if (newValue === undefined) {
  17274. newValue = srcValue;
  17275. }
  17276. assignMergeValue(object, key, newValue);
  17277. }
  17278. }, keysIn);
  17279. }
  17280. /**
  17281. * A specialized version of `baseMerge` for arrays and objects which performs
  17282. * deep merges and tracks traversed objects enabling objects with circular
  17283. * references to be merged.
  17284. *
  17285. * @private
  17286. * @param {Object} object The destination object.
  17287. * @param {Object} source The source object.
  17288. * @param {string} key The key of the value to merge.
  17289. * @param {number} srcIndex The index of `source`.
  17290. * @param {Function} mergeFunc The function to merge values.
  17291. * @param {Function} [customizer] The function to customize assigned values.
  17292. * @param {Object} [stack] Tracks traversed source values and their merged
  17293. * counterparts.
  17294. */
  17295. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  17296. var objValue = safeGet(object, key),
  17297. srcValue = safeGet(source, key),
  17298. stacked = stack.get(srcValue);
  17299. if (stacked) {
  17300. assignMergeValue(object, key, stacked);
  17301. return;
  17302. }
  17303. var newValue = customizer
  17304. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  17305. : undefined;
  17306. var isCommon = newValue === undefined;
  17307. if (isCommon) {
  17308. var isArr = isArray(srcValue),
  17309. isBuff = !isArr && isBuffer(srcValue),
  17310. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  17311. newValue = srcValue;
  17312. if (isArr || isBuff || isTyped) {
  17313. if (isArray(objValue)) {
  17314. newValue = objValue;
  17315. }
  17316. else if (isArrayLikeObject(objValue)) {
  17317. newValue = copyArray(objValue);
  17318. }
  17319. else if (isBuff) {
  17320. isCommon = false;
  17321. newValue = cloneBuffer(srcValue, true);
  17322. }
  17323. else if (isTyped) {
  17324. isCommon = false;
  17325. newValue = cloneTypedArray(srcValue, true);
  17326. }
  17327. else {
  17328. newValue = [];
  17329. }
  17330. }
  17331. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  17332. newValue = objValue;
  17333. if (isArguments(objValue)) {
  17334. newValue = toPlainObject(objValue);
  17335. }
  17336. else if (!isObject(objValue) || isFunction(objValue)) {
  17337. newValue = initCloneObject(srcValue);
  17338. }
  17339. }
  17340. else {
  17341. isCommon = false;
  17342. }
  17343. }
  17344. if (isCommon) {
  17345. // Recursively merge objects and arrays (susceptible to call stack limits).
  17346. stack.set(srcValue, newValue);
  17347. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  17348. stack['delete'](srcValue);
  17349. }
  17350. assignMergeValue(object, key, newValue);
  17351. }
  17352. /**
  17353. * The base implementation of `_.nth` which doesn't coerce arguments.
  17354. *
  17355. * @private
  17356. * @param {Array} array The array to query.
  17357. * @param {number} n The index of the element to return.
  17358. * @returns {*} Returns the nth element of `array`.
  17359. */
  17360. function baseNth(array, n) {
  17361. var length = array.length;
  17362. if (!length) {
  17363. return;
  17364. }
  17365. n += n < 0 ? length : 0;
  17366. return isIndex(n, length) ? array[n] : undefined;
  17367. }
  17368. /**
  17369. * The base implementation of `_.orderBy` without param guards.
  17370. *
  17371. * @private
  17372. * @param {Array|Object} collection The collection to iterate over.
  17373. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  17374. * @param {string[]} orders The sort orders of `iteratees`.
  17375. * @returns {Array} Returns the new sorted array.
  17376. */
  17377. function baseOrderBy(collection, iteratees, orders) {
  17378. if (iteratees.length) {
  17379. iteratees = arrayMap(iteratees, function(iteratee) {
  17380. if (isArray(iteratee)) {
  17381. return function(value) {
  17382. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  17383. }
  17384. }
  17385. return iteratee;
  17386. });
  17387. } else {
  17388. iteratees = [identity];
  17389. }
  17390. var index = -1;
  17391. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  17392. var result = baseMap(collection, function(value, key, collection) {
  17393. var criteria = arrayMap(iteratees, function(iteratee) {
  17394. return iteratee(value);
  17395. });
  17396. return { 'criteria': criteria, 'index': ++index, 'value': value };
  17397. });
  17398. return baseSortBy(result, function(object, other) {
  17399. return compareMultiple(object, other, orders);
  17400. });
  17401. }
  17402. /**
  17403. * The base implementation of `_.pick` without support for individual
  17404. * property identifiers.
  17405. *
  17406. * @private
  17407. * @param {Object} object The source object.
  17408. * @param {string[]} paths The property paths to pick.
  17409. * @returns {Object} Returns the new object.
  17410. */
  17411. function basePick(object, paths) {
  17412. return basePickBy(object, paths, function(value, path) {
  17413. return hasIn(object, path);
  17414. });
  17415. }
  17416. /**
  17417. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  17418. *
  17419. * @private
  17420. * @param {Object} object The source object.
  17421. * @param {string[]} paths The property paths to pick.
  17422. * @param {Function} predicate The function invoked per property.
  17423. * @returns {Object} Returns the new object.
  17424. */
  17425. function basePickBy(object, paths, predicate) {
  17426. var index = -1,
  17427. length = paths.length,
  17428. result = {};
  17429. while (++index < length) {
  17430. var path = paths[index],
  17431. value = baseGet(object, path);
  17432. if (predicate(value, path)) {
  17433. baseSet(result, castPath(path, object), value);
  17434. }
  17435. }
  17436. return result;
  17437. }
  17438. /**
  17439. * A specialized version of `baseProperty` which supports deep paths.
  17440. *
  17441. * @private
  17442. * @param {Array|string} path The path of the property to get.
  17443. * @returns {Function} Returns the new accessor function.
  17444. */
  17445. function basePropertyDeep(path) {
  17446. return function(object) {
  17447. return baseGet(object, path);
  17448. };
  17449. }
  17450. /**
  17451. * The base implementation of `_.pullAllBy` without support for iteratee
  17452. * shorthands.
  17453. *
  17454. * @private
  17455. * @param {Array} array The array to modify.
  17456. * @param {Array} values The values to remove.
  17457. * @param {Function} [iteratee] The iteratee invoked per element.
  17458. * @param {Function} [comparator] The comparator invoked per element.
  17459. * @returns {Array} Returns `array`.
  17460. */
  17461. function basePullAll(array, values, iteratee, comparator) {
  17462. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  17463. index = -1,
  17464. length = values.length,
  17465. seen = array;
  17466. if (array === values) {
  17467. values = copyArray(values);
  17468. }
  17469. if (iteratee) {
  17470. seen = arrayMap(array, baseUnary(iteratee));
  17471. }
  17472. while (++index < length) {
  17473. var fromIndex = 0,
  17474. value = values[index],
  17475. computed = iteratee ? iteratee(value) : value;
  17476. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  17477. if (seen !== array) {
  17478. splice.call(seen, fromIndex, 1);
  17479. }
  17480. splice.call(array, fromIndex, 1);
  17481. }
  17482. }
  17483. return array;
  17484. }
  17485. /**
  17486. * The base implementation of `_.pullAt` without support for individual
  17487. * indexes or capturing the removed elements.
  17488. *
  17489. * @private
  17490. * @param {Array} array The array to modify.
  17491. * @param {number[]} indexes The indexes of elements to remove.
  17492. * @returns {Array} Returns `array`.
  17493. */
  17494. function basePullAt(array, indexes) {
  17495. var length = array ? indexes.length : 0,
  17496. lastIndex = length - 1;
  17497. while (length--) {
  17498. var index = indexes[length];
  17499. if (length == lastIndex || index !== previous) {
  17500. var previous = index;
  17501. if (isIndex(index)) {
  17502. splice.call(array, index, 1);
  17503. } else {
  17504. baseUnset(array, index);
  17505. }
  17506. }
  17507. }
  17508. return array;
  17509. }
  17510. /**
  17511. * The base implementation of `_.random` without support for returning
  17512. * floating-point numbers.
  17513. *
  17514. * @private
  17515. * @param {number} lower The lower bound.
  17516. * @param {number} upper The upper bound.
  17517. * @returns {number} Returns the random number.
  17518. */
  17519. function baseRandom(lower, upper) {
  17520. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  17521. }
  17522. /**
  17523. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  17524. * coerce arguments.
  17525. *
  17526. * @private
  17527. * @param {number} start The start of the range.
  17528. * @param {number} end The end of the range.
  17529. * @param {number} step The value to increment or decrement by.
  17530. * @param {boolean} [fromRight] Specify iterating from right to left.
  17531. * @returns {Array} Returns the range of numbers.
  17532. */
  17533. function baseRange(start, end, step, fromRight) {
  17534. var index = -1,
  17535. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  17536. result = Array(length);
  17537. while (length--) {
  17538. result[fromRight ? length : ++index] = start;
  17539. start += step;
  17540. }
  17541. return result;
  17542. }
  17543. /**
  17544. * The base implementation of `_.repeat` which doesn't coerce arguments.
  17545. *
  17546. * @private
  17547. * @param {string} string The string to repeat.
  17548. * @param {number} n The number of times to repeat the string.
  17549. * @returns {string} Returns the repeated string.
  17550. */
  17551. function baseRepeat(string, n) {
  17552. var result = '';
  17553. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  17554. return result;
  17555. }
  17556. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  17557. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  17558. do {
  17559. if (n % 2) {
  17560. result += string;
  17561. }
  17562. n = nativeFloor(n / 2);
  17563. if (n) {
  17564. string += string;
  17565. }
  17566. } while (n);
  17567. return result;
  17568. }
  17569. /**
  17570. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  17571. *
  17572. * @private
  17573. * @param {Function} func The function to apply a rest parameter to.
  17574. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17575. * @returns {Function} Returns the new function.
  17576. */
  17577. function baseRest(func, start) {
  17578. return setToString(overRest(func, start, identity), func + '');
  17579. }
  17580. /**
  17581. * The base implementation of `_.sample`.
  17582. *
  17583. * @private
  17584. * @param {Array|Object} collection The collection to sample.
  17585. * @returns {*} Returns the random element.
  17586. */
  17587. function baseSample(collection) {
  17588. return arraySample(values(collection));
  17589. }
  17590. /**
  17591. * The base implementation of `_.sampleSize` without param guards.
  17592. *
  17593. * @private
  17594. * @param {Array|Object} collection The collection to sample.
  17595. * @param {number} n The number of elements to sample.
  17596. * @returns {Array} Returns the random elements.
  17597. */
  17598. function baseSampleSize(collection, n) {
  17599. var array = values(collection);
  17600. return shuffleSelf(array, baseClamp(n, 0, array.length));
  17601. }
  17602. /**
  17603. * The base implementation of `_.set`.
  17604. *
  17605. * @private
  17606. * @param {Object} object The object to modify.
  17607. * @param {Array|string} path The path of the property to set.
  17608. * @param {*} value The value to set.
  17609. * @param {Function} [customizer] The function to customize path creation.
  17610. * @returns {Object} Returns `object`.
  17611. */
  17612. function baseSet(object, path, value, customizer) {
  17613. if (!isObject(object)) {
  17614. return object;
  17615. }
  17616. path = castPath(path, object);
  17617. var index = -1,
  17618. length = path.length,
  17619. lastIndex = length - 1,
  17620. nested = object;
  17621. while (nested != null && ++index < length) {
  17622. var key = toKey(path[index]),
  17623. newValue = value;
  17624. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  17625. return object;
  17626. }
  17627. if (index != lastIndex) {
  17628. var objValue = nested[key];
  17629. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  17630. if (newValue === undefined) {
  17631. newValue = isObject(objValue)
  17632. ? objValue
  17633. : (isIndex(path[index + 1]) ? [] : {});
  17634. }
  17635. }
  17636. assignValue(nested, key, newValue);
  17637. nested = nested[key];
  17638. }
  17639. return object;
  17640. }
  17641. /**
  17642. * The base implementation of `setData` without support for hot loop shorting.
  17643. *
  17644. * @private
  17645. * @param {Function} func The function to associate metadata with.
  17646. * @param {*} data The metadata.
  17647. * @returns {Function} Returns `func`.
  17648. */
  17649. var baseSetData = !metaMap ? identity : function(func, data) {
  17650. metaMap.set(func, data);
  17651. return func;
  17652. };
  17653. /**
  17654. * The base implementation of `setToString` without support for hot loop shorting.
  17655. *
  17656. * @private
  17657. * @param {Function} func The function to modify.
  17658. * @param {Function} string The `toString` result.
  17659. * @returns {Function} Returns `func`.
  17660. */
  17661. var baseSetToString = !defineProperty ? identity : function(func, string) {
  17662. return defineProperty(func, 'toString', {
  17663. 'configurable': true,
  17664. 'enumerable': false,
  17665. 'value': constant(string),
  17666. 'writable': true
  17667. });
  17668. };
  17669. /**
  17670. * The base implementation of `_.shuffle`.
  17671. *
  17672. * @private
  17673. * @param {Array|Object} collection The collection to shuffle.
  17674. * @returns {Array} Returns the new shuffled array.
  17675. */
  17676. function baseShuffle(collection) {
  17677. return shuffleSelf(values(collection));
  17678. }
  17679. /**
  17680. * The base implementation of `_.slice` without an iteratee call guard.
  17681. *
  17682. * @private
  17683. * @param {Array} array The array to slice.
  17684. * @param {number} [start=0] The start position.
  17685. * @param {number} [end=array.length] The end position.
  17686. * @returns {Array} Returns the slice of `array`.
  17687. */
  17688. function baseSlice(array, start, end) {
  17689. var index = -1,
  17690. length = array.length;
  17691. if (start < 0) {
  17692. start = -start > length ? 0 : (length + start);
  17693. }
  17694. end = end > length ? length : end;
  17695. if (end < 0) {
  17696. end += length;
  17697. }
  17698. length = start > end ? 0 : ((end - start) >>> 0);
  17699. start >>>= 0;
  17700. var result = Array(length);
  17701. while (++index < length) {
  17702. result[index] = array[index + start];
  17703. }
  17704. return result;
  17705. }
  17706. /**
  17707. * The base implementation of `_.some` without support for iteratee shorthands.
  17708. *
  17709. * @private
  17710. * @param {Array|Object} collection The collection to iterate over.
  17711. * @param {Function} predicate The function invoked per iteration.
  17712. * @returns {boolean} Returns `true` if any element passes the predicate check,
  17713. * else `false`.
  17714. */
  17715. function baseSome(collection, predicate) {
  17716. var result;
  17717. baseEach(collection, function(value, index, collection) {
  17718. result = predicate(value, index, collection);
  17719. return !result;
  17720. });
  17721. return !!result;
  17722. }
  17723. /**
  17724. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  17725. * performs a binary search of `array` to determine the index at which `value`
  17726. * should be inserted into `array` in order to maintain its sort order.
  17727. *
  17728. * @private
  17729. * @param {Array} array The sorted array to inspect.
  17730. * @param {*} value The value to evaluate.
  17731. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17732. * @returns {number} Returns the index at which `value` should be inserted
  17733. * into `array`.
  17734. */
  17735. function baseSortedIndex(array, value, retHighest) {
  17736. var low = 0,
  17737. high = array == null ? low : array.length;
  17738. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  17739. while (low < high) {
  17740. var mid = (low + high) >>> 1,
  17741. computed = array[mid];
  17742. if (computed !== null && !isSymbol(computed) &&
  17743. (retHighest ? (computed <= value) : (computed < value))) {
  17744. low = mid + 1;
  17745. } else {
  17746. high = mid;
  17747. }
  17748. }
  17749. return high;
  17750. }
  17751. return baseSortedIndexBy(array, value, identity, retHighest);
  17752. }
  17753. /**
  17754. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  17755. * which invokes `iteratee` for `value` and each element of `array` to compute
  17756. * their sort ranking. The iteratee is invoked with one argument; (value).
  17757. *
  17758. * @private
  17759. * @param {Array} array The sorted array to inspect.
  17760. * @param {*} value The value to evaluate.
  17761. * @param {Function} iteratee The iteratee invoked per element.
  17762. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17763. * @returns {number} Returns the index at which `value` should be inserted
  17764. * into `array`.
  17765. */
  17766. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  17767. var low = 0,
  17768. high = array == null ? 0 : array.length;
  17769. if (high === 0) {
  17770. return 0;
  17771. }
  17772. value = iteratee(value);
  17773. var valIsNaN = value !== value,
  17774. valIsNull = value === null,
  17775. valIsSymbol = isSymbol(value),
  17776. valIsUndefined = value === undefined;
  17777. while (low < high) {
  17778. var mid = nativeFloor((low + high) / 2),
  17779. computed = iteratee(array[mid]),
  17780. othIsDefined = computed !== undefined,
  17781. othIsNull = computed === null,
  17782. othIsReflexive = computed === computed,
  17783. othIsSymbol = isSymbol(computed);
  17784. if (valIsNaN) {
  17785. var setLow = retHighest || othIsReflexive;
  17786. } else if (valIsUndefined) {
  17787. setLow = othIsReflexive && (retHighest || othIsDefined);
  17788. } else if (valIsNull) {
  17789. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  17790. } else if (valIsSymbol) {
  17791. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  17792. } else if (othIsNull || othIsSymbol) {
  17793. setLow = false;
  17794. } else {
  17795. setLow = retHighest ? (computed <= value) : (computed < value);
  17796. }
  17797. if (setLow) {
  17798. low = mid + 1;
  17799. } else {
  17800. high = mid;
  17801. }
  17802. }
  17803. return nativeMin(high, MAX_ARRAY_INDEX);
  17804. }
  17805. /**
  17806. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  17807. * support for iteratee shorthands.
  17808. *
  17809. * @private
  17810. * @param {Array} array The array to inspect.
  17811. * @param {Function} [iteratee] The iteratee invoked per element.
  17812. * @returns {Array} Returns the new duplicate free array.
  17813. */
  17814. function baseSortedUniq(array, iteratee) {
  17815. var index = -1,
  17816. length = array.length,
  17817. resIndex = 0,
  17818. result = [];
  17819. while (++index < length) {
  17820. var value = array[index],
  17821. computed = iteratee ? iteratee(value) : value;
  17822. if (!index || !eq(computed, seen)) {
  17823. var seen = computed;
  17824. result[resIndex++] = value === 0 ? 0 : value;
  17825. }
  17826. }
  17827. return result;
  17828. }
  17829. /**
  17830. * The base implementation of `_.toNumber` which doesn't ensure correct
  17831. * conversions of binary, hexadecimal, or octal string values.
  17832. *
  17833. * @private
  17834. * @param {*} value The value to process.
  17835. * @returns {number} Returns the number.
  17836. */
  17837. function baseToNumber(value) {
  17838. if (typeof value == 'number') {
  17839. return value;
  17840. }
  17841. if (isSymbol(value)) {
  17842. return NAN;
  17843. }
  17844. return +value;
  17845. }
  17846. /**
  17847. * The base implementation of `_.toString` which doesn't convert nullish
  17848. * values to empty strings.
  17849. *
  17850. * @private
  17851. * @param {*} value The value to process.
  17852. * @returns {string} Returns the string.
  17853. */
  17854. function baseToString(value) {
  17855. // Exit early for strings to avoid a performance hit in some environments.
  17856. if (typeof value == 'string') {
  17857. return value;
  17858. }
  17859. if (isArray(value)) {
  17860. // Recursively convert values (susceptible to call stack limits).
  17861. return arrayMap(value, baseToString) + '';
  17862. }
  17863. if (isSymbol(value)) {
  17864. return symbolToString ? symbolToString.call(value) : '';
  17865. }
  17866. var result = (value + '');
  17867. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17868. }
  17869. /**
  17870. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  17871. *
  17872. * @private
  17873. * @param {Array} array The array to inspect.
  17874. * @param {Function} [iteratee] The iteratee invoked per element.
  17875. * @param {Function} [comparator] The comparator invoked per element.
  17876. * @returns {Array} Returns the new duplicate free array.
  17877. */
  17878. function baseUniq(array, iteratee, comparator) {
  17879. var index = -1,
  17880. includes = arrayIncludes,
  17881. length = array.length,
  17882. isCommon = true,
  17883. result = [],
  17884. seen = result;
  17885. if (comparator) {
  17886. isCommon = false;
  17887. includes = arrayIncludesWith;
  17888. }
  17889. else if (length >= LARGE_ARRAY_SIZE) {
  17890. var set = iteratee ? null : createSet(array);
  17891. if (set) {
  17892. return setToArray(set);
  17893. }
  17894. isCommon = false;
  17895. includes = cacheHas;
  17896. seen = new SetCache;
  17897. }
  17898. else {
  17899. seen = iteratee ? [] : result;
  17900. }
  17901. outer:
  17902. while (++index < length) {
  17903. var value = array[index],
  17904. computed = iteratee ? iteratee(value) : value;
  17905. value = (comparator || value !== 0) ? value : 0;
  17906. if (isCommon && computed === computed) {
  17907. var seenIndex = seen.length;
  17908. while (seenIndex--) {
  17909. if (seen[seenIndex] === computed) {
  17910. continue outer;
  17911. }
  17912. }
  17913. if (iteratee) {
  17914. seen.push(computed);
  17915. }
  17916. result.push(value);
  17917. }
  17918. else if (!includes(seen, computed, comparator)) {
  17919. if (seen !== result) {
  17920. seen.push(computed);
  17921. }
  17922. result.push(value);
  17923. }
  17924. }
  17925. return result;
  17926. }
  17927. /**
  17928. * The base implementation of `_.unset`.
  17929. *
  17930. * @private
  17931. * @param {Object} object The object to modify.
  17932. * @param {Array|string} path The property path to unset.
  17933. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  17934. */
  17935. function baseUnset(object, path) {
  17936. path = castPath(path, object);
  17937. object = parent(object, path);
  17938. return object == null || delete object[toKey(last(path))];
  17939. }
  17940. /**
  17941. * The base implementation of `_.update`.
  17942. *
  17943. * @private
  17944. * @param {Object} object The object to modify.
  17945. * @param {Array|string} path The path of the property to update.
  17946. * @param {Function} updater The function to produce the updated value.
  17947. * @param {Function} [customizer] The function to customize path creation.
  17948. * @returns {Object} Returns `object`.
  17949. */
  17950. function baseUpdate(object, path, updater, customizer) {
  17951. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  17952. }
  17953. /**
  17954. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  17955. * without support for iteratee shorthands.
  17956. *
  17957. * @private
  17958. * @param {Array} array The array to query.
  17959. * @param {Function} predicate The function invoked per iteration.
  17960. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  17961. * @param {boolean} [fromRight] Specify iterating from right to left.
  17962. * @returns {Array} Returns the slice of `array`.
  17963. */
  17964. function baseWhile(array, predicate, isDrop, fromRight) {
  17965. var length = array.length,
  17966. index = fromRight ? length : -1;
  17967. while ((fromRight ? index-- : ++index < length) &&
  17968. predicate(array[index], index, array)) {}
  17969. return isDrop
  17970. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  17971. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  17972. }
  17973. /**
  17974. * The base implementation of `wrapperValue` which returns the result of
  17975. * performing a sequence of actions on the unwrapped `value`, where each
  17976. * successive action is supplied the return value of the previous.
  17977. *
  17978. * @private
  17979. * @param {*} value The unwrapped value.
  17980. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  17981. * @returns {*} Returns the resolved value.
  17982. */
  17983. function baseWrapperValue(value, actions) {
  17984. var result = value;
  17985. if (result instanceof LazyWrapper) {
  17986. result = result.value();
  17987. }
  17988. return arrayReduce(actions, function(result, action) {
  17989. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  17990. }, result);
  17991. }
  17992. /**
  17993. * The base implementation of methods like `_.xor`, without support for
  17994. * iteratee shorthands, that accepts an array of arrays to inspect.
  17995. *
  17996. * @private
  17997. * @param {Array} arrays The arrays to inspect.
  17998. * @param {Function} [iteratee] The iteratee invoked per element.
  17999. * @param {Function} [comparator] The comparator invoked per element.
  18000. * @returns {Array} Returns the new array of values.
  18001. */
  18002. function baseXor(arrays, iteratee, comparator) {
  18003. var length = arrays.length;
  18004. if (length < 2) {
  18005. return length ? baseUniq(arrays[0]) : [];
  18006. }
  18007. var index = -1,
  18008. result = Array(length);
  18009. while (++index < length) {
  18010. var array = arrays[index],
  18011. othIndex = -1;
  18012. while (++othIndex < length) {
  18013. if (othIndex != index) {
  18014. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  18015. }
  18016. }
  18017. }
  18018. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  18019. }
  18020. /**
  18021. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  18022. *
  18023. * @private
  18024. * @param {Array} props The property identifiers.
  18025. * @param {Array} values The property values.
  18026. * @param {Function} assignFunc The function to assign values.
  18027. * @returns {Object} Returns the new object.
  18028. */
  18029. function baseZipObject(props, values, assignFunc) {
  18030. var index = -1,
  18031. length = props.length,
  18032. valsLength = values.length,
  18033. result = {};
  18034. while (++index < length) {
  18035. var value = index < valsLength ? values[index] : undefined;
  18036. assignFunc(result, props[index], value);
  18037. }
  18038. return result;
  18039. }
  18040. /**
  18041. * Casts `value` to an empty array if it's not an array like object.
  18042. *
  18043. * @private
  18044. * @param {*} value The value to inspect.
  18045. * @returns {Array|Object} Returns the cast array-like object.
  18046. */
  18047. function castArrayLikeObject(value) {
  18048. return isArrayLikeObject(value) ? value : [];
  18049. }
  18050. /**
  18051. * Casts `value` to `identity` if it's not a function.
  18052. *
  18053. * @private
  18054. * @param {*} value The value to inspect.
  18055. * @returns {Function} Returns cast function.
  18056. */
  18057. function castFunction(value) {
  18058. return typeof value == 'function' ? value : identity;
  18059. }
  18060. /**
  18061. * Casts `value` to a path array if it's not one.
  18062. *
  18063. * @private
  18064. * @param {*} value The value to inspect.
  18065. * @param {Object} [object] The object to query keys on.
  18066. * @returns {Array} Returns the cast property path array.
  18067. */
  18068. function castPath(value, object) {
  18069. if (isArray(value)) {
  18070. return value;
  18071. }
  18072. return isKey(value, object) ? [value] : stringToPath(toString(value));
  18073. }
  18074. /**
  18075. * A `baseRest` alias which can be replaced with `identity` by module
  18076. * replacement plugins.
  18077. *
  18078. * @private
  18079. * @type {Function}
  18080. * @param {Function} func The function to apply a rest parameter to.
  18081. * @returns {Function} Returns the new function.
  18082. */
  18083. var castRest = baseRest;
  18084. /**
  18085. * Casts `array` to a slice if it's needed.
  18086. *
  18087. * @private
  18088. * @param {Array} array The array to inspect.
  18089. * @param {number} start The start position.
  18090. * @param {number} [end=array.length] The end position.
  18091. * @returns {Array} Returns the cast slice.
  18092. */
  18093. function castSlice(array, start, end) {
  18094. var length = array.length;
  18095. end = end === undefined ? length : end;
  18096. return (!start && end >= length) ? array : baseSlice(array, start, end);
  18097. }
  18098. /**
  18099. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  18100. *
  18101. * @private
  18102. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  18103. */
  18104. var clearTimeout = ctxClearTimeout || function(id) {
  18105. return root.clearTimeout(id);
  18106. };
  18107. /**
  18108. * Creates a clone of `buffer`.
  18109. *
  18110. * @private
  18111. * @param {Buffer} buffer The buffer to clone.
  18112. * @param {boolean} [isDeep] Specify a deep clone.
  18113. * @returns {Buffer} Returns the cloned buffer.
  18114. */
  18115. function cloneBuffer(buffer, isDeep) {
  18116. if (isDeep) {
  18117. return buffer.slice();
  18118. }
  18119. var length = buffer.length,
  18120. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  18121. buffer.copy(result);
  18122. return result;
  18123. }
  18124. /**
  18125. * Creates a clone of `arrayBuffer`.
  18126. *
  18127. * @private
  18128. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  18129. * @returns {ArrayBuffer} Returns the cloned array buffer.
  18130. */
  18131. function cloneArrayBuffer(arrayBuffer) {
  18132. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  18133. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  18134. return result;
  18135. }
  18136. /**
  18137. * Creates a clone of `dataView`.
  18138. *
  18139. * @private
  18140. * @param {Object} dataView The data view to clone.
  18141. * @param {boolean} [isDeep] Specify a deep clone.
  18142. * @returns {Object} Returns the cloned data view.
  18143. */
  18144. function cloneDataView(dataView, isDeep) {
  18145. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  18146. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  18147. }
  18148. /**
  18149. * Creates a clone of `regexp`.
  18150. *
  18151. * @private
  18152. * @param {Object} regexp The regexp to clone.
  18153. * @returns {Object} Returns the cloned regexp.
  18154. */
  18155. function cloneRegExp(regexp) {
  18156. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  18157. result.lastIndex = regexp.lastIndex;
  18158. return result;
  18159. }
  18160. /**
  18161. * Creates a clone of the `symbol` object.
  18162. *
  18163. * @private
  18164. * @param {Object} symbol The symbol object to clone.
  18165. * @returns {Object} Returns the cloned symbol object.
  18166. */
  18167. function cloneSymbol(symbol) {
  18168. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  18169. }
  18170. /**
  18171. * Creates a clone of `typedArray`.
  18172. *
  18173. * @private
  18174. * @param {Object} typedArray The typed array to clone.
  18175. * @param {boolean} [isDeep] Specify a deep clone.
  18176. * @returns {Object} Returns the cloned typed array.
  18177. */
  18178. function cloneTypedArray(typedArray, isDeep) {
  18179. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  18180. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  18181. }
  18182. /**
  18183. * Compares values to sort them in ascending order.
  18184. *
  18185. * @private
  18186. * @param {*} value The value to compare.
  18187. * @param {*} other The other value to compare.
  18188. * @returns {number} Returns the sort order indicator for `value`.
  18189. */
  18190. function compareAscending(value, other) {
  18191. if (value !== other) {
  18192. var valIsDefined = value !== undefined,
  18193. valIsNull = value === null,
  18194. valIsReflexive = value === value,
  18195. valIsSymbol = isSymbol(value);
  18196. var othIsDefined = other !== undefined,
  18197. othIsNull = other === null,
  18198. othIsReflexive = other === other,
  18199. othIsSymbol = isSymbol(other);
  18200. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  18201. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  18202. (valIsNull && othIsDefined && othIsReflexive) ||
  18203. (!valIsDefined && othIsReflexive) ||
  18204. !valIsReflexive) {
  18205. return 1;
  18206. }
  18207. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  18208. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  18209. (othIsNull && valIsDefined && valIsReflexive) ||
  18210. (!othIsDefined && valIsReflexive) ||
  18211. !othIsReflexive) {
  18212. return -1;
  18213. }
  18214. }
  18215. return 0;
  18216. }
  18217. /**
  18218. * Used by `_.orderBy` to compare multiple properties of a value to another
  18219. * and stable sort them.
  18220. *
  18221. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  18222. * specify an order of "desc" for descending or "asc" for ascending sort order
  18223. * of corresponding values.
  18224. *
  18225. * @private
  18226. * @param {Object} object The object to compare.
  18227. * @param {Object} other The other object to compare.
  18228. * @param {boolean[]|string[]} orders The order to sort by for each property.
  18229. * @returns {number} Returns the sort order indicator for `object`.
  18230. */
  18231. function compareMultiple(object, other, orders) {
  18232. var index = -1,
  18233. objCriteria = object.criteria,
  18234. othCriteria = other.criteria,
  18235. length = objCriteria.length,
  18236. ordersLength = orders.length;
  18237. while (++index < length) {
  18238. var result = compareAscending(objCriteria[index], othCriteria[index]);
  18239. if (result) {
  18240. if (index >= ordersLength) {
  18241. return result;
  18242. }
  18243. var order = orders[index];
  18244. return result * (order == 'desc' ? -1 : 1);
  18245. }
  18246. }
  18247. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  18248. // that causes it, under certain circumstances, to provide the same value for
  18249. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  18250. // for more details.
  18251. //
  18252. // This also ensures a stable sort in V8 and other engines.
  18253. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  18254. return object.index - other.index;
  18255. }
  18256. /**
  18257. * Creates an array that is the composition of partially applied arguments,
  18258. * placeholders, and provided arguments into a single array of arguments.
  18259. *
  18260. * @private
  18261. * @param {Array} args The provided arguments.
  18262. * @param {Array} partials The arguments to prepend to those provided.
  18263. * @param {Array} holders The `partials` placeholder indexes.
  18264. * @params {boolean} [isCurried] Specify composing for a curried function.
  18265. * @returns {Array} Returns the new array of composed arguments.
  18266. */
  18267. function composeArgs(args, partials, holders, isCurried) {
  18268. var argsIndex = -1,
  18269. argsLength = args.length,
  18270. holdersLength = holders.length,
  18271. leftIndex = -1,
  18272. leftLength = partials.length,
  18273. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18274. result = Array(leftLength + rangeLength),
  18275. isUncurried = !isCurried;
  18276. while (++leftIndex < leftLength) {
  18277. result[leftIndex] = partials[leftIndex];
  18278. }
  18279. while (++argsIndex < holdersLength) {
  18280. if (isUncurried || argsIndex < argsLength) {
  18281. result[holders[argsIndex]] = args[argsIndex];
  18282. }
  18283. }
  18284. while (rangeLength--) {
  18285. result[leftIndex++] = args[argsIndex++];
  18286. }
  18287. return result;
  18288. }
  18289. /**
  18290. * This function is like `composeArgs` except that the arguments composition
  18291. * is tailored for `_.partialRight`.
  18292. *
  18293. * @private
  18294. * @param {Array} args The provided arguments.
  18295. * @param {Array} partials The arguments to append to those provided.
  18296. * @param {Array} holders The `partials` placeholder indexes.
  18297. * @params {boolean} [isCurried] Specify composing for a curried function.
  18298. * @returns {Array} Returns the new array of composed arguments.
  18299. */
  18300. function composeArgsRight(args, partials, holders, isCurried) {
  18301. var argsIndex = -1,
  18302. argsLength = args.length,
  18303. holdersIndex = -1,
  18304. holdersLength = holders.length,
  18305. rightIndex = -1,
  18306. rightLength = partials.length,
  18307. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18308. result = Array(rangeLength + rightLength),
  18309. isUncurried = !isCurried;
  18310. while (++argsIndex < rangeLength) {
  18311. result[argsIndex] = args[argsIndex];
  18312. }
  18313. var offset = argsIndex;
  18314. while (++rightIndex < rightLength) {
  18315. result[offset + rightIndex] = partials[rightIndex];
  18316. }
  18317. while (++holdersIndex < holdersLength) {
  18318. if (isUncurried || argsIndex < argsLength) {
  18319. result[offset + holders[holdersIndex]] = args[argsIndex++];
  18320. }
  18321. }
  18322. return result;
  18323. }
  18324. /**
  18325. * Copies the values of `source` to `array`.
  18326. *
  18327. * @private
  18328. * @param {Array} source The array to copy values from.
  18329. * @param {Array} [array=[]] The array to copy values to.
  18330. * @returns {Array} Returns `array`.
  18331. */
  18332. function copyArray(source, array) {
  18333. var index = -1,
  18334. length = source.length;
  18335. array || (array = Array(length));
  18336. while (++index < length) {
  18337. array[index] = source[index];
  18338. }
  18339. return array;
  18340. }
  18341. /**
  18342. * Copies properties of `source` to `object`.
  18343. *
  18344. * @private
  18345. * @param {Object} source The object to copy properties from.
  18346. * @param {Array} props The property identifiers to copy.
  18347. * @param {Object} [object={}] The object to copy properties to.
  18348. * @param {Function} [customizer] The function to customize copied values.
  18349. * @returns {Object} Returns `object`.
  18350. */
  18351. function copyObject(source, props, object, customizer) {
  18352. var isNew = !object;
  18353. object || (object = {});
  18354. var index = -1,
  18355. length = props.length;
  18356. while (++index < length) {
  18357. var key = props[index];
  18358. var newValue = customizer
  18359. ? customizer(object[key], source[key], key, object, source)
  18360. : undefined;
  18361. if (newValue === undefined) {
  18362. newValue = source[key];
  18363. }
  18364. if (isNew) {
  18365. baseAssignValue(object, key, newValue);
  18366. } else {
  18367. assignValue(object, key, newValue);
  18368. }
  18369. }
  18370. return object;
  18371. }
  18372. /**
  18373. * Copies own symbols of `source` to `object`.
  18374. *
  18375. * @private
  18376. * @param {Object} source The object to copy symbols from.
  18377. * @param {Object} [object={}] The object to copy symbols to.
  18378. * @returns {Object} Returns `object`.
  18379. */
  18380. function copySymbols(source, object) {
  18381. return copyObject(source, getSymbols(source), object);
  18382. }
  18383. /**
  18384. * Copies own and inherited symbols of `source` to `object`.
  18385. *
  18386. * @private
  18387. * @param {Object} source The object to copy symbols from.
  18388. * @param {Object} [object={}] The object to copy symbols to.
  18389. * @returns {Object} Returns `object`.
  18390. */
  18391. function copySymbolsIn(source, object) {
  18392. return copyObject(source, getSymbolsIn(source), object);
  18393. }
  18394. /**
  18395. * Creates a function like `_.groupBy`.
  18396. *
  18397. * @private
  18398. * @param {Function} setter The function to set accumulator values.
  18399. * @param {Function} [initializer] The accumulator object initializer.
  18400. * @returns {Function} Returns the new aggregator function.
  18401. */
  18402. function createAggregator(setter, initializer) {
  18403. return function(collection, iteratee) {
  18404. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  18405. accumulator = initializer ? initializer() : {};
  18406. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  18407. };
  18408. }
  18409. /**
  18410. * Creates a function like `_.assign`.
  18411. *
  18412. * @private
  18413. * @param {Function} assigner The function to assign values.
  18414. * @returns {Function} Returns the new assigner function.
  18415. */
  18416. function createAssigner(assigner) {
  18417. return baseRest(function(object, sources) {
  18418. var index = -1,
  18419. length = sources.length,
  18420. customizer = length > 1 ? sources[length - 1] : undefined,
  18421. guard = length > 2 ? sources[2] : undefined;
  18422. customizer = (assigner.length > 3 && typeof customizer == 'function')
  18423. ? (length--, customizer)
  18424. : undefined;
  18425. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  18426. customizer = length < 3 ? undefined : customizer;
  18427. length = 1;
  18428. }
  18429. object = Object(object);
  18430. while (++index < length) {
  18431. var source = sources[index];
  18432. if (source) {
  18433. assigner(object, source, index, customizer);
  18434. }
  18435. }
  18436. return object;
  18437. });
  18438. }
  18439. /**
  18440. * Creates a `baseEach` or `baseEachRight` function.
  18441. *
  18442. * @private
  18443. * @param {Function} eachFunc The function to iterate over a collection.
  18444. * @param {boolean} [fromRight] Specify iterating from right to left.
  18445. * @returns {Function} Returns the new base function.
  18446. */
  18447. function createBaseEach(eachFunc, fromRight) {
  18448. return function(collection, iteratee) {
  18449. if (collection == null) {
  18450. return collection;
  18451. }
  18452. if (!isArrayLike(collection)) {
  18453. return eachFunc(collection, iteratee);
  18454. }
  18455. var length = collection.length,
  18456. index = fromRight ? length : -1,
  18457. iterable = Object(collection);
  18458. while ((fromRight ? index-- : ++index < length)) {
  18459. if (iteratee(iterable[index], index, iterable) === false) {
  18460. break;
  18461. }
  18462. }
  18463. return collection;
  18464. };
  18465. }
  18466. /**
  18467. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  18468. *
  18469. * @private
  18470. * @param {boolean} [fromRight] Specify iterating from right to left.
  18471. * @returns {Function} Returns the new base function.
  18472. */
  18473. function createBaseFor(fromRight) {
  18474. return function(object, iteratee, keysFunc) {
  18475. var index = -1,
  18476. iterable = Object(object),
  18477. props = keysFunc(object),
  18478. length = props.length;
  18479. while (length--) {
  18480. var key = props[fromRight ? length : ++index];
  18481. if (iteratee(iterable[key], key, iterable) === false) {
  18482. break;
  18483. }
  18484. }
  18485. return object;
  18486. };
  18487. }
  18488. /**
  18489. * Creates a function that wraps `func` to invoke it with the optional `this`
  18490. * binding of `thisArg`.
  18491. *
  18492. * @private
  18493. * @param {Function} func The function to wrap.
  18494. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18495. * @param {*} [thisArg] The `this` binding of `func`.
  18496. * @returns {Function} Returns the new wrapped function.
  18497. */
  18498. function createBind(func, bitmask, thisArg) {
  18499. var isBind = bitmask & WRAP_BIND_FLAG,
  18500. Ctor = createCtor(func);
  18501. function wrapper() {
  18502. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18503. return fn.apply(isBind ? thisArg : this, arguments);
  18504. }
  18505. return wrapper;
  18506. }
  18507. /**
  18508. * Creates a function like `_.lowerFirst`.
  18509. *
  18510. * @private
  18511. * @param {string} methodName The name of the `String` case method to use.
  18512. * @returns {Function} Returns the new case function.
  18513. */
  18514. function createCaseFirst(methodName) {
  18515. return function(string) {
  18516. string = toString(string);
  18517. var strSymbols = hasUnicode(string)
  18518. ? stringToArray(string)
  18519. : undefined;
  18520. var chr = strSymbols
  18521. ? strSymbols[0]
  18522. : string.charAt(0);
  18523. var trailing = strSymbols
  18524. ? castSlice(strSymbols, 1).join('')
  18525. : string.slice(1);
  18526. return chr[methodName]() + trailing;
  18527. };
  18528. }
  18529. /**
  18530. * Creates a function like `_.camelCase`.
  18531. *
  18532. * @private
  18533. * @param {Function} callback The function to combine each word.
  18534. * @returns {Function} Returns the new compounder function.
  18535. */
  18536. function createCompounder(callback) {
  18537. return function(string) {
  18538. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  18539. };
  18540. }
  18541. /**
  18542. * Creates a function that produces an instance of `Ctor` regardless of
  18543. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  18544. *
  18545. * @private
  18546. * @param {Function} Ctor The constructor to wrap.
  18547. * @returns {Function} Returns the new wrapped function.
  18548. */
  18549. function createCtor(Ctor) {
  18550. return function() {
  18551. // Use a `switch` statement to work with class constructors. See
  18552. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  18553. // for more details.
  18554. var args = arguments;
  18555. switch (args.length) {
  18556. case 0: return new Ctor;
  18557. case 1: return new Ctor(args[0]);
  18558. case 2: return new Ctor(args[0], args[1]);
  18559. case 3: return new Ctor(args[0], args[1], args[2]);
  18560. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  18561. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  18562. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  18563. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  18564. }
  18565. var thisBinding = baseCreate(Ctor.prototype),
  18566. result = Ctor.apply(thisBinding, args);
  18567. // Mimic the constructor's `return` behavior.
  18568. // See https://es5.github.io/#x13.2.2 for more details.
  18569. return isObject(result) ? result : thisBinding;
  18570. };
  18571. }
  18572. /**
  18573. * Creates a function that wraps `func` to enable currying.
  18574. *
  18575. * @private
  18576. * @param {Function} func The function to wrap.
  18577. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18578. * @param {number} arity The arity of `func`.
  18579. * @returns {Function} Returns the new wrapped function.
  18580. */
  18581. function createCurry(func, bitmask, arity) {
  18582. var Ctor = createCtor(func);
  18583. function wrapper() {
  18584. var length = arguments.length,
  18585. args = Array(length),
  18586. index = length,
  18587. placeholder = getHolder(wrapper);
  18588. while (index--) {
  18589. args[index] = arguments[index];
  18590. }
  18591. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  18592. ? []
  18593. : replaceHolders(args, placeholder);
  18594. length -= holders.length;
  18595. if (length < arity) {
  18596. return createRecurry(
  18597. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  18598. args, holders, undefined, undefined, arity - length);
  18599. }
  18600. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18601. return apply(fn, this, args);
  18602. }
  18603. return wrapper;
  18604. }
  18605. /**
  18606. * Creates a `_.find` or `_.findLast` function.
  18607. *
  18608. * @private
  18609. * @param {Function} findIndexFunc The function to find the collection index.
  18610. * @returns {Function} Returns the new find function.
  18611. */
  18612. function createFind(findIndexFunc) {
  18613. return function(collection, predicate, fromIndex) {
  18614. var iterable = Object(collection);
  18615. if (!isArrayLike(collection)) {
  18616. var iteratee = getIteratee(predicate, 3);
  18617. collection = keys(collection);
  18618. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  18619. }
  18620. var index = findIndexFunc(collection, predicate, fromIndex);
  18621. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  18622. };
  18623. }
  18624. /**
  18625. * Creates a `_.flow` or `_.flowRight` function.
  18626. *
  18627. * @private
  18628. * @param {boolean} [fromRight] Specify iterating from right to left.
  18629. * @returns {Function} Returns the new flow function.
  18630. */
  18631. function createFlow(fromRight) {
  18632. return flatRest(function(funcs) {
  18633. var length = funcs.length,
  18634. index = length,
  18635. prereq = LodashWrapper.prototype.thru;
  18636. if (fromRight) {
  18637. funcs.reverse();
  18638. }
  18639. while (index--) {
  18640. var func = funcs[index];
  18641. if (typeof func != 'function') {
  18642. throw new TypeError(FUNC_ERROR_TEXT);
  18643. }
  18644. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  18645. var wrapper = new LodashWrapper([], true);
  18646. }
  18647. }
  18648. index = wrapper ? index : length;
  18649. while (++index < length) {
  18650. func = funcs[index];
  18651. var funcName = getFuncName(func),
  18652. data = funcName == 'wrapper' ? getData(func) : undefined;
  18653. if (data && isLaziable(data[0]) &&
  18654. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  18655. !data[4].length && data[9] == 1
  18656. ) {
  18657. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  18658. } else {
  18659. wrapper = (func.length == 1 && isLaziable(func))
  18660. ? wrapper[funcName]()
  18661. : wrapper.thru(func);
  18662. }
  18663. }
  18664. return function() {
  18665. var args = arguments,
  18666. value = args[0];
  18667. if (wrapper && args.length == 1 && isArray(value)) {
  18668. return wrapper.plant(value).value();
  18669. }
  18670. var index = 0,
  18671. result = length ? funcs[index].apply(this, args) : value;
  18672. while (++index < length) {
  18673. result = funcs[index].call(this, result);
  18674. }
  18675. return result;
  18676. };
  18677. });
  18678. }
  18679. /**
  18680. * Creates a function that wraps `func` to invoke it with optional `this`
  18681. * binding of `thisArg`, partial application, and currying.
  18682. *
  18683. * @private
  18684. * @param {Function|string} func The function or method name to wrap.
  18685. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18686. * @param {*} [thisArg] The `this` binding of `func`.
  18687. * @param {Array} [partials] The arguments to prepend to those provided to
  18688. * the new function.
  18689. * @param {Array} [holders] The `partials` placeholder indexes.
  18690. * @param {Array} [partialsRight] The arguments to append to those provided
  18691. * to the new function.
  18692. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  18693. * @param {Array} [argPos] The argument positions of the new function.
  18694. * @param {number} [ary] The arity cap of `func`.
  18695. * @param {number} [arity] The arity of `func`.
  18696. * @returns {Function} Returns the new wrapped function.
  18697. */
  18698. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  18699. var isAry = bitmask & WRAP_ARY_FLAG,
  18700. isBind = bitmask & WRAP_BIND_FLAG,
  18701. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  18702. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  18703. isFlip = bitmask & WRAP_FLIP_FLAG,
  18704. Ctor = isBindKey ? undefined : createCtor(func);
  18705. function wrapper() {
  18706. var length = arguments.length,
  18707. args = Array(length),
  18708. index = length;
  18709. while (index--) {
  18710. args[index] = arguments[index];
  18711. }
  18712. if (isCurried) {
  18713. var placeholder = getHolder(wrapper),
  18714. holdersCount = countHolders(args, placeholder);
  18715. }
  18716. if (partials) {
  18717. args = composeArgs(args, partials, holders, isCurried);
  18718. }
  18719. if (partialsRight) {
  18720. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  18721. }
  18722. length -= holdersCount;
  18723. if (isCurried && length < arity) {
  18724. var newHolders = replaceHolders(args, placeholder);
  18725. return createRecurry(
  18726. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  18727. args, newHolders, argPos, ary, arity - length
  18728. );
  18729. }
  18730. var thisBinding = isBind ? thisArg : this,
  18731. fn = isBindKey ? thisBinding[func] : func;
  18732. length = args.length;
  18733. if (argPos) {
  18734. args = reorder(args, argPos);
  18735. } else if (isFlip && length > 1) {
  18736. args.reverse();
  18737. }
  18738. if (isAry && ary < length) {
  18739. args.length = ary;
  18740. }
  18741. if (this && this !== root && this instanceof wrapper) {
  18742. fn = Ctor || createCtor(fn);
  18743. }
  18744. return fn.apply(thisBinding, args);
  18745. }
  18746. return wrapper;
  18747. }
  18748. /**
  18749. * Creates a function like `_.invertBy`.
  18750. *
  18751. * @private
  18752. * @param {Function} setter The function to set accumulator values.
  18753. * @param {Function} toIteratee The function to resolve iteratees.
  18754. * @returns {Function} Returns the new inverter function.
  18755. */
  18756. function createInverter(setter, toIteratee) {
  18757. return function(object, iteratee) {
  18758. return baseInverter(object, setter, toIteratee(iteratee), {});
  18759. };
  18760. }
  18761. /**
  18762. * Creates a function that performs a mathematical operation on two values.
  18763. *
  18764. * @private
  18765. * @param {Function} operator The function to perform the operation.
  18766. * @param {number} [defaultValue] The value used for `undefined` arguments.
  18767. * @returns {Function} Returns the new mathematical operation function.
  18768. */
  18769. function createMathOperation(operator, defaultValue) {
  18770. return function(value, other) {
  18771. var result;
  18772. if (value === undefined && other === undefined) {
  18773. return defaultValue;
  18774. }
  18775. if (value !== undefined) {
  18776. result = value;
  18777. }
  18778. if (other !== undefined) {
  18779. if (result === undefined) {
  18780. return other;
  18781. }
  18782. if (typeof value == 'string' || typeof other == 'string') {
  18783. value = baseToString(value);
  18784. other = baseToString(other);
  18785. } else {
  18786. value = baseToNumber(value);
  18787. other = baseToNumber(other);
  18788. }
  18789. result = operator(value, other);
  18790. }
  18791. return result;
  18792. };
  18793. }
  18794. /**
  18795. * Creates a function like `_.over`.
  18796. *
  18797. * @private
  18798. * @param {Function} arrayFunc The function to iterate over iteratees.
  18799. * @returns {Function} Returns the new over function.
  18800. */
  18801. function createOver(arrayFunc) {
  18802. return flatRest(function(iteratees) {
  18803. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  18804. return baseRest(function(args) {
  18805. var thisArg = this;
  18806. return arrayFunc(iteratees, function(iteratee) {
  18807. return apply(iteratee, thisArg, args);
  18808. });
  18809. });
  18810. });
  18811. }
  18812. /**
  18813. * Creates the padding for `string` based on `length`. The `chars` string
  18814. * is truncated if the number of characters exceeds `length`.
  18815. *
  18816. * @private
  18817. * @param {number} length The padding length.
  18818. * @param {string} [chars=' '] The string used as padding.
  18819. * @returns {string} Returns the padding for `string`.
  18820. */
  18821. function createPadding(length, chars) {
  18822. chars = chars === undefined ? ' ' : baseToString(chars);
  18823. var charsLength = chars.length;
  18824. if (charsLength < 2) {
  18825. return charsLength ? baseRepeat(chars, length) : chars;
  18826. }
  18827. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  18828. return hasUnicode(chars)
  18829. ? castSlice(stringToArray(result), 0, length).join('')
  18830. : result.slice(0, length);
  18831. }
  18832. /**
  18833. * Creates a function that wraps `func` to invoke it with the `this` binding
  18834. * of `thisArg` and `partials` prepended to the arguments it receives.
  18835. *
  18836. * @private
  18837. * @param {Function} func The function to wrap.
  18838. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18839. * @param {*} thisArg The `this` binding of `func`.
  18840. * @param {Array} partials The arguments to prepend to those provided to
  18841. * the new function.
  18842. * @returns {Function} Returns the new wrapped function.
  18843. */
  18844. function createPartial(func, bitmask, thisArg, partials) {
  18845. var isBind = bitmask & WRAP_BIND_FLAG,
  18846. Ctor = createCtor(func);
  18847. function wrapper() {
  18848. var argsIndex = -1,
  18849. argsLength = arguments.length,
  18850. leftIndex = -1,
  18851. leftLength = partials.length,
  18852. args = Array(leftLength + argsLength),
  18853. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18854. while (++leftIndex < leftLength) {
  18855. args[leftIndex] = partials[leftIndex];
  18856. }
  18857. while (argsLength--) {
  18858. args[leftIndex++] = arguments[++argsIndex];
  18859. }
  18860. return apply(fn, isBind ? thisArg : this, args);
  18861. }
  18862. return wrapper;
  18863. }
  18864. /**
  18865. * Creates a `_.range` or `_.rangeRight` function.
  18866. *
  18867. * @private
  18868. * @param {boolean} [fromRight] Specify iterating from right to left.
  18869. * @returns {Function} Returns the new range function.
  18870. */
  18871. function createRange(fromRight) {
  18872. return function(start, end, step) {
  18873. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  18874. end = step = undefined;
  18875. }
  18876. // Ensure the sign of `-0` is preserved.
  18877. start = toFinite(start);
  18878. if (end === undefined) {
  18879. end = start;
  18880. start = 0;
  18881. } else {
  18882. end = toFinite(end);
  18883. }
  18884. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  18885. return baseRange(start, end, step, fromRight);
  18886. };
  18887. }
  18888. /**
  18889. * Creates a function that performs a relational operation on two values.
  18890. *
  18891. * @private
  18892. * @param {Function} operator The function to perform the operation.
  18893. * @returns {Function} Returns the new relational operation function.
  18894. */
  18895. function createRelationalOperation(operator) {
  18896. return function(value, other) {
  18897. if (!(typeof value == 'string' && typeof other == 'string')) {
  18898. value = toNumber(value);
  18899. other = toNumber(other);
  18900. }
  18901. return operator(value, other);
  18902. };
  18903. }
  18904. /**
  18905. * Creates a function that wraps `func` to continue currying.
  18906. *
  18907. * @private
  18908. * @param {Function} func The function to wrap.
  18909. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18910. * @param {Function} wrapFunc The function to create the `func` wrapper.
  18911. * @param {*} placeholder The placeholder value.
  18912. * @param {*} [thisArg] The `this` binding of `func`.
  18913. * @param {Array} [partials] The arguments to prepend to those provided to
  18914. * the new function.
  18915. * @param {Array} [holders] The `partials` placeholder indexes.
  18916. * @param {Array} [argPos] The argument positions of the new function.
  18917. * @param {number} [ary] The arity cap of `func`.
  18918. * @param {number} [arity] The arity of `func`.
  18919. * @returns {Function} Returns the new wrapped function.
  18920. */
  18921. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  18922. var isCurry = bitmask & WRAP_CURRY_FLAG,
  18923. newHolders = isCurry ? holders : undefined,
  18924. newHoldersRight = isCurry ? undefined : holders,
  18925. newPartials = isCurry ? partials : undefined,
  18926. newPartialsRight = isCurry ? undefined : partials;
  18927. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  18928. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  18929. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  18930. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  18931. }
  18932. var newData = [
  18933. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  18934. newHoldersRight, argPos, ary, arity
  18935. ];
  18936. var result = wrapFunc.apply(undefined, newData);
  18937. if (isLaziable(func)) {
  18938. setData(result, newData);
  18939. }
  18940. result.placeholder = placeholder;
  18941. return setWrapToString(result, func, bitmask);
  18942. }
  18943. /**
  18944. * Creates a function like `_.round`.
  18945. *
  18946. * @private
  18947. * @param {string} methodName The name of the `Math` method to use when rounding.
  18948. * @returns {Function} Returns the new round function.
  18949. */
  18950. function createRound(methodName) {
  18951. var func = Math[methodName];
  18952. return function(number, precision) {
  18953. number = toNumber(number);
  18954. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  18955. if (precision && nativeIsFinite(number)) {
  18956. // Shift with exponential notation to avoid floating-point issues.
  18957. // See [MDN](https://mdn.io/round#Examples) for more details.
  18958. var pair = (toString(number) + 'e').split('e'),
  18959. value = func(pair[0] + 'e' + (+pair[1] + precision));
  18960. pair = (toString(value) + 'e').split('e');
  18961. return +(pair[0] + 'e' + (+pair[1] - precision));
  18962. }
  18963. return func(number);
  18964. };
  18965. }
  18966. /**
  18967. * Creates a set object of `values`.
  18968. *
  18969. * @private
  18970. * @param {Array} values The values to add to the set.
  18971. * @returns {Object} Returns the new set.
  18972. */
  18973. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  18974. return new Set(values);
  18975. };
  18976. /**
  18977. * Creates a `_.toPairs` or `_.toPairsIn` function.
  18978. *
  18979. * @private
  18980. * @param {Function} keysFunc The function to get the keys of a given object.
  18981. * @returns {Function} Returns the new pairs function.
  18982. */
  18983. function createToPairs(keysFunc) {
  18984. return function(object) {
  18985. var tag = getTag(object);
  18986. if (tag == mapTag) {
  18987. return mapToArray(object);
  18988. }
  18989. if (tag == setTag) {
  18990. return setToPairs(object);
  18991. }
  18992. return baseToPairs(object, keysFunc(object));
  18993. };
  18994. }
  18995. /**
  18996. * Creates a function that either curries or invokes `func` with optional
  18997. * `this` binding and partially applied arguments.
  18998. *
  18999. * @private
  19000. * @param {Function|string} func The function or method name to wrap.
  19001. * @param {number} bitmask The bitmask flags.
  19002. * 1 - `_.bind`
  19003. * 2 - `_.bindKey`
  19004. * 4 - `_.curry` or `_.curryRight` of a bound function
  19005. * 8 - `_.curry`
  19006. * 16 - `_.curryRight`
  19007. * 32 - `_.partial`
  19008. * 64 - `_.partialRight`
  19009. * 128 - `_.rearg`
  19010. * 256 - `_.ary`
  19011. * 512 - `_.flip`
  19012. * @param {*} [thisArg] The `this` binding of `func`.
  19013. * @param {Array} [partials] The arguments to be partially applied.
  19014. * @param {Array} [holders] The `partials` placeholder indexes.
  19015. * @param {Array} [argPos] The argument positions of the new function.
  19016. * @param {number} [ary] The arity cap of `func`.
  19017. * @param {number} [arity] The arity of `func`.
  19018. * @returns {Function} Returns the new wrapped function.
  19019. */
  19020. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  19021. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  19022. if (!isBindKey && typeof func != 'function') {
  19023. throw new TypeError(FUNC_ERROR_TEXT);
  19024. }
  19025. var length = partials ? partials.length : 0;
  19026. if (!length) {
  19027. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  19028. partials = holders = undefined;
  19029. }
  19030. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  19031. arity = arity === undefined ? arity : toInteger(arity);
  19032. length -= holders ? holders.length : 0;
  19033. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  19034. var partialsRight = partials,
  19035. holdersRight = holders;
  19036. partials = holders = undefined;
  19037. }
  19038. var data = isBindKey ? undefined : getData(func);
  19039. var newData = [
  19040. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  19041. argPos, ary, arity
  19042. ];
  19043. if (data) {
  19044. mergeData(newData, data);
  19045. }
  19046. func = newData[0];
  19047. bitmask = newData[1];
  19048. thisArg = newData[2];
  19049. partials = newData[3];
  19050. holders = newData[4];
  19051. arity = newData[9] = newData[9] === undefined
  19052. ? (isBindKey ? 0 : func.length)
  19053. : nativeMax(newData[9] - length, 0);
  19054. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  19055. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  19056. }
  19057. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  19058. var result = createBind(func, bitmask, thisArg);
  19059. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  19060. result = createCurry(func, bitmask, arity);
  19061. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  19062. result = createPartial(func, bitmask, thisArg, partials);
  19063. } else {
  19064. result = createHybrid.apply(undefined, newData);
  19065. }
  19066. var setter = data ? baseSetData : setData;
  19067. return setWrapToString(setter(result, newData), func, bitmask);
  19068. }
  19069. /**
  19070. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  19071. * of source objects to the destination object for all destination properties
  19072. * that resolve to `undefined`.
  19073. *
  19074. * @private
  19075. * @param {*} objValue The destination value.
  19076. * @param {*} srcValue The source value.
  19077. * @param {string} key The key of the property to assign.
  19078. * @param {Object} object The parent object of `objValue`.
  19079. * @returns {*} Returns the value to assign.
  19080. */
  19081. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  19082. if (objValue === undefined ||
  19083. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  19084. return srcValue;
  19085. }
  19086. return objValue;
  19087. }
  19088. /**
  19089. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  19090. * objects into destination objects that are passed thru.
  19091. *
  19092. * @private
  19093. * @param {*} objValue The destination value.
  19094. * @param {*} srcValue The source value.
  19095. * @param {string} key The key of the property to merge.
  19096. * @param {Object} object The parent object of `objValue`.
  19097. * @param {Object} source The parent object of `srcValue`.
  19098. * @param {Object} [stack] Tracks traversed source values and their merged
  19099. * counterparts.
  19100. * @returns {*} Returns the value to assign.
  19101. */
  19102. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  19103. if (isObject(objValue) && isObject(srcValue)) {
  19104. // Recursively merge objects and arrays (susceptible to call stack limits).
  19105. stack.set(srcValue, objValue);
  19106. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  19107. stack['delete'](srcValue);
  19108. }
  19109. return objValue;
  19110. }
  19111. /**
  19112. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  19113. * objects.
  19114. *
  19115. * @private
  19116. * @param {*} value The value to inspect.
  19117. * @param {string} key The key of the property to inspect.
  19118. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  19119. */
  19120. function customOmitClone(value) {
  19121. return isPlainObject(value) ? undefined : value;
  19122. }
  19123. /**
  19124. * A specialized version of `baseIsEqualDeep` for arrays with support for
  19125. * partial deep comparisons.
  19126. *
  19127. * @private
  19128. * @param {Array} array The array to compare.
  19129. * @param {Array} other The other array to compare.
  19130. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19131. * @param {Function} customizer The function to customize comparisons.
  19132. * @param {Function} equalFunc The function to determine equivalents of values.
  19133. * @param {Object} stack Tracks traversed `array` and `other` objects.
  19134. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  19135. */
  19136. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  19137. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19138. arrLength = array.length,
  19139. othLength = other.length;
  19140. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  19141. return false;
  19142. }
  19143. // Check that cyclic values are equal.
  19144. var arrStacked = stack.get(array);
  19145. var othStacked = stack.get(other);
  19146. if (arrStacked && othStacked) {
  19147. return arrStacked == other && othStacked == array;
  19148. }
  19149. var index = -1,
  19150. result = true,
  19151. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  19152. stack.set(array, other);
  19153. stack.set(other, array);
  19154. // Ignore non-index properties.
  19155. while (++index < arrLength) {
  19156. var arrValue = array[index],
  19157. othValue = other[index];
  19158. if (customizer) {
  19159. var compared = isPartial
  19160. ? customizer(othValue, arrValue, index, other, array, stack)
  19161. : customizer(arrValue, othValue, index, array, other, stack);
  19162. }
  19163. if (compared !== undefined) {
  19164. if (compared) {
  19165. continue;
  19166. }
  19167. result = false;
  19168. break;
  19169. }
  19170. // Recursively compare arrays (susceptible to call stack limits).
  19171. if (seen) {
  19172. if (!arraySome(other, function(othValue, othIndex) {
  19173. if (!cacheHas(seen, othIndex) &&
  19174. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  19175. return seen.push(othIndex);
  19176. }
  19177. })) {
  19178. result = false;
  19179. break;
  19180. }
  19181. } else if (!(
  19182. arrValue === othValue ||
  19183. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  19184. )) {
  19185. result = false;
  19186. break;
  19187. }
  19188. }
  19189. stack['delete'](array);
  19190. stack['delete'](other);
  19191. return result;
  19192. }
  19193. /**
  19194. * A specialized version of `baseIsEqualDeep` for comparing objects of
  19195. * the same `toStringTag`.
  19196. *
  19197. * **Note:** This function only supports comparing values with tags of
  19198. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  19199. *
  19200. * @private
  19201. * @param {Object} object The object to compare.
  19202. * @param {Object} other The other object to compare.
  19203. * @param {string} tag The `toStringTag` of the objects to compare.
  19204. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19205. * @param {Function} customizer The function to customize comparisons.
  19206. * @param {Function} equalFunc The function to determine equivalents of values.
  19207. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19208. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19209. */
  19210. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  19211. switch (tag) {
  19212. case dataViewTag:
  19213. if ((object.byteLength != other.byteLength) ||
  19214. (object.byteOffset != other.byteOffset)) {
  19215. return false;
  19216. }
  19217. object = object.buffer;
  19218. other = other.buffer;
  19219. case arrayBufferTag:
  19220. if ((object.byteLength != other.byteLength) ||
  19221. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  19222. return false;
  19223. }
  19224. return true;
  19225. case boolTag:
  19226. case dateTag:
  19227. case numberTag:
  19228. // Coerce booleans to `1` or `0` and dates to milliseconds.
  19229. // Invalid dates are coerced to `NaN`.
  19230. return eq(+object, +other);
  19231. case errorTag:
  19232. return object.name == other.name && object.message == other.message;
  19233. case regexpTag:
  19234. case stringTag:
  19235. // Coerce regexes to strings and treat strings, primitives and objects,
  19236. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  19237. // for more details.
  19238. return object == (other + '');
  19239. case mapTag:
  19240. var convert = mapToArray;
  19241. case setTag:
  19242. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  19243. convert || (convert = setToArray);
  19244. if (object.size != other.size && !isPartial) {
  19245. return false;
  19246. }
  19247. // Assume cyclic values are equal.
  19248. var stacked = stack.get(object);
  19249. if (stacked) {
  19250. return stacked == other;
  19251. }
  19252. bitmask |= COMPARE_UNORDERED_FLAG;
  19253. // Recursively compare objects (susceptible to call stack limits).
  19254. stack.set(object, other);
  19255. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  19256. stack['delete'](object);
  19257. return result;
  19258. case symbolTag:
  19259. if (symbolValueOf) {
  19260. return symbolValueOf.call(object) == symbolValueOf.call(other);
  19261. }
  19262. }
  19263. return false;
  19264. }
  19265. /**
  19266. * A specialized version of `baseIsEqualDeep` for objects with support for
  19267. * partial deep comparisons.
  19268. *
  19269. * @private
  19270. * @param {Object} object The object to compare.
  19271. * @param {Object} other The other object to compare.
  19272. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19273. * @param {Function} customizer The function to customize comparisons.
  19274. * @param {Function} equalFunc The function to determine equivalents of values.
  19275. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19276. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19277. */
  19278. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  19279. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19280. objProps = getAllKeys(object),
  19281. objLength = objProps.length,
  19282. othProps = getAllKeys(other),
  19283. othLength = othProps.length;
  19284. if (objLength != othLength && !isPartial) {
  19285. return false;
  19286. }
  19287. var index = objLength;
  19288. while (index--) {
  19289. var key = objProps[index];
  19290. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  19291. return false;
  19292. }
  19293. }
  19294. // Check that cyclic values are equal.
  19295. var objStacked = stack.get(object);
  19296. var othStacked = stack.get(other);
  19297. if (objStacked && othStacked) {
  19298. return objStacked == other && othStacked == object;
  19299. }
  19300. var result = true;
  19301. stack.set(object, other);
  19302. stack.set(other, object);
  19303. var skipCtor = isPartial;
  19304. while (++index < objLength) {
  19305. key = objProps[index];
  19306. var objValue = object[key],
  19307. othValue = other[key];
  19308. if (customizer) {
  19309. var compared = isPartial
  19310. ? customizer(othValue, objValue, key, other, object, stack)
  19311. : customizer(objValue, othValue, key, object, other, stack);
  19312. }
  19313. // Recursively compare objects (susceptible to call stack limits).
  19314. if (!(compared === undefined
  19315. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  19316. : compared
  19317. )) {
  19318. result = false;
  19319. break;
  19320. }
  19321. skipCtor || (skipCtor = key == 'constructor');
  19322. }
  19323. if (result && !skipCtor) {
  19324. var objCtor = object.constructor,
  19325. othCtor = other.constructor;
  19326. // Non `Object` object instances with different constructors are not equal.
  19327. if (objCtor != othCtor &&
  19328. ('constructor' in object && 'constructor' in other) &&
  19329. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  19330. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  19331. result = false;
  19332. }
  19333. }
  19334. stack['delete'](object);
  19335. stack['delete'](other);
  19336. return result;
  19337. }
  19338. /**
  19339. * A specialized version of `baseRest` which flattens the rest array.
  19340. *
  19341. * @private
  19342. * @param {Function} func The function to apply a rest parameter to.
  19343. * @returns {Function} Returns the new function.
  19344. */
  19345. function flatRest(func) {
  19346. return setToString(overRest(func, undefined, flatten), func + '');
  19347. }
  19348. /**
  19349. * Creates an array of own enumerable property names and symbols of `object`.
  19350. *
  19351. * @private
  19352. * @param {Object} object The object to query.
  19353. * @returns {Array} Returns the array of property names and symbols.
  19354. */
  19355. function getAllKeys(object) {
  19356. return baseGetAllKeys(object, keys, getSymbols);
  19357. }
  19358. /**
  19359. * Creates an array of own and inherited enumerable property names and
  19360. * symbols of `object`.
  19361. *
  19362. * @private
  19363. * @param {Object} object The object to query.
  19364. * @returns {Array} Returns the array of property names and symbols.
  19365. */
  19366. function getAllKeysIn(object) {
  19367. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  19368. }
  19369. /**
  19370. * Gets metadata for `func`.
  19371. *
  19372. * @private
  19373. * @param {Function} func The function to query.
  19374. * @returns {*} Returns the metadata for `func`.
  19375. */
  19376. var getData = !metaMap ? noop : function(func) {
  19377. return metaMap.get(func);
  19378. };
  19379. /**
  19380. * Gets the name of `func`.
  19381. *
  19382. * @private
  19383. * @param {Function} func The function to query.
  19384. * @returns {string} Returns the function name.
  19385. */
  19386. function getFuncName(func) {
  19387. var result = (func.name + ''),
  19388. array = realNames[result],
  19389. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  19390. while (length--) {
  19391. var data = array[length],
  19392. otherFunc = data.func;
  19393. if (otherFunc == null || otherFunc == func) {
  19394. return data.name;
  19395. }
  19396. }
  19397. return result;
  19398. }
  19399. /**
  19400. * Gets the argument placeholder value for `func`.
  19401. *
  19402. * @private
  19403. * @param {Function} func The function to inspect.
  19404. * @returns {*} Returns the placeholder value.
  19405. */
  19406. function getHolder(func) {
  19407. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  19408. return object.placeholder;
  19409. }
  19410. /**
  19411. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  19412. * this function returns the custom method, otherwise it returns `baseIteratee`.
  19413. * If arguments are provided, the chosen function is invoked with them and
  19414. * its result is returned.
  19415. *
  19416. * @private
  19417. * @param {*} [value] The value to convert to an iteratee.
  19418. * @param {number} [arity] The arity of the created iteratee.
  19419. * @returns {Function} Returns the chosen function or its result.
  19420. */
  19421. function getIteratee() {
  19422. var result = lodash.iteratee || iteratee;
  19423. result = result === iteratee ? baseIteratee : result;
  19424. return arguments.length ? result(arguments[0], arguments[1]) : result;
  19425. }
  19426. /**
  19427. * Gets the data for `map`.
  19428. *
  19429. * @private
  19430. * @param {Object} map The map to query.
  19431. * @param {string} key The reference key.
  19432. * @returns {*} Returns the map data.
  19433. */
  19434. function getMapData(map, key) {
  19435. var data = map.__data__;
  19436. return isKeyable(key)
  19437. ? data[typeof key == 'string' ? 'string' : 'hash']
  19438. : data.map;
  19439. }
  19440. /**
  19441. * Gets the property names, values, and compare flags of `object`.
  19442. *
  19443. * @private
  19444. * @param {Object} object The object to query.
  19445. * @returns {Array} Returns the match data of `object`.
  19446. */
  19447. function getMatchData(object) {
  19448. var result = keys(object),
  19449. length = result.length;
  19450. while (length--) {
  19451. var key = result[length],
  19452. value = object[key];
  19453. result[length] = [key, value, isStrictComparable(value)];
  19454. }
  19455. return result;
  19456. }
  19457. /**
  19458. * Gets the native function at `key` of `object`.
  19459. *
  19460. * @private
  19461. * @param {Object} object The object to query.
  19462. * @param {string} key The key of the method to get.
  19463. * @returns {*} Returns the function if it's native, else `undefined`.
  19464. */
  19465. function getNative(object, key) {
  19466. var value = getValue(object, key);
  19467. return baseIsNative(value) ? value : undefined;
  19468. }
  19469. /**
  19470. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  19471. *
  19472. * @private
  19473. * @param {*} value The value to query.
  19474. * @returns {string} Returns the raw `toStringTag`.
  19475. */
  19476. function getRawTag(value) {
  19477. var isOwn = hasOwnProperty.call(value, symToStringTag),
  19478. tag = value[symToStringTag];
  19479. try {
  19480. value[symToStringTag] = undefined;
  19481. var unmasked = true;
  19482. } catch (e) {}
  19483. var result = nativeObjectToString.call(value);
  19484. if (unmasked) {
  19485. if (isOwn) {
  19486. value[symToStringTag] = tag;
  19487. } else {
  19488. delete value[symToStringTag];
  19489. }
  19490. }
  19491. return result;
  19492. }
  19493. /**
  19494. * Creates an array of the own enumerable symbols of `object`.
  19495. *
  19496. * @private
  19497. * @param {Object} object The object to query.
  19498. * @returns {Array} Returns the array of symbols.
  19499. */
  19500. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  19501. if (object == null) {
  19502. return [];
  19503. }
  19504. object = Object(object);
  19505. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  19506. return propertyIsEnumerable.call(object, symbol);
  19507. });
  19508. };
  19509. /**
  19510. * Creates an array of the own and inherited enumerable symbols of `object`.
  19511. *
  19512. * @private
  19513. * @param {Object} object The object to query.
  19514. * @returns {Array} Returns the array of symbols.
  19515. */
  19516. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  19517. var result = [];
  19518. while (object) {
  19519. arrayPush(result, getSymbols(object));
  19520. object = getPrototype(object);
  19521. }
  19522. return result;
  19523. };
  19524. /**
  19525. * Gets the `toStringTag` of `value`.
  19526. *
  19527. * @private
  19528. * @param {*} value The value to query.
  19529. * @returns {string} Returns the `toStringTag`.
  19530. */
  19531. var getTag = baseGetTag;
  19532. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  19533. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  19534. (Map && getTag(new Map) != mapTag) ||
  19535. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  19536. (Set && getTag(new Set) != setTag) ||
  19537. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  19538. getTag = function(value) {
  19539. var result = baseGetTag(value),
  19540. Ctor = result == objectTag ? value.constructor : undefined,
  19541. ctorString = Ctor ? toSource(Ctor) : '';
  19542. if (ctorString) {
  19543. switch (ctorString) {
  19544. case dataViewCtorString: return dataViewTag;
  19545. case mapCtorString: return mapTag;
  19546. case promiseCtorString: return promiseTag;
  19547. case setCtorString: return setTag;
  19548. case weakMapCtorString: return weakMapTag;
  19549. }
  19550. }
  19551. return result;
  19552. };
  19553. }
  19554. /**
  19555. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  19556. *
  19557. * @private
  19558. * @param {number} start The start of the view.
  19559. * @param {number} end The end of the view.
  19560. * @param {Array} transforms The transformations to apply to the view.
  19561. * @returns {Object} Returns an object containing the `start` and `end`
  19562. * positions of the view.
  19563. */
  19564. function getView(start, end, transforms) {
  19565. var index = -1,
  19566. length = transforms.length;
  19567. while (++index < length) {
  19568. var data = transforms[index],
  19569. size = data.size;
  19570. switch (data.type) {
  19571. case 'drop': start += size; break;
  19572. case 'dropRight': end -= size; break;
  19573. case 'take': end = nativeMin(end, start + size); break;
  19574. case 'takeRight': start = nativeMax(start, end - size); break;
  19575. }
  19576. }
  19577. return { 'start': start, 'end': end };
  19578. }
  19579. /**
  19580. * Extracts wrapper details from the `source` body comment.
  19581. *
  19582. * @private
  19583. * @param {string} source The source to inspect.
  19584. * @returns {Array} Returns the wrapper details.
  19585. */
  19586. function getWrapDetails(source) {
  19587. var match = source.match(reWrapDetails);
  19588. return match ? match[1].split(reSplitDetails) : [];
  19589. }
  19590. /**
  19591. * Checks if `path` exists on `object`.
  19592. *
  19593. * @private
  19594. * @param {Object} object The object to query.
  19595. * @param {Array|string} path The path to check.
  19596. * @param {Function} hasFunc The function to check properties.
  19597. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  19598. */
  19599. function hasPath(object, path, hasFunc) {
  19600. path = castPath(path, object);
  19601. var index = -1,
  19602. length = path.length,
  19603. result = false;
  19604. while (++index < length) {
  19605. var key = toKey(path[index]);
  19606. if (!(result = object != null && hasFunc(object, key))) {
  19607. break;
  19608. }
  19609. object = object[key];
  19610. }
  19611. if (result || ++index != length) {
  19612. return result;
  19613. }
  19614. length = object == null ? 0 : object.length;
  19615. return !!length && isLength(length) && isIndex(key, length) &&
  19616. (isArray(object) || isArguments(object));
  19617. }
  19618. /**
  19619. * Initializes an array clone.
  19620. *
  19621. * @private
  19622. * @param {Array} array The array to clone.
  19623. * @returns {Array} Returns the initialized clone.
  19624. */
  19625. function initCloneArray(array) {
  19626. var length = array.length,
  19627. result = new array.constructor(length);
  19628. // Add properties assigned by `RegExp#exec`.
  19629. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  19630. result.index = array.index;
  19631. result.input = array.input;
  19632. }
  19633. return result;
  19634. }
  19635. /**
  19636. * Initializes an object clone.
  19637. *
  19638. * @private
  19639. * @param {Object} object The object to clone.
  19640. * @returns {Object} Returns the initialized clone.
  19641. */
  19642. function initCloneObject(object) {
  19643. return (typeof object.constructor == 'function' && !isPrototype(object))
  19644. ? baseCreate(getPrototype(object))
  19645. : {};
  19646. }
  19647. /**
  19648. * Initializes an object clone based on its `toStringTag`.
  19649. *
  19650. * **Note:** This function only supports cloning values with tags of
  19651. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  19652. *
  19653. * @private
  19654. * @param {Object} object The object to clone.
  19655. * @param {string} tag The `toStringTag` of the object to clone.
  19656. * @param {boolean} [isDeep] Specify a deep clone.
  19657. * @returns {Object} Returns the initialized clone.
  19658. */
  19659. function initCloneByTag(object, tag, isDeep) {
  19660. var Ctor = object.constructor;
  19661. switch (tag) {
  19662. case arrayBufferTag:
  19663. return cloneArrayBuffer(object);
  19664. case boolTag:
  19665. case dateTag:
  19666. return new Ctor(+object);
  19667. case dataViewTag:
  19668. return cloneDataView(object, isDeep);
  19669. case float32Tag: case float64Tag:
  19670. case int8Tag: case int16Tag: case int32Tag:
  19671. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  19672. return cloneTypedArray(object, isDeep);
  19673. case mapTag:
  19674. return new Ctor;
  19675. case numberTag:
  19676. case stringTag:
  19677. return new Ctor(object);
  19678. case regexpTag:
  19679. return cloneRegExp(object);
  19680. case setTag:
  19681. return new Ctor;
  19682. case symbolTag:
  19683. return cloneSymbol(object);
  19684. }
  19685. }
  19686. /**
  19687. * Inserts wrapper `details` in a comment at the top of the `source` body.
  19688. *
  19689. * @private
  19690. * @param {string} source The source to modify.
  19691. * @returns {Array} details The details to insert.
  19692. * @returns {string} Returns the modified source.
  19693. */
  19694. function insertWrapDetails(source, details) {
  19695. var length = details.length;
  19696. if (!length) {
  19697. return source;
  19698. }
  19699. var lastIndex = length - 1;
  19700. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  19701. details = details.join(length > 2 ? ', ' : ' ');
  19702. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  19703. }
  19704. /**
  19705. * Checks if `value` is a flattenable `arguments` object or array.
  19706. *
  19707. * @private
  19708. * @param {*} value The value to check.
  19709. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  19710. */
  19711. function isFlattenable(value) {
  19712. return isArray(value) || isArguments(value) ||
  19713. !!(spreadableSymbol && value && value[spreadableSymbol]);
  19714. }
  19715. /**
  19716. * Checks if `value` is a valid array-like index.
  19717. *
  19718. * @private
  19719. * @param {*} value The value to check.
  19720. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19721. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19722. */
  19723. function isIndex(value, length) {
  19724. var type = typeof value;
  19725. length = length == null ? MAX_SAFE_INTEGER : length;
  19726. return !!length &&
  19727. (type == 'number' ||
  19728. (type != 'symbol' && reIsUint.test(value))) &&
  19729. (value > -1 && value % 1 == 0 && value < length);
  19730. }
  19731. /**
  19732. * Checks if the given arguments are from an iteratee call.
  19733. *
  19734. * @private
  19735. * @param {*} value The potential iteratee value argument.
  19736. * @param {*} index The potential iteratee index or key argument.
  19737. * @param {*} object The potential iteratee object argument.
  19738. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  19739. * else `false`.
  19740. */
  19741. function isIterateeCall(value, index, object) {
  19742. if (!isObject(object)) {
  19743. return false;
  19744. }
  19745. var type = typeof index;
  19746. if (type == 'number'
  19747. ? (isArrayLike(object) && isIndex(index, object.length))
  19748. : (type == 'string' && index in object)
  19749. ) {
  19750. return eq(object[index], value);
  19751. }
  19752. return false;
  19753. }
  19754. /**
  19755. * Checks if `value` is a property name and not a property path.
  19756. *
  19757. * @private
  19758. * @param {*} value The value to check.
  19759. * @param {Object} [object] The object to query keys on.
  19760. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  19761. */
  19762. function isKey(value, object) {
  19763. if (isArray(value)) {
  19764. return false;
  19765. }
  19766. var type = typeof value;
  19767. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  19768. value == null || isSymbol(value)) {
  19769. return true;
  19770. }
  19771. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  19772. (object != null && value in Object(object));
  19773. }
  19774. /**
  19775. * Checks if `value` is suitable for use as unique object key.
  19776. *
  19777. * @private
  19778. * @param {*} value The value to check.
  19779. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19780. */
  19781. function isKeyable(value) {
  19782. var type = typeof value;
  19783. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19784. ? (value !== '__proto__')
  19785. : (value === null);
  19786. }
  19787. /**
  19788. * Checks if `func` has a lazy counterpart.
  19789. *
  19790. * @private
  19791. * @param {Function} func The function to check.
  19792. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  19793. * else `false`.
  19794. */
  19795. function isLaziable(func) {
  19796. var funcName = getFuncName(func),
  19797. other = lodash[funcName];
  19798. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  19799. return false;
  19800. }
  19801. if (func === other) {
  19802. return true;
  19803. }
  19804. var data = getData(other);
  19805. return !!data && func === data[0];
  19806. }
  19807. /**
  19808. * Checks if `func` has its source masked.
  19809. *
  19810. * @private
  19811. * @param {Function} func The function to check.
  19812. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19813. */
  19814. function isMasked(func) {
  19815. return !!maskSrcKey && (maskSrcKey in func);
  19816. }
  19817. /**
  19818. * Checks if `func` is capable of being masked.
  19819. *
  19820. * @private
  19821. * @param {*} value The value to check.
  19822. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  19823. */
  19824. var isMaskable = coreJsData ? isFunction : stubFalse;
  19825. /**
  19826. * Checks if `value` is likely a prototype object.
  19827. *
  19828. * @private
  19829. * @param {*} value The value to check.
  19830. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19831. */
  19832. function isPrototype(value) {
  19833. var Ctor = value && value.constructor,
  19834. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19835. return value === proto;
  19836. }
  19837. /**
  19838. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  19839. *
  19840. * @private
  19841. * @param {*} value The value to check.
  19842. * @returns {boolean} Returns `true` if `value` if suitable for strict
  19843. * equality comparisons, else `false`.
  19844. */
  19845. function isStrictComparable(value) {
  19846. return value === value && !isObject(value);
  19847. }
  19848. /**
  19849. * A specialized version of `matchesProperty` for source values suitable
  19850. * for strict equality comparisons, i.e. `===`.
  19851. *
  19852. * @private
  19853. * @param {string} key The key of the property to get.
  19854. * @param {*} srcValue The value to match.
  19855. * @returns {Function} Returns the new spec function.
  19856. */
  19857. function matchesStrictComparable(key, srcValue) {
  19858. return function(object) {
  19859. if (object == null) {
  19860. return false;
  19861. }
  19862. return object[key] === srcValue &&
  19863. (srcValue !== undefined || (key in Object(object)));
  19864. };
  19865. }
  19866. /**
  19867. * A specialized version of `_.memoize` which clears the memoized function's
  19868. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  19869. *
  19870. * @private
  19871. * @param {Function} func The function to have its output memoized.
  19872. * @returns {Function} Returns the new memoized function.
  19873. */
  19874. function memoizeCapped(func) {
  19875. var result = memoize(func, function(key) {
  19876. if (cache.size === MAX_MEMOIZE_SIZE) {
  19877. cache.clear();
  19878. }
  19879. return key;
  19880. });
  19881. var cache = result.cache;
  19882. return result;
  19883. }
  19884. /**
  19885. * Merges the function metadata of `source` into `data`.
  19886. *
  19887. * Merging metadata reduces the number of wrappers used to invoke a function.
  19888. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  19889. * may be applied regardless of execution order. Methods like `_.ary` and
  19890. * `_.rearg` modify function arguments, making the order in which they are
  19891. * executed important, preventing the merging of metadata. However, we make
  19892. * an exception for a safe combined case where curried functions have `_.ary`
  19893. * and or `_.rearg` applied.
  19894. *
  19895. * @private
  19896. * @param {Array} data The destination metadata.
  19897. * @param {Array} source The source metadata.
  19898. * @returns {Array} Returns `data`.
  19899. */
  19900. function mergeData(data, source) {
  19901. var bitmask = data[1],
  19902. srcBitmask = source[1],
  19903. newBitmask = bitmask | srcBitmask,
  19904. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  19905. var isCombo =
  19906. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  19907. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  19908. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  19909. // Exit early if metadata can't be merged.
  19910. if (!(isCommon || isCombo)) {
  19911. return data;
  19912. }
  19913. // Use source `thisArg` if available.
  19914. if (srcBitmask & WRAP_BIND_FLAG) {
  19915. data[2] = source[2];
  19916. // Set when currying a bound function.
  19917. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  19918. }
  19919. // Compose partial arguments.
  19920. var value = source[3];
  19921. if (value) {
  19922. var partials = data[3];
  19923. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  19924. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  19925. }
  19926. // Compose partial right arguments.
  19927. value = source[5];
  19928. if (value) {
  19929. partials = data[5];
  19930. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  19931. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  19932. }
  19933. // Use source `argPos` if available.
  19934. value = source[7];
  19935. if (value) {
  19936. data[7] = value;
  19937. }
  19938. // Use source `ary` if it's smaller.
  19939. if (srcBitmask & WRAP_ARY_FLAG) {
  19940. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  19941. }
  19942. // Use source `arity` if one is not provided.
  19943. if (data[9] == null) {
  19944. data[9] = source[9];
  19945. }
  19946. // Use source `func` and merge bitmasks.
  19947. data[0] = source[0];
  19948. data[1] = newBitmask;
  19949. return data;
  19950. }
  19951. /**
  19952. * This function is like
  19953. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  19954. * except that it includes inherited enumerable properties.
  19955. *
  19956. * @private
  19957. * @param {Object} object The object to query.
  19958. * @returns {Array} Returns the array of property names.
  19959. */
  19960. function nativeKeysIn(object) {
  19961. var result = [];
  19962. if (object != null) {
  19963. for (var key in Object(object)) {
  19964. result.push(key);
  19965. }
  19966. }
  19967. return result;
  19968. }
  19969. /**
  19970. * Converts `value` to a string using `Object.prototype.toString`.
  19971. *
  19972. * @private
  19973. * @param {*} value The value to convert.
  19974. * @returns {string} Returns the converted string.
  19975. */
  19976. function objectToString(value) {
  19977. return nativeObjectToString.call(value);
  19978. }
  19979. /**
  19980. * A specialized version of `baseRest` which transforms the rest array.
  19981. *
  19982. * @private
  19983. * @param {Function} func The function to apply a rest parameter to.
  19984. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19985. * @param {Function} transform The rest array transform.
  19986. * @returns {Function} Returns the new function.
  19987. */
  19988. function overRest(func, start, transform) {
  19989. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  19990. return function() {
  19991. var args = arguments,
  19992. index = -1,
  19993. length = nativeMax(args.length - start, 0),
  19994. array = Array(length);
  19995. while (++index < length) {
  19996. array[index] = args[start + index];
  19997. }
  19998. index = -1;
  19999. var otherArgs = Array(start + 1);
  20000. while (++index < start) {
  20001. otherArgs[index] = args[index];
  20002. }
  20003. otherArgs[start] = transform(array);
  20004. return apply(func, this, otherArgs);
  20005. };
  20006. }
  20007. /**
  20008. * Gets the parent value at `path` of `object`.
  20009. *
  20010. * @private
  20011. * @param {Object} object The object to query.
  20012. * @param {Array} path The path to get the parent value of.
  20013. * @returns {*} Returns the parent value.
  20014. */
  20015. function parent(object, path) {
  20016. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  20017. }
  20018. /**
  20019. * Reorder `array` according to the specified indexes where the element at
  20020. * the first index is assigned as the first element, the element at
  20021. * the second index is assigned as the second element, and so on.
  20022. *
  20023. * @private
  20024. * @param {Array} array The array to reorder.
  20025. * @param {Array} indexes The arranged array indexes.
  20026. * @returns {Array} Returns `array`.
  20027. */
  20028. function reorder(array, indexes) {
  20029. var arrLength = array.length,
  20030. length = nativeMin(indexes.length, arrLength),
  20031. oldArray = copyArray(array);
  20032. while (length--) {
  20033. var index = indexes[length];
  20034. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  20035. }
  20036. return array;
  20037. }
  20038. /**
  20039. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  20040. *
  20041. * @private
  20042. * @param {Object} object The object to query.
  20043. * @param {string} key The key of the property to get.
  20044. * @returns {*} Returns the property value.
  20045. */
  20046. function safeGet(object, key) {
  20047. if (key === 'constructor' && typeof object[key] === 'function') {
  20048. return;
  20049. }
  20050. if (key == '__proto__') {
  20051. return;
  20052. }
  20053. return object[key];
  20054. }
  20055. /**
  20056. * Sets metadata for `func`.
  20057. *
  20058. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  20059. * period of time, it will trip its breaker and transition to an identity
  20060. * function to avoid garbage collection pauses in V8. See
  20061. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  20062. * for more details.
  20063. *
  20064. * @private
  20065. * @param {Function} func The function to associate metadata with.
  20066. * @param {*} data The metadata.
  20067. * @returns {Function} Returns `func`.
  20068. */
  20069. var setData = shortOut(baseSetData);
  20070. /**
  20071. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  20072. *
  20073. * @private
  20074. * @param {Function} func The function to delay.
  20075. * @param {number} wait The number of milliseconds to delay invocation.
  20076. * @returns {number|Object} Returns the timer id or timeout object.
  20077. */
  20078. var setTimeout = ctxSetTimeout || function(func, wait) {
  20079. return root.setTimeout(func, wait);
  20080. };
  20081. /**
  20082. * Sets the `toString` method of `func` to return `string`.
  20083. *
  20084. * @private
  20085. * @param {Function} func The function to modify.
  20086. * @param {Function} string The `toString` result.
  20087. * @returns {Function} Returns `func`.
  20088. */
  20089. var setToString = shortOut(baseSetToString);
  20090. /**
  20091. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  20092. * with wrapper details in a comment at the top of the source body.
  20093. *
  20094. * @private
  20095. * @param {Function} wrapper The function to modify.
  20096. * @param {Function} reference The reference function.
  20097. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20098. * @returns {Function} Returns `wrapper`.
  20099. */
  20100. function setWrapToString(wrapper, reference, bitmask) {
  20101. var source = (reference + '');
  20102. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  20103. }
  20104. /**
  20105. * Creates a function that'll short out and invoke `identity` instead
  20106. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  20107. * milliseconds.
  20108. *
  20109. * @private
  20110. * @param {Function} func The function to restrict.
  20111. * @returns {Function} Returns the new shortable function.
  20112. */
  20113. function shortOut(func) {
  20114. var count = 0,
  20115. lastCalled = 0;
  20116. return function() {
  20117. var stamp = nativeNow(),
  20118. remaining = HOT_SPAN - (stamp - lastCalled);
  20119. lastCalled = stamp;
  20120. if (remaining > 0) {
  20121. if (++count >= HOT_COUNT) {
  20122. return arguments[0];
  20123. }
  20124. } else {
  20125. count = 0;
  20126. }
  20127. return func.apply(undefined, arguments);
  20128. };
  20129. }
  20130. /**
  20131. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  20132. *
  20133. * @private
  20134. * @param {Array} array The array to shuffle.
  20135. * @param {number} [size=array.length] The size of `array`.
  20136. * @returns {Array} Returns `array`.
  20137. */
  20138. function shuffleSelf(array, size) {
  20139. var index = -1,
  20140. length = array.length,
  20141. lastIndex = length - 1;
  20142. size = size === undefined ? length : size;
  20143. while (++index < size) {
  20144. var rand = baseRandom(index, lastIndex),
  20145. value = array[rand];
  20146. array[rand] = array[index];
  20147. array[index] = value;
  20148. }
  20149. array.length = size;
  20150. return array;
  20151. }
  20152. /**
  20153. * Converts `string` to a property path array.
  20154. *
  20155. * @private
  20156. * @param {string} string The string to convert.
  20157. * @returns {Array} Returns the property path array.
  20158. */
  20159. var stringToPath = memoizeCapped(function(string) {
  20160. var result = [];
  20161. if (string.charCodeAt(0) === 46 /* . */) {
  20162. result.push('');
  20163. }
  20164. string.replace(rePropName, function(match, number, quote, subString) {
  20165. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  20166. });
  20167. return result;
  20168. });
  20169. /**
  20170. * Converts `value` to a string key if it's not a string or symbol.
  20171. *
  20172. * @private
  20173. * @param {*} value The value to inspect.
  20174. * @returns {string|symbol} Returns the key.
  20175. */
  20176. function toKey(value) {
  20177. if (typeof value == 'string' || isSymbol(value)) {
  20178. return value;
  20179. }
  20180. var result = (value + '');
  20181. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  20182. }
  20183. /**
  20184. * Converts `func` to its source code.
  20185. *
  20186. * @private
  20187. * @param {Function} func The function to convert.
  20188. * @returns {string} Returns the source code.
  20189. */
  20190. function toSource(func) {
  20191. if (func != null) {
  20192. try {
  20193. return funcToString.call(func);
  20194. } catch (e) {}
  20195. try {
  20196. return (func + '');
  20197. } catch (e) {}
  20198. }
  20199. return '';
  20200. }
  20201. /**
  20202. * Updates wrapper `details` based on `bitmask` flags.
  20203. *
  20204. * @private
  20205. * @returns {Array} details The details to modify.
  20206. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20207. * @returns {Array} Returns `details`.
  20208. */
  20209. function updateWrapDetails(details, bitmask) {
  20210. arrayEach(wrapFlags, function(pair) {
  20211. var value = '_.' + pair[0];
  20212. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  20213. details.push(value);
  20214. }
  20215. });
  20216. return details.sort();
  20217. }
  20218. /**
  20219. * Creates a clone of `wrapper`.
  20220. *
  20221. * @private
  20222. * @param {Object} wrapper The wrapper to clone.
  20223. * @returns {Object} Returns the cloned wrapper.
  20224. */
  20225. function wrapperClone(wrapper) {
  20226. if (wrapper instanceof LazyWrapper) {
  20227. return wrapper.clone();
  20228. }
  20229. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  20230. result.__actions__ = copyArray(wrapper.__actions__);
  20231. result.__index__ = wrapper.__index__;
  20232. result.__values__ = wrapper.__values__;
  20233. return result;
  20234. }
  20235. /*------------------------------------------------------------------------*/
  20236. /**
  20237. * Creates an array of elements split into groups the length of `size`.
  20238. * If `array` can't be split evenly, the final chunk will be the remaining
  20239. * elements.
  20240. *
  20241. * @static
  20242. * @memberOf _
  20243. * @since 3.0.0
  20244. * @category Array
  20245. * @param {Array} array The array to process.
  20246. * @param {number} [size=1] The length of each chunk
  20247. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20248. * @returns {Array} Returns the new array of chunks.
  20249. * @example
  20250. *
  20251. * _.chunk(['a', 'b', 'c', 'd'], 2);
  20252. * // => [['a', 'b'], ['c', 'd']]
  20253. *
  20254. * _.chunk(['a', 'b', 'c', 'd'], 3);
  20255. * // => [['a', 'b', 'c'], ['d']]
  20256. */
  20257. function chunk(array, size, guard) {
  20258. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  20259. size = 1;
  20260. } else {
  20261. size = nativeMax(toInteger(size), 0);
  20262. }
  20263. var length = array == null ? 0 : array.length;
  20264. if (!length || size < 1) {
  20265. return [];
  20266. }
  20267. var index = 0,
  20268. resIndex = 0,
  20269. result = Array(nativeCeil(length / size));
  20270. while (index < length) {
  20271. result[resIndex++] = baseSlice(array, index, (index += size));
  20272. }
  20273. return result;
  20274. }
  20275. /**
  20276. * Creates an array with all falsey values removed. The values `false`, `null`,
  20277. * `0`, `""`, `undefined`, and `NaN` are falsey.
  20278. *
  20279. * @static
  20280. * @memberOf _
  20281. * @since 0.1.0
  20282. * @category Array
  20283. * @param {Array} array The array to compact.
  20284. * @returns {Array} Returns the new array of filtered values.
  20285. * @example
  20286. *
  20287. * _.compact([0, 1, false, 2, '', 3]);
  20288. * // => [1, 2, 3]
  20289. */
  20290. function compact(array) {
  20291. var index = -1,
  20292. length = array == null ? 0 : array.length,
  20293. resIndex = 0,
  20294. result = [];
  20295. while (++index < length) {
  20296. var value = array[index];
  20297. if (value) {
  20298. result[resIndex++] = value;
  20299. }
  20300. }
  20301. return result;
  20302. }
  20303. /**
  20304. * Creates a new array concatenating `array` with any additional arrays
  20305. * and/or values.
  20306. *
  20307. * @static
  20308. * @memberOf _
  20309. * @since 4.0.0
  20310. * @category Array
  20311. * @param {Array} array The array to concatenate.
  20312. * @param {...*} [values] The values to concatenate.
  20313. * @returns {Array} Returns the new concatenated array.
  20314. * @example
  20315. *
  20316. * var array = [1];
  20317. * var other = _.concat(array, 2, [3], [[4]]);
  20318. *
  20319. * console.log(other);
  20320. * // => [1, 2, 3, [4]]
  20321. *
  20322. * console.log(array);
  20323. * // => [1]
  20324. */
  20325. function concat() {
  20326. var length = arguments.length;
  20327. if (!length) {
  20328. return [];
  20329. }
  20330. var args = Array(length - 1),
  20331. array = arguments[0],
  20332. index = length;
  20333. while (index--) {
  20334. args[index - 1] = arguments[index];
  20335. }
  20336. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  20337. }
  20338. /**
  20339. * Creates an array of `array` values not included in the other given arrays
  20340. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20341. * for equality comparisons. The order and references of result values are
  20342. * determined by the first array.
  20343. *
  20344. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  20345. *
  20346. * @static
  20347. * @memberOf _
  20348. * @since 0.1.0
  20349. * @category Array
  20350. * @param {Array} array The array to inspect.
  20351. * @param {...Array} [values] The values to exclude.
  20352. * @returns {Array} Returns the new array of filtered values.
  20353. * @see _.without, _.xor
  20354. * @example
  20355. *
  20356. * _.difference([2, 1], [2, 3]);
  20357. * // => [1]
  20358. */
  20359. var difference = baseRest(function(array, values) {
  20360. return isArrayLikeObject(array)
  20361. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  20362. : [];
  20363. });
  20364. /**
  20365. * This method is like `_.difference` except that it accepts `iteratee` which
  20366. * is invoked for each element of `array` and `values` to generate the criterion
  20367. * by which they're compared. The order and references of result values are
  20368. * determined by the first array. The iteratee is invoked with one argument:
  20369. * (value).
  20370. *
  20371. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  20372. *
  20373. * @static
  20374. * @memberOf _
  20375. * @since 4.0.0
  20376. * @category Array
  20377. * @param {Array} array The array to inspect.
  20378. * @param {...Array} [values] The values to exclude.
  20379. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20380. * @returns {Array} Returns the new array of filtered values.
  20381. * @example
  20382. *
  20383. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20384. * // => [1.2]
  20385. *
  20386. * // The `_.property` iteratee shorthand.
  20387. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  20388. * // => [{ 'x': 2 }]
  20389. */
  20390. var differenceBy = baseRest(function(array, values) {
  20391. var iteratee = last(values);
  20392. if (isArrayLikeObject(iteratee)) {
  20393. iteratee = undefined;
  20394. }
  20395. return isArrayLikeObject(array)
  20396. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  20397. : [];
  20398. });
  20399. /**
  20400. * This method is like `_.difference` except that it accepts `comparator`
  20401. * which is invoked to compare elements of `array` to `values`. The order and
  20402. * references of result values are determined by the first array. The comparator
  20403. * is invoked with two arguments: (arrVal, othVal).
  20404. *
  20405. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  20406. *
  20407. * @static
  20408. * @memberOf _
  20409. * @since 4.0.0
  20410. * @category Array
  20411. * @param {Array} array The array to inspect.
  20412. * @param {...Array} [values] The values to exclude.
  20413. * @param {Function} [comparator] The comparator invoked per element.
  20414. * @returns {Array} Returns the new array of filtered values.
  20415. * @example
  20416. *
  20417. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20418. *
  20419. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  20420. * // => [{ 'x': 2, 'y': 1 }]
  20421. */
  20422. var differenceWith = baseRest(function(array, values) {
  20423. var comparator = last(values);
  20424. if (isArrayLikeObject(comparator)) {
  20425. comparator = undefined;
  20426. }
  20427. return isArrayLikeObject(array)
  20428. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  20429. : [];
  20430. });
  20431. /**
  20432. * Creates a slice of `array` with `n` elements dropped from the beginning.
  20433. *
  20434. * @static
  20435. * @memberOf _
  20436. * @since 0.5.0
  20437. * @category Array
  20438. * @param {Array} array The array to query.
  20439. * @param {number} [n=1] The number of elements to drop.
  20440. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20441. * @returns {Array} Returns the slice of `array`.
  20442. * @example
  20443. *
  20444. * _.drop([1, 2, 3]);
  20445. * // => [2, 3]
  20446. *
  20447. * _.drop([1, 2, 3], 2);
  20448. * // => [3]
  20449. *
  20450. * _.drop([1, 2, 3], 5);
  20451. * // => []
  20452. *
  20453. * _.drop([1, 2, 3], 0);
  20454. * // => [1, 2, 3]
  20455. */
  20456. function drop(array, n, guard) {
  20457. var length = array == null ? 0 : array.length;
  20458. if (!length) {
  20459. return [];
  20460. }
  20461. n = (guard || n === undefined) ? 1 : toInteger(n);
  20462. return baseSlice(array, n < 0 ? 0 : n, length);
  20463. }
  20464. /**
  20465. * Creates a slice of `array` with `n` elements dropped from the end.
  20466. *
  20467. * @static
  20468. * @memberOf _
  20469. * @since 3.0.0
  20470. * @category Array
  20471. * @param {Array} array The array to query.
  20472. * @param {number} [n=1] The number of elements to drop.
  20473. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20474. * @returns {Array} Returns the slice of `array`.
  20475. * @example
  20476. *
  20477. * _.dropRight([1, 2, 3]);
  20478. * // => [1, 2]
  20479. *
  20480. * _.dropRight([1, 2, 3], 2);
  20481. * // => [1]
  20482. *
  20483. * _.dropRight([1, 2, 3], 5);
  20484. * // => []
  20485. *
  20486. * _.dropRight([1, 2, 3], 0);
  20487. * // => [1, 2, 3]
  20488. */
  20489. function dropRight(array, n, guard) {
  20490. var length = array == null ? 0 : array.length;
  20491. if (!length) {
  20492. return [];
  20493. }
  20494. n = (guard || n === undefined) ? 1 : toInteger(n);
  20495. n = length - n;
  20496. return baseSlice(array, 0, n < 0 ? 0 : n);
  20497. }
  20498. /**
  20499. * Creates a slice of `array` excluding elements dropped from the end.
  20500. * Elements are dropped until `predicate` returns falsey. The predicate is
  20501. * invoked with three arguments: (value, index, array).
  20502. *
  20503. * @static
  20504. * @memberOf _
  20505. * @since 3.0.0
  20506. * @category Array
  20507. * @param {Array} array The array to query.
  20508. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20509. * @returns {Array} Returns the slice of `array`.
  20510. * @example
  20511. *
  20512. * var users = [
  20513. * { 'user': 'barney', 'active': true },
  20514. * { 'user': 'fred', 'active': false },
  20515. * { 'user': 'pebbles', 'active': false }
  20516. * ];
  20517. *
  20518. * _.dropRightWhile(users, function(o) { return !o.active; });
  20519. * // => objects for ['barney']
  20520. *
  20521. * // The `_.matches` iteratee shorthand.
  20522. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  20523. * // => objects for ['barney', 'fred']
  20524. *
  20525. * // The `_.matchesProperty` iteratee shorthand.
  20526. * _.dropRightWhile(users, ['active', false]);
  20527. * // => objects for ['barney']
  20528. *
  20529. * // The `_.property` iteratee shorthand.
  20530. * _.dropRightWhile(users, 'active');
  20531. * // => objects for ['barney', 'fred', 'pebbles']
  20532. */
  20533. function dropRightWhile(array, predicate) {
  20534. return (array && array.length)
  20535. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  20536. : [];
  20537. }
  20538. /**
  20539. * Creates a slice of `array` excluding elements dropped from the beginning.
  20540. * Elements are dropped until `predicate` returns falsey. The predicate is
  20541. * invoked with three arguments: (value, index, array).
  20542. *
  20543. * @static
  20544. * @memberOf _
  20545. * @since 3.0.0
  20546. * @category Array
  20547. * @param {Array} array The array to query.
  20548. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20549. * @returns {Array} Returns the slice of `array`.
  20550. * @example
  20551. *
  20552. * var users = [
  20553. * { 'user': 'barney', 'active': false },
  20554. * { 'user': 'fred', 'active': false },
  20555. * { 'user': 'pebbles', 'active': true }
  20556. * ];
  20557. *
  20558. * _.dropWhile(users, function(o) { return !o.active; });
  20559. * // => objects for ['pebbles']
  20560. *
  20561. * // The `_.matches` iteratee shorthand.
  20562. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  20563. * // => objects for ['fred', 'pebbles']
  20564. *
  20565. * // The `_.matchesProperty` iteratee shorthand.
  20566. * _.dropWhile(users, ['active', false]);
  20567. * // => objects for ['pebbles']
  20568. *
  20569. * // The `_.property` iteratee shorthand.
  20570. * _.dropWhile(users, 'active');
  20571. * // => objects for ['barney', 'fred', 'pebbles']
  20572. */
  20573. function dropWhile(array, predicate) {
  20574. return (array && array.length)
  20575. ? baseWhile(array, getIteratee(predicate, 3), true)
  20576. : [];
  20577. }
  20578. /**
  20579. * Fills elements of `array` with `value` from `start` up to, but not
  20580. * including, `end`.
  20581. *
  20582. * **Note:** This method mutates `array`.
  20583. *
  20584. * @static
  20585. * @memberOf _
  20586. * @since 3.2.0
  20587. * @category Array
  20588. * @param {Array} array The array to fill.
  20589. * @param {*} value The value to fill `array` with.
  20590. * @param {number} [start=0] The start position.
  20591. * @param {number} [end=array.length] The end position.
  20592. * @returns {Array} Returns `array`.
  20593. * @example
  20594. *
  20595. * var array = [1, 2, 3];
  20596. *
  20597. * _.fill(array, 'a');
  20598. * console.log(array);
  20599. * // => ['a', 'a', 'a']
  20600. *
  20601. * _.fill(Array(3), 2);
  20602. * // => [2, 2, 2]
  20603. *
  20604. * _.fill([4, 6, 8, 10], '*', 1, 3);
  20605. * // => [4, '*', '*', 10]
  20606. */
  20607. function fill(array, value, start, end) {
  20608. var length = array == null ? 0 : array.length;
  20609. if (!length) {
  20610. return [];
  20611. }
  20612. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  20613. start = 0;
  20614. end = length;
  20615. }
  20616. return baseFill(array, value, start, end);
  20617. }
  20618. /**
  20619. * This method is like `_.find` except that it returns the index of the first
  20620. * element `predicate` returns truthy for instead of the element itself.
  20621. *
  20622. * @static
  20623. * @memberOf _
  20624. * @since 1.1.0
  20625. * @category Array
  20626. * @param {Array} array The array to inspect.
  20627. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20628. * @param {number} [fromIndex=0] The index to search from.
  20629. * @returns {number} Returns the index of the found element, else `-1`.
  20630. * @example
  20631. *
  20632. * var users = [
  20633. * { 'user': 'barney', 'active': false },
  20634. * { 'user': 'fred', 'active': false },
  20635. * { 'user': 'pebbles', 'active': true }
  20636. * ];
  20637. *
  20638. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  20639. * // => 0
  20640. *
  20641. * // The `_.matches` iteratee shorthand.
  20642. * _.findIndex(users, { 'user': 'fred', 'active': false });
  20643. * // => 1
  20644. *
  20645. * // The `_.matchesProperty` iteratee shorthand.
  20646. * _.findIndex(users, ['active', false]);
  20647. * // => 0
  20648. *
  20649. * // The `_.property` iteratee shorthand.
  20650. * _.findIndex(users, 'active');
  20651. * // => 2
  20652. */
  20653. function findIndex(array, predicate, fromIndex) {
  20654. var length = array == null ? 0 : array.length;
  20655. if (!length) {
  20656. return -1;
  20657. }
  20658. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20659. if (index < 0) {
  20660. index = nativeMax(length + index, 0);
  20661. }
  20662. return baseFindIndex(array, getIteratee(predicate, 3), index);
  20663. }
  20664. /**
  20665. * This method is like `_.findIndex` except that it iterates over elements
  20666. * of `collection` from right to left.
  20667. *
  20668. * @static
  20669. * @memberOf _
  20670. * @since 2.0.0
  20671. * @category Array
  20672. * @param {Array} array The array to inspect.
  20673. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20674. * @param {number} [fromIndex=array.length-1] The index to search from.
  20675. * @returns {number} Returns the index of the found element, else `-1`.
  20676. * @example
  20677. *
  20678. * var users = [
  20679. * { 'user': 'barney', 'active': true },
  20680. * { 'user': 'fred', 'active': false },
  20681. * { 'user': 'pebbles', 'active': false }
  20682. * ];
  20683. *
  20684. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  20685. * // => 2
  20686. *
  20687. * // The `_.matches` iteratee shorthand.
  20688. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  20689. * // => 0
  20690. *
  20691. * // The `_.matchesProperty` iteratee shorthand.
  20692. * _.findLastIndex(users, ['active', false]);
  20693. * // => 2
  20694. *
  20695. * // The `_.property` iteratee shorthand.
  20696. * _.findLastIndex(users, 'active');
  20697. * // => 0
  20698. */
  20699. function findLastIndex(array, predicate, fromIndex) {
  20700. var length = array == null ? 0 : array.length;
  20701. if (!length) {
  20702. return -1;
  20703. }
  20704. var index = length - 1;
  20705. if (fromIndex !== undefined) {
  20706. index = toInteger(fromIndex);
  20707. index = fromIndex < 0
  20708. ? nativeMax(length + index, 0)
  20709. : nativeMin(index, length - 1);
  20710. }
  20711. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  20712. }
  20713. /**
  20714. * Flattens `array` a single level deep.
  20715. *
  20716. * @static
  20717. * @memberOf _
  20718. * @since 0.1.0
  20719. * @category Array
  20720. * @param {Array} array The array to flatten.
  20721. * @returns {Array} Returns the new flattened array.
  20722. * @example
  20723. *
  20724. * _.flatten([1, [2, [3, [4]], 5]]);
  20725. * // => [1, 2, [3, [4]], 5]
  20726. */
  20727. function flatten(array) {
  20728. var length = array == null ? 0 : array.length;
  20729. return length ? baseFlatten(array, 1) : [];
  20730. }
  20731. /**
  20732. * Recursively flattens `array`.
  20733. *
  20734. * @static
  20735. * @memberOf _
  20736. * @since 3.0.0
  20737. * @category Array
  20738. * @param {Array} array The array to flatten.
  20739. * @returns {Array} Returns the new flattened array.
  20740. * @example
  20741. *
  20742. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  20743. * // => [1, 2, 3, 4, 5]
  20744. */
  20745. function flattenDeep(array) {
  20746. var length = array == null ? 0 : array.length;
  20747. return length ? baseFlatten(array, INFINITY) : [];
  20748. }
  20749. /**
  20750. * Recursively flatten `array` up to `depth` times.
  20751. *
  20752. * @static
  20753. * @memberOf _
  20754. * @since 4.4.0
  20755. * @category Array
  20756. * @param {Array} array The array to flatten.
  20757. * @param {number} [depth=1] The maximum recursion depth.
  20758. * @returns {Array} Returns the new flattened array.
  20759. * @example
  20760. *
  20761. * var array = [1, [2, [3, [4]], 5]];
  20762. *
  20763. * _.flattenDepth(array, 1);
  20764. * // => [1, 2, [3, [4]], 5]
  20765. *
  20766. * _.flattenDepth(array, 2);
  20767. * // => [1, 2, 3, [4], 5]
  20768. */
  20769. function flattenDepth(array, depth) {
  20770. var length = array == null ? 0 : array.length;
  20771. if (!length) {
  20772. return [];
  20773. }
  20774. depth = depth === undefined ? 1 : toInteger(depth);
  20775. return baseFlatten(array, depth);
  20776. }
  20777. /**
  20778. * The inverse of `_.toPairs`; this method returns an object composed
  20779. * from key-value `pairs`.
  20780. *
  20781. * @static
  20782. * @memberOf _
  20783. * @since 4.0.0
  20784. * @category Array
  20785. * @param {Array} pairs The key-value pairs.
  20786. * @returns {Object} Returns the new object.
  20787. * @example
  20788. *
  20789. * _.fromPairs([['a', 1], ['b', 2]]);
  20790. * // => { 'a': 1, 'b': 2 }
  20791. */
  20792. function fromPairs(pairs) {
  20793. var index = -1,
  20794. length = pairs == null ? 0 : pairs.length,
  20795. result = {};
  20796. while (++index < length) {
  20797. var pair = pairs[index];
  20798. result[pair[0]] = pair[1];
  20799. }
  20800. return result;
  20801. }
  20802. /**
  20803. * Gets the first element of `array`.
  20804. *
  20805. * @static
  20806. * @memberOf _
  20807. * @since 0.1.0
  20808. * @alias first
  20809. * @category Array
  20810. * @param {Array} array The array to query.
  20811. * @returns {*} Returns the first element of `array`.
  20812. * @example
  20813. *
  20814. * _.head([1, 2, 3]);
  20815. * // => 1
  20816. *
  20817. * _.head([]);
  20818. * // => undefined
  20819. */
  20820. function head(array) {
  20821. return (array && array.length) ? array[0] : undefined;
  20822. }
  20823. /**
  20824. * Gets the index at which the first occurrence of `value` is found in `array`
  20825. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20826. * for equality comparisons. If `fromIndex` is negative, it's used as the
  20827. * offset from the end of `array`.
  20828. *
  20829. * @static
  20830. * @memberOf _
  20831. * @since 0.1.0
  20832. * @category Array
  20833. * @param {Array} array The array to inspect.
  20834. * @param {*} value The value to search for.
  20835. * @param {number} [fromIndex=0] The index to search from.
  20836. * @returns {number} Returns the index of the matched value, else `-1`.
  20837. * @example
  20838. *
  20839. * _.indexOf([1, 2, 1, 2], 2);
  20840. * // => 1
  20841. *
  20842. * // Search from the `fromIndex`.
  20843. * _.indexOf([1, 2, 1, 2], 2, 2);
  20844. * // => 3
  20845. */
  20846. function indexOf(array, value, fromIndex) {
  20847. var length = array == null ? 0 : array.length;
  20848. if (!length) {
  20849. return -1;
  20850. }
  20851. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20852. if (index < 0) {
  20853. index = nativeMax(length + index, 0);
  20854. }
  20855. return baseIndexOf(array, value, index);
  20856. }
  20857. /**
  20858. * Gets all but the last element of `array`.
  20859. *
  20860. * @static
  20861. * @memberOf _
  20862. * @since 0.1.0
  20863. * @category Array
  20864. * @param {Array} array The array to query.
  20865. * @returns {Array} Returns the slice of `array`.
  20866. * @example
  20867. *
  20868. * _.initial([1, 2, 3]);
  20869. * // => [1, 2]
  20870. */
  20871. function initial(array) {
  20872. var length = array == null ? 0 : array.length;
  20873. return length ? baseSlice(array, 0, -1) : [];
  20874. }
  20875. /**
  20876. * Creates an array of unique values that are included in all given arrays
  20877. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20878. * for equality comparisons. The order and references of result values are
  20879. * determined by the first array.
  20880. *
  20881. * @static
  20882. * @memberOf _
  20883. * @since 0.1.0
  20884. * @category Array
  20885. * @param {...Array} [arrays] The arrays to inspect.
  20886. * @returns {Array} Returns the new array of intersecting values.
  20887. * @example
  20888. *
  20889. * _.intersection([2, 1], [2, 3]);
  20890. * // => [2]
  20891. */
  20892. var intersection = baseRest(function(arrays) {
  20893. var mapped = arrayMap(arrays, castArrayLikeObject);
  20894. return (mapped.length && mapped[0] === arrays[0])
  20895. ? baseIntersection(mapped)
  20896. : [];
  20897. });
  20898. /**
  20899. * This method is like `_.intersection` except that it accepts `iteratee`
  20900. * which is invoked for each element of each `arrays` to generate the criterion
  20901. * by which they're compared. The order and references of result values are
  20902. * determined by the first array. The iteratee is invoked with one argument:
  20903. * (value).
  20904. *
  20905. * @static
  20906. * @memberOf _
  20907. * @since 4.0.0
  20908. * @category Array
  20909. * @param {...Array} [arrays] The arrays to inspect.
  20910. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20911. * @returns {Array} Returns the new array of intersecting values.
  20912. * @example
  20913. *
  20914. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20915. * // => [2.1]
  20916. *
  20917. * // The `_.property` iteratee shorthand.
  20918. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  20919. * // => [{ 'x': 1 }]
  20920. */
  20921. var intersectionBy = baseRest(function(arrays) {
  20922. var iteratee = last(arrays),
  20923. mapped = arrayMap(arrays, castArrayLikeObject);
  20924. if (iteratee === last(mapped)) {
  20925. iteratee = undefined;
  20926. } else {
  20927. mapped.pop();
  20928. }
  20929. return (mapped.length && mapped[0] === arrays[0])
  20930. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  20931. : [];
  20932. });
  20933. /**
  20934. * This method is like `_.intersection` except that it accepts `comparator`
  20935. * which is invoked to compare elements of `arrays`. The order and references
  20936. * of result values are determined by the first array. The comparator is
  20937. * invoked with two arguments: (arrVal, othVal).
  20938. *
  20939. * @static
  20940. * @memberOf _
  20941. * @since 4.0.0
  20942. * @category Array
  20943. * @param {...Array} [arrays] The arrays to inspect.
  20944. * @param {Function} [comparator] The comparator invoked per element.
  20945. * @returns {Array} Returns the new array of intersecting values.
  20946. * @example
  20947. *
  20948. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20949. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  20950. *
  20951. * _.intersectionWith(objects, others, _.isEqual);
  20952. * // => [{ 'x': 1, 'y': 2 }]
  20953. */
  20954. var intersectionWith = baseRest(function(arrays) {
  20955. var comparator = last(arrays),
  20956. mapped = arrayMap(arrays, castArrayLikeObject);
  20957. comparator = typeof comparator == 'function' ? comparator : undefined;
  20958. if (comparator) {
  20959. mapped.pop();
  20960. }
  20961. return (mapped.length && mapped[0] === arrays[0])
  20962. ? baseIntersection(mapped, undefined, comparator)
  20963. : [];
  20964. });
  20965. /**
  20966. * Converts all elements in `array` into a string separated by `separator`.
  20967. *
  20968. * @static
  20969. * @memberOf _
  20970. * @since 4.0.0
  20971. * @category Array
  20972. * @param {Array} array The array to convert.
  20973. * @param {string} [separator=','] The element separator.
  20974. * @returns {string} Returns the joined string.
  20975. * @example
  20976. *
  20977. * _.join(['a', 'b', 'c'], '~');
  20978. * // => 'a~b~c'
  20979. */
  20980. function join(array, separator) {
  20981. return array == null ? '' : nativeJoin.call(array, separator);
  20982. }
  20983. /**
  20984. * Gets the last element of `array`.
  20985. *
  20986. * @static
  20987. * @memberOf _
  20988. * @since 0.1.0
  20989. * @category Array
  20990. * @param {Array} array The array to query.
  20991. * @returns {*} Returns the last element of `array`.
  20992. * @example
  20993. *
  20994. * _.last([1, 2, 3]);
  20995. * // => 3
  20996. */
  20997. function last(array) {
  20998. var length = array == null ? 0 : array.length;
  20999. return length ? array[length - 1] : undefined;
  21000. }
  21001. /**
  21002. * This method is like `_.indexOf` except that it iterates over elements of
  21003. * `array` from right to left.
  21004. *
  21005. * @static
  21006. * @memberOf _
  21007. * @since 0.1.0
  21008. * @category Array
  21009. * @param {Array} array The array to inspect.
  21010. * @param {*} value The value to search for.
  21011. * @param {number} [fromIndex=array.length-1] The index to search from.
  21012. * @returns {number} Returns the index of the matched value, else `-1`.
  21013. * @example
  21014. *
  21015. * _.lastIndexOf([1, 2, 1, 2], 2);
  21016. * // => 3
  21017. *
  21018. * // Search from the `fromIndex`.
  21019. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  21020. * // => 1
  21021. */
  21022. function lastIndexOf(array, value, fromIndex) {
  21023. var length = array == null ? 0 : array.length;
  21024. if (!length) {
  21025. return -1;
  21026. }
  21027. var index = length;
  21028. if (fromIndex !== undefined) {
  21029. index = toInteger(fromIndex);
  21030. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  21031. }
  21032. return value === value
  21033. ? strictLastIndexOf(array, value, index)
  21034. : baseFindIndex(array, baseIsNaN, index, true);
  21035. }
  21036. /**
  21037. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  21038. * element from the end is returned.
  21039. *
  21040. * @static
  21041. * @memberOf _
  21042. * @since 4.11.0
  21043. * @category Array
  21044. * @param {Array} array The array to query.
  21045. * @param {number} [n=0] The index of the element to return.
  21046. * @returns {*} Returns the nth element of `array`.
  21047. * @example
  21048. *
  21049. * var array = ['a', 'b', 'c', 'd'];
  21050. *
  21051. * _.nth(array, 1);
  21052. * // => 'b'
  21053. *
  21054. * _.nth(array, -2);
  21055. * // => 'c';
  21056. */
  21057. function nth(array, n) {
  21058. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  21059. }
  21060. /**
  21061. * Removes all given values from `array` using
  21062. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21063. * for equality comparisons.
  21064. *
  21065. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  21066. * to remove elements from an array by predicate.
  21067. *
  21068. * @static
  21069. * @memberOf _
  21070. * @since 2.0.0
  21071. * @category Array
  21072. * @param {Array} array The array to modify.
  21073. * @param {...*} [values] The values to remove.
  21074. * @returns {Array} Returns `array`.
  21075. * @example
  21076. *
  21077. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  21078. *
  21079. * _.pull(array, 'a', 'c');
  21080. * console.log(array);
  21081. * // => ['b', 'b']
  21082. */
  21083. var pull = baseRest(pullAll);
  21084. /**
  21085. * This method is like `_.pull` except that it accepts an array of values to remove.
  21086. *
  21087. * **Note:** Unlike `_.difference`, this method mutates `array`.
  21088. *
  21089. * @static
  21090. * @memberOf _
  21091. * @since 4.0.0
  21092. * @category Array
  21093. * @param {Array} array The array to modify.
  21094. * @param {Array} values The values to remove.
  21095. * @returns {Array} Returns `array`.
  21096. * @example
  21097. *
  21098. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  21099. *
  21100. * _.pullAll(array, ['a', 'c']);
  21101. * console.log(array);
  21102. * // => ['b', 'b']
  21103. */
  21104. function pullAll(array, values) {
  21105. return (array && array.length && values && values.length)
  21106. ? basePullAll(array, values)
  21107. : array;
  21108. }
  21109. /**
  21110. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  21111. * invoked for each element of `array` and `values` to generate the criterion
  21112. * by which they're compared. The iteratee is invoked with one argument: (value).
  21113. *
  21114. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  21115. *
  21116. * @static
  21117. * @memberOf _
  21118. * @since 4.0.0
  21119. * @category Array
  21120. * @param {Array} array The array to modify.
  21121. * @param {Array} values The values to remove.
  21122. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21123. * @returns {Array} Returns `array`.
  21124. * @example
  21125. *
  21126. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  21127. *
  21128. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  21129. * console.log(array);
  21130. * // => [{ 'x': 2 }]
  21131. */
  21132. function pullAllBy(array, values, iteratee) {
  21133. return (array && array.length && values && values.length)
  21134. ? basePullAll(array, values, getIteratee(iteratee, 2))
  21135. : array;
  21136. }
  21137. /**
  21138. * This method is like `_.pullAll` except that it accepts `comparator` which
  21139. * is invoked to compare elements of `array` to `values`. The comparator is
  21140. * invoked with two arguments: (arrVal, othVal).
  21141. *
  21142. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  21143. *
  21144. * @static
  21145. * @memberOf _
  21146. * @since 4.6.0
  21147. * @category Array
  21148. * @param {Array} array The array to modify.
  21149. * @param {Array} values The values to remove.
  21150. * @param {Function} [comparator] The comparator invoked per element.
  21151. * @returns {Array} Returns `array`.
  21152. * @example
  21153. *
  21154. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  21155. *
  21156. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  21157. * console.log(array);
  21158. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  21159. */
  21160. function pullAllWith(array, values, comparator) {
  21161. return (array && array.length && values && values.length)
  21162. ? basePullAll(array, values, undefined, comparator)
  21163. : array;
  21164. }
  21165. /**
  21166. * Removes elements from `array` corresponding to `indexes` and returns an
  21167. * array of removed elements.
  21168. *
  21169. * **Note:** Unlike `_.at`, this method mutates `array`.
  21170. *
  21171. * @static
  21172. * @memberOf _
  21173. * @since 3.0.0
  21174. * @category Array
  21175. * @param {Array} array The array to modify.
  21176. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  21177. * @returns {Array} Returns the new array of removed elements.
  21178. * @example
  21179. *
  21180. * var array = ['a', 'b', 'c', 'd'];
  21181. * var pulled = _.pullAt(array, [1, 3]);
  21182. *
  21183. * console.log(array);
  21184. * // => ['a', 'c']
  21185. *
  21186. * console.log(pulled);
  21187. * // => ['b', 'd']
  21188. */
  21189. var pullAt = flatRest(function(array, indexes) {
  21190. var length = array == null ? 0 : array.length,
  21191. result = baseAt(array, indexes);
  21192. basePullAt(array, arrayMap(indexes, function(index) {
  21193. return isIndex(index, length) ? +index : index;
  21194. }).sort(compareAscending));
  21195. return result;
  21196. });
  21197. /**
  21198. * Removes all elements from `array` that `predicate` returns truthy for
  21199. * and returns an array of the removed elements. The predicate is invoked
  21200. * with three arguments: (value, index, array).
  21201. *
  21202. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  21203. * to pull elements from an array by value.
  21204. *
  21205. * @static
  21206. * @memberOf _
  21207. * @since 2.0.0
  21208. * @category Array
  21209. * @param {Array} array The array to modify.
  21210. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21211. * @returns {Array} Returns the new array of removed elements.
  21212. * @example
  21213. *
  21214. * var array = [1, 2, 3, 4];
  21215. * var evens = _.remove(array, function(n) {
  21216. * return n % 2 == 0;
  21217. * });
  21218. *
  21219. * console.log(array);
  21220. * // => [1, 3]
  21221. *
  21222. * console.log(evens);
  21223. * // => [2, 4]
  21224. */
  21225. function remove(array, predicate) {
  21226. var result = [];
  21227. if (!(array && array.length)) {
  21228. return result;
  21229. }
  21230. var index = -1,
  21231. indexes = [],
  21232. length = array.length;
  21233. predicate = getIteratee(predicate, 3);
  21234. while (++index < length) {
  21235. var value = array[index];
  21236. if (predicate(value, index, array)) {
  21237. result.push(value);
  21238. indexes.push(index);
  21239. }
  21240. }
  21241. basePullAt(array, indexes);
  21242. return result;
  21243. }
  21244. /**
  21245. * Reverses `array` so that the first element becomes the last, the second
  21246. * element becomes the second to last, and so on.
  21247. *
  21248. * **Note:** This method mutates `array` and is based on
  21249. * [`Array#reverse`](https://mdn.io/Array/reverse).
  21250. *
  21251. * @static
  21252. * @memberOf _
  21253. * @since 4.0.0
  21254. * @category Array
  21255. * @param {Array} array The array to modify.
  21256. * @returns {Array} Returns `array`.
  21257. * @example
  21258. *
  21259. * var array = [1, 2, 3];
  21260. *
  21261. * _.reverse(array);
  21262. * // => [3, 2, 1]
  21263. *
  21264. * console.log(array);
  21265. * // => [3, 2, 1]
  21266. */
  21267. function reverse(array) {
  21268. return array == null ? array : nativeReverse.call(array);
  21269. }
  21270. /**
  21271. * Creates a slice of `array` from `start` up to, but not including, `end`.
  21272. *
  21273. * **Note:** This method is used instead of
  21274. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  21275. * returned.
  21276. *
  21277. * @static
  21278. * @memberOf _
  21279. * @since 3.0.0
  21280. * @category Array
  21281. * @param {Array} array The array to slice.
  21282. * @param {number} [start=0] The start position.
  21283. * @param {number} [end=array.length] The end position.
  21284. * @returns {Array} Returns the slice of `array`.
  21285. */
  21286. function slice(array, start, end) {
  21287. var length = array == null ? 0 : array.length;
  21288. if (!length) {
  21289. return [];
  21290. }
  21291. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  21292. start = 0;
  21293. end = length;
  21294. }
  21295. else {
  21296. start = start == null ? 0 : toInteger(start);
  21297. end = end === undefined ? length : toInteger(end);
  21298. }
  21299. return baseSlice(array, start, end);
  21300. }
  21301. /**
  21302. * Uses a binary search to determine the lowest index at which `value`
  21303. * should be inserted into `array` in order to maintain its sort order.
  21304. *
  21305. * @static
  21306. * @memberOf _
  21307. * @since 0.1.0
  21308. * @category Array
  21309. * @param {Array} array The sorted array to inspect.
  21310. * @param {*} value The value to evaluate.
  21311. * @returns {number} Returns the index at which `value` should be inserted
  21312. * into `array`.
  21313. * @example
  21314. *
  21315. * _.sortedIndex([30, 50], 40);
  21316. * // => 1
  21317. */
  21318. function sortedIndex(array, value) {
  21319. return baseSortedIndex(array, value);
  21320. }
  21321. /**
  21322. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  21323. * which is invoked for `value` and each element of `array` to compute their
  21324. * sort ranking. The iteratee is invoked with one argument: (value).
  21325. *
  21326. * @static
  21327. * @memberOf _
  21328. * @since 4.0.0
  21329. * @category Array
  21330. * @param {Array} array The sorted array to inspect.
  21331. * @param {*} value The value to evaluate.
  21332. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21333. * @returns {number} Returns the index at which `value` should be inserted
  21334. * into `array`.
  21335. * @example
  21336. *
  21337. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21338. *
  21339. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21340. * // => 0
  21341. *
  21342. * // The `_.property` iteratee shorthand.
  21343. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  21344. * // => 0
  21345. */
  21346. function sortedIndexBy(array, value, iteratee) {
  21347. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  21348. }
  21349. /**
  21350. * This method is like `_.indexOf` except that it performs a binary
  21351. * search on a sorted `array`.
  21352. *
  21353. * @static
  21354. * @memberOf _
  21355. * @since 4.0.0
  21356. * @category Array
  21357. * @param {Array} array The array to inspect.
  21358. * @param {*} value The value to search for.
  21359. * @returns {number} Returns the index of the matched value, else `-1`.
  21360. * @example
  21361. *
  21362. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  21363. * // => 1
  21364. */
  21365. function sortedIndexOf(array, value) {
  21366. var length = array == null ? 0 : array.length;
  21367. if (length) {
  21368. var index = baseSortedIndex(array, value);
  21369. if (index < length && eq(array[index], value)) {
  21370. return index;
  21371. }
  21372. }
  21373. return -1;
  21374. }
  21375. /**
  21376. * This method is like `_.sortedIndex` except that it returns the highest
  21377. * index at which `value` should be inserted into `array` in order to
  21378. * maintain its sort order.
  21379. *
  21380. * @static
  21381. * @memberOf _
  21382. * @since 3.0.0
  21383. * @category Array
  21384. * @param {Array} array The sorted array to inspect.
  21385. * @param {*} value The value to evaluate.
  21386. * @returns {number} Returns the index at which `value` should be inserted
  21387. * into `array`.
  21388. * @example
  21389. *
  21390. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  21391. * // => 4
  21392. */
  21393. function sortedLastIndex(array, value) {
  21394. return baseSortedIndex(array, value, true);
  21395. }
  21396. /**
  21397. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  21398. * which is invoked for `value` and each element of `array` to compute their
  21399. * sort ranking. The iteratee is invoked with one argument: (value).
  21400. *
  21401. * @static
  21402. * @memberOf _
  21403. * @since 4.0.0
  21404. * @category Array
  21405. * @param {Array} array The sorted array to inspect.
  21406. * @param {*} value The value to evaluate.
  21407. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21408. * @returns {number} Returns the index at which `value` should be inserted
  21409. * into `array`.
  21410. * @example
  21411. *
  21412. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21413. *
  21414. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21415. * // => 1
  21416. *
  21417. * // The `_.property` iteratee shorthand.
  21418. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  21419. * // => 1
  21420. */
  21421. function sortedLastIndexBy(array, value, iteratee) {
  21422. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  21423. }
  21424. /**
  21425. * This method is like `_.lastIndexOf` except that it performs a binary
  21426. * search on a sorted `array`.
  21427. *
  21428. * @static
  21429. * @memberOf _
  21430. * @since 4.0.0
  21431. * @category Array
  21432. * @param {Array} array The array to inspect.
  21433. * @param {*} value The value to search for.
  21434. * @returns {number} Returns the index of the matched value, else `-1`.
  21435. * @example
  21436. *
  21437. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  21438. * // => 3
  21439. */
  21440. function sortedLastIndexOf(array, value) {
  21441. var length = array == null ? 0 : array.length;
  21442. if (length) {
  21443. var index = baseSortedIndex(array, value, true) - 1;
  21444. if (eq(array[index], value)) {
  21445. return index;
  21446. }
  21447. }
  21448. return -1;
  21449. }
  21450. /**
  21451. * This method is like `_.uniq` except that it's designed and optimized
  21452. * for sorted arrays.
  21453. *
  21454. * @static
  21455. * @memberOf _
  21456. * @since 4.0.0
  21457. * @category Array
  21458. * @param {Array} array The array to inspect.
  21459. * @returns {Array} Returns the new duplicate free array.
  21460. * @example
  21461. *
  21462. * _.sortedUniq([1, 1, 2]);
  21463. * // => [1, 2]
  21464. */
  21465. function sortedUniq(array) {
  21466. return (array && array.length)
  21467. ? baseSortedUniq(array)
  21468. : [];
  21469. }
  21470. /**
  21471. * This method is like `_.uniqBy` except that it's designed and optimized
  21472. * for sorted arrays.
  21473. *
  21474. * @static
  21475. * @memberOf _
  21476. * @since 4.0.0
  21477. * @category Array
  21478. * @param {Array} array The array to inspect.
  21479. * @param {Function} [iteratee] The iteratee invoked per element.
  21480. * @returns {Array} Returns the new duplicate free array.
  21481. * @example
  21482. *
  21483. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  21484. * // => [1.1, 2.3]
  21485. */
  21486. function sortedUniqBy(array, iteratee) {
  21487. return (array && array.length)
  21488. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  21489. : [];
  21490. }
  21491. /**
  21492. * Gets all but the first element of `array`.
  21493. *
  21494. * @static
  21495. * @memberOf _
  21496. * @since 4.0.0
  21497. * @category Array
  21498. * @param {Array} array The array to query.
  21499. * @returns {Array} Returns the slice of `array`.
  21500. * @example
  21501. *
  21502. * _.tail([1, 2, 3]);
  21503. * // => [2, 3]
  21504. */
  21505. function tail(array) {
  21506. var length = array == null ? 0 : array.length;
  21507. return length ? baseSlice(array, 1, length) : [];
  21508. }
  21509. /**
  21510. * Creates a slice of `array` with `n` elements taken from the beginning.
  21511. *
  21512. * @static
  21513. * @memberOf _
  21514. * @since 0.1.0
  21515. * @category Array
  21516. * @param {Array} array The array to query.
  21517. * @param {number} [n=1] The number of elements to take.
  21518. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21519. * @returns {Array} Returns the slice of `array`.
  21520. * @example
  21521. *
  21522. * _.take([1, 2, 3]);
  21523. * // => [1]
  21524. *
  21525. * _.take([1, 2, 3], 2);
  21526. * // => [1, 2]
  21527. *
  21528. * _.take([1, 2, 3], 5);
  21529. * // => [1, 2, 3]
  21530. *
  21531. * _.take([1, 2, 3], 0);
  21532. * // => []
  21533. */
  21534. function take(array, n, guard) {
  21535. if (!(array && array.length)) {
  21536. return [];
  21537. }
  21538. n = (guard || n === undefined) ? 1 : toInteger(n);
  21539. return baseSlice(array, 0, n < 0 ? 0 : n);
  21540. }
  21541. /**
  21542. * Creates a slice of `array` with `n` elements taken from the end.
  21543. *
  21544. * @static
  21545. * @memberOf _
  21546. * @since 3.0.0
  21547. * @category Array
  21548. * @param {Array} array The array to query.
  21549. * @param {number} [n=1] The number of elements to take.
  21550. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21551. * @returns {Array} Returns the slice of `array`.
  21552. * @example
  21553. *
  21554. * _.takeRight([1, 2, 3]);
  21555. * // => [3]
  21556. *
  21557. * _.takeRight([1, 2, 3], 2);
  21558. * // => [2, 3]
  21559. *
  21560. * _.takeRight([1, 2, 3], 5);
  21561. * // => [1, 2, 3]
  21562. *
  21563. * _.takeRight([1, 2, 3], 0);
  21564. * // => []
  21565. */
  21566. function takeRight(array, n, guard) {
  21567. var length = array == null ? 0 : array.length;
  21568. if (!length) {
  21569. return [];
  21570. }
  21571. n = (guard || n === undefined) ? 1 : toInteger(n);
  21572. n = length - n;
  21573. return baseSlice(array, n < 0 ? 0 : n, length);
  21574. }
  21575. /**
  21576. * Creates a slice of `array` with elements taken from the end. Elements are
  21577. * taken until `predicate` returns falsey. The predicate is invoked with
  21578. * three arguments: (value, index, array).
  21579. *
  21580. * @static
  21581. * @memberOf _
  21582. * @since 3.0.0
  21583. * @category Array
  21584. * @param {Array} array The array to query.
  21585. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21586. * @returns {Array} Returns the slice of `array`.
  21587. * @example
  21588. *
  21589. * var users = [
  21590. * { 'user': 'barney', 'active': true },
  21591. * { 'user': 'fred', 'active': false },
  21592. * { 'user': 'pebbles', 'active': false }
  21593. * ];
  21594. *
  21595. * _.takeRightWhile(users, function(o) { return !o.active; });
  21596. * // => objects for ['fred', 'pebbles']
  21597. *
  21598. * // The `_.matches` iteratee shorthand.
  21599. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  21600. * // => objects for ['pebbles']
  21601. *
  21602. * // The `_.matchesProperty` iteratee shorthand.
  21603. * _.takeRightWhile(users, ['active', false]);
  21604. * // => objects for ['fred', 'pebbles']
  21605. *
  21606. * // The `_.property` iteratee shorthand.
  21607. * _.takeRightWhile(users, 'active');
  21608. * // => []
  21609. */
  21610. function takeRightWhile(array, predicate) {
  21611. return (array && array.length)
  21612. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  21613. : [];
  21614. }
  21615. /**
  21616. * Creates a slice of `array` with elements taken from the beginning. Elements
  21617. * are taken until `predicate` returns falsey. The predicate is invoked with
  21618. * three arguments: (value, index, array).
  21619. *
  21620. * @static
  21621. * @memberOf _
  21622. * @since 3.0.0
  21623. * @category Array
  21624. * @param {Array} array The array to query.
  21625. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21626. * @returns {Array} Returns the slice of `array`.
  21627. * @example
  21628. *
  21629. * var users = [
  21630. * { 'user': 'barney', 'active': false },
  21631. * { 'user': 'fred', 'active': false },
  21632. * { 'user': 'pebbles', 'active': true }
  21633. * ];
  21634. *
  21635. * _.takeWhile(users, function(o) { return !o.active; });
  21636. * // => objects for ['barney', 'fred']
  21637. *
  21638. * // The `_.matches` iteratee shorthand.
  21639. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  21640. * // => objects for ['barney']
  21641. *
  21642. * // The `_.matchesProperty` iteratee shorthand.
  21643. * _.takeWhile(users, ['active', false]);
  21644. * // => objects for ['barney', 'fred']
  21645. *
  21646. * // The `_.property` iteratee shorthand.
  21647. * _.takeWhile(users, 'active');
  21648. * // => []
  21649. */
  21650. function takeWhile(array, predicate) {
  21651. return (array && array.length)
  21652. ? baseWhile(array, getIteratee(predicate, 3))
  21653. : [];
  21654. }
  21655. /**
  21656. * Creates an array of unique values, in order, from all given arrays using
  21657. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21658. * for equality comparisons.
  21659. *
  21660. * @static
  21661. * @memberOf _
  21662. * @since 0.1.0
  21663. * @category Array
  21664. * @param {...Array} [arrays] The arrays to inspect.
  21665. * @returns {Array} Returns the new array of combined values.
  21666. * @example
  21667. *
  21668. * _.union([2], [1, 2]);
  21669. * // => [2, 1]
  21670. */
  21671. var union = baseRest(function(arrays) {
  21672. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  21673. });
  21674. /**
  21675. * This method is like `_.union` except that it accepts `iteratee` which is
  21676. * invoked for each element of each `arrays` to generate the criterion by
  21677. * which uniqueness is computed. Result values are chosen from the first
  21678. * array in which the value occurs. The iteratee is invoked with one argument:
  21679. * (value).
  21680. *
  21681. * @static
  21682. * @memberOf _
  21683. * @since 4.0.0
  21684. * @category Array
  21685. * @param {...Array} [arrays] The arrays to inspect.
  21686. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21687. * @returns {Array} Returns the new array of combined values.
  21688. * @example
  21689. *
  21690. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  21691. * // => [2.1, 1.2]
  21692. *
  21693. * // The `_.property` iteratee shorthand.
  21694. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21695. * // => [{ 'x': 1 }, { 'x': 2 }]
  21696. */
  21697. var unionBy = baseRest(function(arrays) {
  21698. var iteratee = last(arrays);
  21699. if (isArrayLikeObject(iteratee)) {
  21700. iteratee = undefined;
  21701. }
  21702. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  21703. });
  21704. /**
  21705. * This method is like `_.union` except that it accepts `comparator` which
  21706. * is invoked to compare elements of `arrays`. Result values are chosen from
  21707. * the first array in which the value occurs. The comparator is invoked
  21708. * with two arguments: (arrVal, othVal).
  21709. *
  21710. * @static
  21711. * @memberOf _
  21712. * @since 4.0.0
  21713. * @category Array
  21714. * @param {...Array} [arrays] The arrays to inspect.
  21715. * @param {Function} [comparator] The comparator invoked per element.
  21716. * @returns {Array} Returns the new array of combined values.
  21717. * @example
  21718. *
  21719. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21720. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21721. *
  21722. * _.unionWith(objects, others, _.isEqual);
  21723. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21724. */
  21725. var unionWith = baseRest(function(arrays) {
  21726. var comparator = last(arrays);
  21727. comparator = typeof comparator == 'function' ? comparator : undefined;
  21728. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  21729. });
  21730. /**
  21731. * Creates a duplicate-free version of an array, using
  21732. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21733. * for equality comparisons, in which only the first occurrence of each element
  21734. * is kept. The order of result values is determined by the order they occur
  21735. * in the array.
  21736. *
  21737. * @static
  21738. * @memberOf _
  21739. * @since 0.1.0
  21740. * @category Array
  21741. * @param {Array} array The array to inspect.
  21742. * @returns {Array} Returns the new duplicate free array.
  21743. * @example
  21744. *
  21745. * _.uniq([2, 1, 2]);
  21746. * // => [2, 1]
  21747. */
  21748. function uniq(array) {
  21749. return (array && array.length) ? baseUniq(array) : [];
  21750. }
  21751. /**
  21752. * This method is like `_.uniq` except that it accepts `iteratee` which is
  21753. * invoked for each element in `array` to generate the criterion by which
  21754. * uniqueness is computed. The order of result values is determined by the
  21755. * order they occur in the array. The iteratee is invoked with one argument:
  21756. * (value).
  21757. *
  21758. * @static
  21759. * @memberOf _
  21760. * @since 4.0.0
  21761. * @category Array
  21762. * @param {Array} array The array to inspect.
  21763. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21764. * @returns {Array} Returns the new duplicate free array.
  21765. * @example
  21766. *
  21767. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  21768. * // => [2.1, 1.2]
  21769. *
  21770. * // The `_.property` iteratee shorthand.
  21771. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  21772. * // => [{ 'x': 1 }, { 'x': 2 }]
  21773. */
  21774. function uniqBy(array, iteratee) {
  21775. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  21776. }
  21777. /**
  21778. * This method is like `_.uniq` except that it accepts `comparator` which
  21779. * is invoked to compare elements of `array`. The order of result values is
  21780. * determined by the order they occur in the array.The comparator is invoked
  21781. * with two arguments: (arrVal, othVal).
  21782. *
  21783. * @static
  21784. * @memberOf _
  21785. * @since 4.0.0
  21786. * @category Array
  21787. * @param {Array} array The array to inspect.
  21788. * @param {Function} [comparator] The comparator invoked per element.
  21789. * @returns {Array} Returns the new duplicate free array.
  21790. * @example
  21791. *
  21792. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21793. *
  21794. * _.uniqWith(objects, _.isEqual);
  21795. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  21796. */
  21797. function uniqWith(array, comparator) {
  21798. comparator = typeof comparator == 'function' ? comparator : undefined;
  21799. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  21800. }
  21801. /**
  21802. * This method is like `_.zip` except that it accepts an array of grouped
  21803. * elements and creates an array regrouping the elements to their pre-zip
  21804. * configuration.
  21805. *
  21806. * @static
  21807. * @memberOf _
  21808. * @since 1.2.0
  21809. * @category Array
  21810. * @param {Array} array The array of grouped elements to process.
  21811. * @returns {Array} Returns the new array of regrouped elements.
  21812. * @example
  21813. *
  21814. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  21815. * // => [['a', 1, true], ['b', 2, false]]
  21816. *
  21817. * _.unzip(zipped);
  21818. * // => [['a', 'b'], [1, 2], [true, false]]
  21819. */
  21820. function unzip(array) {
  21821. if (!(array && array.length)) {
  21822. return [];
  21823. }
  21824. var length = 0;
  21825. array = arrayFilter(array, function(group) {
  21826. if (isArrayLikeObject(group)) {
  21827. length = nativeMax(group.length, length);
  21828. return true;
  21829. }
  21830. });
  21831. return baseTimes(length, function(index) {
  21832. return arrayMap(array, baseProperty(index));
  21833. });
  21834. }
  21835. /**
  21836. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  21837. * how regrouped values should be combined. The iteratee is invoked with the
  21838. * elements of each group: (...group).
  21839. *
  21840. * @static
  21841. * @memberOf _
  21842. * @since 3.8.0
  21843. * @category Array
  21844. * @param {Array} array The array of grouped elements to process.
  21845. * @param {Function} [iteratee=_.identity] The function to combine
  21846. * regrouped values.
  21847. * @returns {Array} Returns the new array of regrouped elements.
  21848. * @example
  21849. *
  21850. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  21851. * // => [[1, 10, 100], [2, 20, 200]]
  21852. *
  21853. * _.unzipWith(zipped, _.add);
  21854. * // => [3, 30, 300]
  21855. */
  21856. function unzipWith(array, iteratee) {
  21857. if (!(array && array.length)) {
  21858. return [];
  21859. }
  21860. var result = unzip(array);
  21861. if (iteratee == null) {
  21862. return result;
  21863. }
  21864. return arrayMap(result, function(group) {
  21865. return apply(iteratee, undefined, group);
  21866. });
  21867. }
  21868. /**
  21869. * Creates an array excluding all given values using
  21870. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21871. * for equality comparisons.
  21872. *
  21873. * **Note:** Unlike `_.pull`, this method returns a new array.
  21874. *
  21875. * @static
  21876. * @memberOf _
  21877. * @since 0.1.0
  21878. * @category Array
  21879. * @param {Array} array The array to inspect.
  21880. * @param {...*} [values] The values to exclude.
  21881. * @returns {Array} Returns the new array of filtered values.
  21882. * @see _.difference, _.xor
  21883. * @example
  21884. *
  21885. * _.without([2, 1, 2, 3], 1, 2);
  21886. * // => [3]
  21887. */
  21888. var without = baseRest(function(array, values) {
  21889. return isArrayLikeObject(array)
  21890. ? baseDifference(array, values)
  21891. : [];
  21892. });
  21893. /**
  21894. * Creates an array of unique values that is the
  21895. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  21896. * of the given arrays. The order of result values is determined by the order
  21897. * they occur in the arrays.
  21898. *
  21899. * @static
  21900. * @memberOf _
  21901. * @since 2.4.0
  21902. * @category Array
  21903. * @param {...Array} [arrays] The arrays to inspect.
  21904. * @returns {Array} Returns the new array of filtered values.
  21905. * @see _.difference, _.without
  21906. * @example
  21907. *
  21908. * _.xor([2, 1], [2, 3]);
  21909. * // => [1, 3]
  21910. */
  21911. var xor = baseRest(function(arrays) {
  21912. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  21913. });
  21914. /**
  21915. * This method is like `_.xor` except that it accepts `iteratee` which is
  21916. * invoked for each element of each `arrays` to generate the criterion by
  21917. * which by which they're compared. The order of result values is determined
  21918. * by the order they occur in the arrays. The iteratee is invoked with one
  21919. * argument: (value).
  21920. *
  21921. * @static
  21922. * @memberOf _
  21923. * @since 4.0.0
  21924. * @category Array
  21925. * @param {...Array} [arrays] The arrays to inspect.
  21926. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21927. * @returns {Array} Returns the new array of filtered values.
  21928. * @example
  21929. *
  21930. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  21931. * // => [1.2, 3.4]
  21932. *
  21933. * // The `_.property` iteratee shorthand.
  21934. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21935. * // => [{ 'x': 2 }]
  21936. */
  21937. var xorBy = baseRest(function(arrays) {
  21938. var iteratee = last(arrays);
  21939. if (isArrayLikeObject(iteratee)) {
  21940. iteratee = undefined;
  21941. }
  21942. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  21943. });
  21944. /**
  21945. * This method is like `_.xor` except that it accepts `comparator` which is
  21946. * invoked to compare elements of `arrays`. The order of result values is
  21947. * determined by the order they occur in the arrays. The comparator is invoked
  21948. * with two arguments: (arrVal, othVal).
  21949. *
  21950. * @static
  21951. * @memberOf _
  21952. * @since 4.0.0
  21953. * @category Array
  21954. * @param {...Array} [arrays] The arrays to inspect.
  21955. * @param {Function} [comparator] The comparator invoked per element.
  21956. * @returns {Array} Returns the new array of filtered values.
  21957. * @example
  21958. *
  21959. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21960. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21961. *
  21962. * _.xorWith(objects, others, _.isEqual);
  21963. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21964. */
  21965. var xorWith = baseRest(function(arrays) {
  21966. var comparator = last(arrays);
  21967. comparator = typeof comparator == 'function' ? comparator : undefined;
  21968. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  21969. });
  21970. /**
  21971. * Creates an array of grouped elements, the first of which contains the
  21972. * first elements of the given arrays, the second of which contains the
  21973. * second elements of the given arrays, and so on.
  21974. *
  21975. * @static
  21976. * @memberOf _
  21977. * @since 0.1.0
  21978. * @category Array
  21979. * @param {...Array} [arrays] The arrays to process.
  21980. * @returns {Array} Returns the new array of grouped elements.
  21981. * @example
  21982. *
  21983. * _.zip(['a', 'b'], [1, 2], [true, false]);
  21984. * // => [['a', 1, true], ['b', 2, false]]
  21985. */
  21986. var zip = baseRest(unzip);
  21987. /**
  21988. * This method is like `_.fromPairs` except that it accepts two arrays,
  21989. * one of property identifiers and one of corresponding values.
  21990. *
  21991. * @static
  21992. * @memberOf _
  21993. * @since 0.4.0
  21994. * @category Array
  21995. * @param {Array} [props=[]] The property identifiers.
  21996. * @param {Array} [values=[]] The property values.
  21997. * @returns {Object} Returns the new object.
  21998. * @example
  21999. *
  22000. * _.zipObject(['a', 'b'], [1, 2]);
  22001. * // => { 'a': 1, 'b': 2 }
  22002. */
  22003. function zipObject(props, values) {
  22004. return baseZipObject(props || [], values || [], assignValue);
  22005. }
  22006. /**
  22007. * This method is like `_.zipObject` except that it supports property paths.
  22008. *
  22009. * @static
  22010. * @memberOf _
  22011. * @since 4.1.0
  22012. * @category Array
  22013. * @param {Array} [props=[]] The property identifiers.
  22014. * @param {Array} [values=[]] The property values.
  22015. * @returns {Object} Returns the new object.
  22016. * @example
  22017. *
  22018. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  22019. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  22020. */
  22021. function zipObjectDeep(props, values) {
  22022. return baseZipObject(props || [], values || [], baseSet);
  22023. }
  22024. /**
  22025. * This method is like `_.zip` except that it accepts `iteratee` to specify
  22026. * how grouped values should be combined. The iteratee is invoked with the
  22027. * elements of each group: (...group).
  22028. *
  22029. * @static
  22030. * @memberOf _
  22031. * @since 3.8.0
  22032. * @category Array
  22033. * @param {...Array} [arrays] The arrays to process.
  22034. * @param {Function} [iteratee=_.identity] The function to combine
  22035. * grouped values.
  22036. * @returns {Array} Returns the new array of grouped elements.
  22037. * @example
  22038. *
  22039. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  22040. * return a + b + c;
  22041. * });
  22042. * // => [111, 222]
  22043. */
  22044. var zipWith = baseRest(function(arrays) {
  22045. var length = arrays.length,
  22046. iteratee = length > 1 ? arrays[length - 1] : undefined;
  22047. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  22048. return unzipWith(arrays, iteratee);
  22049. });
  22050. /*------------------------------------------------------------------------*/
  22051. /**
  22052. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  22053. * chain sequences enabled. The result of such sequences must be unwrapped
  22054. * with `_#value`.
  22055. *
  22056. * @static
  22057. * @memberOf _
  22058. * @since 1.3.0
  22059. * @category Seq
  22060. * @param {*} value The value to wrap.
  22061. * @returns {Object} Returns the new `lodash` wrapper instance.
  22062. * @example
  22063. *
  22064. * var users = [
  22065. * { 'user': 'barney', 'age': 36 },
  22066. * { 'user': 'fred', 'age': 40 },
  22067. * { 'user': 'pebbles', 'age': 1 }
  22068. * ];
  22069. *
  22070. * var youngest = _
  22071. * .chain(users)
  22072. * .sortBy('age')
  22073. * .map(function(o) {
  22074. * return o.user + ' is ' + o.age;
  22075. * })
  22076. * .head()
  22077. * .value();
  22078. * // => 'pebbles is 1'
  22079. */
  22080. function chain(value) {
  22081. var result = lodash(value);
  22082. result.__chain__ = true;
  22083. return result;
  22084. }
  22085. /**
  22086. * This method invokes `interceptor` and returns `value`. The interceptor
  22087. * is invoked with one argument; (value). The purpose of this method is to
  22088. * "tap into" a method chain sequence in order to modify intermediate results.
  22089. *
  22090. * @static
  22091. * @memberOf _
  22092. * @since 0.1.0
  22093. * @category Seq
  22094. * @param {*} value The value to provide to `interceptor`.
  22095. * @param {Function} interceptor The function to invoke.
  22096. * @returns {*} Returns `value`.
  22097. * @example
  22098. *
  22099. * _([1, 2, 3])
  22100. * .tap(function(array) {
  22101. * // Mutate input array.
  22102. * array.pop();
  22103. * })
  22104. * .reverse()
  22105. * .value();
  22106. * // => [2, 1]
  22107. */
  22108. function tap(value, interceptor) {
  22109. interceptor(value);
  22110. return value;
  22111. }
  22112. /**
  22113. * This method is like `_.tap` except that it returns the result of `interceptor`.
  22114. * The purpose of this method is to "pass thru" values replacing intermediate
  22115. * results in a method chain sequence.
  22116. *
  22117. * @static
  22118. * @memberOf _
  22119. * @since 3.0.0
  22120. * @category Seq
  22121. * @param {*} value The value to provide to `interceptor`.
  22122. * @param {Function} interceptor The function to invoke.
  22123. * @returns {*} Returns the result of `interceptor`.
  22124. * @example
  22125. *
  22126. * _(' abc ')
  22127. * .chain()
  22128. * .trim()
  22129. * .thru(function(value) {
  22130. * return [value];
  22131. * })
  22132. * .value();
  22133. * // => ['abc']
  22134. */
  22135. function thru(value, interceptor) {
  22136. return interceptor(value);
  22137. }
  22138. /**
  22139. * This method is the wrapper version of `_.at`.
  22140. *
  22141. * @name at
  22142. * @memberOf _
  22143. * @since 1.0.0
  22144. * @category Seq
  22145. * @param {...(string|string[])} [paths] The property paths to pick.
  22146. * @returns {Object} Returns the new `lodash` wrapper instance.
  22147. * @example
  22148. *
  22149. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  22150. *
  22151. * _(object).at(['a[0].b.c', 'a[1]']).value();
  22152. * // => [3, 4]
  22153. */
  22154. var wrapperAt = flatRest(function(paths) {
  22155. var length = paths.length,
  22156. start = length ? paths[0] : 0,
  22157. value = this.__wrapped__,
  22158. interceptor = function(object) { return baseAt(object, paths); };
  22159. if (length > 1 || this.__actions__.length ||
  22160. !(value instanceof LazyWrapper) || !isIndex(start)) {
  22161. return this.thru(interceptor);
  22162. }
  22163. value = value.slice(start, +start + (length ? 1 : 0));
  22164. value.__actions__.push({
  22165. 'func': thru,
  22166. 'args': [interceptor],
  22167. 'thisArg': undefined
  22168. });
  22169. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  22170. if (length && !array.length) {
  22171. array.push(undefined);
  22172. }
  22173. return array;
  22174. });
  22175. });
  22176. /**
  22177. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  22178. *
  22179. * @name chain
  22180. * @memberOf _
  22181. * @since 0.1.0
  22182. * @category Seq
  22183. * @returns {Object} Returns the new `lodash` wrapper instance.
  22184. * @example
  22185. *
  22186. * var users = [
  22187. * { 'user': 'barney', 'age': 36 },
  22188. * { 'user': 'fred', 'age': 40 }
  22189. * ];
  22190. *
  22191. * // A sequence without explicit chaining.
  22192. * _(users).head();
  22193. * // => { 'user': 'barney', 'age': 36 }
  22194. *
  22195. * // A sequence with explicit chaining.
  22196. * _(users)
  22197. * .chain()
  22198. * .head()
  22199. * .pick('user')
  22200. * .value();
  22201. * // => { 'user': 'barney' }
  22202. */
  22203. function wrapperChain() {
  22204. return chain(this);
  22205. }
  22206. /**
  22207. * Executes the chain sequence and returns the wrapped result.
  22208. *
  22209. * @name commit
  22210. * @memberOf _
  22211. * @since 3.2.0
  22212. * @category Seq
  22213. * @returns {Object} Returns the new `lodash` wrapper instance.
  22214. * @example
  22215. *
  22216. * var array = [1, 2];
  22217. * var wrapped = _(array).push(3);
  22218. *
  22219. * console.log(array);
  22220. * // => [1, 2]
  22221. *
  22222. * wrapped = wrapped.commit();
  22223. * console.log(array);
  22224. * // => [1, 2, 3]
  22225. *
  22226. * wrapped.last();
  22227. * // => 3
  22228. *
  22229. * console.log(array);
  22230. * // => [1, 2, 3]
  22231. */
  22232. function wrapperCommit() {
  22233. return new LodashWrapper(this.value(), this.__chain__);
  22234. }
  22235. /**
  22236. * Gets the next value on a wrapped object following the
  22237. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  22238. *
  22239. * @name next
  22240. * @memberOf _
  22241. * @since 4.0.0
  22242. * @category Seq
  22243. * @returns {Object} Returns the next iterator value.
  22244. * @example
  22245. *
  22246. * var wrapped = _([1, 2]);
  22247. *
  22248. * wrapped.next();
  22249. * // => { 'done': false, 'value': 1 }
  22250. *
  22251. * wrapped.next();
  22252. * // => { 'done': false, 'value': 2 }
  22253. *
  22254. * wrapped.next();
  22255. * // => { 'done': true, 'value': undefined }
  22256. */
  22257. function wrapperNext() {
  22258. if (this.__values__ === undefined) {
  22259. this.__values__ = toArray(this.value());
  22260. }
  22261. var done = this.__index__ >= this.__values__.length,
  22262. value = done ? undefined : this.__values__[this.__index__++];
  22263. return { 'done': done, 'value': value };
  22264. }
  22265. /**
  22266. * Enables the wrapper to be iterable.
  22267. *
  22268. * @name Symbol.iterator
  22269. * @memberOf _
  22270. * @since 4.0.0
  22271. * @category Seq
  22272. * @returns {Object} Returns the wrapper object.
  22273. * @example
  22274. *
  22275. * var wrapped = _([1, 2]);
  22276. *
  22277. * wrapped[Symbol.iterator]() === wrapped;
  22278. * // => true
  22279. *
  22280. * Array.from(wrapped);
  22281. * // => [1, 2]
  22282. */
  22283. function wrapperToIterator() {
  22284. return this;
  22285. }
  22286. /**
  22287. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  22288. *
  22289. * @name plant
  22290. * @memberOf _
  22291. * @since 3.2.0
  22292. * @category Seq
  22293. * @param {*} value The value to plant.
  22294. * @returns {Object} Returns the new `lodash` wrapper instance.
  22295. * @example
  22296. *
  22297. * function square(n) {
  22298. * return n * n;
  22299. * }
  22300. *
  22301. * var wrapped = _([1, 2]).map(square);
  22302. * var other = wrapped.plant([3, 4]);
  22303. *
  22304. * other.value();
  22305. * // => [9, 16]
  22306. *
  22307. * wrapped.value();
  22308. * // => [1, 4]
  22309. */
  22310. function wrapperPlant(value) {
  22311. var result,
  22312. parent = this;
  22313. while (parent instanceof baseLodash) {
  22314. var clone = wrapperClone(parent);
  22315. clone.__index__ = 0;
  22316. clone.__values__ = undefined;
  22317. if (result) {
  22318. previous.__wrapped__ = clone;
  22319. } else {
  22320. result = clone;
  22321. }
  22322. var previous = clone;
  22323. parent = parent.__wrapped__;
  22324. }
  22325. previous.__wrapped__ = value;
  22326. return result;
  22327. }
  22328. /**
  22329. * This method is the wrapper version of `_.reverse`.
  22330. *
  22331. * **Note:** This method mutates the wrapped array.
  22332. *
  22333. * @name reverse
  22334. * @memberOf _
  22335. * @since 0.1.0
  22336. * @category Seq
  22337. * @returns {Object} Returns the new `lodash` wrapper instance.
  22338. * @example
  22339. *
  22340. * var array = [1, 2, 3];
  22341. *
  22342. * _(array).reverse().value()
  22343. * // => [3, 2, 1]
  22344. *
  22345. * console.log(array);
  22346. * // => [3, 2, 1]
  22347. */
  22348. function wrapperReverse() {
  22349. var value = this.__wrapped__;
  22350. if (value instanceof LazyWrapper) {
  22351. var wrapped = value;
  22352. if (this.__actions__.length) {
  22353. wrapped = new LazyWrapper(this);
  22354. }
  22355. wrapped = wrapped.reverse();
  22356. wrapped.__actions__.push({
  22357. 'func': thru,
  22358. 'args': [reverse],
  22359. 'thisArg': undefined
  22360. });
  22361. return new LodashWrapper(wrapped, this.__chain__);
  22362. }
  22363. return this.thru(reverse);
  22364. }
  22365. /**
  22366. * Executes the chain sequence to resolve the unwrapped value.
  22367. *
  22368. * @name value
  22369. * @memberOf _
  22370. * @since 0.1.0
  22371. * @alias toJSON, valueOf
  22372. * @category Seq
  22373. * @returns {*} Returns the resolved unwrapped value.
  22374. * @example
  22375. *
  22376. * _([1, 2, 3]).value();
  22377. * // => [1, 2, 3]
  22378. */
  22379. function wrapperValue() {
  22380. return baseWrapperValue(this.__wrapped__, this.__actions__);
  22381. }
  22382. /*------------------------------------------------------------------------*/
  22383. /**
  22384. * Creates an object composed of keys generated from the results of running
  22385. * each element of `collection` thru `iteratee`. The corresponding value of
  22386. * each key is the number of times the key was returned by `iteratee`. The
  22387. * iteratee is invoked with one argument: (value).
  22388. *
  22389. * @static
  22390. * @memberOf _
  22391. * @since 0.5.0
  22392. * @category Collection
  22393. * @param {Array|Object} collection The collection to iterate over.
  22394. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22395. * @returns {Object} Returns the composed aggregate object.
  22396. * @example
  22397. *
  22398. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  22399. * // => { '4': 1, '6': 2 }
  22400. *
  22401. * // The `_.property` iteratee shorthand.
  22402. * _.countBy(['one', 'two', 'three'], 'length');
  22403. * // => { '3': 2, '5': 1 }
  22404. */
  22405. var countBy = createAggregator(function(result, value, key) {
  22406. if (hasOwnProperty.call(result, key)) {
  22407. ++result[key];
  22408. } else {
  22409. baseAssignValue(result, key, 1);
  22410. }
  22411. });
  22412. /**
  22413. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  22414. * Iteration is stopped once `predicate` returns falsey. The predicate is
  22415. * invoked with three arguments: (value, index|key, collection).
  22416. *
  22417. * **Note:** This method returns `true` for
  22418. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  22419. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  22420. * elements of empty collections.
  22421. *
  22422. * @static
  22423. * @memberOf _
  22424. * @since 0.1.0
  22425. * @category Collection
  22426. * @param {Array|Object} collection The collection to iterate over.
  22427. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22428. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22429. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  22430. * else `false`.
  22431. * @example
  22432. *
  22433. * _.every([true, 1, null, 'yes'], Boolean);
  22434. * // => false
  22435. *
  22436. * var users = [
  22437. * { 'user': 'barney', 'age': 36, 'active': false },
  22438. * { 'user': 'fred', 'age': 40, 'active': false }
  22439. * ];
  22440. *
  22441. * // The `_.matches` iteratee shorthand.
  22442. * _.every(users, { 'user': 'barney', 'active': false });
  22443. * // => false
  22444. *
  22445. * // The `_.matchesProperty` iteratee shorthand.
  22446. * _.every(users, ['active', false]);
  22447. * // => true
  22448. *
  22449. * // The `_.property` iteratee shorthand.
  22450. * _.every(users, 'active');
  22451. * // => false
  22452. */
  22453. function every(collection, predicate, guard) {
  22454. var func = isArray(collection) ? arrayEvery : baseEvery;
  22455. if (guard && isIterateeCall(collection, predicate, guard)) {
  22456. predicate = undefined;
  22457. }
  22458. return func(collection, getIteratee(predicate, 3));
  22459. }
  22460. /**
  22461. * Iterates over elements of `collection`, returning an array of all elements
  22462. * `predicate` returns truthy for. The predicate is invoked with three
  22463. * arguments: (value, index|key, collection).
  22464. *
  22465. * **Note:** Unlike `_.remove`, this method returns a new array.
  22466. *
  22467. * @static
  22468. * @memberOf _
  22469. * @since 0.1.0
  22470. * @category Collection
  22471. * @param {Array|Object} collection The collection to iterate over.
  22472. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22473. * @returns {Array} Returns the new filtered array.
  22474. * @see _.reject
  22475. * @example
  22476. *
  22477. * var users = [
  22478. * { 'user': 'barney', 'age': 36, 'active': true },
  22479. * { 'user': 'fred', 'age': 40, 'active': false }
  22480. * ];
  22481. *
  22482. * _.filter(users, function(o) { return !o.active; });
  22483. * // => objects for ['fred']
  22484. *
  22485. * // The `_.matches` iteratee shorthand.
  22486. * _.filter(users, { 'age': 36, 'active': true });
  22487. * // => objects for ['barney']
  22488. *
  22489. * // The `_.matchesProperty` iteratee shorthand.
  22490. * _.filter(users, ['active', false]);
  22491. * // => objects for ['fred']
  22492. *
  22493. * // The `_.property` iteratee shorthand.
  22494. * _.filter(users, 'active');
  22495. * // => objects for ['barney']
  22496. *
  22497. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  22498. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  22499. * // => objects for ['fred', 'barney']
  22500. */
  22501. function filter(collection, predicate) {
  22502. var func = isArray(collection) ? arrayFilter : baseFilter;
  22503. return func(collection, getIteratee(predicate, 3));
  22504. }
  22505. /**
  22506. * Iterates over elements of `collection`, returning the first element
  22507. * `predicate` returns truthy for. The predicate is invoked with three
  22508. * arguments: (value, index|key, collection).
  22509. *
  22510. * @static
  22511. * @memberOf _
  22512. * @since 0.1.0
  22513. * @category Collection
  22514. * @param {Array|Object} collection The collection to inspect.
  22515. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22516. * @param {number} [fromIndex=0] The index to search from.
  22517. * @returns {*} Returns the matched element, else `undefined`.
  22518. * @example
  22519. *
  22520. * var users = [
  22521. * { 'user': 'barney', 'age': 36, 'active': true },
  22522. * { 'user': 'fred', 'age': 40, 'active': false },
  22523. * { 'user': 'pebbles', 'age': 1, 'active': true }
  22524. * ];
  22525. *
  22526. * _.find(users, function(o) { return o.age < 40; });
  22527. * // => object for 'barney'
  22528. *
  22529. * // The `_.matches` iteratee shorthand.
  22530. * _.find(users, { 'age': 1, 'active': true });
  22531. * // => object for 'pebbles'
  22532. *
  22533. * // The `_.matchesProperty` iteratee shorthand.
  22534. * _.find(users, ['active', false]);
  22535. * // => object for 'fred'
  22536. *
  22537. * // The `_.property` iteratee shorthand.
  22538. * _.find(users, 'active');
  22539. * // => object for 'barney'
  22540. */
  22541. var find = createFind(findIndex);
  22542. /**
  22543. * This method is like `_.find` except that it iterates over elements of
  22544. * `collection` from right to left.
  22545. *
  22546. * @static
  22547. * @memberOf _
  22548. * @since 2.0.0
  22549. * @category Collection
  22550. * @param {Array|Object} collection The collection to inspect.
  22551. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22552. * @param {number} [fromIndex=collection.length-1] The index to search from.
  22553. * @returns {*} Returns the matched element, else `undefined`.
  22554. * @example
  22555. *
  22556. * _.findLast([1, 2, 3, 4], function(n) {
  22557. * return n % 2 == 1;
  22558. * });
  22559. * // => 3
  22560. */
  22561. var findLast = createFind(findLastIndex);
  22562. /**
  22563. * Creates a flattened array of values by running each element in `collection`
  22564. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  22565. * with three arguments: (value, index|key, collection).
  22566. *
  22567. * @static
  22568. * @memberOf _
  22569. * @since 4.0.0
  22570. * @category Collection
  22571. * @param {Array|Object} collection The collection to iterate over.
  22572. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22573. * @returns {Array} Returns the new flattened array.
  22574. * @example
  22575. *
  22576. * function duplicate(n) {
  22577. * return [n, n];
  22578. * }
  22579. *
  22580. * _.flatMap([1, 2], duplicate);
  22581. * // => [1, 1, 2, 2]
  22582. */
  22583. function flatMap(collection, iteratee) {
  22584. return baseFlatten(map(collection, iteratee), 1);
  22585. }
  22586. /**
  22587. * This method is like `_.flatMap` except that it recursively flattens the
  22588. * mapped results.
  22589. *
  22590. * @static
  22591. * @memberOf _
  22592. * @since 4.7.0
  22593. * @category Collection
  22594. * @param {Array|Object} collection The collection to iterate over.
  22595. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22596. * @returns {Array} Returns the new flattened array.
  22597. * @example
  22598. *
  22599. * function duplicate(n) {
  22600. * return [[[n, n]]];
  22601. * }
  22602. *
  22603. * _.flatMapDeep([1, 2], duplicate);
  22604. * // => [1, 1, 2, 2]
  22605. */
  22606. function flatMapDeep(collection, iteratee) {
  22607. return baseFlatten(map(collection, iteratee), INFINITY);
  22608. }
  22609. /**
  22610. * This method is like `_.flatMap` except that it recursively flattens the
  22611. * mapped results up to `depth` times.
  22612. *
  22613. * @static
  22614. * @memberOf _
  22615. * @since 4.7.0
  22616. * @category Collection
  22617. * @param {Array|Object} collection The collection to iterate over.
  22618. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22619. * @param {number} [depth=1] The maximum recursion depth.
  22620. * @returns {Array} Returns the new flattened array.
  22621. * @example
  22622. *
  22623. * function duplicate(n) {
  22624. * return [[[n, n]]];
  22625. * }
  22626. *
  22627. * _.flatMapDepth([1, 2], duplicate, 2);
  22628. * // => [[1, 1], [2, 2]]
  22629. */
  22630. function flatMapDepth(collection, iteratee, depth) {
  22631. depth = depth === undefined ? 1 : toInteger(depth);
  22632. return baseFlatten(map(collection, iteratee), depth);
  22633. }
  22634. /**
  22635. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  22636. * The iteratee is invoked with three arguments: (value, index|key, collection).
  22637. * Iteratee functions may exit iteration early by explicitly returning `false`.
  22638. *
  22639. * **Note:** As with other "Collections" methods, objects with a "length"
  22640. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  22641. * or `_.forOwn` for object iteration.
  22642. *
  22643. * @static
  22644. * @memberOf _
  22645. * @since 0.1.0
  22646. * @alias each
  22647. * @category Collection
  22648. * @param {Array|Object} collection The collection to iterate over.
  22649. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22650. * @returns {Array|Object} Returns `collection`.
  22651. * @see _.forEachRight
  22652. * @example
  22653. *
  22654. * _.forEach([1, 2], function(value) {
  22655. * console.log(value);
  22656. * });
  22657. * // => Logs `1` then `2`.
  22658. *
  22659. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  22660. * console.log(key);
  22661. * });
  22662. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  22663. */
  22664. function forEach(collection, iteratee) {
  22665. var func = isArray(collection) ? arrayEach : baseEach;
  22666. return func(collection, getIteratee(iteratee, 3));
  22667. }
  22668. /**
  22669. * This method is like `_.forEach` except that it iterates over elements of
  22670. * `collection` from right to left.
  22671. *
  22672. * @static
  22673. * @memberOf _
  22674. * @since 2.0.0
  22675. * @alias eachRight
  22676. * @category Collection
  22677. * @param {Array|Object} collection The collection to iterate over.
  22678. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22679. * @returns {Array|Object} Returns `collection`.
  22680. * @see _.forEach
  22681. * @example
  22682. *
  22683. * _.forEachRight([1, 2], function(value) {
  22684. * console.log(value);
  22685. * });
  22686. * // => Logs `2` then `1`.
  22687. */
  22688. function forEachRight(collection, iteratee) {
  22689. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  22690. return func(collection, getIteratee(iteratee, 3));
  22691. }
  22692. /**
  22693. * Creates an object composed of keys generated from the results of running
  22694. * each element of `collection` thru `iteratee`. The order of grouped values
  22695. * is determined by the order they occur in `collection`. The corresponding
  22696. * value of each key is an array of elements responsible for generating the
  22697. * key. The iteratee is invoked with one argument: (value).
  22698. *
  22699. * @static
  22700. * @memberOf _
  22701. * @since 0.1.0
  22702. * @category Collection
  22703. * @param {Array|Object} collection The collection to iterate over.
  22704. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22705. * @returns {Object} Returns the composed aggregate object.
  22706. * @example
  22707. *
  22708. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  22709. * // => { '4': [4.2], '6': [6.1, 6.3] }
  22710. *
  22711. * // The `_.property` iteratee shorthand.
  22712. * _.groupBy(['one', 'two', 'three'], 'length');
  22713. * // => { '3': ['one', 'two'], '5': ['three'] }
  22714. */
  22715. var groupBy = createAggregator(function(result, value, key) {
  22716. if (hasOwnProperty.call(result, key)) {
  22717. result[key].push(value);
  22718. } else {
  22719. baseAssignValue(result, key, [value]);
  22720. }
  22721. });
  22722. /**
  22723. * Checks if `value` is in `collection`. If `collection` is a string, it's
  22724. * checked for a substring of `value`, otherwise
  22725. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22726. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  22727. * the offset from the end of `collection`.
  22728. *
  22729. * @static
  22730. * @memberOf _
  22731. * @since 0.1.0
  22732. * @category Collection
  22733. * @param {Array|Object|string} collection The collection to inspect.
  22734. * @param {*} value The value to search for.
  22735. * @param {number} [fromIndex=0] The index to search from.
  22736. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22737. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  22738. * @example
  22739. *
  22740. * _.includes([1, 2, 3], 1);
  22741. * // => true
  22742. *
  22743. * _.includes([1, 2, 3], 1, 2);
  22744. * // => false
  22745. *
  22746. * _.includes({ 'a': 1, 'b': 2 }, 1);
  22747. * // => true
  22748. *
  22749. * _.includes('abcd', 'bc');
  22750. * // => true
  22751. */
  22752. function includes(collection, value, fromIndex, guard) {
  22753. collection = isArrayLike(collection) ? collection : values(collection);
  22754. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  22755. var length = collection.length;
  22756. if (fromIndex < 0) {
  22757. fromIndex = nativeMax(length + fromIndex, 0);
  22758. }
  22759. return isString(collection)
  22760. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  22761. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  22762. }
  22763. /**
  22764. * Invokes the method at `path` of each element in `collection`, returning
  22765. * an array of the results of each invoked method. Any additional arguments
  22766. * are provided to each invoked method. If `path` is a function, it's invoked
  22767. * for, and `this` bound to, each element in `collection`.
  22768. *
  22769. * @static
  22770. * @memberOf _
  22771. * @since 4.0.0
  22772. * @category Collection
  22773. * @param {Array|Object} collection The collection to iterate over.
  22774. * @param {Array|Function|string} path The path of the method to invoke or
  22775. * the function invoked per iteration.
  22776. * @param {...*} [args] The arguments to invoke each method with.
  22777. * @returns {Array} Returns the array of results.
  22778. * @example
  22779. *
  22780. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  22781. * // => [[1, 5, 7], [1, 2, 3]]
  22782. *
  22783. * _.invokeMap([123, 456], String.prototype.split, '');
  22784. * // => [['1', '2', '3'], ['4', '5', '6']]
  22785. */
  22786. var invokeMap = baseRest(function(collection, path, args) {
  22787. var index = -1,
  22788. isFunc = typeof path == 'function',
  22789. result = isArrayLike(collection) ? Array(collection.length) : [];
  22790. baseEach(collection, function(value) {
  22791. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  22792. });
  22793. return result;
  22794. });
  22795. /**
  22796. * Creates an object composed of keys generated from the results of running
  22797. * each element of `collection` thru `iteratee`. The corresponding value of
  22798. * each key is the last element responsible for generating the key. The
  22799. * iteratee is invoked with one argument: (value).
  22800. *
  22801. * @static
  22802. * @memberOf _
  22803. * @since 4.0.0
  22804. * @category Collection
  22805. * @param {Array|Object} collection The collection to iterate over.
  22806. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22807. * @returns {Object} Returns the composed aggregate object.
  22808. * @example
  22809. *
  22810. * var array = [
  22811. * { 'dir': 'left', 'code': 97 },
  22812. * { 'dir': 'right', 'code': 100 }
  22813. * ];
  22814. *
  22815. * _.keyBy(array, function(o) {
  22816. * return String.fromCharCode(o.code);
  22817. * });
  22818. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  22819. *
  22820. * _.keyBy(array, 'dir');
  22821. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  22822. */
  22823. var keyBy = createAggregator(function(result, value, key) {
  22824. baseAssignValue(result, key, value);
  22825. });
  22826. /**
  22827. * Creates an array of values by running each element in `collection` thru
  22828. * `iteratee`. The iteratee is invoked with three arguments:
  22829. * (value, index|key, collection).
  22830. *
  22831. * Many lodash methods are guarded to work as iteratees for methods like
  22832. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  22833. *
  22834. * The guarded methods are:
  22835. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  22836. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  22837. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  22838. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  22839. *
  22840. * @static
  22841. * @memberOf _
  22842. * @since 0.1.0
  22843. * @category Collection
  22844. * @param {Array|Object} collection The collection to iterate over.
  22845. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22846. * @returns {Array} Returns the new mapped array.
  22847. * @example
  22848. *
  22849. * function square(n) {
  22850. * return n * n;
  22851. * }
  22852. *
  22853. * _.map([4, 8], square);
  22854. * // => [16, 64]
  22855. *
  22856. * _.map({ 'a': 4, 'b': 8 }, square);
  22857. * // => [16, 64] (iteration order is not guaranteed)
  22858. *
  22859. * var users = [
  22860. * { 'user': 'barney' },
  22861. * { 'user': 'fred' }
  22862. * ];
  22863. *
  22864. * // The `_.property` iteratee shorthand.
  22865. * _.map(users, 'user');
  22866. * // => ['barney', 'fred']
  22867. */
  22868. function map(collection, iteratee) {
  22869. var func = isArray(collection) ? arrayMap : baseMap;
  22870. return func(collection, getIteratee(iteratee, 3));
  22871. }
  22872. /**
  22873. * This method is like `_.sortBy` except that it allows specifying the sort
  22874. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  22875. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  22876. * descending or "asc" for ascending sort order of corresponding values.
  22877. *
  22878. * @static
  22879. * @memberOf _
  22880. * @since 4.0.0
  22881. * @category Collection
  22882. * @param {Array|Object} collection The collection to iterate over.
  22883. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  22884. * The iteratees to sort by.
  22885. * @param {string[]} [orders] The sort orders of `iteratees`.
  22886. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22887. * @returns {Array} Returns the new sorted array.
  22888. * @example
  22889. *
  22890. * var users = [
  22891. * { 'user': 'fred', 'age': 48 },
  22892. * { 'user': 'barney', 'age': 34 },
  22893. * { 'user': 'fred', 'age': 40 },
  22894. * { 'user': 'barney', 'age': 36 }
  22895. * ];
  22896. *
  22897. * // Sort by `user` in ascending order and by `age` in descending order.
  22898. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  22899. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22900. */
  22901. function orderBy(collection, iteratees, orders, guard) {
  22902. if (collection == null) {
  22903. return [];
  22904. }
  22905. if (!isArray(iteratees)) {
  22906. iteratees = iteratees == null ? [] : [iteratees];
  22907. }
  22908. orders = guard ? undefined : orders;
  22909. if (!isArray(orders)) {
  22910. orders = orders == null ? [] : [orders];
  22911. }
  22912. return baseOrderBy(collection, iteratees, orders);
  22913. }
  22914. /**
  22915. * Creates an array of elements split into two groups, the first of which
  22916. * contains elements `predicate` returns truthy for, the second of which
  22917. * contains elements `predicate` returns falsey for. The predicate is
  22918. * invoked with one argument: (value).
  22919. *
  22920. * @static
  22921. * @memberOf _
  22922. * @since 3.0.0
  22923. * @category Collection
  22924. * @param {Array|Object} collection The collection to iterate over.
  22925. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22926. * @returns {Array} Returns the array of grouped elements.
  22927. * @example
  22928. *
  22929. * var users = [
  22930. * { 'user': 'barney', 'age': 36, 'active': false },
  22931. * { 'user': 'fred', 'age': 40, 'active': true },
  22932. * { 'user': 'pebbles', 'age': 1, 'active': false }
  22933. * ];
  22934. *
  22935. * _.partition(users, function(o) { return o.active; });
  22936. * // => objects for [['fred'], ['barney', 'pebbles']]
  22937. *
  22938. * // The `_.matches` iteratee shorthand.
  22939. * _.partition(users, { 'age': 1, 'active': false });
  22940. * // => objects for [['pebbles'], ['barney', 'fred']]
  22941. *
  22942. * // The `_.matchesProperty` iteratee shorthand.
  22943. * _.partition(users, ['active', false]);
  22944. * // => objects for [['barney', 'pebbles'], ['fred']]
  22945. *
  22946. * // The `_.property` iteratee shorthand.
  22947. * _.partition(users, 'active');
  22948. * // => objects for [['fred'], ['barney', 'pebbles']]
  22949. */
  22950. var partition = createAggregator(function(result, value, key) {
  22951. result[key ? 0 : 1].push(value);
  22952. }, function() { return [[], []]; });
  22953. /**
  22954. * Reduces `collection` to a value which is the accumulated result of running
  22955. * each element in `collection` thru `iteratee`, where each successive
  22956. * invocation is supplied the return value of the previous. If `accumulator`
  22957. * is not given, the first element of `collection` is used as the initial
  22958. * value. The iteratee is invoked with four arguments:
  22959. * (accumulator, value, index|key, collection).
  22960. *
  22961. * Many lodash methods are guarded to work as iteratees for methods like
  22962. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  22963. *
  22964. * The guarded methods are:
  22965. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  22966. * and `sortBy`
  22967. *
  22968. * @static
  22969. * @memberOf _
  22970. * @since 0.1.0
  22971. * @category Collection
  22972. * @param {Array|Object} collection The collection to iterate over.
  22973. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22974. * @param {*} [accumulator] The initial value.
  22975. * @returns {*} Returns the accumulated value.
  22976. * @see _.reduceRight
  22977. * @example
  22978. *
  22979. * _.reduce([1, 2], function(sum, n) {
  22980. * return sum + n;
  22981. * }, 0);
  22982. * // => 3
  22983. *
  22984. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  22985. * (result[value] || (result[value] = [])).push(key);
  22986. * return result;
  22987. * }, {});
  22988. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  22989. */
  22990. function reduce(collection, iteratee, accumulator) {
  22991. var func = isArray(collection) ? arrayReduce : baseReduce,
  22992. initAccum = arguments.length < 3;
  22993. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  22994. }
  22995. /**
  22996. * This method is like `_.reduce` except that it iterates over elements of
  22997. * `collection` from right to left.
  22998. *
  22999. * @static
  23000. * @memberOf _
  23001. * @since 0.1.0
  23002. * @category Collection
  23003. * @param {Array|Object} collection The collection to iterate over.
  23004. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23005. * @param {*} [accumulator] The initial value.
  23006. * @returns {*} Returns the accumulated value.
  23007. * @see _.reduce
  23008. * @example
  23009. *
  23010. * var array = [[0, 1], [2, 3], [4, 5]];
  23011. *
  23012. * _.reduceRight(array, function(flattened, other) {
  23013. * return flattened.concat(other);
  23014. * }, []);
  23015. * // => [4, 5, 2, 3, 0, 1]
  23016. */
  23017. function reduceRight(collection, iteratee, accumulator) {
  23018. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  23019. initAccum = arguments.length < 3;
  23020. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  23021. }
  23022. /**
  23023. * The opposite of `_.filter`; this method returns the elements of `collection`
  23024. * that `predicate` does **not** return truthy for.
  23025. *
  23026. * @static
  23027. * @memberOf _
  23028. * @since 0.1.0
  23029. * @category Collection
  23030. * @param {Array|Object} collection The collection to iterate over.
  23031. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23032. * @returns {Array} Returns the new filtered array.
  23033. * @see _.filter
  23034. * @example
  23035. *
  23036. * var users = [
  23037. * { 'user': 'barney', 'age': 36, 'active': false },
  23038. * { 'user': 'fred', 'age': 40, 'active': true }
  23039. * ];
  23040. *
  23041. * _.reject(users, function(o) { return !o.active; });
  23042. * // => objects for ['fred']
  23043. *
  23044. * // The `_.matches` iteratee shorthand.
  23045. * _.reject(users, { 'age': 40, 'active': true });
  23046. * // => objects for ['barney']
  23047. *
  23048. * // The `_.matchesProperty` iteratee shorthand.
  23049. * _.reject(users, ['active', false]);
  23050. * // => objects for ['fred']
  23051. *
  23052. * // The `_.property` iteratee shorthand.
  23053. * _.reject(users, 'active');
  23054. * // => objects for ['barney']
  23055. */
  23056. function reject(collection, predicate) {
  23057. var func = isArray(collection) ? arrayFilter : baseFilter;
  23058. return func(collection, negate(getIteratee(predicate, 3)));
  23059. }
  23060. /**
  23061. * Gets a random element from `collection`.
  23062. *
  23063. * @static
  23064. * @memberOf _
  23065. * @since 2.0.0
  23066. * @category Collection
  23067. * @param {Array|Object} collection The collection to sample.
  23068. * @returns {*} Returns the random element.
  23069. * @example
  23070. *
  23071. * _.sample([1, 2, 3, 4]);
  23072. * // => 2
  23073. */
  23074. function sample(collection) {
  23075. var func = isArray(collection) ? arraySample : baseSample;
  23076. return func(collection);
  23077. }
  23078. /**
  23079. * Gets `n` random elements at unique keys from `collection` up to the
  23080. * size of `collection`.
  23081. *
  23082. * @static
  23083. * @memberOf _
  23084. * @since 4.0.0
  23085. * @category Collection
  23086. * @param {Array|Object} collection The collection to sample.
  23087. * @param {number} [n=1] The number of elements to sample.
  23088. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23089. * @returns {Array} Returns the random elements.
  23090. * @example
  23091. *
  23092. * _.sampleSize([1, 2, 3], 2);
  23093. * // => [3, 1]
  23094. *
  23095. * _.sampleSize([1, 2, 3], 4);
  23096. * // => [2, 3, 1]
  23097. */
  23098. function sampleSize(collection, n, guard) {
  23099. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  23100. n = 1;
  23101. } else {
  23102. n = toInteger(n);
  23103. }
  23104. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  23105. return func(collection, n);
  23106. }
  23107. /**
  23108. * Creates an array of shuffled values, using a version of the
  23109. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  23110. *
  23111. * @static
  23112. * @memberOf _
  23113. * @since 0.1.0
  23114. * @category Collection
  23115. * @param {Array|Object} collection The collection to shuffle.
  23116. * @returns {Array} Returns the new shuffled array.
  23117. * @example
  23118. *
  23119. * _.shuffle([1, 2, 3, 4]);
  23120. * // => [4, 1, 3, 2]
  23121. */
  23122. function shuffle(collection) {
  23123. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  23124. return func(collection);
  23125. }
  23126. /**
  23127. * Gets the size of `collection` by returning its length for array-like
  23128. * values or the number of own enumerable string keyed properties for objects.
  23129. *
  23130. * @static
  23131. * @memberOf _
  23132. * @since 0.1.0
  23133. * @category Collection
  23134. * @param {Array|Object|string} collection The collection to inspect.
  23135. * @returns {number} Returns the collection size.
  23136. * @example
  23137. *
  23138. * _.size([1, 2, 3]);
  23139. * // => 3
  23140. *
  23141. * _.size({ 'a': 1, 'b': 2 });
  23142. * // => 2
  23143. *
  23144. * _.size('pebbles');
  23145. * // => 7
  23146. */
  23147. function size(collection) {
  23148. if (collection == null) {
  23149. return 0;
  23150. }
  23151. if (isArrayLike(collection)) {
  23152. return isString(collection) ? stringSize(collection) : collection.length;
  23153. }
  23154. var tag = getTag(collection);
  23155. if (tag == mapTag || tag == setTag) {
  23156. return collection.size;
  23157. }
  23158. return baseKeys(collection).length;
  23159. }
  23160. /**
  23161. * Checks if `predicate` returns truthy for **any** element of `collection`.
  23162. * Iteration is stopped once `predicate` returns truthy. The predicate is
  23163. * invoked with three arguments: (value, index|key, collection).
  23164. *
  23165. * @static
  23166. * @memberOf _
  23167. * @since 0.1.0
  23168. * @category Collection
  23169. * @param {Array|Object} collection The collection to iterate over.
  23170. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23171. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23172. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23173. * else `false`.
  23174. * @example
  23175. *
  23176. * _.some([null, 0, 'yes', false], Boolean);
  23177. * // => true
  23178. *
  23179. * var users = [
  23180. * { 'user': 'barney', 'active': true },
  23181. * { 'user': 'fred', 'active': false }
  23182. * ];
  23183. *
  23184. * // The `_.matches` iteratee shorthand.
  23185. * _.some(users, { 'user': 'barney', 'active': false });
  23186. * // => false
  23187. *
  23188. * // The `_.matchesProperty` iteratee shorthand.
  23189. * _.some(users, ['active', false]);
  23190. * // => true
  23191. *
  23192. * // The `_.property` iteratee shorthand.
  23193. * _.some(users, 'active');
  23194. * // => true
  23195. */
  23196. function some(collection, predicate, guard) {
  23197. var func = isArray(collection) ? arraySome : baseSome;
  23198. if (guard && isIterateeCall(collection, predicate, guard)) {
  23199. predicate = undefined;
  23200. }
  23201. return func(collection, getIteratee(predicate, 3));
  23202. }
  23203. /**
  23204. * Creates an array of elements, sorted in ascending order by the results of
  23205. * running each element in a collection thru each iteratee. This method
  23206. * performs a stable sort, that is, it preserves the original sort order of
  23207. * equal elements. The iteratees are invoked with one argument: (value).
  23208. *
  23209. * @static
  23210. * @memberOf _
  23211. * @since 0.1.0
  23212. * @category Collection
  23213. * @param {Array|Object} collection The collection to iterate over.
  23214. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23215. * The iteratees to sort by.
  23216. * @returns {Array} Returns the new sorted array.
  23217. * @example
  23218. *
  23219. * var users = [
  23220. * { 'user': 'fred', 'age': 48 },
  23221. * { 'user': 'barney', 'age': 36 },
  23222. * { 'user': 'fred', 'age': 30 },
  23223. * { 'user': 'barney', 'age': 34 }
  23224. * ];
  23225. *
  23226. * _.sortBy(users, [function(o) { return o.user; }]);
  23227. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  23228. *
  23229. * _.sortBy(users, ['user', 'age']);
  23230. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  23231. */
  23232. var sortBy = baseRest(function(collection, iteratees) {
  23233. if (collection == null) {
  23234. return [];
  23235. }
  23236. var length = iteratees.length;
  23237. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  23238. iteratees = [];
  23239. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  23240. iteratees = [iteratees[0]];
  23241. }
  23242. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  23243. });
  23244. /*------------------------------------------------------------------------*/
  23245. /**
  23246. * Gets the timestamp of the number of milliseconds that have elapsed since
  23247. * the Unix epoch (1 January 1970 00:00:00 UTC).
  23248. *
  23249. * @static
  23250. * @memberOf _
  23251. * @since 2.4.0
  23252. * @category Date
  23253. * @returns {number} Returns the timestamp.
  23254. * @example
  23255. *
  23256. * _.defer(function(stamp) {
  23257. * console.log(_.now() - stamp);
  23258. * }, _.now());
  23259. * // => Logs the number of milliseconds it took for the deferred invocation.
  23260. */
  23261. var now = ctxNow || function() {
  23262. return root.Date.now();
  23263. };
  23264. /*------------------------------------------------------------------------*/
  23265. /**
  23266. * The opposite of `_.before`; this method creates a function that invokes
  23267. * `func` once it's called `n` or more times.
  23268. *
  23269. * @static
  23270. * @memberOf _
  23271. * @since 0.1.0
  23272. * @category Function
  23273. * @param {number} n The number of calls before `func` is invoked.
  23274. * @param {Function} func The function to restrict.
  23275. * @returns {Function} Returns the new restricted function.
  23276. * @example
  23277. *
  23278. * var saves = ['profile', 'settings'];
  23279. *
  23280. * var done = _.after(saves.length, function() {
  23281. * console.log('done saving!');
  23282. * });
  23283. *
  23284. * _.forEach(saves, function(type) {
  23285. * asyncSave({ 'type': type, 'complete': done });
  23286. * });
  23287. * // => Logs 'done saving!' after the two async saves have completed.
  23288. */
  23289. function after(n, func) {
  23290. if (typeof func != 'function') {
  23291. throw new TypeError(FUNC_ERROR_TEXT);
  23292. }
  23293. n = toInteger(n);
  23294. return function() {
  23295. if (--n < 1) {
  23296. return func.apply(this, arguments);
  23297. }
  23298. };
  23299. }
  23300. /**
  23301. * Creates a function that invokes `func`, with up to `n` arguments,
  23302. * ignoring any additional arguments.
  23303. *
  23304. * @static
  23305. * @memberOf _
  23306. * @since 3.0.0
  23307. * @category Function
  23308. * @param {Function} func The function to cap arguments for.
  23309. * @param {number} [n=func.length] The arity cap.
  23310. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23311. * @returns {Function} Returns the new capped function.
  23312. * @example
  23313. *
  23314. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  23315. * // => [6, 8, 10]
  23316. */
  23317. function ary(func, n, guard) {
  23318. n = guard ? undefined : n;
  23319. n = (func && n == null) ? func.length : n;
  23320. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  23321. }
  23322. /**
  23323. * Creates a function that invokes `func`, with the `this` binding and arguments
  23324. * of the created function, while it's called less than `n` times. Subsequent
  23325. * calls to the created function return the result of the last `func` invocation.
  23326. *
  23327. * @static
  23328. * @memberOf _
  23329. * @since 3.0.0
  23330. * @category Function
  23331. * @param {number} n The number of calls at which `func` is no longer invoked.
  23332. * @param {Function} func The function to restrict.
  23333. * @returns {Function} Returns the new restricted function.
  23334. * @example
  23335. *
  23336. * jQuery(element).on('click', _.before(5, addContactToList));
  23337. * // => Allows adding up to 4 contacts to the list.
  23338. */
  23339. function before(n, func) {
  23340. var result;
  23341. if (typeof func != 'function') {
  23342. throw new TypeError(FUNC_ERROR_TEXT);
  23343. }
  23344. n = toInteger(n);
  23345. return function() {
  23346. if (--n > 0) {
  23347. result = func.apply(this, arguments);
  23348. }
  23349. if (n <= 1) {
  23350. func = undefined;
  23351. }
  23352. return result;
  23353. };
  23354. }
  23355. /**
  23356. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  23357. * and `partials` prepended to the arguments it receives.
  23358. *
  23359. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  23360. * may be used as a placeholder for partially applied arguments.
  23361. *
  23362. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  23363. * property of bound functions.
  23364. *
  23365. * @static
  23366. * @memberOf _
  23367. * @since 0.1.0
  23368. * @category Function
  23369. * @param {Function} func The function to bind.
  23370. * @param {*} thisArg The `this` binding of `func`.
  23371. * @param {...*} [partials] The arguments to be partially applied.
  23372. * @returns {Function} Returns the new bound function.
  23373. * @example
  23374. *
  23375. * function greet(greeting, punctuation) {
  23376. * return greeting + ' ' + this.user + punctuation;
  23377. * }
  23378. *
  23379. * var object = { 'user': 'fred' };
  23380. *
  23381. * var bound = _.bind(greet, object, 'hi');
  23382. * bound('!');
  23383. * // => 'hi fred!'
  23384. *
  23385. * // Bound with placeholders.
  23386. * var bound = _.bind(greet, object, _, '!');
  23387. * bound('hi');
  23388. * // => 'hi fred!'
  23389. */
  23390. var bind = baseRest(function(func, thisArg, partials) {
  23391. var bitmask = WRAP_BIND_FLAG;
  23392. if (partials.length) {
  23393. var holders = replaceHolders(partials, getHolder(bind));
  23394. bitmask |= WRAP_PARTIAL_FLAG;
  23395. }
  23396. return createWrap(func, bitmask, thisArg, partials, holders);
  23397. });
  23398. /**
  23399. * Creates a function that invokes the method at `object[key]` with `partials`
  23400. * prepended to the arguments it receives.
  23401. *
  23402. * This method differs from `_.bind` by allowing bound functions to reference
  23403. * methods that may be redefined or don't yet exist. See
  23404. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  23405. * for more details.
  23406. *
  23407. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  23408. * builds, may be used as a placeholder for partially applied arguments.
  23409. *
  23410. * @static
  23411. * @memberOf _
  23412. * @since 0.10.0
  23413. * @category Function
  23414. * @param {Object} object The object to invoke the method on.
  23415. * @param {string} key The key of the method.
  23416. * @param {...*} [partials] The arguments to be partially applied.
  23417. * @returns {Function} Returns the new bound function.
  23418. * @example
  23419. *
  23420. * var object = {
  23421. * 'user': 'fred',
  23422. * 'greet': function(greeting, punctuation) {
  23423. * return greeting + ' ' + this.user + punctuation;
  23424. * }
  23425. * };
  23426. *
  23427. * var bound = _.bindKey(object, 'greet', 'hi');
  23428. * bound('!');
  23429. * // => 'hi fred!'
  23430. *
  23431. * object.greet = function(greeting, punctuation) {
  23432. * return greeting + 'ya ' + this.user + punctuation;
  23433. * };
  23434. *
  23435. * bound('!');
  23436. * // => 'hiya fred!'
  23437. *
  23438. * // Bound with placeholders.
  23439. * var bound = _.bindKey(object, 'greet', _, '!');
  23440. * bound('hi');
  23441. * // => 'hiya fred!'
  23442. */
  23443. var bindKey = baseRest(function(object, key, partials) {
  23444. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  23445. if (partials.length) {
  23446. var holders = replaceHolders(partials, getHolder(bindKey));
  23447. bitmask |= WRAP_PARTIAL_FLAG;
  23448. }
  23449. return createWrap(key, bitmask, object, partials, holders);
  23450. });
  23451. /**
  23452. * Creates a function that accepts arguments of `func` and either invokes
  23453. * `func` returning its result, if at least `arity` number of arguments have
  23454. * been provided, or returns a function that accepts the remaining `func`
  23455. * arguments, and so on. The arity of `func` may be specified if `func.length`
  23456. * is not sufficient.
  23457. *
  23458. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  23459. * may be used as a placeholder for provided arguments.
  23460. *
  23461. * **Note:** This method doesn't set the "length" property of curried functions.
  23462. *
  23463. * @static
  23464. * @memberOf _
  23465. * @since 2.0.0
  23466. * @category Function
  23467. * @param {Function} func The function to curry.
  23468. * @param {number} [arity=func.length] The arity of `func`.
  23469. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23470. * @returns {Function} Returns the new curried function.
  23471. * @example
  23472. *
  23473. * var abc = function(a, b, c) {
  23474. * return [a, b, c];
  23475. * };
  23476. *
  23477. * var curried = _.curry(abc);
  23478. *
  23479. * curried(1)(2)(3);
  23480. * // => [1, 2, 3]
  23481. *
  23482. * curried(1, 2)(3);
  23483. * // => [1, 2, 3]
  23484. *
  23485. * curried(1, 2, 3);
  23486. * // => [1, 2, 3]
  23487. *
  23488. * // Curried with placeholders.
  23489. * curried(1)(_, 3)(2);
  23490. * // => [1, 2, 3]
  23491. */
  23492. function curry(func, arity, guard) {
  23493. arity = guard ? undefined : arity;
  23494. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23495. result.placeholder = curry.placeholder;
  23496. return result;
  23497. }
  23498. /**
  23499. * This method is like `_.curry` except that arguments are applied to `func`
  23500. * in the manner of `_.partialRight` instead of `_.partial`.
  23501. *
  23502. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  23503. * builds, may be used as a placeholder for provided arguments.
  23504. *
  23505. * **Note:** This method doesn't set the "length" property of curried functions.
  23506. *
  23507. * @static
  23508. * @memberOf _
  23509. * @since 3.0.0
  23510. * @category Function
  23511. * @param {Function} func The function to curry.
  23512. * @param {number} [arity=func.length] The arity of `func`.
  23513. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23514. * @returns {Function} Returns the new curried function.
  23515. * @example
  23516. *
  23517. * var abc = function(a, b, c) {
  23518. * return [a, b, c];
  23519. * };
  23520. *
  23521. * var curried = _.curryRight(abc);
  23522. *
  23523. * curried(3)(2)(1);
  23524. * // => [1, 2, 3]
  23525. *
  23526. * curried(2, 3)(1);
  23527. * // => [1, 2, 3]
  23528. *
  23529. * curried(1, 2, 3);
  23530. * // => [1, 2, 3]
  23531. *
  23532. * // Curried with placeholders.
  23533. * curried(3)(1, _)(2);
  23534. * // => [1, 2, 3]
  23535. */
  23536. function curryRight(func, arity, guard) {
  23537. arity = guard ? undefined : arity;
  23538. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23539. result.placeholder = curryRight.placeholder;
  23540. return result;
  23541. }
  23542. /**
  23543. * Creates a debounced function that delays invoking `func` until after `wait`
  23544. * milliseconds have elapsed since the last time the debounced function was
  23545. * invoked. The debounced function comes with a `cancel` method to cancel
  23546. * delayed `func` invocations and a `flush` method to immediately invoke them.
  23547. * Provide `options` to indicate whether `func` should be invoked on the
  23548. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  23549. * with the last arguments provided to the debounced function. Subsequent
  23550. * calls to the debounced function return the result of the last `func`
  23551. * invocation.
  23552. *
  23553. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23554. * invoked on the trailing edge of the timeout only if the debounced function
  23555. * is invoked more than once during the `wait` timeout.
  23556. *
  23557. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23558. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23559. *
  23560. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23561. * for details over the differences between `_.debounce` and `_.throttle`.
  23562. *
  23563. * @static
  23564. * @memberOf _
  23565. * @since 0.1.0
  23566. * @category Function
  23567. * @param {Function} func The function to debounce.
  23568. * @param {number} [wait=0] The number of milliseconds to delay.
  23569. * @param {Object} [options={}] The options object.
  23570. * @param {boolean} [options.leading=false]
  23571. * Specify invoking on the leading edge of the timeout.
  23572. * @param {number} [options.maxWait]
  23573. * The maximum time `func` is allowed to be delayed before it's invoked.
  23574. * @param {boolean} [options.trailing=true]
  23575. * Specify invoking on the trailing edge of the timeout.
  23576. * @returns {Function} Returns the new debounced function.
  23577. * @example
  23578. *
  23579. * // Avoid costly calculations while the window size is in flux.
  23580. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  23581. *
  23582. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  23583. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  23584. * 'leading': true,
  23585. * 'trailing': false
  23586. * }));
  23587. *
  23588. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  23589. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  23590. * var source = new EventSource('/stream');
  23591. * jQuery(source).on('message', debounced);
  23592. *
  23593. * // Cancel the trailing debounced invocation.
  23594. * jQuery(window).on('popstate', debounced.cancel);
  23595. */
  23596. function debounce(func, wait, options) {
  23597. var lastArgs,
  23598. lastThis,
  23599. maxWait,
  23600. result,
  23601. timerId,
  23602. lastCallTime,
  23603. lastInvokeTime = 0,
  23604. leading = false,
  23605. maxing = false,
  23606. trailing = true;
  23607. if (typeof func != 'function') {
  23608. throw new TypeError(FUNC_ERROR_TEXT);
  23609. }
  23610. wait = toNumber(wait) || 0;
  23611. if (isObject(options)) {
  23612. leading = !!options.leading;
  23613. maxing = 'maxWait' in options;
  23614. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  23615. trailing = 'trailing' in options ? !!options.trailing : trailing;
  23616. }
  23617. function invokeFunc(time) {
  23618. var args = lastArgs,
  23619. thisArg = lastThis;
  23620. lastArgs = lastThis = undefined;
  23621. lastInvokeTime = time;
  23622. result = func.apply(thisArg, args);
  23623. return result;
  23624. }
  23625. function leadingEdge(time) {
  23626. // Reset any `maxWait` timer.
  23627. lastInvokeTime = time;
  23628. // Start the timer for the trailing edge.
  23629. timerId = setTimeout(timerExpired, wait);
  23630. // Invoke the leading edge.
  23631. return leading ? invokeFunc(time) : result;
  23632. }
  23633. function remainingWait(time) {
  23634. var timeSinceLastCall = time - lastCallTime,
  23635. timeSinceLastInvoke = time - lastInvokeTime,
  23636. timeWaiting = wait - timeSinceLastCall;
  23637. return maxing
  23638. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  23639. : timeWaiting;
  23640. }
  23641. function shouldInvoke(time) {
  23642. var timeSinceLastCall = time - lastCallTime,
  23643. timeSinceLastInvoke = time - lastInvokeTime;
  23644. // Either this is the first call, activity has stopped and we're at the
  23645. // trailing edge, the system time has gone backwards and we're treating
  23646. // it as the trailing edge, or we've hit the `maxWait` limit.
  23647. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  23648. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  23649. }
  23650. function timerExpired() {
  23651. var time = now();
  23652. if (shouldInvoke(time)) {
  23653. return trailingEdge(time);
  23654. }
  23655. // Restart the timer.
  23656. timerId = setTimeout(timerExpired, remainingWait(time));
  23657. }
  23658. function trailingEdge(time) {
  23659. timerId = undefined;
  23660. // Only invoke if we have `lastArgs` which means `func` has been
  23661. // debounced at least once.
  23662. if (trailing && lastArgs) {
  23663. return invokeFunc(time);
  23664. }
  23665. lastArgs = lastThis = undefined;
  23666. return result;
  23667. }
  23668. function cancel() {
  23669. if (timerId !== undefined) {
  23670. clearTimeout(timerId);
  23671. }
  23672. lastInvokeTime = 0;
  23673. lastArgs = lastCallTime = lastThis = timerId = undefined;
  23674. }
  23675. function flush() {
  23676. return timerId === undefined ? result : trailingEdge(now());
  23677. }
  23678. function debounced() {
  23679. var time = now(),
  23680. isInvoking = shouldInvoke(time);
  23681. lastArgs = arguments;
  23682. lastThis = this;
  23683. lastCallTime = time;
  23684. if (isInvoking) {
  23685. if (timerId === undefined) {
  23686. return leadingEdge(lastCallTime);
  23687. }
  23688. if (maxing) {
  23689. // Handle invocations in a tight loop.
  23690. clearTimeout(timerId);
  23691. timerId = setTimeout(timerExpired, wait);
  23692. return invokeFunc(lastCallTime);
  23693. }
  23694. }
  23695. if (timerId === undefined) {
  23696. timerId = setTimeout(timerExpired, wait);
  23697. }
  23698. return result;
  23699. }
  23700. debounced.cancel = cancel;
  23701. debounced.flush = flush;
  23702. return debounced;
  23703. }
  23704. /**
  23705. * Defers invoking the `func` until the current call stack has cleared. Any
  23706. * additional arguments are provided to `func` when it's invoked.
  23707. *
  23708. * @static
  23709. * @memberOf _
  23710. * @since 0.1.0
  23711. * @category Function
  23712. * @param {Function} func The function to defer.
  23713. * @param {...*} [args] The arguments to invoke `func` with.
  23714. * @returns {number} Returns the timer id.
  23715. * @example
  23716. *
  23717. * _.defer(function(text) {
  23718. * console.log(text);
  23719. * }, 'deferred');
  23720. * // => Logs 'deferred' after one millisecond.
  23721. */
  23722. var defer = baseRest(function(func, args) {
  23723. return baseDelay(func, 1, args);
  23724. });
  23725. /**
  23726. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  23727. * provided to `func` when it's invoked.
  23728. *
  23729. * @static
  23730. * @memberOf _
  23731. * @since 0.1.0
  23732. * @category Function
  23733. * @param {Function} func The function to delay.
  23734. * @param {number} wait The number of milliseconds to delay invocation.
  23735. * @param {...*} [args] The arguments to invoke `func` with.
  23736. * @returns {number} Returns the timer id.
  23737. * @example
  23738. *
  23739. * _.delay(function(text) {
  23740. * console.log(text);
  23741. * }, 1000, 'later');
  23742. * // => Logs 'later' after one second.
  23743. */
  23744. var delay = baseRest(function(func, wait, args) {
  23745. return baseDelay(func, toNumber(wait) || 0, args);
  23746. });
  23747. /**
  23748. * Creates a function that invokes `func` with arguments reversed.
  23749. *
  23750. * @static
  23751. * @memberOf _
  23752. * @since 4.0.0
  23753. * @category Function
  23754. * @param {Function} func The function to flip arguments for.
  23755. * @returns {Function} Returns the new flipped function.
  23756. * @example
  23757. *
  23758. * var flipped = _.flip(function() {
  23759. * return _.toArray(arguments);
  23760. * });
  23761. *
  23762. * flipped('a', 'b', 'c', 'd');
  23763. * // => ['d', 'c', 'b', 'a']
  23764. */
  23765. function flip(func) {
  23766. return createWrap(func, WRAP_FLIP_FLAG);
  23767. }
  23768. /**
  23769. * Creates a function that memoizes the result of `func`. If `resolver` is
  23770. * provided, it determines the cache key for storing the result based on the
  23771. * arguments provided to the memoized function. By default, the first argument
  23772. * provided to the memoized function is used as the map cache key. The `func`
  23773. * is invoked with the `this` binding of the memoized function.
  23774. *
  23775. * **Note:** The cache is exposed as the `cache` property on the memoized
  23776. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  23777. * constructor with one whose instances implement the
  23778. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  23779. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  23780. *
  23781. * @static
  23782. * @memberOf _
  23783. * @since 0.1.0
  23784. * @category Function
  23785. * @param {Function} func The function to have its output memoized.
  23786. * @param {Function} [resolver] The function to resolve the cache key.
  23787. * @returns {Function} Returns the new memoized function.
  23788. * @example
  23789. *
  23790. * var object = { 'a': 1, 'b': 2 };
  23791. * var other = { 'c': 3, 'd': 4 };
  23792. *
  23793. * var values = _.memoize(_.values);
  23794. * values(object);
  23795. * // => [1, 2]
  23796. *
  23797. * values(other);
  23798. * // => [3, 4]
  23799. *
  23800. * object.a = 2;
  23801. * values(object);
  23802. * // => [1, 2]
  23803. *
  23804. * // Modify the result cache.
  23805. * values.cache.set(object, ['a', 'b']);
  23806. * values(object);
  23807. * // => ['a', 'b']
  23808. *
  23809. * // Replace `_.memoize.Cache`.
  23810. * _.memoize.Cache = WeakMap;
  23811. */
  23812. function memoize(func, resolver) {
  23813. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  23814. throw new TypeError(FUNC_ERROR_TEXT);
  23815. }
  23816. var memoized = function() {
  23817. var args = arguments,
  23818. key = resolver ? resolver.apply(this, args) : args[0],
  23819. cache = memoized.cache;
  23820. if (cache.has(key)) {
  23821. return cache.get(key);
  23822. }
  23823. var result = func.apply(this, args);
  23824. memoized.cache = cache.set(key, result) || cache;
  23825. return result;
  23826. };
  23827. memoized.cache = new (memoize.Cache || MapCache);
  23828. return memoized;
  23829. }
  23830. // Expose `MapCache`.
  23831. memoize.Cache = MapCache;
  23832. /**
  23833. * Creates a function that negates the result of the predicate `func`. The
  23834. * `func` predicate is invoked with the `this` binding and arguments of the
  23835. * created function.
  23836. *
  23837. * @static
  23838. * @memberOf _
  23839. * @since 3.0.0
  23840. * @category Function
  23841. * @param {Function} predicate The predicate to negate.
  23842. * @returns {Function} Returns the new negated function.
  23843. * @example
  23844. *
  23845. * function isEven(n) {
  23846. * return n % 2 == 0;
  23847. * }
  23848. *
  23849. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  23850. * // => [1, 3, 5]
  23851. */
  23852. function negate(predicate) {
  23853. if (typeof predicate != 'function') {
  23854. throw new TypeError(FUNC_ERROR_TEXT);
  23855. }
  23856. return function() {
  23857. var args = arguments;
  23858. switch (args.length) {
  23859. case 0: return !predicate.call(this);
  23860. case 1: return !predicate.call(this, args[0]);
  23861. case 2: return !predicate.call(this, args[0], args[1]);
  23862. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  23863. }
  23864. return !predicate.apply(this, args);
  23865. };
  23866. }
  23867. /**
  23868. * Creates a function that is restricted to invoking `func` once. Repeat calls
  23869. * to the function return the value of the first invocation. The `func` is
  23870. * invoked with the `this` binding and arguments of the created function.
  23871. *
  23872. * @static
  23873. * @memberOf _
  23874. * @since 0.1.0
  23875. * @category Function
  23876. * @param {Function} func The function to restrict.
  23877. * @returns {Function} Returns the new restricted function.
  23878. * @example
  23879. *
  23880. * var initialize = _.once(createApplication);
  23881. * initialize();
  23882. * initialize();
  23883. * // => `createApplication` is invoked once
  23884. */
  23885. function once(func) {
  23886. return before(2, func);
  23887. }
  23888. /**
  23889. * Creates a function that invokes `func` with its arguments transformed.
  23890. *
  23891. * @static
  23892. * @since 4.0.0
  23893. * @memberOf _
  23894. * @category Function
  23895. * @param {Function} func The function to wrap.
  23896. * @param {...(Function|Function[])} [transforms=[_.identity]]
  23897. * The argument transforms.
  23898. * @returns {Function} Returns the new function.
  23899. * @example
  23900. *
  23901. * function doubled(n) {
  23902. * return n * 2;
  23903. * }
  23904. *
  23905. * function square(n) {
  23906. * return n * n;
  23907. * }
  23908. *
  23909. * var func = _.overArgs(function(x, y) {
  23910. * return [x, y];
  23911. * }, [square, doubled]);
  23912. *
  23913. * func(9, 3);
  23914. * // => [81, 6]
  23915. *
  23916. * func(10, 5);
  23917. * // => [100, 10]
  23918. */
  23919. var overArgs = castRest(function(func, transforms) {
  23920. transforms = (transforms.length == 1 && isArray(transforms[0]))
  23921. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  23922. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  23923. var funcsLength = transforms.length;
  23924. return baseRest(function(args) {
  23925. var index = -1,
  23926. length = nativeMin(args.length, funcsLength);
  23927. while (++index < length) {
  23928. args[index] = transforms[index].call(this, args[index]);
  23929. }
  23930. return apply(func, this, args);
  23931. });
  23932. });
  23933. /**
  23934. * Creates a function that invokes `func` with `partials` prepended to the
  23935. * arguments it receives. This method is like `_.bind` except it does **not**
  23936. * alter the `this` binding.
  23937. *
  23938. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  23939. * builds, may be used as a placeholder for partially applied arguments.
  23940. *
  23941. * **Note:** This method doesn't set the "length" property of partially
  23942. * applied functions.
  23943. *
  23944. * @static
  23945. * @memberOf _
  23946. * @since 0.2.0
  23947. * @category Function
  23948. * @param {Function} func The function to partially apply arguments to.
  23949. * @param {...*} [partials] The arguments to be partially applied.
  23950. * @returns {Function} Returns the new partially applied function.
  23951. * @example
  23952. *
  23953. * function greet(greeting, name) {
  23954. * return greeting + ' ' + name;
  23955. * }
  23956. *
  23957. * var sayHelloTo = _.partial(greet, 'hello');
  23958. * sayHelloTo('fred');
  23959. * // => 'hello fred'
  23960. *
  23961. * // Partially applied with placeholders.
  23962. * var greetFred = _.partial(greet, _, 'fred');
  23963. * greetFred('hi');
  23964. * // => 'hi fred'
  23965. */
  23966. var partial = baseRest(function(func, partials) {
  23967. var holders = replaceHolders(partials, getHolder(partial));
  23968. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  23969. });
  23970. /**
  23971. * This method is like `_.partial` except that partially applied arguments
  23972. * are appended to the arguments it receives.
  23973. *
  23974. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  23975. * builds, may be used as a placeholder for partially applied arguments.
  23976. *
  23977. * **Note:** This method doesn't set the "length" property of partially
  23978. * applied functions.
  23979. *
  23980. * @static
  23981. * @memberOf _
  23982. * @since 1.0.0
  23983. * @category Function
  23984. * @param {Function} func The function to partially apply arguments to.
  23985. * @param {...*} [partials] The arguments to be partially applied.
  23986. * @returns {Function} Returns the new partially applied function.
  23987. * @example
  23988. *
  23989. * function greet(greeting, name) {
  23990. * return greeting + ' ' + name;
  23991. * }
  23992. *
  23993. * var greetFred = _.partialRight(greet, 'fred');
  23994. * greetFred('hi');
  23995. * // => 'hi fred'
  23996. *
  23997. * // Partially applied with placeholders.
  23998. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  23999. * sayHelloTo('fred');
  24000. * // => 'hello fred'
  24001. */
  24002. var partialRight = baseRest(function(func, partials) {
  24003. var holders = replaceHolders(partials, getHolder(partialRight));
  24004. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  24005. });
  24006. /**
  24007. * Creates a function that invokes `func` with arguments arranged according
  24008. * to the specified `indexes` where the argument value at the first index is
  24009. * provided as the first argument, the argument value at the second index is
  24010. * provided as the second argument, and so on.
  24011. *
  24012. * @static
  24013. * @memberOf _
  24014. * @since 3.0.0
  24015. * @category Function
  24016. * @param {Function} func The function to rearrange arguments for.
  24017. * @param {...(number|number[])} indexes The arranged argument indexes.
  24018. * @returns {Function} Returns the new function.
  24019. * @example
  24020. *
  24021. * var rearged = _.rearg(function(a, b, c) {
  24022. * return [a, b, c];
  24023. * }, [2, 0, 1]);
  24024. *
  24025. * rearged('b', 'c', 'a')
  24026. * // => ['a', 'b', 'c']
  24027. */
  24028. var rearg = flatRest(function(func, indexes) {
  24029. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  24030. });
  24031. /**
  24032. * Creates a function that invokes `func` with the `this` binding of the
  24033. * created function and arguments from `start` and beyond provided as
  24034. * an array.
  24035. *
  24036. * **Note:** This method is based on the
  24037. * [rest parameter](https://mdn.io/rest_parameters).
  24038. *
  24039. * @static
  24040. * @memberOf _
  24041. * @since 4.0.0
  24042. * @category Function
  24043. * @param {Function} func The function to apply a rest parameter to.
  24044. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24045. * @returns {Function} Returns the new function.
  24046. * @example
  24047. *
  24048. * var say = _.rest(function(what, names) {
  24049. * return what + ' ' + _.initial(names).join(', ') +
  24050. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  24051. * });
  24052. *
  24053. * say('hello', 'fred', 'barney', 'pebbles');
  24054. * // => 'hello fred, barney, & pebbles'
  24055. */
  24056. function rest(func, start) {
  24057. if (typeof func != 'function') {
  24058. throw new TypeError(FUNC_ERROR_TEXT);
  24059. }
  24060. start = start === undefined ? start : toInteger(start);
  24061. return baseRest(func, start);
  24062. }
  24063. /**
  24064. * Creates a function that invokes `func` with the `this` binding of the
  24065. * create function and an array of arguments much like
  24066. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  24067. *
  24068. * **Note:** This method is based on the
  24069. * [spread operator](https://mdn.io/spread_operator).
  24070. *
  24071. * @static
  24072. * @memberOf _
  24073. * @since 3.2.0
  24074. * @category Function
  24075. * @param {Function} func The function to spread arguments over.
  24076. * @param {number} [start=0] The start position of the spread.
  24077. * @returns {Function} Returns the new function.
  24078. * @example
  24079. *
  24080. * var say = _.spread(function(who, what) {
  24081. * return who + ' says ' + what;
  24082. * });
  24083. *
  24084. * say(['fred', 'hello']);
  24085. * // => 'fred says hello'
  24086. *
  24087. * var numbers = Promise.all([
  24088. * Promise.resolve(40),
  24089. * Promise.resolve(36)
  24090. * ]);
  24091. *
  24092. * numbers.then(_.spread(function(x, y) {
  24093. * return x + y;
  24094. * }));
  24095. * // => a Promise of 76
  24096. */
  24097. function spread(func, start) {
  24098. if (typeof func != 'function') {
  24099. throw new TypeError(FUNC_ERROR_TEXT);
  24100. }
  24101. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  24102. return baseRest(function(args) {
  24103. var array = args[start],
  24104. otherArgs = castSlice(args, 0, start);
  24105. if (array) {
  24106. arrayPush(otherArgs, array);
  24107. }
  24108. return apply(func, this, otherArgs);
  24109. });
  24110. }
  24111. /**
  24112. * Creates a throttled function that only invokes `func` at most once per
  24113. * every `wait` milliseconds. The throttled function comes with a `cancel`
  24114. * method to cancel delayed `func` invocations and a `flush` method to
  24115. * immediately invoke them. Provide `options` to indicate whether `func`
  24116. * should be invoked on the leading and/or trailing edge of the `wait`
  24117. * timeout. The `func` is invoked with the last arguments provided to the
  24118. * throttled function. Subsequent calls to the throttled function return the
  24119. * result of the last `func` invocation.
  24120. *
  24121. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  24122. * invoked on the trailing edge of the timeout only if the throttled function
  24123. * is invoked more than once during the `wait` timeout.
  24124. *
  24125. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  24126. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  24127. *
  24128. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  24129. * for details over the differences between `_.throttle` and `_.debounce`.
  24130. *
  24131. * @static
  24132. * @memberOf _
  24133. * @since 0.1.0
  24134. * @category Function
  24135. * @param {Function} func The function to throttle.
  24136. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  24137. * @param {Object} [options={}] The options object.
  24138. * @param {boolean} [options.leading=true]
  24139. * Specify invoking on the leading edge of the timeout.
  24140. * @param {boolean} [options.trailing=true]
  24141. * Specify invoking on the trailing edge of the timeout.
  24142. * @returns {Function} Returns the new throttled function.
  24143. * @example
  24144. *
  24145. * // Avoid excessively updating the position while scrolling.
  24146. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  24147. *
  24148. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  24149. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  24150. * jQuery(element).on('click', throttled);
  24151. *
  24152. * // Cancel the trailing throttled invocation.
  24153. * jQuery(window).on('popstate', throttled.cancel);
  24154. */
  24155. function throttle(func, wait, options) {
  24156. var leading = true,
  24157. trailing = true;
  24158. if (typeof func != 'function') {
  24159. throw new TypeError(FUNC_ERROR_TEXT);
  24160. }
  24161. if (isObject(options)) {
  24162. leading = 'leading' in options ? !!options.leading : leading;
  24163. trailing = 'trailing' in options ? !!options.trailing : trailing;
  24164. }
  24165. return debounce(func, wait, {
  24166. 'leading': leading,
  24167. 'maxWait': wait,
  24168. 'trailing': trailing
  24169. });
  24170. }
  24171. /**
  24172. * Creates a function that accepts up to one argument, ignoring any
  24173. * additional arguments.
  24174. *
  24175. * @static
  24176. * @memberOf _
  24177. * @since 4.0.0
  24178. * @category Function
  24179. * @param {Function} func The function to cap arguments for.
  24180. * @returns {Function} Returns the new capped function.
  24181. * @example
  24182. *
  24183. * _.map(['6', '8', '10'], _.unary(parseInt));
  24184. * // => [6, 8, 10]
  24185. */
  24186. function unary(func) {
  24187. return ary(func, 1);
  24188. }
  24189. /**
  24190. * Creates a function that provides `value` to `wrapper` as its first
  24191. * argument. Any additional arguments provided to the function are appended
  24192. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  24193. * binding of the created function.
  24194. *
  24195. * @static
  24196. * @memberOf _
  24197. * @since 0.1.0
  24198. * @category Function
  24199. * @param {*} value The value to wrap.
  24200. * @param {Function} [wrapper=identity] The wrapper function.
  24201. * @returns {Function} Returns the new function.
  24202. * @example
  24203. *
  24204. * var p = _.wrap(_.escape, function(func, text) {
  24205. * return '<p>' + func(text) + '</p>';
  24206. * });
  24207. *
  24208. * p('fred, barney, & pebbles');
  24209. * // => '<p>fred, barney, &amp; pebbles</p>'
  24210. */
  24211. function wrap(value, wrapper) {
  24212. return partial(castFunction(wrapper), value);
  24213. }
  24214. /*------------------------------------------------------------------------*/
  24215. /**
  24216. * Casts `value` as an array if it's not one.
  24217. *
  24218. * @static
  24219. * @memberOf _
  24220. * @since 4.4.0
  24221. * @category Lang
  24222. * @param {*} value The value to inspect.
  24223. * @returns {Array} Returns the cast array.
  24224. * @example
  24225. *
  24226. * _.castArray(1);
  24227. * // => [1]
  24228. *
  24229. * _.castArray({ 'a': 1 });
  24230. * // => [{ 'a': 1 }]
  24231. *
  24232. * _.castArray('abc');
  24233. * // => ['abc']
  24234. *
  24235. * _.castArray(null);
  24236. * // => [null]
  24237. *
  24238. * _.castArray(undefined);
  24239. * // => [undefined]
  24240. *
  24241. * _.castArray();
  24242. * // => []
  24243. *
  24244. * var array = [1, 2, 3];
  24245. * console.log(_.castArray(array) === array);
  24246. * // => true
  24247. */
  24248. function castArray() {
  24249. if (!arguments.length) {
  24250. return [];
  24251. }
  24252. var value = arguments[0];
  24253. return isArray(value) ? value : [value];
  24254. }
  24255. /**
  24256. * Creates a shallow clone of `value`.
  24257. *
  24258. * **Note:** This method is loosely based on the
  24259. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  24260. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  24261. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  24262. * arrays. The own enumerable properties of `arguments` objects are cloned
  24263. * as plain objects. An empty object is returned for uncloneable values such
  24264. * as error objects, functions, DOM nodes, and WeakMaps.
  24265. *
  24266. * @static
  24267. * @memberOf _
  24268. * @since 0.1.0
  24269. * @category Lang
  24270. * @param {*} value The value to clone.
  24271. * @returns {*} Returns the cloned value.
  24272. * @see _.cloneDeep
  24273. * @example
  24274. *
  24275. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24276. *
  24277. * var shallow = _.clone(objects);
  24278. * console.log(shallow[0] === objects[0]);
  24279. * // => true
  24280. */
  24281. function clone(value) {
  24282. return baseClone(value, CLONE_SYMBOLS_FLAG);
  24283. }
  24284. /**
  24285. * This method is like `_.clone` except that it accepts `customizer` which
  24286. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  24287. * cloning is handled by the method instead. The `customizer` is invoked with
  24288. * up to four arguments; (value [, index|key, object, stack]).
  24289. *
  24290. * @static
  24291. * @memberOf _
  24292. * @since 4.0.0
  24293. * @category Lang
  24294. * @param {*} value The value to clone.
  24295. * @param {Function} [customizer] The function to customize cloning.
  24296. * @returns {*} Returns the cloned value.
  24297. * @see _.cloneDeepWith
  24298. * @example
  24299. *
  24300. * function customizer(value) {
  24301. * if (_.isElement(value)) {
  24302. * return value.cloneNode(false);
  24303. * }
  24304. * }
  24305. *
  24306. * var el = _.cloneWith(document.body, customizer);
  24307. *
  24308. * console.log(el === document.body);
  24309. * // => false
  24310. * console.log(el.nodeName);
  24311. * // => 'BODY'
  24312. * console.log(el.childNodes.length);
  24313. * // => 0
  24314. */
  24315. function cloneWith(value, customizer) {
  24316. customizer = typeof customizer == 'function' ? customizer : undefined;
  24317. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  24318. }
  24319. /**
  24320. * This method is like `_.clone` except that it recursively clones `value`.
  24321. *
  24322. * @static
  24323. * @memberOf _
  24324. * @since 1.0.0
  24325. * @category Lang
  24326. * @param {*} value The value to recursively clone.
  24327. * @returns {*} Returns the deep cloned value.
  24328. * @see _.clone
  24329. * @example
  24330. *
  24331. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24332. *
  24333. * var deep = _.cloneDeep(objects);
  24334. * console.log(deep[0] === objects[0]);
  24335. * // => false
  24336. */
  24337. function cloneDeep(value) {
  24338. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  24339. }
  24340. /**
  24341. * This method is like `_.cloneWith` except that it recursively clones `value`.
  24342. *
  24343. * @static
  24344. * @memberOf _
  24345. * @since 4.0.0
  24346. * @category Lang
  24347. * @param {*} value The value to recursively clone.
  24348. * @param {Function} [customizer] The function to customize cloning.
  24349. * @returns {*} Returns the deep cloned value.
  24350. * @see _.cloneWith
  24351. * @example
  24352. *
  24353. * function customizer(value) {
  24354. * if (_.isElement(value)) {
  24355. * return value.cloneNode(true);
  24356. * }
  24357. * }
  24358. *
  24359. * var el = _.cloneDeepWith(document.body, customizer);
  24360. *
  24361. * console.log(el === document.body);
  24362. * // => false
  24363. * console.log(el.nodeName);
  24364. * // => 'BODY'
  24365. * console.log(el.childNodes.length);
  24366. * // => 20
  24367. */
  24368. function cloneDeepWith(value, customizer) {
  24369. customizer = typeof customizer == 'function' ? customizer : undefined;
  24370. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  24371. }
  24372. /**
  24373. * Checks if `object` conforms to `source` by invoking the predicate
  24374. * properties of `source` with the corresponding property values of `object`.
  24375. *
  24376. * **Note:** This method is equivalent to `_.conforms` when `source` is
  24377. * partially applied.
  24378. *
  24379. * @static
  24380. * @memberOf _
  24381. * @since 4.14.0
  24382. * @category Lang
  24383. * @param {Object} object The object to inspect.
  24384. * @param {Object} source The object of property predicates to conform to.
  24385. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  24386. * @example
  24387. *
  24388. * var object = { 'a': 1, 'b': 2 };
  24389. *
  24390. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  24391. * // => true
  24392. *
  24393. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  24394. * // => false
  24395. */
  24396. function conformsTo(object, source) {
  24397. return source == null || baseConformsTo(object, source, keys(source));
  24398. }
  24399. /**
  24400. * Performs a
  24401. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24402. * comparison between two values to determine if they are equivalent.
  24403. *
  24404. * @static
  24405. * @memberOf _
  24406. * @since 4.0.0
  24407. * @category Lang
  24408. * @param {*} value The value to compare.
  24409. * @param {*} other The other value to compare.
  24410. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24411. * @example
  24412. *
  24413. * var object = { 'a': 1 };
  24414. * var other = { 'a': 1 };
  24415. *
  24416. * _.eq(object, object);
  24417. * // => true
  24418. *
  24419. * _.eq(object, other);
  24420. * // => false
  24421. *
  24422. * _.eq('a', 'a');
  24423. * // => true
  24424. *
  24425. * _.eq('a', Object('a'));
  24426. * // => false
  24427. *
  24428. * _.eq(NaN, NaN);
  24429. * // => true
  24430. */
  24431. function eq(value, other) {
  24432. return value === other || (value !== value && other !== other);
  24433. }
  24434. /**
  24435. * Checks if `value` is greater than `other`.
  24436. *
  24437. * @static
  24438. * @memberOf _
  24439. * @since 3.9.0
  24440. * @category Lang
  24441. * @param {*} value The value to compare.
  24442. * @param {*} other The other value to compare.
  24443. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  24444. * else `false`.
  24445. * @see _.lt
  24446. * @example
  24447. *
  24448. * _.gt(3, 1);
  24449. * // => true
  24450. *
  24451. * _.gt(3, 3);
  24452. * // => false
  24453. *
  24454. * _.gt(1, 3);
  24455. * // => false
  24456. */
  24457. var gt = createRelationalOperation(baseGt);
  24458. /**
  24459. * Checks if `value` is greater than or equal to `other`.
  24460. *
  24461. * @static
  24462. * @memberOf _
  24463. * @since 3.9.0
  24464. * @category Lang
  24465. * @param {*} value The value to compare.
  24466. * @param {*} other The other value to compare.
  24467. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  24468. * `other`, else `false`.
  24469. * @see _.lte
  24470. * @example
  24471. *
  24472. * _.gte(3, 1);
  24473. * // => true
  24474. *
  24475. * _.gte(3, 3);
  24476. * // => true
  24477. *
  24478. * _.gte(1, 3);
  24479. * // => false
  24480. */
  24481. var gte = createRelationalOperation(function(value, other) {
  24482. return value >= other;
  24483. });
  24484. /**
  24485. * Checks if `value` is likely an `arguments` object.
  24486. *
  24487. * @static
  24488. * @memberOf _
  24489. * @since 0.1.0
  24490. * @category Lang
  24491. * @param {*} value The value to check.
  24492. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  24493. * else `false`.
  24494. * @example
  24495. *
  24496. * _.isArguments(function() { return arguments; }());
  24497. * // => true
  24498. *
  24499. * _.isArguments([1, 2, 3]);
  24500. * // => false
  24501. */
  24502. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  24503. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  24504. !propertyIsEnumerable.call(value, 'callee');
  24505. };
  24506. /**
  24507. * Checks if `value` is classified as an `Array` object.
  24508. *
  24509. * @static
  24510. * @memberOf _
  24511. * @since 0.1.0
  24512. * @category Lang
  24513. * @param {*} value The value to check.
  24514. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  24515. * @example
  24516. *
  24517. * _.isArray([1, 2, 3]);
  24518. * // => true
  24519. *
  24520. * _.isArray(document.body.children);
  24521. * // => false
  24522. *
  24523. * _.isArray('abc');
  24524. * // => false
  24525. *
  24526. * _.isArray(_.noop);
  24527. * // => false
  24528. */
  24529. var isArray = Array.isArray;
  24530. /**
  24531. * Checks if `value` is classified as an `ArrayBuffer` object.
  24532. *
  24533. * @static
  24534. * @memberOf _
  24535. * @since 4.3.0
  24536. * @category Lang
  24537. * @param {*} value The value to check.
  24538. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  24539. * @example
  24540. *
  24541. * _.isArrayBuffer(new ArrayBuffer(2));
  24542. * // => true
  24543. *
  24544. * _.isArrayBuffer(new Array(2));
  24545. * // => false
  24546. */
  24547. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  24548. /**
  24549. * Checks if `value` is array-like. A value is considered array-like if it's
  24550. * not a function and has a `value.length` that's an integer greater than or
  24551. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  24552. *
  24553. * @static
  24554. * @memberOf _
  24555. * @since 4.0.0
  24556. * @category Lang
  24557. * @param {*} value The value to check.
  24558. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  24559. * @example
  24560. *
  24561. * _.isArrayLike([1, 2, 3]);
  24562. * // => true
  24563. *
  24564. * _.isArrayLike(document.body.children);
  24565. * // => true
  24566. *
  24567. * _.isArrayLike('abc');
  24568. * // => true
  24569. *
  24570. * _.isArrayLike(_.noop);
  24571. * // => false
  24572. */
  24573. function isArrayLike(value) {
  24574. return value != null && isLength(value.length) && !isFunction(value);
  24575. }
  24576. /**
  24577. * This method is like `_.isArrayLike` except that it also checks if `value`
  24578. * is an object.
  24579. *
  24580. * @static
  24581. * @memberOf _
  24582. * @since 4.0.0
  24583. * @category Lang
  24584. * @param {*} value The value to check.
  24585. * @returns {boolean} Returns `true` if `value` is an array-like object,
  24586. * else `false`.
  24587. * @example
  24588. *
  24589. * _.isArrayLikeObject([1, 2, 3]);
  24590. * // => true
  24591. *
  24592. * _.isArrayLikeObject(document.body.children);
  24593. * // => true
  24594. *
  24595. * _.isArrayLikeObject('abc');
  24596. * // => false
  24597. *
  24598. * _.isArrayLikeObject(_.noop);
  24599. * // => false
  24600. */
  24601. function isArrayLikeObject(value) {
  24602. return isObjectLike(value) && isArrayLike(value);
  24603. }
  24604. /**
  24605. * Checks if `value` is classified as a boolean primitive or object.
  24606. *
  24607. * @static
  24608. * @memberOf _
  24609. * @since 0.1.0
  24610. * @category Lang
  24611. * @param {*} value The value to check.
  24612. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  24613. * @example
  24614. *
  24615. * _.isBoolean(false);
  24616. * // => true
  24617. *
  24618. * _.isBoolean(null);
  24619. * // => false
  24620. */
  24621. function isBoolean(value) {
  24622. return value === true || value === false ||
  24623. (isObjectLike(value) && baseGetTag(value) == boolTag);
  24624. }
  24625. /**
  24626. * Checks if `value` is a buffer.
  24627. *
  24628. * @static
  24629. * @memberOf _
  24630. * @since 4.3.0
  24631. * @category Lang
  24632. * @param {*} value The value to check.
  24633. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  24634. * @example
  24635. *
  24636. * _.isBuffer(new Buffer(2));
  24637. * // => true
  24638. *
  24639. * _.isBuffer(new Uint8Array(2));
  24640. * // => false
  24641. */
  24642. var isBuffer = nativeIsBuffer || stubFalse;
  24643. /**
  24644. * Checks if `value` is classified as a `Date` object.
  24645. *
  24646. * @static
  24647. * @memberOf _
  24648. * @since 0.1.0
  24649. * @category Lang
  24650. * @param {*} value The value to check.
  24651. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24652. * @example
  24653. *
  24654. * _.isDate(new Date);
  24655. * // => true
  24656. *
  24657. * _.isDate('Mon April 23 2012');
  24658. * // => false
  24659. */
  24660. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  24661. /**
  24662. * Checks if `value` is likely a DOM element.
  24663. *
  24664. * @static
  24665. * @memberOf _
  24666. * @since 0.1.0
  24667. * @category Lang
  24668. * @param {*} value The value to check.
  24669. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  24670. * @example
  24671. *
  24672. * _.isElement(document.body);
  24673. * // => true
  24674. *
  24675. * _.isElement('<body>');
  24676. * // => false
  24677. */
  24678. function isElement(value) {
  24679. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  24680. }
  24681. /**
  24682. * Checks if `value` is an empty object, collection, map, or set.
  24683. *
  24684. * Objects are considered empty if they have no own enumerable string keyed
  24685. * properties.
  24686. *
  24687. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  24688. * jQuery-like collections are considered empty if they have a `length` of `0`.
  24689. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  24690. *
  24691. * @static
  24692. * @memberOf _
  24693. * @since 0.1.0
  24694. * @category Lang
  24695. * @param {*} value The value to check.
  24696. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  24697. * @example
  24698. *
  24699. * _.isEmpty(null);
  24700. * // => true
  24701. *
  24702. * _.isEmpty(true);
  24703. * // => true
  24704. *
  24705. * _.isEmpty(1);
  24706. * // => true
  24707. *
  24708. * _.isEmpty([1, 2, 3]);
  24709. * // => false
  24710. *
  24711. * _.isEmpty({ 'a': 1 });
  24712. * // => false
  24713. */
  24714. function isEmpty(value) {
  24715. if (value == null) {
  24716. return true;
  24717. }
  24718. if (isArrayLike(value) &&
  24719. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  24720. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  24721. return !value.length;
  24722. }
  24723. var tag = getTag(value);
  24724. if (tag == mapTag || tag == setTag) {
  24725. return !value.size;
  24726. }
  24727. if (isPrototype(value)) {
  24728. return !baseKeys(value).length;
  24729. }
  24730. for (var key in value) {
  24731. if (hasOwnProperty.call(value, key)) {
  24732. return false;
  24733. }
  24734. }
  24735. return true;
  24736. }
  24737. /**
  24738. * Performs a deep comparison between two values to determine if they are
  24739. * equivalent.
  24740. *
  24741. * **Note:** This method supports comparing arrays, array buffers, booleans,
  24742. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  24743. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  24744. * by their own, not inherited, enumerable properties. Functions and DOM
  24745. * nodes are compared by strict equality, i.e. `===`.
  24746. *
  24747. * @static
  24748. * @memberOf _
  24749. * @since 0.1.0
  24750. * @category Lang
  24751. * @param {*} value The value to compare.
  24752. * @param {*} other The other value to compare.
  24753. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24754. * @example
  24755. *
  24756. * var object = { 'a': 1 };
  24757. * var other = { 'a': 1 };
  24758. *
  24759. * _.isEqual(object, other);
  24760. * // => true
  24761. *
  24762. * object === other;
  24763. * // => false
  24764. */
  24765. function isEqual(value, other) {
  24766. return baseIsEqual(value, other);
  24767. }
  24768. /**
  24769. * This method is like `_.isEqual` except that it accepts `customizer` which
  24770. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24771. * are handled by the method instead. The `customizer` is invoked with up to
  24772. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  24773. *
  24774. * @static
  24775. * @memberOf _
  24776. * @since 4.0.0
  24777. * @category Lang
  24778. * @param {*} value The value to compare.
  24779. * @param {*} other The other value to compare.
  24780. * @param {Function} [customizer] The function to customize comparisons.
  24781. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24782. * @example
  24783. *
  24784. * function isGreeting(value) {
  24785. * return /^h(?:i|ello)$/.test(value);
  24786. * }
  24787. *
  24788. * function customizer(objValue, othValue) {
  24789. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24790. * return true;
  24791. * }
  24792. * }
  24793. *
  24794. * var array = ['hello', 'goodbye'];
  24795. * var other = ['hi', 'goodbye'];
  24796. *
  24797. * _.isEqualWith(array, other, customizer);
  24798. * // => true
  24799. */
  24800. function isEqualWith(value, other, customizer) {
  24801. customizer = typeof customizer == 'function' ? customizer : undefined;
  24802. var result = customizer ? customizer(value, other) : undefined;
  24803. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  24804. }
  24805. /**
  24806. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  24807. * `SyntaxError`, `TypeError`, or `URIError` object.
  24808. *
  24809. * @static
  24810. * @memberOf _
  24811. * @since 3.0.0
  24812. * @category Lang
  24813. * @param {*} value The value to check.
  24814. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  24815. * @example
  24816. *
  24817. * _.isError(new Error);
  24818. * // => true
  24819. *
  24820. * _.isError(Error);
  24821. * // => false
  24822. */
  24823. function isError(value) {
  24824. if (!isObjectLike(value)) {
  24825. return false;
  24826. }
  24827. var tag = baseGetTag(value);
  24828. return tag == errorTag || tag == domExcTag ||
  24829. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  24830. }
  24831. /**
  24832. * Checks if `value` is a finite primitive number.
  24833. *
  24834. * **Note:** This method is based on
  24835. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  24836. *
  24837. * @static
  24838. * @memberOf _
  24839. * @since 0.1.0
  24840. * @category Lang
  24841. * @param {*} value The value to check.
  24842. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  24843. * @example
  24844. *
  24845. * _.isFinite(3);
  24846. * // => true
  24847. *
  24848. * _.isFinite(Number.MIN_VALUE);
  24849. * // => true
  24850. *
  24851. * _.isFinite(Infinity);
  24852. * // => false
  24853. *
  24854. * _.isFinite('3');
  24855. * // => false
  24856. */
  24857. function isFinite(value) {
  24858. return typeof value == 'number' && nativeIsFinite(value);
  24859. }
  24860. /**
  24861. * Checks if `value` is classified as a `Function` object.
  24862. *
  24863. * @static
  24864. * @memberOf _
  24865. * @since 0.1.0
  24866. * @category Lang
  24867. * @param {*} value The value to check.
  24868. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  24869. * @example
  24870. *
  24871. * _.isFunction(_);
  24872. * // => true
  24873. *
  24874. * _.isFunction(/abc/);
  24875. * // => false
  24876. */
  24877. function isFunction(value) {
  24878. if (!isObject(value)) {
  24879. return false;
  24880. }
  24881. // The use of `Object#toString` avoids issues with the `typeof` operator
  24882. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  24883. var tag = baseGetTag(value);
  24884. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  24885. }
  24886. /**
  24887. * Checks if `value` is an integer.
  24888. *
  24889. * **Note:** This method is based on
  24890. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  24891. *
  24892. * @static
  24893. * @memberOf _
  24894. * @since 4.0.0
  24895. * @category Lang
  24896. * @param {*} value The value to check.
  24897. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  24898. * @example
  24899. *
  24900. * _.isInteger(3);
  24901. * // => true
  24902. *
  24903. * _.isInteger(Number.MIN_VALUE);
  24904. * // => false
  24905. *
  24906. * _.isInteger(Infinity);
  24907. * // => false
  24908. *
  24909. * _.isInteger('3');
  24910. * // => false
  24911. */
  24912. function isInteger(value) {
  24913. return typeof value == 'number' && value == toInteger(value);
  24914. }
  24915. /**
  24916. * Checks if `value` is a valid array-like length.
  24917. *
  24918. * **Note:** This method is loosely based on
  24919. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24920. *
  24921. * @static
  24922. * @memberOf _
  24923. * @since 4.0.0
  24924. * @category Lang
  24925. * @param {*} value The value to check.
  24926. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  24927. * @example
  24928. *
  24929. * _.isLength(3);
  24930. * // => true
  24931. *
  24932. * _.isLength(Number.MIN_VALUE);
  24933. * // => false
  24934. *
  24935. * _.isLength(Infinity);
  24936. * // => false
  24937. *
  24938. * _.isLength('3');
  24939. * // => false
  24940. */
  24941. function isLength(value) {
  24942. return typeof value == 'number' &&
  24943. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  24944. }
  24945. /**
  24946. * Checks if `value` is the
  24947. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  24948. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  24949. *
  24950. * @static
  24951. * @memberOf _
  24952. * @since 0.1.0
  24953. * @category Lang
  24954. * @param {*} value The value to check.
  24955. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  24956. * @example
  24957. *
  24958. * _.isObject({});
  24959. * // => true
  24960. *
  24961. * _.isObject([1, 2, 3]);
  24962. * // => true
  24963. *
  24964. * _.isObject(_.noop);
  24965. * // => true
  24966. *
  24967. * _.isObject(null);
  24968. * // => false
  24969. */
  24970. function isObject(value) {
  24971. var type = typeof value;
  24972. return value != null && (type == 'object' || type == 'function');
  24973. }
  24974. /**
  24975. * Checks if `value` is object-like. A value is object-like if it's not `null`
  24976. * and has a `typeof` result of "object".
  24977. *
  24978. * @static
  24979. * @memberOf _
  24980. * @since 4.0.0
  24981. * @category Lang
  24982. * @param {*} value The value to check.
  24983. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  24984. * @example
  24985. *
  24986. * _.isObjectLike({});
  24987. * // => true
  24988. *
  24989. * _.isObjectLike([1, 2, 3]);
  24990. * // => true
  24991. *
  24992. * _.isObjectLike(_.noop);
  24993. * // => false
  24994. *
  24995. * _.isObjectLike(null);
  24996. * // => false
  24997. */
  24998. function isObjectLike(value) {
  24999. return value != null && typeof value == 'object';
  25000. }
  25001. /**
  25002. * Checks if `value` is classified as a `Map` object.
  25003. *
  25004. * @static
  25005. * @memberOf _
  25006. * @since 4.3.0
  25007. * @category Lang
  25008. * @param {*} value The value to check.
  25009. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  25010. * @example
  25011. *
  25012. * _.isMap(new Map);
  25013. * // => true
  25014. *
  25015. * _.isMap(new WeakMap);
  25016. * // => false
  25017. */
  25018. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  25019. /**
  25020. * Performs a partial deep comparison between `object` and `source` to
  25021. * determine if `object` contains equivalent property values.
  25022. *
  25023. * **Note:** This method is equivalent to `_.matches` when `source` is
  25024. * partially applied.
  25025. *
  25026. * Partial comparisons will match empty array and empty object `source`
  25027. * values against any array or object value, respectively. See `_.isEqual`
  25028. * for a list of supported value comparisons.
  25029. *
  25030. * @static
  25031. * @memberOf _
  25032. * @since 3.0.0
  25033. * @category Lang
  25034. * @param {Object} object The object to inspect.
  25035. * @param {Object} source The object of property values to match.
  25036. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  25037. * @example
  25038. *
  25039. * var object = { 'a': 1, 'b': 2 };
  25040. *
  25041. * _.isMatch(object, { 'b': 2 });
  25042. * // => true
  25043. *
  25044. * _.isMatch(object, { 'b': 1 });
  25045. * // => false
  25046. */
  25047. function isMatch(object, source) {
  25048. return object === source || baseIsMatch(object, source, getMatchData(source));
  25049. }
  25050. /**
  25051. * This method is like `_.isMatch` except that it accepts `customizer` which
  25052. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  25053. * are handled by the method instead. The `customizer` is invoked with five
  25054. * arguments: (objValue, srcValue, index|key, object, source).
  25055. *
  25056. * @static
  25057. * @memberOf _
  25058. * @since 4.0.0
  25059. * @category Lang
  25060. * @param {Object} object The object to inspect.
  25061. * @param {Object} source The object of property values to match.
  25062. * @param {Function} [customizer] The function to customize comparisons.
  25063. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  25064. * @example
  25065. *
  25066. * function isGreeting(value) {
  25067. * return /^h(?:i|ello)$/.test(value);
  25068. * }
  25069. *
  25070. * function customizer(objValue, srcValue) {
  25071. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  25072. * return true;
  25073. * }
  25074. * }
  25075. *
  25076. * var object = { 'greeting': 'hello' };
  25077. * var source = { 'greeting': 'hi' };
  25078. *
  25079. * _.isMatchWith(object, source, customizer);
  25080. * // => true
  25081. */
  25082. function isMatchWith(object, source, customizer) {
  25083. customizer = typeof customizer == 'function' ? customizer : undefined;
  25084. return baseIsMatch(object, source, getMatchData(source), customizer);
  25085. }
  25086. /**
  25087. * Checks if `value` is `NaN`.
  25088. *
  25089. * **Note:** This method is based on
  25090. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  25091. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  25092. * `undefined` and other non-number values.
  25093. *
  25094. * @static
  25095. * @memberOf _
  25096. * @since 0.1.0
  25097. * @category Lang
  25098. * @param {*} value The value to check.
  25099. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  25100. * @example
  25101. *
  25102. * _.isNaN(NaN);
  25103. * // => true
  25104. *
  25105. * _.isNaN(new Number(NaN));
  25106. * // => true
  25107. *
  25108. * isNaN(undefined);
  25109. * // => true
  25110. *
  25111. * _.isNaN(undefined);
  25112. * // => false
  25113. */
  25114. function isNaN(value) {
  25115. // An `NaN` primitive is the only value that is not equal to itself.
  25116. // Perform the `toStringTag` check first to avoid errors with some
  25117. // ActiveX objects in IE.
  25118. return isNumber(value) && value != +value;
  25119. }
  25120. /**
  25121. * Checks if `value` is a pristine native function.
  25122. *
  25123. * **Note:** This method can't reliably detect native functions in the presence
  25124. * of the core-js package because core-js circumvents this kind of detection.
  25125. * Despite multiple requests, the core-js maintainer has made it clear: any
  25126. * attempt to fix the detection will be obstructed. As a result, we're left
  25127. * with little choice but to throw an error. Unfortunately, this also affects
  25128. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  25129. * which rely on core-js.
  25130. *
  25131. * @static
  25132. * @memberOf _
  25133. * @since 3.0.0
  25134. * @category Lang
  25135. * @param {*} value The value to check.
  25136. * @returns {boolean} Returns `true` if `value` is a native function,
  25137. * else `false`.
  25138. * @example
  25139. *
  25140. * _.isNative(Array.prototype.push);
  25141. * // => true
  25142. *
  25143. * _.isNative(_);
  25144. * // => false
  25145. */
  25146. function isNative(value) {
  25147. if (isMaskable(value)) {
  25148. throw new Error(CORE_ERROR_TEXT);
  25149. }
  25150. return baseIsNative(value);
  25151. }
  25152. /**
  25153. * Checks if `value` is `null`.
  25154. *
  25155. * @static
  25156. * @memberOf _
  25157. * @since 0.1.0
  25158. * @category Lang
  25159. * @param {*} value The value to check.
  25160. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  25161. * @example
  25162. *
  25163. * _.isNull(null);
  25164. * // => true
  25165. *
  25166. * _.isNull(void 0);
  25167. * // => false
  25168. */
  25169. function isNull(value) {
  25170. return value === null;
  25171. }
  25172. /**
  25173. * Checks if `value` is `null` or `undefined`.
  25174. *
  25175. * @static
  25176. * @memberOf _
  25177. * @since 4.0.0
  25178. * @category Lang
  25179. * @param {*} value The value to check.
  25180. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  25181. * @example
  25182. *
  25183. * _.isNil(null);
  25184. * // => true
  25185. *
  25186. * _.isNil(void 0);
  25187. * // => true
  25188. *
  25189. * _.isNil(NaN);
  25190. * // => false
  25191. */
  25192. function isNil(value) {
  25193. return value == null;
  25194. }
  25195. /**
  25196. * Checks if `value` is classified as a `Number` primitive or object.
  25197. *
  25198. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  25199. * classified as numbers, use the `_.isFinite` method.
  25200. *
  25201. * @static
  25202. * @memberOf _
  25203. * @since 0.1.0
  25204. * @category Lang
  25205. * @param {*} value The value to check.
  25206. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  25207. * @example
  25208. *
  25209. * _.isNumber(3);
  25210. * // => true
  25211. *
  25212. * _.isNumber(Number.MIN_VALUE);
  25213. * // => true
  25214. *
  25215. * _.isNumber(Infinity);
  25216. * // => true
  25217. *
  25218. * _.isNumber('3');
  25219. * // => false
  25220. */
  25221. function isNumber(value) {
  25222. return typeof value == 'number' ||
  25223. (isObjectLike(value) && baseGetTag(value) == numberTag);
  25224. }
  25225. /**
  25226. * Checks if `value` is a plain object, that is, an object created by the
  25227. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  25228. *
  25229. * @static
  25230. * @memberOf _
  25231. * @since 0.8.0
  25232. * @category Lang
  25233. * @param {*} value The value to check.
  25234. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  25235. * @example
  25236. *
  25237. * function Foo() {
  25238. * this.a = 1;
  25239. * }
  25240. *
  25241. * _.isPlainObject(new Foo);
  25242. * // => false
  25243. *
  25244. * _.isPlainObject([1, 2, 3]);
  25245. * // => false
  25246. *
  25247. * _.isPlainObject({ 'x': 0, 'y': 0 });
  25248. * // => true
  25249. *
  25250. * _.isPlainObject(Object.create(null));
  25251. * // => true
  25252. */
  25253. function isPlainObject(value) {
  25254. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  25255. return false;
  25256. }
  25257. var proto = getPrototype(value);
  25258. if (proto === null) {
  25259. return true;
  25260. }
  25261. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  25262. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  25263. funcToString.call(Ctor) == objectCtorString;
  25264. }
  25265. /**
  25266. * Checks if `value` is classified as a `RegExp` object.
  25267. *
  25268. * @static
  25269. * @memberOf _
  25270. * @since 0.1.0
  25271. * @category Lang
  25272. * @param {*} value The value to check.
  25273. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  25274. * @example
  25275. *
  25276. * _.isRegExp(/abc/);
  25277. * // => true
  25278. *
  25279. * _.isRegExp('/abc/');
  25280. * // => false
  25281. */
  25282. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  25283. /**
  25284. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  25285. * double precision number which isn't the result of a rounded unsafe integer.
  25286. *
  25287. * **Note:** This method is based on
  25288. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  25289. *
  25290. * @static
  25291. * @memberOf _
  25292. * @since 4.0.0
  25293. * @category Lang
  25294. * @param {*} value The value to check.
  25295. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  25296. * @example
  25297. *
  25298. * _.isSafeInteger(3);
  25299. * // => true
  25300. *
  25301. * _.isSafeInteger(Number.MIN_VALUE);
  25302. * // => false
  25303. *
  25304. * _.isSafeInteger(Infinity);
  25305. * // => false
  25306. *
  25307. * _.isSafeInteger('3');
  25308. * // => false
  25309. */
  25310. function isSafeInteger(value) {
  25311. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  25312. }
  25313. /**
  25314. * Checks if `value` is classified as a `Set` object.
  25315. *
  25316. * @static
  25317. * @memberOf _
  25318. * @since 4.3.0
  25319. * @category Lang
  25320. * @param {*} value The value to check.
  25321. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  25322. * @example
  25323. *
  25324. * _.isSet(new Set);
  25325. * // => true
  25326. *
  25327. * _.isSet(new WeakSet);
  25328. * // => false
  25329. */
  25330. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  25331. /**
  25332. * Checks if `value` is classified as a `String` primitive or object.
  25333. *
  25334. * @static
  25335. * @since 0.1.0
  25336. * @memberOf _
  25337. * @category Lang
  25338. * @param {*} value The value to check.
  25339. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  25340. * @example
  25341. *
  25342. * _.isString('abc');
  25343. * // => true
  25344. *
  25345. * _.isString(1);
  25346. * // => false
  25347. */
  25348. function isString(value) {
  25349. return typeof value == 'string' ||
  25350. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  25351. }
  25352. /**
  25353. * Checks if `value` is classified as a `Symbol` primitive or object.
  25354. *
  25355. * @static
  25356. * @memberOf _
  25357. * @since 4.0.0
  25358. * @category Lang
  25359. * @param {*} value The value to check.
  25360. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  25361. * @example
  25362. *
  25363. * _.isSymbol(Symbol.iterator);
  25364. * // => true
  25365. *
  25366. * _.isSymbol('abc');
  25367. * // => false
  25368. */
  25369. function isSymbol(value) {
  25370. return typeof value == 'symbol' ||
  25371. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  25372. }
  25373. /**
  25374. * Checks if `value` is classified as a typed array.
  25375. *
  25376. * @static
  25377. * @memberOf _
  25378. * @since 3.0.0
  25379. * @category Lang
  25380. * @param {*} value The value to check.
  25381. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  25382. * @example
  25383. *
  25384. * _.isTypedArray(new Uint8Array);
  25385. * // => true
  25386. *
  25387. * _.isTypedArray([]);
  25388. * // => false
  25389. */
  25390. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  25391. /**
  25392. * Checks if `value` is `undefined`.
  25393. *
  25394. * @static
  25395. * @since 0.1.0
  25396. * @memberOf _
  25397. * @category Lang
  25398. * @param {*} value The value to check.
  25399. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  25400. * @example
  25401. *
  25402. * _.isUndefined(void 0);
  25403. * // => true
  25404. *
  25405. * _.isUndefined(null);
  25406. * // => false
  25407. */
  25408. function isUndefined(value) {
  25409. return value === undefined;
  25410. }
  25411. /**
  25412. * Checks if `value` is classified as a `WeakMap` object.
  25413. *
  25414. * @static
  25415. * @memberOf _
  25416. * @since 4.3.0
  25417. * @category Lang
  25418. * @param {*} value The value to check.
  25419. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  25420. * @example
  25421. *
  25422. * _.isWeakMap(new WeakMap);
  25423. * // => true
  25424. *
  25425. * _.isWeakMap(new Map);
  25426. * // => false
  25427. */
  25428. function isWeakMap(value) {
  25429. return isObjectLike(value) && getTag(value) == weakMapTag;
  25430. }
  25431. /**
  25432. * Checks if `value` is classified as a `WeakSet` object.
  25433. *
  25434. * @static
  25435. * @memberOf _
  25436. * @since 4.3.0
  25437. * @category Lang
  25438. * @param {*} value The value to check.
  25439. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  25440. * @example
  25441. *
  25442. * _.isWeakSet(new WeakSet);
  25443. * // => true
  25444. *
  25445. * _.isWeakSet(new Set);
  25446. * // => false
  25447. */
  25448. function isWeakSet(value) {
  25449. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  25450. }
  25451. /**
  25452. * Checks if `value` is less than `other`.
  25453. *
  25454. * @static
  25455. * @memberOf _
  25456. * @since 3.9.0
  25457. * @category Lang
  25458. * @param {*} value The value to compare.
  25459. * @param {*} other The other value to compare.
  25460. * @returns {boolean} Returns `true` if `value` is less than `other`,
  25461. * else `false`.
  25462. * @see _.gt
  25463. * @example
  25464. *
  25465. * _.lt(1, 3);
  25466. * // => true
  25467. *
  25468. * _.lt(3, 3);
  25469. * // => false
  25470. *
  25471. * _.lt(3, 1);
  25472. * // => false
  25473. */
  25474. var lt = createRelationalOperation(baseLt);
  25475. /**
  25476. * Checks if `value` is less than or equal to `other`.
  25477. *
  25478. * @static
  25479. * @memberOf _
  25480. * @since 3.9.0
  25481. * @category Lang
  25482. * @param {*} value The value to compare.
  25483. * @param {*} other The other value to compare.
  25484. * @returns {boolean} Returns `true` if `value` is less than or equal to
  25485. * `other`, else `false`.
  25486. * @see _.gte
  25487. * @example
  25488. *
  25489. * _.lte(1, 3);
  25490. * // => true
  25491. *
  25492. * _.lte(3, 3);
  25493. * // => true
  25494. *
  25495. * _.lte(3, 1);
  25496. * // => false
  25497. */
  25498. var lte = createRelationalOperation(function(value, other) {
  25499. return value <= other;
  25500. });
  25501. /**
  25502. * Converts `value` to an array.
  25503. *
  25504. * @static
  25505. * @since 0.1.0
  25506. * @memberOf _
  25507. * @category Lang
  25508. * @param {*} value The value to convert.
  25509. * @returns {Array} Returns the converted array.
  25510. * @example
  25511. *
  25512. * _.toArray({ 'a': 1, 'b': 2 });
  25513. * // => [1, 2]
  25514. *
  25515. * _.toArray('abc');
  25516. * // => ['a', 'b', 'c']
  25517. *
  25518. * _.toArray(1);
  25519. * // => []
  25520. *
  25521. * _.toArray(null);
  25522. * // => []
  25523. */
  25524. function toArray(value) {
  25525. if (!value) {
  25526. return [];
  25527. }
  25528. if (isArrayLike(value)) {
  25529. return isString(value) ? stringToArray(value) : copyArray(value);
  25530. }
  25531. if (symIterator && value[symIterator]) {
  25532. return iteratorToArray(value[symIterator]());
  25533. }
  25534. var tag = getTag(value),
  25535. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  25536. return func(value);
  25537. }
  25538. /**
  25539. * Converts `value` to a finite number.
  25540. *
  25541. * @static
  25542. * @memberOf _
  25543. * @since 4.12.0
  25544. * @category Lang
  25545. * @param {*} value The value to convert.
  25546. * @returns {number} Returns the converted number.
  25547. * @example
  25548. *
  25549. * _.toFinite(3.2);
  25550. * // => 3.2
  25551. *
  25552. * _.toFinite(Number.MIN_VALUE);
  25553. * // => 5e-324
  25554. *
  25555. * _.toFinite(Infinity);
  25556. * // => 1.7976931348623157e+308
  25557. *
  25558. * _.toFinite('3.2');
  25559. * // => 3.2
  25560. */
  25561. function toFinite(value) {
  25562. if (!value) {
  25563. return value === 0 ? value : 0;
  25564. }
  25565. value = toNumber(value);
  25566. if (value === INFINITY || value === -INFINITY) {
  25567. var sign = (value < 0 ? -1 : 1);
  25568. return sign * MAX_INTEGER;
  25569. }
  25570. return value === value ? value : 0;
  25571. }
  25572. /**
  25573. * Converts `value` to an integer.
  25574. *
  25575. * **Note:** This method is loosely based on
  25576. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  25577. *
  25578. * @static
  25579. * @memberOf _
  25580. * @since 4.0.0
  25581. * @category Lang
  25582. * @param {*} value The value to convert.
  25583. * @returns {number} Returns the converted integer.
  25584. * @example
  25585. *
  25586. * _.toInteger(3.2);
  25587. * // => 3
  25588. *
  25589. * _.toInteger(Number.MIN_VALUE);
  25590. * // => 0
  25591. *
  25592. * _.toInteger(Infinity);
  25593. * // => 1.7976931348623157e+308
  25594. *
  25595. * _.toInteger('3.2');
  25596. * // => 3
  25597. */
  25598. function toInteger(value) {
  25599. var result = toFinite(value),
  25600. remainder = result % 1;
  25601. return result === result ? (remainder ? result - remainder : result) : 0;
  25602. }
  25603. /**
  25604. * Converts `value` to an integer suitable for use as the length of an
  25605. * array-like object.
  25606. *
  25607. * **Note:** This method is based on
  25608. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  25609. *
  25610. * @static
  25611. * @memberOf _
  25612. * @since 4.0.0
  25613. * @category Lang
  25614. * @param {*} value The value to convert.
  25615. * @returns {number} Returns the converted integer.
  25616. * @example
  25617. *
  25618. * _.toLength(3.2);
  25619. * // => 3
  25620. *
  25621. * _.toLength(Number.MIN_VALUE);
  25622. * // => 0
  25623. *
  25624. * _.toLength(Infinity);
  25625. * // => 4294967295
  25626. *
  25627. * _.toLength('3.2');
  25628. * // => 3
  25629. */
  25630. function toLength(value) {
  25631. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  25632. }
  25633. /**
  25634. * Converts `value` to a number.
  25635. *
  25636. * @static
  25637. * @memberOf _
  25638. * @since 4.0.0
  25639. * @category Lang
  25640. * @param {*} value The value to process.
  25641. * @returns {number} Returns the number.
  25642. * @example
  25643. *
  25644. * _.toNumber(3.2);
  25645. * // => 3.2
  25646. *
  25647. * _.toNumber(Number.MIN_VALUE);
  25648. * // => 5e-324
  25649. *
  25650. * _.toNumber(Infinity);
  25651. * // => Infinity
  25652. *
  25653. * _.toNumber('3.2');
  25654. * // => 3.2
  25655. */
  25656. function toNumber(value) {
  25657. if (typeof value == 'number') {
  25658. return value;
  25659. }
  25660. if (isSymbol(value)) {
  25661. return NAN;
  25662. }
  25663. if (isObject(value)) {
  25664. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  25665. value = isObject(other) ? (other + '') : other;
  25666. }
  25667. if (typeof value != 'string') {
  25668. return value === 0 ? value : +value;
  25669. }
  25670. value = value.replace(reTrim, '');
  25671. var isBinary = reIsBinary.test(value);
  25672. return (isBinary || reIsOctal.test(value))
  25673. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  25674. : (reIsBadHex.test(value) ? NAN : +value);
  25675. }
  25676. /**
  25677. * Converts `value` to a plain object flattening inherited enumerable string
  25678. * keyed properties of `value` to own properties of the plain object.
  25679. *
  25680. * @static
  25681. * @memberOf _
  25682. * @since 3.0.0
  25683. * @category Lang
  25684. * @param {*} value The value to convert.
  25685. * @returns {Object} Returns the converted plain object.
  25686. * @example
  25687. *
  25688. * function Foo() {
  25689. * this.b = 2;
  25690. * }
  25691. *
  25692. * Foo.prototype.c = 3;
  25693. *
  25694. * _.assign({ 'a': 1 }, new Foo);
  25695. * // => { 'a': 1, 'b': 2 }
  25696. *
  25697. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25698. * // => { 'a': 1, 'b': 2, 'c': 3 }
  25699. */
  25700. function toPlainObject(value) {
  25701. return copyObject(value, keysIn(value));
  25702. }
  25703. /**
  25704. * Converts `value` to a safe integer. A safe integer can be compared and
  25705. * represented correctly.
  25706. *
  25707. * @static
  25708. * @memberOf _
  25709. * @since 4.0.0
  25710. * @category Lang
  25711. * @param {*} value The value to convert.
  25712. * @returns {number} Returns the converted integer.
  25713. * @example
  25714. *
  25715. * _.toSafeInteger(3.2);
  25716. * // => 3
  25717. *
  25718. * _.toSafeInteger(Number.MIN_VALUE);
  25719. * // => 0
  25720. *
  25721. * _.toSafeInteger(Infinity);
  25722. * // => 9007199254740991
  25723. *
  25724. * _.toSafeInteger('3.2');
  25725. * // => 3
  25726. */
  25727. function toSafeInteger(value) {
  25728. return value
  25729. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  25730. : (value === 0 ? value : 0);
  25731. }
  25732. /**
  25733. * Converts `value` to a string. An empty string is returned for `null`
  25734. * and `undefined` values. The sign of `-0` is preserved.
  25735. *
  25736. * @static
  25737. * @memberOf _
  25738. * @since 4.0.0
  25739. * @category Lang
  25740. * @param {*} value The value to convert.
  25741. * @returns {string} Returns the converted string.
  25742. * @example
  25743. *
  25744. * _.toString(null);
  25745. * // => ''
  25746. *
  25747. * _.toString(-0);
  25748. * // => '-0'
  25749. *
  25750. * _.toString([1, 2, 3]);
  25751. * // => '1,2,3'
  25752. */
  25753. function toString(value) {
  25754. return value == null ? '' : baseToString(value);
  25755. }
  25756. /*------------------------------------------------------------------------*/
  25757. /**
  25758. * Assigns own enumerable string keyed properties of source objects to the
  25759. * destination object. Source objects are applied from left to right.
  25760. * Subsequent sources overwrite property assignments of previous sources.
  25761. *
  25762. * **Note:** This method mutates `object` and is loosely based on
  25763. * [`Object.assign`](https://mdn.io/Object/assign).
  25764. *
  25765. * @static
  25766. * @memberOf _
  25767. * @since 0.10.0
  25768. * @category Object
  25769. * @param {Object} object The destination object.
  25770. * @param {...Object} [sources] The source objects.
  25771. * @returns {Object} Returns `object`.
  25772. * @see _.assignIn
  25773. * @example
  25774. *
  25775. * function Foo() {
  25776. * this.a = 1;
  25777. * }
  25778. *
  25779. * function Bar() {
  25780. * this.c = 3;
  25781. * }
  25782. *
  25783. * Foo.prototype.b = 2;
  25784. * Bar.prototype.d = 4;
  25785. *
  25786. * _.assign({ 'a': 0 }, new Foo, new Bar);
  25787. * // => { 'a': 1, 'c': 3 }
  25788. */
  25789. var assign = createAssigner(function(object, source) {
  25790. if (isPrototype(source) || isArrayLike(source)) {
  25791. copyObject(source, keys(source), object);
  25792. return;
  25793. }
  25794. for (var key in source) {
  25795. if (hasOwnProperty.call(source, key)) {
  25796. assignValue(object, key, source[key]);
  25797. }
  25798. }
  25799. });
  25800. /**
  25801. * This method is like `_.assign` except that it iterates over own and
  25802. * inherited source properties.
  25803. *
  25804. * **Note:** This method mutates `object`.
  25805. *
  25806. * @static
  25807. * @memberOf _
  25808. * @since 4.0.0
  25809. * @alias extend
  25810. * @category Object
  25811. * @param {Object} object The destination object.
  25812. * @param {...Object} [sources] The source objects.
  25813. * @returns {Object} Returns `object`.
  25814. * @see _.assign
  25815. * @example
  25816. *
  25817. * function Foo() {
  25818. * this.a = 1;
  25819. * }
  25820. *
  25821. * function Bar() {
  25822. * this.c = 3;
  25823. * }
  25824. *
  25825. * Foo.prototype.b = 2;
  25826. * Bar.prototype.d = 4;
  25827. *
  25828. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  25829. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  25830. */
  25831. var assignIn = createAssigner(function(object, source) {
  25832. copyObject(source, keysIn(source), object);
  25833. });
  25834. /**
  25835. * This method is like `_.assignIn` except that it accepts `customizer`
  25836. * which is invoked to produce the assigned values. If `customizer` returns
  25837. * `undefined`, assignment is handled by the method instead. The `customizer`
  25838. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25839. *
  25840. * **Note:** This method mutates `object`.
  25841. *
  25842. * @static
  25843. * @memberOf _
  25844. * @since 4.0.0
  25845. * @alias extendWith
  25846. * @category Object
  25847. * @param {Object} object The destination object.
  25848. * @param {...Object} sources The source objects.
  25849. * @param {Function} [customizer] The function to customize assigned values.
  25850. * @returns {Object} Returns `object`.
  25851. * @see _.assignWith
  25852. * @example
  25853. *
  25854. * function customizer(objValue, srcValue) {
  25855. * return _.isUndefined(objValue) ? srcValue : objValue;
  25856. * }
  25857. *
  25858. * var defaults = _.partialRight(_.assignInWith, customizer);
  25859. *
  25860. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25861. * // => { 'a': 1, 'b': 2 }
  25862. */
  25863. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  25864. copyObject(source, keysIn(source), object, customizer);
  25865. });
  25866. /**
  25867. * This method is like `_.assign` except that it accepts `customizer`
  25868. * which is invoked to produce the assigned values. If `customizer` returns
  25869. * `undefined`, assignment is handled by the method instead. The `customizer`
  25870. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25871. *
  25872. * **Note:** This method mutates `object`.
  25873. *
  25874. * @static
  25875. * @memberOf _
  25876. * @since 4.0.0
  25877. * @category Object
  25878. * @param {Object} object The destination object.
  25879. * @param {...Object} sources The source objects.
  25880. * @param {Function} [customizer] The function to customize assigned values.
  25881. * @returns {Object} Returns `object`.
  25882. * @see _.assignInWith
  25883. * @example
  25884. *
  25885. * function customizer(objValue, srcValue) {
  25886. * return _.isUndefined(objValue) ? srcValue : objValue;
  25887. * }
  25888. *
  25889. * var defaults = _.partialRight(_.assignWith, customizer);
  25890. *
  25891. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25892. * // => { 'a': 1, 'b': 2 }
  25893. */
  25894. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  25895. copyObject(source, keys(source), object, customizer);
  25896. });
  25897. /**
  25898. * Creates an array of values corresponding to `paths` of `object`.
  25899. *
  25900. * @static
  25901. * @memberOf _
  25902. * @since 1.0.0
  25903. * @category Object
  25904. * @param {Object} object The object to iterate over.
  25905. * @param {...(string|string[])} [paths] The property paths to pick.
  25906. * @returns {Array} Returns the picked values.
  25907. * @example
  25908. *
  25909. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25910. *
  25911. * _.at(object, ['a[0].b.c', 'a[1]']);
  25912. * // => [3, 4]
  25913. */
  25914. var at = flatRest(baseAt);
  25915. /**
  25916. * Creates an object that inherits from the `prototype` object. If a
  25917. * `properties` object is given, its own enumerable string keyed properties
  25918. * are assigned to the created object.
  25919. *
  25920. * @static
  25921. * @memberOf _
  25922. * @since 2.3.0
  25923. * @category Object
  25924. * @param {Object} prototype The object to inherit from.
  25925. * @param {Object} [properties] The properties to assign to the object.
  25926. * @returns {Object} Returns the new object.
  25927. * @example
  25928. *
  25929. * function Shape() {
  25930. * this.x = 0;
  25931. * this.y = 0;
  25932. * }
  25933. *
  25934. * function Circle() {
  25935. * Shape.call(this);
  25936. * }
  25937. *
  25938. * Circle.prototype = _.create(Shape.prototype, {
  25939. * 'constructor': Circle
  25940. * });
  25941. *
  25942. * var circle = new Circle;
  25943. * circle instanceof Circle;
  25944. * // => true
  25945. *
  25946. * circle instanceof Shape;
  25947. * // => true
  25948. */
  25949. function create(prototype, properties) {
  25950. var result = baseCreate(prototype);
  25951. return properties == null ? result : baseAssign(result, properties);
  25952. }
  25953. /**
  25954. * Assigns own and inherited enumerable string keyed properties of source
  25955. * objects to the destination object for all destination properties that
  25956. * resolve to `undefined`. Source objects are applied from left to right.
  25957. * Once a property is set, additional values of the same property are ignored.
  25958. *
  25959. * **Note:** This method mutates `object`.
  25960. *
  25961. * @static
  25962. * @since 0.1.0
  25963. * @memberOf _
  25964. * @category Object
  25965. * @param {Object} object The destination object.
  25966. * @param {...Object} [sources] The source objects.
  25967. * @returns {Object} Returns `object`.
  25968. * @see _.defaultsDeep
  25969. * @example
  25970. *
  25971. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25972. * // => { 'a': 1, 'b': 2 }
  25973. */
  25974. var defaults = baseRest(function(object, sources) {
  25975. object = Object(object);
  25976. var index = -1;
  25977. var length = sources.length;
  25978. var guard = length > 2 ? sources[2] : undefined;
  25979. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25980. length = 1;
  25981. }
  25982. while (++index < length) {
  25983. var source = sources[index];
  25984. var props = keysIn(source);
  25985. var propsIndex = -1;
  25986. var propsLength = props.length;
  25987. while (++propsIndex < propsLength) {
  25988. var key = props[propsIndex];
  25989. var value = object[key];
  25990. if (value === undefined ||
  25991. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  25992. object[key] = source[key];
  25993. }
  25994. }
  25995. }
  25996. return object;
  25997. });
  25998. /**
  25999. * This method is like `_.defaults` except that it recursively assigns
  26000. * default properties.
  26001. *
  26002. * **Note:** This method mutates `object`.
  26003. *
  26004. * @static
  26005. * @memberOf _
  26006. * @since 3.10.0
  26007. * @category Object
  26008. * @param {Object} object The destination object.
  26009. * @param {...Object} [sources] The source objects.
  26010. * @returns {Object} Returns `object`.
  26011. * @see _.defaults
  26012. * @example
  26013. *
  26014. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  26015. * // => { 'a': { 'b': 2, 'c': 3 } }
  26016. */
  26017. var defaultsDeep = baseRest(function(args) {
  26018. args.push(undefined, customDefaultsMerge);
  26019. return apply(mergeWith, undefined, args);
  26020. });
  26021. /**
  26022. * This method is like `_.find` except that it returns the key of the first
  26023. * element `predicate` returns truthy for instead of the element itself.
  26024. *
  26025. * @static
  26026. * @memberOf _
  26027. * @since 1.1.0
  26028. * @category Object
  26029. * @param {Object} object The object to inspect.
  26030. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26031. * @returns {string|undefined} Returns the key of the matched element,
  26032. * else `undefined`.
  26033. * @example
  26034. *
  26035. * var users = {
  26036. * 'barney': { 'age': 36, 'active': true },
  26037. * 'fred': { 'age': 40, 'active': false },
  26038. * 'pebbles': { 'age': 1, 'active': true }
  26039. * };
  26040. *
  26041. * _.findKey(users, function(o) { return o.age < 40; });
  26042. * // => 'barney' (iteration order is not guaranteed)
  26043. *
  26044. * // The `_.matches` iteratee shorthand.
  26045. * _.findKey(users, { 'age': 1, 'active': true });
  26046. * // => 'pebbles'
  26047. *
  26048. * // The `_.matchesProperty` iteratee shorthand.
  26049. * _.findKey(users, ['active', false]);
  26050. * // => 'fred'
  26051. *
  26052. * // The `_.property` iteratee shorthand.
  26053. * _.findKey(users, 'active');
  26054. * // => 'barney'
  26055. */
  26056. function findKey(object, predicate) {
  26057. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  26058. }
  26059. /**
  26060. * This method is like `_.findKey` except that it iterates over elements of
  26061. * a collection in the opposite order.
  26062. *
  26063. * @static
  26064. * @memberOf _
  26065. * @since 2.0.0
  26066. * @category Object
  26067. * @param {Object} object The object to inspect.
  26068. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26069. * @returns {string|undefined} Returns the key of the matched element,
  26070. * else `undefined`.
  26071. * @example
  26072. *
  26073. * var users = {
  26074. * 'barney': { 'age': 36, 'active': true },
  26075. * 'fred': { 'age': 40, 'active': false },
  26076. * 'pebbles': { 'age': 1, 'active': true }
  26077. * };
  26078. *
  26079. * _.findLastKey(users, function(o) { return o.age < 40; });
  26080. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  26081. *
  26082. * // The `_.matches` iteratee shorthand.
  26083. * _.findLastKey(users, { 'age': 36, 'active': true });
  26084. * // => 'barney'
  26085. *
  26086. * // The `_.matchesProperty` iteratee shorthand.
  26087. * _.findLastKey(users, ['active', false]);
  26088. * // => 'fred'
  26089. *
  26090. * // The `_.property` iteratee shorthand.
  26091. * _.findLastKey(users, 'active');
  26092. * // => 'pebbles'
  26093. */
  26094. function findLastKey(object, predicate) {
  26095. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  26096. }
  26097. /**
  26098. * Iterates over own and inherited enumerable string keyed properties of an
  26099. * object and invokes `iteratee` for each property. The iteratee is invoked
  26100. * with three arguments: (value, key, object). Iteratee functions may exit
  26101. * iteration early by explicitly returning `false`.
  26102. *
  26103. * @static
  26104. * @memberOf _
  26105. * @since 0.3.0
  26106. * @category Object
  26107. * @param {Object} object The object to iterate over.
  26108. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26109. * @returns {Object} Returns `object`.
  26110. * @see _.forInRight
  26111. * @example
  26112. *
  26113. * function Foo() {
  26114. * this.a = 1;
  26115. * this.b = 2;
  26116. * }
  26117. *
  26118. * Foo.prototype.c = 3;
  26119. *
  26120. * _.forIn(new Foo, function(value, key) {
  26121. * console.log(key);
  26122. * });
  26123. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  26124. */
  26125. function forIn(object, iteratee) {
  26126. return object == null
  26127. ? object
  26128. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  26129. }
  26130. /**
  26131. * This method is like `_.forIn` except that it iterates over properties of
  26132. * `object` in the opposite order.
  26133. *
  26134. * @static
  26135. * @memberOf _
  26136. * @since 2.0.0
  26137. * @category Object
  26138. * @param {Object} object The object to iterate over.
  26139. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26140. * @returns {Object} Returns `object`.
  26141. * @see _.forIn
  26142. * @example
  26143. *
  26144. * function Foo() {
  26145. * this.a = 1;
  26146. * this.b = 2;
  26147. * }
  26148. *
  26149. * Foo.prototype.c = 3;
  26150. *
  26151. * _.forInRight(new Foo, function(value, key) {
  26152. * console.log(key);
  26153. * });
  26154. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  26155. */
  26156. function forInRight(object, iteratee) {
  26157. return object == null
  26158. ? object
  26159. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  26160. }
  26161. /**
  26162. * Iterates over own enumerable string keyed properties of an object and
  26163. * invokes `iteratee` for each property. The iteratee is invoked with three
  26164. * arguments: (value, key, object). Iteratee functions may exit iteration
  26165. * early by explicitly returning `false`.
  26166. *
  26167. * @static
  26168. * @memberOf _
  26169. * @since 0.3.0
  26170. * @category Object
  26171. * @param {Object} object The object to iterate over.
  26172. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26173. * @returns {Object} Returns `object`.
  26174. * @see _.forOwnRight
  26175. * @example
  26176. *
  26177. * function Foo() {
  26178. * this.a = 1;
  26179. * this.b = 2;
  26180. * }
  26181. *
  26182. * Foo.prototype.c = 3;
  26183. *
  26184. * _.forOwn(new Foo, function(value, key) {
  26185. * console.log(key);
  26186. * });
  26187. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26188. */
  26189. function forOwn(object, iteratee) {
  26190. return object && baseForOwn(object, getIteratee(iteratee, 3));
  26191. }
  26192. /**
  26193. * This method is like `_.forOwn` except that it iterates over properties of
  26194. * `object` in the opposite order.
  26195. *
  26196. * @static
  26197. * @memberOf _
  26198. * @since 2.0.0
  26199. * @category Object
  26200. * @param {Object} object The object to iterate over.
  26201. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26202. * @returns {Object} Returns `object`.
  26203. * @see _.forOwn
  26204. * @example
  26205. *
  26206. * function Foo() {
  26207. * this.a = 1;
  26208. * this.b = 2;
  26209. * }
  26210. *
  26211. * Foo.prototype.c = 3;
  26212. *
  26213. * _.forOwnRight(new Foo, function(value, key) {
  26214. * console.log(key);
  26215. * });
  26216. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  26217. */
  26218. function forOwnRight(object, iteratee) {
  26219. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  26220. }
  26221. /**
  26222. * Creates an array of function property names from own enumerable properties
  26223. * of `object`.
  26224. *
  26225. * @static
  26226. * @since 0.1.0
  26227. * @memberOf _
  26228. * @category Object
  26229. * @param {Object} object The object to inspect.
  26230. * @returns {Array} Returns the function names.
  26231. * @see _.functionsIn
  26232. * @example
  26233. *
  26234. * function Foo() {
  26235. * this.a = _.constant('a');
  26236. * this.b = _.constant('b');
  26237. * }
  26238. *
  26239. * Foo.prototype.c = _.constant('c');
  26240. *
  26241. * _.functions(new Foo);
  26242. * // => ['a', 'b']
  26243. */
  26244. function functions(object) {
  26245. return object == null ? [] : baseFunctions(object, keys(object));
  26246. }
  26247. /**
  26248. * Creates an array of function property names from own and inherited
  26249. * enumerable properties of `object`.
  26250. *
  26251. * @static
  26252. * @memberOf _
  26253. * @since 4.0.0
  26254. * @category Object
  26255. * @param {Object} object The object to inspect.
  26256. * @returns {Array} Returns the function names.
  26257. * @see _.functions
  26258. * @example
  26259. *
  26260. * function Foo() {
  26261. * this.a = _.constant('a');
  26262. * this.b = _.constant('b');
  26263. * }
  26264. *
  26265. * Foo.prototype.c = _.constant('c');
  26266. *
  26267. * _.functionsIn(new Foo);
  26268. * // => ['a', 'b', 'c']
  26269. */
  26270. function functionsIn(object) {
  26271. return object == null ? [] : baseFunctions(object, keysIn(object));
  26272. }
  26273. /**
  26274. * Gets the value at `path` of `object`. If the resolved value is
  26275. * `undefined`, the `defaultValue` is returned in its place.
  26276. *
  26277. * @static
  26278. * @memberOf _
  26279. * @since 3.7.0
  26280. * @category Object
  26281. * @param {Object} object The object to query.
  26282. * @param {Array|string} path The path of the property to get.
  26283. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26284. * @returns {*} Returns the resolved value.
  26285. * @example
  26286. *
  26287. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26288. *
  26289. * _.get(object, 'a[0].b.c');
  26290. * // => 3
  26291. *
  26292. * _.get(object, ['a', '0', 'b', 'c']);
  26293. * // => 3
  26294. *
  26295. * _.get(object, 'a.b.c', 'default');
  26296. * // => 'default'
  26297. */
  26298. function get(object, path, defaultValue) {
  26299. var result = object == null ? undefined : baseGet(object, path);
  26300. return result === undefined ? defaultValue : result;
  26301. }
  26302. /**
  26303. * Checks if `path` is a direct property of `object`.
  26304. *
  26305. * @static
  26306. * @since 0.1.0
  26307. * @memberOf _
  26308. * @category Object
  26309. * @param {Object} object The object to query.
  26310. * @param {Array|string} path The path to check.
  26311. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26312. * @example
  26313. *
  26314. * var object = { 'a': { 'b': 2 } };
  26315. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  26316. *
  26317. * _.has(object, 'a');
  26318. * // => true
  26319. *
  26320. * _.has(object, 'a.b');
  26321. * // => true
  26322. *
  26323. * _.has(object, ['a', 'b']);
  26324. * // => true
  26325. *
  26326. * _.has(other, 'a');
  26327. * // => false
  26328. */
  26329. function has(object, path) {
  26330. return object != null && hasPath(object, path, baseHas);
  26331. }
  26332. /**
  26333. * Checks if `path` is a direct or inherited property of `object`.
  26334. *
  26335. * @static
  26336. * @memberOf _
  26337. * @since 4.0.0
  26338. * @category Object
  26339. * @param {Object} object The object to query.
  26340. * @param {Array|string} path The path to check.
  26341. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26342. * @example
  26343. *
  26344. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  26345. *
  26346. * _.hasIn(object, 'a');
  26347. * // => true
  26348. *
  26349. * _.hasIn(object, 'a.b');
  26350. * // => true
  26351. *
  26352. * _.hasIn(object, ['a', 'b']);
  26353. * // => true
  26354. *
  26355. * _.hasIn(object, 'b');
  26356. * // => false
  26357. */
  26358. function hasIn(object, path) {
  26359. return object != null && hasPath(object, path, baseHasIn);
  26360. }
  26361. /**
  26362. * Creates an object composed of the inverted keys and values of `object`.
  26363. * If `object` contains duplicate values, subsequent values overwrite
  26364. * property assignments of previous values.
  26365. *
  26366. * @static
  26367. * @memberOf _
  26368. * @since 0.7.0
  26369. * @category Object
  26370. * @param {Object} object The object to invert.
  26371. * @returns {Object} Returns the new inverted object.
  26372. * @example
  26373. *
  26374. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26375. *
  26376. * _.invert(object);
  26377. * // => { '1': 'c', '2': 'b' }
  26378. */
  26379. var invert = createInverter(function(result, value, key) {
  26380. if (value != null &&
  26381. typeof value.toString != 'function') {
  26382. value = nativeObjectToString.call(value);
  26383. }
  26384. result[value] = key;
  26385. }, constant(identity));
  26386. /**
  26387. * This method is like `_.invert` except that the inverted object is generated
  26388. * from the results of running each element of `object` thru `iteratee`. The
  26389. * corresponding inverted value of each inverted key is an array of keys
  26390. * responsible for generating the inverted value. The iteratee is invoked
  26391. * with one argument: (value).
  26392. *
  26393. * @static
  26394. * @memberOf _
  26395. * @since 4.1.0
  26396. * @category Object
  26397. * @param {Object} object The object to invert.
  26398. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26399. * @returns {Object} Returns the new inverted object.
  26400. * @example
  26401. *
  26402. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26403. *
  26404. * _.invertBy(object);
  26405. * // => { '1': ['a', 'c'], '2': ['b'] }
  26406. *
  26407. * _.invertBy(object, function(value) {
  26408. * return 'group' + value;
  26409. * });
  26410. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  26411. */
  26412. var invertBy = createInverter(function(result, value, key) {
  26413. if (value != null &&
  26414. typeof value.toString != 'function') {
  26415. value = nativeObjectToString.call(value);
  26416. }
  26417. if (hasOwnProperty.call(result, value)) {
  26418. result[value].push(key);
  26419. } else {
  26420. result[value] = [key];
  26421. }
  26422. }, getIteratee);
  26423. /**
  26424. * Invokes the method at `path` of `object`.
  26425. *
  26426. * @static
  26427. * @memberOf _
  26428. * @since 4.0.0
  26429. * @category Object
  26430. * @param {Object} object The object to query.
  26431. * @param {Array|string} path The path of the method to invoke.
  26432. * @param {...*} [args] The arguments to invoke the method with.
  26433. * @returns {*} Returns the result of the invoked method.
  26434. * @example
  26435. *
  26436. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  26437. *
  26438. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  26439. * // => [2, 3]
  26440. */
  26441. var invoke = baseRest(baseInvoke);
  26442. /**
  26443. * Creates an array of the own enumerable property names of `object`.
  26444. *
  26445. * **Note:** Non-object values are coerced to objects. See the
  26446. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  26447. * for more details.
  26448. *
  26449. * @static
  26450. * @since 0.1.0
  26451. * @memberOf _
  26452. * @category Object
  26453. * @param {Object} object The object to query.
  26454. * @returns {Array} Returns the array of property names.
  26455. * @example
  26456. *
  26457. * function Foo() {
  26458. * this.a = 1;
  26459. * this.b = 2;
  26460. * }
  26461. *
  26462. * Foo.prototype.c = 3;
  26463. *
  26464. * _.keys(new Foo);
  26465. * // => ['a', 'b'] (iteration order is not guaranteed)
  26466. *
  26467. * _.keys('hi');
  26468. * // => ['0', '1']
  26469. */
  26470. function keys(object) {
  26471. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  26472. }
  26473. /**
  26474. * Creates an array of the own and inherited enumerable property names of `object`.
  26475. *
  26476. * **Note:** Non-object values are coerced to objects.
  26477. *
  26478. * @static
  26479. * @memberOf _
  26480. * @since 3.0.0
  26481. * @category Object
  26482. * @param {Object} object The object to query.
  26483. * @returns {Array} Returns the array of property names.
  26484. * @example
  26485. *
  26486. * function Foo() {
  26487. * this.a = 1;
  26488. * this.b = 2;
  26489. * }
  26490. *
  26491. * Foo.prototype.c = 3;
  26492. *
  26493. * _.keysIn(new Foo);
  26494. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  26495. */
  26496. function keysIn(object) {
  26497. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  26498. }
  26499. /**
  26500. * The opposite of `_.mapValues`; this method creates an object with the
  26501. * same values as `object` and keys generated by running each own enumerable
  26502. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  26503. * with three arguments: (value, key, object).
  26504. *
  26505. * @static
  26506. * @memberOf _
  26507. * @since 3.8.0
  26508. * @category Object
  26509. * @param {Object} object The object to iterate over.
  26510. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26511. * @returns {Object} Returns the new mapped object.
  26512. * @see _.mapValues
  26513. * @example
  26514. *
  26515. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  26516. * return key + value;
  26517. * });
  26518. * // => { 'a1': 1, 'b2': 2 }
  26519. */
  26520. function mapKeys(object, iteratee) {
  26521. var result = {};
  26522. iteratee = getIteratee(iteratee, 3);
  26523. baseForOwn(object, function(value, key, object) {
  26524. baseAssignValue(result, iteratee(value, key, object), value);
  26525. });
  26526. return result;
  26527. }
  26528. /**
  26529. * Creates an object with the same keys as `object` and values generated
  26530. * by running each own enumerable string keyed property of `object` thru
  26531. * `iteratee`. The iteratee is invoked with three arguments:
  26532. * (value, key, object).
  26533. *
  26534. * @static
  26535. * @memberOf _
  26536. * @since 2.4.0
  26537. * @category Object
  26538. * @param {Object} object The object to iterate over.
  26539. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26540. * @returns {Object} Returns the new mapped object.
  26541. * @see _.mapKeys
  26542. * @example
  26543. *
  26544. * var users = {
  26545. * 'fred': { 'user': 'fred', 'age': 40 },
  26546. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  26547. * };
  26548. *
  26549. * _.mapValues(users, function(o) { return o.age; });
  26550. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26551. *
  26552. * // The `_.property` iteratee shorthand.
  26553. * _.mapValues(users, 'age');
  26554. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26555. */
  26556. function mapValues(object, iteratee) {
  26557. var result = {};
  26558. iteratee = getIteratee(iteratee, 3);
  26559. baseForOwn(object, function(value, key, object) {
  26560. baseAssignValue(result, key, iteratee(value, key, object));
  26561. });
  26562. return result;
  26563. }
  26564. /**
  26565. * This method is like `_.assign` except that it recursively merges own and
  26566. * inherited enumerable string keyed properties of source objects into the
  26567. * destination object. Source properties that resolve to `undefined` are
  26568. * skipped if a destination value exists. Array and plain object properties
  26569. * are merged recursively. Other objects and value types are overridden by
  26570. * assignment. Source objects are applied from left to right. Subsequent
  26571. * sources overwrite property assignments of previous sources.
  26572. *
  26573. * **Note:** This method mutates `object`.
  26574. *
  26575. * @static
  26576. * @memberOf _
  26577. * @since 0.5.0
  26578. * @category Object
  26579. * @param {Object} object The destination object.
  26580. * @param {...Object} [sources] The source objects.
  26581. * @returns {Object} Returns `object`.
  26582. * @example
  26583. *
  26584. * var object = {
  26585. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  26586. * };
  26587. *
  26588. * var other = {
  26589. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  26590. * };
  26591. *
  26592. * _.merge(object, other);
  26593. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  26594. */
  26595. var merge = createAssigner(function(object, source, srcIndex) {
  26596. baseMerge(object, source, srcIndex);
  26597. });
  26598. /**
  26599. * This method is like `_.merge` except that it accepts `customizer` which
  26600. * is invoked to produce the merged values of the destination and source
  26601. * properties. If `customizer` returns `undefined`, merging is handled by the
  26602. * method instead. The `customizer` is invoked with six arguments:
  26603. * (objValue, srcValue, key, object, source, stack).
  26604. *
  26605. * **Note:** This method mutates `object`.
  26606. *
  26607. * @static
  26608. * @memberOf _
  26609. * @since 4.0.0
  26610. * @category Object
  26611. * @param {Object} object The destination object.
  26612. * @param {...Object} sources The source objects.
  26613. * @param {Function} customizer The function to customize assigned values.
  26614. * @returns {Object} Returns `object`.
  26615. * @example
  26616. *
  26617. * function customizer(objValue, srcValue) {
  26618. * if (_.isArray(objValue)) {
  26619. * return objValue.concat(srcValue);
  26620. * }
  26621. * }
  26622. *
  26623. * var object = { 'a': [1], 'b': [2] };
  26624. * var other = { 'a': [3], 'b': [4] };
  26625. *
  26626. * _.mergeWith(object, other, customizer);
  26627. * // => { 'a': [1, 3], 'b': [2, 4] }
  26628. */
  26629. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  26630. baseMerge(object, source, srcIndex, customizer);
  26631. });
  26632. /**
  26633. * The opposite of `_.pick`; this method creates an object composed of the
  26634. * own and inherited enumerable property paths of `object` that are not omitted.
  26635. *
  26636. * **Note:** This method is considerably slower than `_.pick`.
  26637. *
  26638. * @static
  26639. * @since 0.1.0
  26640. * @memberOf _
  26641. * @category Object
  26642. * @param {Object} object The source object.
  26643. * @param {...(string|string[])} [paths] The property paths to omit.
  26644. * @returns {Object} Returns the new object.
  26645. * @example
  26646. *
  26647. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26648. *
  26649. * _.omit(object, ['a', 'c']);
  26650. * // => { 'b': '2' }
  26651. */
  26652. var omit = flatRest(function(object, paths) {
  26653. var result = {};
  26654. if (object == null) {
  26655. return result;
  26656. }
  26657. var isDeep = false;
  26658. paths = arrayMap(paths, function(path) {
  26659. path = castPath(path, object);
  26660. isDeep || (isDeep = path.length > 1);
  26661. return path;
  26662. });
  26663. copyObject(object, getAllKeysIn(object), result);
  26664. if (isDeep) {
  26665. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  26666. }
  26667. var length = paths.length;
  26668. while (length--) {
  26669. baseUnset(result, paths[length]);
  26670. }
  26671. return result;
  26672. });
  26673. /**
  26674. * The opposite of `_.pickBy`; this method creates an object composed of
  26675. * the own and inherited enumerable string keyed properties of `object` that
  26676. * `predicate` doesn't return truthy for. The predicate is invoked with two
  26677. * arguments: (value, key).
  26678. *
  26679. * @static
  26680. * @memberOf _
  26681. * @since 4.0.0
  26682. * @category Object
  26683. * @param {Object} object The source object.
  26684. * @param {Function} [predicate=_.identity] The function invoked per property.
  26685. * @returns {Object} Returns the new object.
  26686. * @example
  26687. *
  26688. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26689. *
  26690. * _.omitBy(object, _.isNumber);
  26691. * // => { 'b': '2' }
  26692. */
  26693. function omitBy(object, predicate) {
  26694. return pickBy(object, negate(getIteratee(predicate)));
  26695. }
  26696. /**
  26697. * Creates an object composed of the picked `object` properties.
  26698. *
  26699. * @static
  26700. * @since 0.1.0
  26701. * @memberOf _
  26702. * @category Object
  26703. * @param {Object} object The source object.
  26704. * @param {...(string|string[])} [paths] The property paths to pick.
  26705. * @returns {Object} Returns the new object.
  26706. * @example
  26707. *
  26708. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26709. *
  26710. * _.pick(object, ['a', 'c']);
  26711. * // => { 'a': 1, 'c': 3 }
  26712. */
  26713. var pick = flatRest(function(object, paths) {
  26714. return object == null ? {} : basePick(object, paths);
  26715. });
  26716. /**
  26717. * Creates an object composed of the `object` properties `predicate` returns
  26718. * truthy for. The predicate is invoked with two arguments: (value, key).
  26719. *
  26720. * @static
  26721. * @memberOf _
  26722. * @since 4.0.0
  26723. * @category Object
  26724. * @param {Object} object The source object.
  26725. * @param {Function} [predicate=_.identity] The function invoked per property.
  26726. * @returns {Object} Returns the new object.
  26727. * @example
  26728. *
  26729. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26730. *
  26731. * _.pickBy(object, _.isNumber);
  26732. * // => { 'a': 1, 'c': 3 }
  26733. */
  26734. function pickBy(object, predicate) {
  26735. if (object == null) {
  26736. return {};
  26737. }
  26738. var props = arrayMap(getAllKeysIn(object), function(prop) {
  26739. return [prop];
  26740. });
  26741. predicate = getIteratee(predicate);
  26742. return basePickBy(object, props, function(value, path) {
  26743. return predicate(value, path[0]);
  26744. });
  26745. }
  26746. /**
  26747. * This method is like `_.get` except that if the resolved value is a
  26748. * function it's invoked with the `this` binding of its parent object and
  26749. * its result is returned.
  26750. *
  26751. * @static
  26752. * @since 0.1.0
  26753. * @memberOf _
  26754. * @category Object
  26755. * @param {Object} object The object to query.
  26756. * @param {Array|string} path The path of the property to resolve.
  26757. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26758. * @returns {*} Returns the resolved value.
  26759. * @example
  26760. *
  26761. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  26762. *
  26763. * _.result(object, 'a[0].b.c1');
  26764. * // => 3
  26765. *
  26766. * _.result(object, 'a[0].b.c2');
  26767. * // => 4
  26768. *
  26769. * _.result(object, 'a[0].b.c3', 'default');
  26770. * // => 'default'
  26771. *
  26772. * _.result(object, 'a[0].b.c3', _.constant('default'));
  26773. * // => 'default'
  26774. */
  26775. function result(object, path, defaultValue) {
  26776. path = castPath(path, object);
  26777. var index = -1,
  26778. length = path.length;
  26779. // Ensure the loop is entered when path is empty.
  26780. if (!length) {
  26781. length = 1;
  26782. object = undefined;
  26783. }
  26784. while (++index < length) {
  26785. var value = object == null ? undefined : object[toKey(path[index])];
  26786. if (value === undefined) {
  26787. index = length;
  26788. value = defaultValue;
  26789. }
  26790. object = isFunction(value) ? value.call(object) : value;
  26791. }
  26792. return object;
  26793. }
  26794. /**
  26795. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  26796. * it's created. Arrays are created for missing index properties while objects
  26797. * are created for all other missing properties. Use `_.setWith` to customize
  26798. * `path` creation.
  26799. *
  26800. * **Note:** This method mutates `object`.
  26801. *
  26802. * @static
  26803. * @memberOf _
  26804. * @since 3.7.0
  26805. * @category Object
  26806. * @param {Object} object The object to modify.
  26807. * @param {Array|string} path The path of the property to set.
  26808. * @param {*} value The value to set.
  26809. * @returns {Object} Returns `object`.
  26810. * @example
  26811. *
  26812. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26813. *
  26814. * _.set(object, 'a[0].b.c', 4);
  26815. * console.log(object.a[0].b.c);
  26816. * // => 4
  26817. *
  26818. * _.set(object, ['x', '0', 'y', 'z'], 5);
  26819. * console.log(object.x[0].y.z);
  26820. * // => 5
  26821. */
  26822. function set(object, path, value) {
  26823. return object == null ? object : baseSet(object, path, value);
  26824. }
  26825. /**
  26826. * This method is like `_.set` except that it accepts `customizer` which is
  26827. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26828. * path creation is handled by the method instead. The `customizer` is invoked
  26829. * with three arguments: (nsValue, key, nsObject).
  26830. *
  26831. * **Note:** This method mutates `object`.
  26832. *
  26833. * @static
  26834. * @memberOf _
  26835. * @since 4.0.0
  26836. * @category Object
  26837. * @param {Object} object The object to modify.
  26838. * @param {Array|string} path The path of the property to set.
  26839. * @param {*} value The value to set.
  26840. * @param {Function} [customizer] The function to customize assigned values.
  26841. * @returns {Object} Returns `object`.
  26842. * @example
  26843. *
  26844. * var object = {};
  26845. *
  26846. * _.setWith(object, '[0][1]', 'a', Object);
  26847. * // => { '0': { '1': 'a' } }
  26848. */
  26849. function setWith(object, path, value, customizer) {
  26850. customizer = typeof customizer == 'function' ? customizer : undefined;
  26851. return object == null ? object : baseSet(object, path, value, customizer);
  26852. }
  26853. /**
  26854. * Creates an array of own enumerable string keyed-value pairs for `object`
  26855. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  26856. * entries are returned.
  26857. *
  26858. * @static
  26859. * @memberOf _
  26860. * @since 4.0.0
  26861. * @alias entries
  26862. * @category Object
  26863. * @param {Object} object The object to query.
  26864. * @returns {Array} Returns the key-value pairs.
  26865. * @example
  26866. *
  26867. * function Foo() {
  26868. * this.a = 1;
  26869. * this.b = 2;
  26870. * }
  26871. *
  26872. * Foo.prototype.c = 3;
  26873. *
  26874. * _.toPairs(new Foo);
  26875. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26876. */
  26877. var toPairs = createToPairs(keys);
  26878. /**
  26879. * Creates an array of own and inherited enumerable string keyed-value pairs
  26880. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  26881. * or set, its entries are returned.
  26882. *
  26883. * @static
  26884. * @memberOf _
  26885. * @since 4.0.0
  26886. * @alias entriesIn
  26887. * @category Object
  26888. * @param {Object} object The object to query.
  26889. * @returns {Array} Returns the key-value pairs.
  26890. * @example
  26891. *
  26892. * function Foo() {
  26893. * this.a = 1;
  26894. * this.b = 2;
  26895. * }
  26896. *
  26897. * Foo.prototype.c = 3;
  26898. *
  26899. * _.toPairsIn(new Foo);
  26900. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  26901. */
  26902. var toPairsIn = createToPairs(keysIn);
  26903. /**
  26904. * An alternative to `_.reduce`; this method transforms `object` to a new
  26905. * `accumulator` object which is the result of running each of its own
  26906. * enumerable string keyed properties thru `iteratee`, with each invocation
  26907. * potentially mutating the `accumulator` object. If `accumulator` is not
  26908. * provided, a new object with the same `[[Prototype]]` will be used. The
  26909. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  26910. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26911. *
  26912. * @static
  26913. * @memberOf _
  26914. * @since 1.3.0
  26915. * @category Object
  26916. * @param {Object} object The object to iterate over.
  26917. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26918. * @param {*} [accumulator] The custom accumulator value.
  26919. * @returns {*} Returns the accumulated value.
  26920. * @example
  26921. *
  26922. * _.transform([2, 3, 4], function(result, n) {
  26923. * result.push(n *= n);
  26924. * return n % 2 == 0;
  26925. * }, []);
  26926. * // => [4, 9]
  26927. *
  26928. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26929. * (result[value] || (result[value] = [])).push(key);
  26930. * }, {});
  26931. * // => { '1': ['a', 'c'], '2': ['b'] }
  26932. */
  26933. function transform(object, iteratee, accumulator) {
  26934. var isArr = isArray(object),
  26935. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  26936. iteratee = getIteratee(iteratee, 4);
  26937. if (accumulator == null) {
  26938. var Ctor = object && object.constructor;
  26939. if (isArrLike) {
  26940. accumulator = isArr ? new Ctor : [];
  26941. }
  26942. else if (isObject(object)) {
  26943. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  26944. }
  26945. else {
  26946. accumulator = {};
  26947. }
  26948. }
  26949. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  26950. return iteratee(accumulator, value, index, object);
  26951. });
  26952. return accumulator;
  26953. }
  26954. /**
  26955. * Removes the property at `path` of `object`.
  26956. *
  26957. * **Note:** This method mutates `object`.
  26958. *
  26959. * @static
  26960. * @memberOf _
  26961. * @since 4.0.0
  26962. * @category Object
  26963. * @param {Object} object The object to modify.
  26964. * @param {Array|string} path The path of the property to unset.
  26965. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  26966. * @example
  26967. *
  26968. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  26969. * _.unset(object, 'a[0].b.c');
  26970. * // => true
  26971. *
  26972. * console.log(object);
  26973. * // => { 'a': [{ 'b': {} }] };
  26974. *
  26975. * _.unset(object, ['a', '0', 'b', 'c']);
  26976. * // => true
  26977. *
  26978. * console.log(object);
  26979. * // => { 'a': [{ 'b': {} }] };
  26980. */
  26981. function unset(object, path) {
  26982. return object == null ? true : baseUnset(object, path);
  26983. }
  26984. /**
  26985. * This method is like `_.set` except that accepts `updater` to produce the
  26986. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  26987. * is invoked with one argument: (value).
  26988. *
  26989. * **Note:** This method mutates `object`.
  26990. *
  26991. * @static
  26992. * @memberOf _
  26993. * @since 4.6.0
  26994. * @category Object
  26995. * @param {Object} object The object to modify.
  26996. * @param {Array|string} path The path of the property to set.
  26997. * @param {Function} updater The function to produce the updated value.
  26998. * @returns {Object} Returns `object`.
  26999. * @example
  27000. *
  27001. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  27002. *
  27003. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  27004. * console.log(object.a[0].b.c);
  27005. * // => 9
  27006. *
  27007. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  27008. * console.log(object.x[0].y.z);
  27009. * // => 0
  27010. */
  27011. function update(object, path, updater) {
  27012. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  27013. }
  27014. /**
  27015. * This method is like `_.update` except that it accepts `customizer` which is
  27016. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  27017. * path creation is handled by the method instead. The `customizer` is invoked
  27018. * with three arguments: (nsValue, key, nsObject).
  27019. *
  27020. * **Note:** This method mutates `object`.
  27021. *
  27022. * @static
  27023. * @memberOf _
  27024. * @since 4.6.0
  27025. * @category Object
  27026. * @param {Object} object The object to modify.
  27027. * @param {Array|string} path The path of the property to set.
  27028. * @param {Function} updater The function to produce the updated value.
  27029. * @param {Function} [customizer] The function to customize assigned values.
  27030. * @returns {Object} Returns `object`.
  27031. * @example
  27032. *
  27033. * var object = {};
  27034. *
  27035. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  27036. * // => { '0': { '1': 'a' } }
  27037. */
  27038. function updateWith(object, path, updater, customizer) {
  27039. customizer = typeof customizer == 'function' ? customizer : undefined;
  27040. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  27041. }
  27042. /**
  27043. * Creates an array of the own enumerable string keyed property values of `object`.
  27044. *
  27045. * **Note:** Non-object values are coerced to objects.
  27046. *
  27047. * @static
  27048. * @since 0.1.0
  27049. * @memberOf _
  27050. * @category Object
  27051. * @param {Object} object The object to query.
  27052. * @returns {Array} Returns the array of property values.
  27053. * @example
  27054. *
  27055. * function Foo() {
  27056. * this.a = 1;
  27057. * this.b = 2;
  27058. * }
  27059. *
  27060. * Foo.prototype.c = 3;
  27061. *
  27062. * _.values(new Foo);
  27063. * // => [1, 2] (iteration order is not guaranteed)
  27064. *
  27065. * _.values('hi');
  27066. * // => ['h', 'i']
  27067. */
  27068. function values(object) {
  27069. return object == null ? [] : baseValues(object, keys(object));
  27070. }
  27071. /**
  27072. * Creates an array of the own and inherited enumerable string keyed property
  27073. * values of `object`.
  27074. *
  27075. * **Note:** Non-object values are coerced to objects.
  27076. *
  27077. * @static
  27078. * @memberOf _
  27079. * @since 3.0.0
  27080. * @category Object
  27081. * @param {Object} object The object to query.
  27082. * @returns {Array} Returns the array of property values.
  27083. * @example
  27084. *
  27085. * function Foo() {
  27086. * this.a = 1;
  27087. * this.b = 2;
  27088. * }
  27089. *
  27090. * Foo.prototype.c = 3;
  27091. *
  27092. * _.valuesIn(new Foo);
  27093. * // => [1, 2, 3] (iteration order is not guaranteed)
  27094. */
  27095. function valuesIn(object) {
  27096. return object == null ? [] : baseValues(object, keysIn(object));
  27097. }
  27098. /*------------------------------------------------------------------------*/
  27099. /**
  27100. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  27101. *
  27102. * @static
  27103. * @memberOf _
  27104. * @since 4.0.0
  27105. * @category Number
  27106. * @param {number} number The number to clamp.
  27107. * @param {number} [lower] The lower bound.
  27108. * @param {number} upper The upper bound.
  27109. * @returns {number} Returns the clamped number.
  27110. * @example
  27111. *
  27112. * _.clamp(-10, -5, 5);
  27113. * // => -5
  27114. *
  27115. * _.clamp(10, -5, 5);
  27116. * // => 5
  27117. */
  27118. function clamp(number, lower, upper) {
  27119. if (upper === undefined) {
  27120. upper = lower;
  27121. lower = undefined;
  27122. }
  27123. if (upper !== undefined) {
  27124. upper = toNumber(upper);
  27125. upper = upper === upper ? upper : 0;
  27126. }
  27127. if (lower !== undefined) {
  27128. lower = toNumber(lower);
  27129. lower = lower === lower ? lower : 0;
  27130. }
  27131. return baseClamp(toNumber(number), lower, upper);
  27132. }
  27133. /**
  27134. * Checks if `n` is between `start` and up to, but not including, `end`. If
  27135. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  27136. * If `start` is greater than `end` the params are swapped to support
  27137. * negative ranges.
  27138. *
  27139. * @static
  27140. * @memberOf _
  27141. * @since 3.3.0
  27142. * @category Number
  27143. * @param {number} number The number to check.
  27144. * @param {number} [start=0] The start of the range.
  27145. * @param {number} end The end of the range.
  27146. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  27147. * @see _.range, _.rangeRight
  27148. * @example
  27149. *
  27150. * _.inRange(3, 2, 4);
  27151. * // => true
  27152. *
  27153. * _.inRange(4, 8);
  27154. * // => true
  27155. *
  27156. * _.inRange(4, 2);
  27157. * // => false
  27158. *
  27159. * _.inRange(2, 2);
  27160. * // => false
  27161. *
  27162. * _.inRange(1.2, 2);
  27163. * // => true
  27164. *
  27165. * _.inRange(5.2, 4);
  27166. * // => false
  27167. *
  27168. * _.inRange(-3, -2, -6);
  27169. * // => true
  27170. */
  27171. function inRange(number, start, end) {
  27172. start = toFinite(start);
  27173. if (end === undefined) {
  27174. end = start;
  27175. start = 0;
  27176. } else {
  27177. end = toFinite(end);
  27178. }
  27179. number = toNumber(number);
  27180. return baseInRange(number, start, end);
  27181. }
  27182. /**
  27183. * Produces a random number between the inclusive `lower` and `upper` bounds.
  27184. * If only one argument is provided a number between `0` and the given number
  27185. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  27186. * floats, a floating-point number is returned instead of an integer.
  27187. *
  27188. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  27189. * floating-point values which can produce unexpected results.
  27190. *
  27191. * @static
  27192. * @memberOf _
  27193. * @since 0.7.0
  27194. * @category Number
  27195. * @param {number} [lower=0] The lower bound.
  27196. * @param {number} [upper=1] The upper bound.
  27197. * @param {boolean} [floating] Specify returning a floating-point number.
  27198. * @returns {number} Returns the random number.
  27199. * @example
  27200. *
  27201. * _.random(0, 5);
  27202. * // => an integer between 0 and 5
  27203. *
  27204. * _.random(5);
  27205. * // => also an integer between 0 and 5
  27206. *
  27207. * _.random(5, true);
  27208. * // => a floating-point number between 0 and 5
  27209. *
  27210. * _.random(1.2, 5.2);
  27211. * // => a floating-point number between 1.2 and 5.2
  27212. */
  27213. function random(lower, upper, floating) {
  27214. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  27215. upper = floating = undefined;
  27216. }
  27217. if (floating === undefined) {
  27218. if (typeof upper == 'boolean') {
  27219. floating = upper;
  27220. upper = undefined;
  27221. }
  27222. else if (typeof lower == 'boolean') {
  27223. floating = lower;
  27224. lower = undefined;
  27225. }
  27226. }
  27227. if (lower === undefined && upper === undefined) {
  27228. lower = 0;
  27229. upper = 1;
  27230. }
  27231. else {
  27232. lower = toFinite(lower);
  27233. if (upper === undefined) {
  27234. upper = lower;
  27235. lower = 0;
  27236. } else {
  27237. upper = toFinite(upper);
  27238. }
  27239. }
  27240. if (lower > upper) {
  27241. var temp = lower;
  27242. lower = upper;
  27243. upper = temp;
  27244. }
  27245. if (floating || lower % 1 || upper % 1) {
  27246. var rand = nativeRandom();
  27247. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  27248. }
  27249. return baseRandom(lower, upper);
  27250. }
  27251. /*------------------------------------------------------------------------*/
  27252. /**
  27253. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  27254. *
  27255. * @static
  27256. * @memberOf _
  27257. * @since 3.0.0
  27258. * @category String
  27259. * @param {string} [string=''] The string to convert.
  27260. * @returns {string} Returns the camel cased string.
  27261. * @example
  27262. *
  27263. * _.camelCase('Foo Bar');
  27264. * // => 'fooBar'
  27265. *
  27266. * _.camelCase('--foo-bar--');
  27267. * // => 'fooBar'
  27268. *
  27269. * _.camelCase('__FOO_BAR__');
  27270. * // => 'fooBar'
  27271. */
  27272. var camelCase = createCompounder(function(result, word, index) {
  27273. word = word.toLowerCase();
  27274. return result + (index ? capitalize(word) : word);
  27275. });
  27276. /**
  27277. * Converts the first character of `string` to upper case and the remaining
  27278. * to lower case.
  27279. *
  27280. * @static
  27281. * @memberOf _
  27282. * @since 3.0.0
  27283. * @category String
  27284. * @param {string} [string=''] The string to capitalize.
  27285. * @returns {string} Returns the capitalized string.
  27286. * @example
  27287. *
  27288. * _.capitalize('FRED');
  27289. * // => 'Fred'
  27290. */
  27291. function capitalize(string) {
  27292. return upperFirst(toString(string).toLowerCase());
  27293. }
  27294. /**
  27295. * Deburrs `string` by converting
  27296. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  27297. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  27298. * letters to basic Latin letters and removing
  27299. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  27300. *
  27301. * @static
  27302. * @memberOf _
  27303. * @since 3.0.0
  27304. * @category String
  27305. * @param {string} [string=''] The string to deburr.
  27306. * @returns {string} Returns the deburred string.
  27307. * @example
  27308. *
  27309. * _.deburr('déjà vu');
  27310. * // => 'deja vu'
  27311. */
  27312. function deburr(string) {
  27313. string = toString(string);
  27314. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  27315. }
  27316. /**
  27317. * Checks if `string` ends with the given target string.
  27318. *
  27319. * @static
  27320. * @memberOf _
  27321. * @since 3.0.0
  27322. * @category String
  27323. * @param {string} [string=''] The string to inspect.
  27324. * @param {string} [target] The string to search for.
  27325. * @param {number} [position=string.length] The position to search up to.
  27326. * @returns {boolean} Returns `true` if `string` ends with `target`,
  27327. * else `false`.
  27328. * @example
  27329. *
  27330. * _.endsWith('abc', 'c');
  27331. * // => true
  27332. *
  27333. * _.endsWith('abc', 'b');
  27334. * // => false
  27335. *
  27336. * _.endsWith('abc', 'b', 2);
  27337. * // => true
  27338. */
  27339. function endsWith(string, target, position) {
  27340. string = toString(string);
  27341. target = baseToString(target);
  27342. var length = string.length;
  27343. position = position === undefined
  27344. ? length
  27345. : baseClamp(toInteger(position), 0, length);
  27346. var end = position;
  27347. position -= target.length;
  27348. return position >= 0 && string.slice(position, end) == target;
  27349. }
  27350. /**
  27351. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  27352. * corresponding HTML entities.
  27353. *
  27354. * **Note:** No other characters are escaped. To escape additional
  27355. * characters use a third-party library like [_he_](https://mths.be/he).
  27356. *
  27357. * Though the ">" character is escaped for symmetry, characters like
  27358. * ">" and "/" don't need escaping in HTML and have no special meaning
  27359. * unless they're part of a tag or unquoted attribute value. See
  27360. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  27361. * (under "semi-related fun fact") for more details.
  27362. *
  27363. * When working with HTML you should always
  27364. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  27365. * XSS vectors.
  27366. *
  27367. * @static
  27368. * @since 0.1.0
  27369. * @memberOf _
  27370. * @category String
  27371. * @param {string} [string=''] The string to escape.
  27372. * @returns {string} Returns the escaped string.
  27373. * @example
  27374. *
  27375. * _.escape('fred, barney, & pebbles');
  27376. * // => 'fred, barney, &amp; pebbles'
  27377. */
  27378. function escape(string) {
  27379. string = toString(string);
  27380. return (string && reHasUnescapedHtml.test(string))
  27381. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  27382. : string;
  27383. }
  27384. /**
  27385. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  27386. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  27387. *
  27388. * @static
  27389. * @memberOf _
  27390. * @since 3.0.0
  27391. * @category String
  27392. * @param {string} [string=''] The string to escape.
  27393. * @returns {string} Returns the escaped string.
  27394. * @example
  27395. *
  27396. * _.escapeRegExp('[lodash](https://lodash.com/)');
  27397. * // => '\[lodash\]\(https://lodash\.com/\)'
  27398. */
  27399. function escapeRegExp(string) {
  27400. string = toString(string);
  27401. return (string && reHasRegExpChar.test(string))
  27402. ? string.replace(reRegExpChar, '\\$&')
  27403. : string;
  27404. }
  27405. /**
  27406. * Converts `string` to
  27407. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  27408. *
  27409. * @static
  27410. * @memberOf _
  27411. * @since 3.0.0
  27412. * @category String
  27413. * @param {string} [string=''] The string to convert.
  27414. * @returns {string} Returns the kebab cased string.
  27415. * @example
  27416. *
  27417. * _.kebabCase('Foo Bar');
  27418. * // => 'foo-bar'
  27419. *
  27420. * _.kebabCase('fooBar');
  27421. * // => 'foo-bar'
  27422. *
  27423. * _.kebabCase('__FOO_BAR__');
  27424. * // => 'foo-bar'
  27425. */
  27426. var kebabCase = createCompounder(function(result, word, index) {
  27427. return result + (index ? '-' : '') + word.toLowerCase();
  27428. });
  27429. /**
  27430. * Converts `string`, as space separated words, to lower case.
  27431. *
  27432. * @static
  27433. * @memberOf _
  27434. * @since 4.0.0
  27435. * @category String
  27436. * @param {string} [string=''] The string to convert.
  27437. * @returns {string} Returns the lower cased string.
  27438. * @example
  27439. *
  27440. * _.lowerCase('--Foo-Bar--');
  27441. * // => 'foo bar'
  27442. *
  27443. * _.lowerCase('fooBar');
  27444. * // => 'foo bar'
  27445. *
  27446. * _.lowerCase('__FOO_BAR__');
  27447. * // => 'foo bar'
  27448. */
  27449. var lowerCase = createCompounder(function(result, word, index) {
  27450. return result + (index ? ' ' : '') + word.toLowerCase();
  27451. });
  27452. /**
  27453. * Converts the first character of `string` to lower case.
  27454. *
  27455. * @static
  27456. * @memberOf _
  27457. * @since 4.0.0
  27458. * @category String
  27459. * @param {string} [string=''] The string to convert.
  27460. * @returns {string} Returns the converted string.
  27461. * @example
  27462. *
  27463. * _.lowerFirst('Fred');
  27464. * // => 'fred'
  27465. *
  27466. * _.lowerFirst('FRED');
  27467. * // => 'fRED'
  27468. */
  27469. var lowerFirst = createCaseFirst('toLowerCase');
  27470. /**
  27471. * Pads `string` on the left and right sides if it's shorter than `length`.
  27472. * Padding characters are truncated if they can't be evenly divided by `length`.
  27473. *
  27474. * @static
  27475. * @memberOf _
  27476. * @since 3.0.0
  27477. * @category String
  27478. * @param {string} [string=''] The string to pad.
  27479. * @param {number} [length=0] The padding length.
  27480. * @param {string} [chars=' '] The string used as padding.
  27481. * @returns {string} Returns the padded string.
  27482. * @example
  27483. *
  27484. * _.pad('abc', 8);
  27485. * // => ' abc '
  27486. *
  27487. * _.pad('abc', 8, '_-');
  27488. * // => '_-abc_-_'
  27489. *
  27490. * _.pad('abc', 3);
  27491. * // => 'abc'
  27492. */
  27493. function pad(string, length, chars) {
  27494. string = toString(string);
  27495. length = toInteger(length);
  27496. var strLength = length ? stringSize(string) : 0;
  27497. if (!length || strLength >= length) {
  27498. return string;
  27499. }
  27500. var mid = (length - strLength) / 2;
  27501. return (
  27502. createPadding(nativeFloor(mid), chars) +
  27503. string +
  27504. createPadding(nativeCeil(mid), chars)
  27505. );
  27506. }
  27507. /**
  27508. * Pads `string` on the right side if it's shorter than `length`. Padding
  27509. * characters are truncated if they exceed `length`.
  27510. *
  27511. * @static
  27512. * @memberOf _
  27513. * @since 4.0.0
  27514. * @category String
  27515. * @param {string} [string=''] The string to pad.
  27516. * @param {number} [length=0] The padding length.
  27517. * @param {string} [chars=' '] The string used as padding.
  27518. * @returns {string} Returns the padded string.
  27519. * @example
  27520. *
  27521. * _.padEnd('abc', 6);
  27522. * // => 'abc '
  27523. *
  27524. * _.padEnd('abc', 6, '_-');
  27525. * // => 'abc_-_'
  27526. *
  27527. * _.padEnd('abc', 3);
  27528. * // => 'abc'
  27529. */
  27530. function padEnd(string, length, chars) {
  27531. string = toString(string);
  27532. length = toInteger(length);
  27533. var strLength = length ? stringSize(string) : 0;
  27534. return (length && strLength < length)
  27535. ? (string + createPadding(length - strLength, chars))
  27536. : string;
  27537. }
  27538. /**
  27539. * Pads `string` on the left side if it's shorter than `length`. Padding
  27540. * characters are truncated if they exceed `length`.
  27541. *
  27542. * @static
  27543. * @memberOf _
  27544. * @since 4.0.0
  27545. * @category String
  27546. * @param {string} [string=''] The string to pad.
  27547. * @param {number} [length=0] The padding length.
  27548. * @param {string} [chars=' '] The string used as padding.
  27549. * @returns {string} Returns the padded string.
  27550. * @example
  27551. *
  27552. * _.padStart('abc', 6);
  27553. * // => ' abc'
  27554. *
  27555. * _.padStart('abc', 6, '_-');
  27556. * // => '_-_abc'
  27557. *
  27558. * _.padStart('abc', 3);
  27559. * // => 'abc'
  27560. */
  27561. function padStart(string, length, chars) {
  27562. string = toString(string);
  27563. length = toInteger(length);
  27564. var strLength = length ? stringSize(string) : 0;
  27565. return (length && strLength < length)
  27566. ? (createPadding(length - strLength, chars) + string)
  27567. : string;
  27568. }
  27569. /**
  27570. * Converts `string` to an integer of the specified radix. If `radix` is
  27571. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  27572. * hexadecimal, in which case a `radix` of `16` is used.
  27573. *
  27574. * **Note:** This method aligns with the
  27575. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  27576. *
  27577. * @static
  27578. * @memberOf _
  27579. * @since 1.1.0
  27580. * @category String
  27581. * @param {string} string The string to convert.
  27582. * @param {number} [radix=10] The radix to interpret `value` by.
  27583. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27584. * @returns {number} Returns the converted integer.
  27585. * @example
  27586. *
  27587. * _.parseInt('08');
  27588. * // => 8
  27589. *
  27590. * _.map(['6', '08', '10'], _.parseInt);
  27591. * // => [6, 8, 10]
  27592. */
  27593. function parseInt(string, radix, guard) {
  27594. if (guard || radix == null) {
  27595. radix = 0;
  27596. } else if (radix) {
  27597. radix = +radix;
  27598. }
  27599. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  27600. }
  27601. /**
  27602. * Repeats the given string `n` times.
  27603. *
  27604. * @static
  27605. * @memberOf _
  27606. * @since 3.0.0
  27607. * @category String
  27608. * @param {string} [string=''] The string to repeat.
  27609. * @param {number} [n=1] The number of times to repeat the string.
  27610. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27611. * @returns {string} Returns the repeated string.
  27612. * @example
  27613. *
  27614. * _.repeat('*', 3);
  27615. * // => '***'
  27616. *
  27617. * _.repeat('abc', 2);
  27618. * // => 'abcabc'
  27619. *
  27620. * _.repeat('abc', 0);
  27621. * // => ''
  27622. */
  27623. function repeat(string, n, guard) {
  27624. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  27625. n = 1;
  27626. } else {
  27627. n = toInteger(n);
  27628. }
  27629. return baseRepeat(toString(string), n);
  27630. }
  27631. /**
  27632. * Replaces matches for `pattern` in `string` with `replacement`.
  27633. *
  27634. * **Note:** This method is based on
  27635. * [`String#replace`](https://mdn.io/String/replace).
  27636. *
  27637. * @static
  27638. * @memberOf _
  27639. * @since 4.0.0
  27640. * @category String
  27641. * @param {string} [string=''] The string to modify.
  27642. * @param {RegExp|string} pattern The pattern to replace.
  27643. * @param {Function|string} replacement The match replacement.
  27644. * @returns {string} Returns the modified string.
  27645. * @example
  27646. *
  27647. * _.replace('Hi Fred', 'Fred', 'Barney');
  27648. * // => 'Hi Barney'
  27649. */
  27650. function replace() {
  27651. var args = arguments,
  27652. string = toString(args[0]);
  27653. return args.length < 3 ? string : string.replace(args[1], args[2]);
  27654. }
  27655. /**
  27656. * Converts `string` to
  27657. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  27658. *
  27659. * @static
  27660. * @memberOf _
  27661. * @since 3.0.0
  27662. * @category String
  27663. * @param {string} [string=''] The string to convert.
  27664. * @returns {string} Returns the snake cased string.
  27665. * @example
  27666. *
  27667. * _.snakeCase('Foo Bar');
  27668. * // => 'foo_bar'
  27669. *
  27670. * _.snakeCase('fooBar');
  27671. * // => 'foo_bar'
  27672. *
  27673. * _.snakeCase('--FOO-BAR--');
  27674. * // => 'foo_bar'
  27675. */
  27676. var snakeCase = createCompounder(function(result, word, index) {
  27677. return result + (index ? '_' : '') + word.toLowerCase();
  27678. });
  27679. /**
  27680. * Splits `string` by `separator`.
  27681. *
  27682. * **Note:** This method is based on
  27683. * [`String#split`](https://mdn.io/String/split).
  27684. *
  27685. * @static
  27686. * @memberOf _
  27687. * @since 4.0.0
  27688. * @category String
  27689. * @param {string} [string=''] The string to split.
  27690. * @param {RegExp|string} separator The separator pattern to split by.
  27691. * @param {number} [limit] The length to truncate results to.
  27692. * @returns {Array} Returns the string segments.
  27693. * @example
  27694. *
  27695. * _.split('a-b-c', '-', 2);
  27696. * // => ['a', 'b']
  27697. */
  27698. function split(string, separator, limit) {
  27699. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  27700. separator = limit = undefined;
  27701. }
  27702. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  27703. if (!limit) {
  27704. return [];
  27705. }
  27706. string = toString(string);
  27707. if (string && (
  27708. typeof separator == 'string' ||
  27709. (separator != null && !isRegExp(separator))
  27710. )) {
  27711. separator = baseToString(separator);
  27712. if (!separator && hasUnicode(string)) {
  27713. return castSlice(stringToArray(string), 0, limit);
  27714. }
  27715. }
  27716. return string.split(separator, limit);
  27717. }
  27718. /**
  27719. * Converts `string` to
  27720. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  27721. *
  27722. * @static
  27723. * @memberOf _
  27724. * @since 3.1.0
  27725. * @category String
  27726. * @param {string} [string=''] The string to convert.
  27727. * @returns {string} Returns the start cased string.
  27728. * @example
  27729. *
  27730. * _.startCase('--foo-bar--');
  27731. * // => 'Foo Bar'
  27732. *
  27733. * _.startCase('fooBar');
  27734. * // => 'Foo Bar'
  27735. *
  27736. * _.startCase('__FOO_BAR__');
  27737. * // => 'FOO BAR'
  27738. */
  27739. var startCase = createCompounder(function(result, word, index) {
  27740. return result + (index ? ' ' : '') + upperFirst(word);
  27741. });
  27742. /**
  27743. * Checks if `string` starts with the given target string.
  27744. *
  27745. * @static
  27746. * @memberOf _
  27747. * @since 3.0.0
  27748. * @category String
  27749. * @param {string} [string=''] The string to inspect.
  27750. * @param {string} [target] The string to search for.
  27751. * @param {number} [position=0] The position to search from.
  27752. * @returns {boolean} Returns `true` if `string` starts with `target`,
  27753. * else `false`.
  27754. * @example
  27755. *
  27756. * _.startsWith('abc', 'a');
  27757. * // => true
  27758. *
  27759. * _.startsWith('abc', 'b');
  27760. * // => false
  27761. *
  27762. * _.startsWith('abc', 'b', 1);
  27763. * // => true
  27764. */
  27765. function startsWith(string, target, position) {
  27766. string = toString(string);
  27767. position = position == null
  27768. ? 0
  27769. : baseClamp(toInteger(position), 0, string.length);
  27770. target = baseToString(target);
  27771. return string.slice(position, position + target.length) == target;
  27772. }
  27773. /**
  27774. * Creates a compiled template function that can interpolate data properties
  27775. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  27776. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  27777. * properties may be accessed as free variables in the template. If a setting
  27778. * object is given, it takes precedence over `_.templateSettings` values.
  27779. *
  27780. * **Note:** In the development build `_.template` utilizes
  27781. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  27782. * for easier debugging.
  27783. *
  27784. * For more information on precompiling templates see
  27785. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  27786. *
  27787. * For more information on Chrome extension sandboxes see
  27788. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  27789. *
  27790. * @static
  27791. * @since 0.1.0
  27792. * @memberOf _
  27793. * @category String
  27794. * @param {string} [string=''] The template string.
  27795. * @param {Object} [options={}] The options object.
  27796. * @param {RegExp} [options.escape=_.templateSettings.escape]
  27797. * The HTML "escape" delimiter.
  27798. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  27799. * The "evaluate" delimiter.
  27800. * @param {Object} [options.imports=_.templateSettings.imports]
  27801. * An object to import into the template as free variables.
  27802. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  27803. * The "interpolate" delimiter.
  27804. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  27805. * The sourceURL of the compiled template.
  27806. * @param {string} [options.variable='obj']
  27807. * The data object variable name.
  27808. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27809. * @returns {Function} Returns the compiled template function.
  27810. * @example
  27811. *
  27812. * // Use the "interpolate" delimiter to create a compiled template.
  27813. * var compiled = _.template('hello <%= user %>!');
  27814. * compiled({ 'user': 'fred' });
  27815. * // => 'hello fred!'
  27816. *
  27817. * // Use the HTML "escape" delimiter to escape data property values.
  27818. * var compiled = _.template('<b><%- value %></b>');
  27819. * compiled({ 'value': '<script>' });
  27820. * // => '<b>&lt;script&gt;</b>'
  27821. *
  27822. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  27823. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  27824. * compiled({ 'users': ['fred', 'barney'] });
  27825. * // => '<li>fred</li><li>barney</li>'
  27826. *
  27827. * // Use the internal `print` function in "evaluate" delimiters.
  27828. * var compiled = _.template('<% print("hello " + user); %>!');
  27829. * compiled({ 'user': 'barney' });
  27830. * // => 'hello barney!'
  27831. *
  27832. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  27833. * // Disable support by replacing the "interpolate" delimiter.
  27834. * var compiled = _.template('hello ${ user }!');
  27835. * compiled({ 'user': 'pebbles' });
  27836. * // => 'hello pebbles!'
  27837. *
  27838. * // Use backslashes to treat delimiters as plain text.
  27839. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  27840. * compiled({ 'value': 'ignored' });
  27841. * // => '<%- value %>'
  27842. *
  27843. * // Use the `imports` option to import `jQuery` as `jq`.
  27844. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  27845. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  27846. * compiled({ 'users': ['fred', 'barney'] });
  27847. * // => '<li>fred</li><li>barney</li>'
  27848. *
  27849. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  27850. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  27851. * compiled(data);
  27852. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  27853. *
  27854. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  27855. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  27856. * compiled.source;
  27857. * // => function(data) {
  27858. * // var __t, __p = '';
  27859. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  27860. * // return __p;
  27861. * // }
  27862. *
  27863. * // Use custom template delimiters.
  27864. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  27865. * var compiled = _.template('hello {{ user }}!');
  27866. * compiled({ 'user': 'mustache' });
  27867. * // => 'hello mustache!'
  27868. *
  27869. * // Use the `source` property to inline compiled templates for meaningful
  27870. * // line numbers in error messages and stack traces.
  27871. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  27872. * var JST = {\
  27873. * "main": ' + _.template(mainText).source + '\
  27874. * };\
  27875. * ');
  27876. */
  27877. function template(string, options, guard) {
  27878. // Based on John Resig's `tmpl` implementation
  27879. // (http://ejohn.org/blog/javascript-micro-templating/)
  27880. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  27881. var settings = lodash.templateSettings;
  27882. if (guard && isIterateeCall(string, options, guard)) {
  27883. options = undefined;
  27884. }
  27885. string = toString(string);
  27886. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  27887. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  27888. importsKeys = keys(imports),
  27889. importsValues = baseValues(imports, importsKeys);
  27890. var isEscaping,
  27891. isEvaluating,
  27892. index = 0,
  27893. interpolate = options.interpolate || reNoMatch,
  27894. source = "__p += '";
  27895. // Compile the regexp to match each delimiter.
  27896. var reDelimiters = RegExp(
  27897. (options.escape || reNoMatch).source + '|' +
  27898. interpolate.source + '|' +
  27899. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  27900. (options.evaluate || reNoMatch).source + '|$'
  27901. , 'g');
  27902. // Use a sourceURL for easier debugging.
  27903. // The sourceURL gets injected into the source that's eval-ed, so be careful
  27904. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  27905. // and escape the comment, thus injecting code that gets evaled.
  27906. var sourceURL = '//# sourceURL=' +
  27907. (hasOwnProperty.call(options, 'sourceURL')
  27908. ? (options.sourceURL + '').replace(/\s/g, ' ')
  27909. : ('lodash.templateSources[' + (++templateCounter) + ']')
  27910. ) + '\n';
  27911. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  27912. interpolateValue || (interpolateValue = esTemplateValue);
  27913. // Escape characters that can't be included in string literals.
  27914. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  27915. // Replace delimiters with snippets.
  27916. if (escapeValue) {
  27917. isEscaping = true;
  27918. source += "' +\n__e(" + escapeValue + ") +\n'";
  27919. }
  27920. if (evaluateValue) {
  27921. isEvaluating = true;
  27922. source += "';\n" + evaluateValue + ";\n__p += '";
  27923. }
  27924. if (interpolateValue) {
  27925. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  27926. }
  27927. index = offset + match.length;
  27928. // The JS engine embedded in Adobe products needs `match` returned in
  27929. // order to produce the correct `offset` value.
  27930. return match;
  27931. });
  27932. source += "';\n";
  27933. // If `variable` is not specified wrap a with-statement around the generated
  27934. // code to add the data object to the top of the scope chain.
  27935. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  27936. if (!variable) {
  27937. source = 'with (obj) {\n' + source + '\n}\n';
  27938. }
  27939. // Cleanup code by stripping empty strings.
  27940. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  27941. .replace(reEmptyStringMiddle, '$1')
  27942. .replace(reEmptyStringTrailing, '$1;');
  27943. // Frame code as the function body.
  27944. source = 'function(' + (variable || 'obj') + ') {\n' +
  27945. (variable
  27946. ? ''
  27947. : 'obj || (obj = {});\n'
  27948. ) +
  27949. "var __t, __p = ''" +
  27950. (isEscaping
  27951. ? ', __e = _.escape'
  27952. : ''
  27953. ) +
  27954. (isEvaluating
  27955. ? ', __j = Array.prototype.join;\n' +
  27956. "function print() { __p += __j.call(arguments, '') }\n"
  27957. : ';\n'
  27958. ) +
  27959. source +
  27960. 'return __p\n}';
  27961. var result = attempt(function() {
  27962. return Function(importsKeys, sourceURL + 'return ' + source)
  27963. .apply(undefined, importsValues);
  27964. });
  27965. // Provide the compiled function's source by its `toString` method or
  27966. // the `source` property as a convenience for inlining compiled templates.
  27967. result.source = source;
  27968. if (isError(result)) {
  27969. throw result;
  27970. }
  27971. return result;
  27972. }
  27973. /**
  27974. * Converts `string`, as a whole, to lower case just like
  27975. * [String#toLowerCase](https://mdn.io/toLowerCase).
  27976. *
  27977. * @static
  27978. * @memberOf _
  27979. * @since 4.0.0
  27980. * @category String
  27981. * @param {string} [string=''] The string to convert.
  27982. * @returns {string} Returns the lower cased string.
  27983. * @example
  27984. *
  27985. * _.toLower('--Foo-Bar--');
  27986. * // => '--foo-bar--'
  27987. *
  27988. * _.toLower('fooBar');
  27989. * // => 'foobar'
  27990. *
  27991. * _.toLower('__FOO_BAR__');
  27992. * // => '__foo_bar__'
  27993. */
  27994. function toLower(value) {
  27995. return toString(value).toLowerCase();
  27996. }
  27997. /**
  27998. * Converts `string`, as a whole, to upper case just like
  27999. * [String#toUpperCase](https://mdn.io/toUpperCase).
  28000. *
  28001. * @static
  28002. * @memberOf _
  28003. * @since 4.0.0
  28004. * @category String
  28005. * @param {string} [string=''] The string to convert.
  28006. * @returns {string} Returns the upper cased string.
  28007. * @example
  28008. *
  28009. * _.toUpper('--foo-bar--');
  28010. * // => '--FOO-BAR--'
  28011. *
  28012. * _.toUpper('fooBar');
  28013. * // => 'FOOBAR'
  28014. *
  28015. * _.toUpper('__foo_bar__');
  28016. * // => '__FOO_BAR__'
  28017. */
  28018. function toUpper(value) {
  28019. return toString(value).toUpperCase();
  28020. }
  28021. /**
  28022. * Removes leading and trailing whitespace or specified characters from `string`.
  28023. *
  28024. * @static
  28025. * @memberOf _
  28026. * @since 3.0.0
  28027. * @category String
  28028. * @param {string} [string=''] The string to trim.
  28029. * @param {string} [chars=whitespace] The characters to trim.
  28030. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28031. * @returns {string} Returns the trimmed string.
  28032. * @example
  28033. *
  28034. * _.trim(' abc ');
  28035. * // => 'abc'
  28036. *
  28037. * _.trim('-_-abc-_-', '_-');
  28038. * // => 'abc'
  28039. *
  28040. * _.map([' foo ', ' bar '], _.trim);
  28041. * // => ['foo', 'bar']
  28042. */
  28043. function trim(string, chars, guard) {
  28044. string = toString(string);
  28045. if (string && (guard || chars === undefined)) {
  28046. return string.replace(reTrim, '');
  28047. }
  28048. if (!string || !(chars = baseToString(chars))) {
  28049. return string;
  28050. }
  28051. var strSymbols = stringToArray(string),
  28052. chrSymbols = stringToArray(chars),
  28053. start = charsStartIndex(strSymbols, chrSymbols),
  28054. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  28055. return castSlice(strSymbols, start, end).join('');
  28056. }
  28057. /**
  28058. * Removes trailing whitespace or specified characters from `string`.
  28059. *
  28060. * @static
  28061. * @memberOf _
  28062. * @since 4.0.0
  28063. * @category String
  28064. * @param {string} [string=''] The string to trim.
  28065. * @param {string} [chars=whitespace] The characters to trim.
  28066. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28067. * @returns {string} Returns the trimmed string.
  28068. * @example
  28069. *
  28070. * _.trimEnd(' abc ');
  28071. * // => ' abc'
  28072. *
  28073. * _.trimEnd('-_-abc-_-', '_-');
  28074. * // => '-_-abc'
  28075. */
  28076. function trimEnd(string, chars, guard) {
  28077. string = toString(string);
  28078. if (string && (guard || chars === undefined)) {
  28079. return string.replace(reTrimEnd, '');
  28080. }
  28081. if (!string || !(chars = baseToString(chars))) {
  28082. return string;
  28083. }
  28084. var strSymbols = stringToArray(string),
  28085. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  28086. return castSlice(strSymbols, 0, end).join('');
  28087. }
  28088. /**
  28089. * Removes leading whitespace or specified characters from `string`.
  28090. *
  28091. * @static
  28092. * @memberOf _
  28093. * @since 4.0.0
  28094. * @category String
  28095. * @param {string} [string=''] The string to trim.
  28096. * @param {string} [chars=whitespace] The characters to trim.
  28097. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28098. * @returns {string} Returns the trimmed string.
  28099. * @example
  28100. *
  28101. * _.trimStart(' abc ');
  28102. * // => 'abc '
  28103. *
  28104. * _.trimStart('-_-abc-_-', '_-');
  28105. * // => 'abc-_-'
  28106. */
  28107. function trimStart(string, chars, guard) {
  28108. string = toString(string);
  28109. if (string && (guard || chars === undefined)) {
  28110. return string.replace(reTrimStart, '');
  28111. }
  28112. if (!string || !(chars = baseToString(chars))) {
  28113. return string;
  28114. }
  28115. var strSymbols = stringToArray(string),
  28116. start = charsStartIndex(strSymbols, stringToArray(chars));
  28117. return castSlice(strSymbols, start).join('');
  28118. }
  28119. /**
  28120. * Truncates `string` if it's longer than the given maximum string length.
  28121. * The last characters of the truncated string are replaced with the omission
  28122. * string which defaults to "...".
  28123. *
  28124. * @static
  28125. * @memberOf _
  28126. * @since 4.0.0
  28127. * @category String
  28128. * @param {string} [string=''] The string to truncate.
  28129. * @param {Object} [options={}] The options object.
  28130. * @param {number} [options.length=30] The maximum string length.
  28131. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  28132. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  28133. * @returns {string} Returns the truncated string.
  28134. * @example
  28135. *
  28136. * _.truncate('hi-diddly-ho there, neighborino');
  28137. * // => 'hi-diddly-ho there, neighbo...'
  28138. *
  28139. * _.truncate('hi-diddly-ho there, neighborino', {
  28140. * 'length': 24,
  28141. * 'separator': ' '
  28142. * });
  28143. * // => 'hi-diddly-ho there,...'
  28144. *
  28145. * _.truncate('hi-diddly-ho there, neighborino', {
  28146. * 'length': 24,
  28147. * 'separator': /,? +/
  28148. * });
  28149. * // => 'hi-diddly-ho there...'
  28150. *
  28151. * _.truncate('hi-diddly-ho there, neighborino', {
  28152. * 'omission': ' [...]'
  28153. * });
  28154. * // => 'hi-diddly-ho there, neig [...]'
  28155. */
  28156. function truncate(string, options) {
  28157. var length = DEFAULT_TRUNC_LENGTH,
  28158. omission = DEFAULT_TRUNC_OMISSION;
  28159. if (isObject(options)) {
  28160. var separator = 'separator' in options ? options.separator : separator;
  28161. length = 'length' in options ? toInteger(options.length) : length;
  28162. omission = 'omission' in options ? baseToString(options.omission) : omission;
  28163. }
  28164. string = toString(string);
  28165. var strLength = string.length;
  28166. if (hasUnicode(string)) {
  28167. var strSymbols = stringToArray(string);
  28168. strLength = strSymbols.length;
  28169. }
  28170. if (length >= strLength) {
  28171. return string;
  28172. }
  28173. var end = length - stringSize(omission);
  28174. if (end < 1) {
  28175. return omission;
  28176. }
  28177. var result = strSymbols
  28178. ? castSlice(strSymbols, 0, end).join('')
  28179. : string.slice(0, end);
  28180. if (separator === undefined) {
  28181. return result + omission;
  28182. }
  28183. if (strSymbols) {
  28184. end += (result.length - end);
  28185. }
  28186. if (isRegExp(separator)) {
  28187. if (string.slice(end).search(separator)) {
  28188. var match,
  28189. substring = result;
  28190. if (!separator.global) {
  28191. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  28192. }
  28193. separator.lastIndex = 0;
  28194. while ((match = separator.exec(substring))) {
  28195. var newEnd = match.index;
  28196. }
  28197. result = result.slice(0, newEnd === undefined ? end : newEnd);
  28198. }
  28199. } else if (string.indexOf(baseToString(separator), end) != end) {
  28200. var index = result.lastIndexOf(separator);
  28201. if (index > -1) {
  28202. result = result.slice(0, index);
  28203. }
  28204. }
  28205. return result + omission;
  28206. }
  28207. /**
  28208. * The inverse of `_.escape`; this method converts the HTML entities
  28209. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  28210. * their corresponding characters.
  28211. *
  28212. * **Note:** No other HTML entities are unescaped. To unescape additional
  28213. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  28214. *
  28215. * @static
  28216. * @memberOf _
  28217. * @since 0.6.0
  28218. * @category String
  28219. * @param {string} [string=''] The string to unescape.
  28220. * @returns {string} Returns the unescaped string.
  28221. * @example
  28222. *
  28223. * _.unescape('fred, barney, &amp; pebbles');
  28224. * // => 'fred, barney, & pebbles'
  28225. */
  28226. function unescape(string) {
  28227. string = toString(string);
  28228. return (string && reHasEscapedHtml.test(string))
  28229. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  28230. : string;
  28231. }
  28232. /**
  28233. * Converts `string`, as space separated words, to upper case.
  28234. *
  28235. * @static
  28236. * @memberOf _
  28237. * @since 4.0.0
  28238. * @category String
  28239. * @param {string} [string=''] The string to convert.
  28240. * @returns {string} Returns the upper cased string.
  28241. * @example
  28242. *
  28243. * _.upperCase('--foo-bar');
  28244. * // => 'FOO BAR'
  28245. *
  28246. * _.upperCase('fooBar');
  28247. * // => 'FOO BAR'
  28248. *
  28249. * _.upperCase('__foo_bar__');
  28250. * // => 'FOO BAR'
  28251. */
  28252. var upperCase = createCompounder(function(result, word, index) {
  28253. return result + (index ? ' ' : '') + word.toUpperCase();
  28254. });
  28255. /**
  28256. * Converts the first character of `string` to upper case.
  28257. *
  28258. * @static
  28259. * @memberOf _
  28260. * @since 4.0.0
  28261. * @category String
  28262. * @param {string} [string=''] The string to convert.
  28263. * @returns {string} Returns the converted string.
  28264. * @example
  28265. *
  28266. * _.upperFirst('fred');
  28267. * // => 'Fred'
  28268. *
  28269. * _.upperFirst('FRED');
  28270. * // => 'FRED'
  28271. */
  28272. var upperFirst = createCaseFirst('toUpperCase');
  28273. /**
  28274. * Splits `string` into an array of its words.
  28275. *
  28276. * @static
  28277. * @memberOf _
  28278. * @since 3.0.0
  28279. * @category String
  28280. * @param {string} [string=''] The string to inspect.
  28281. * @param {RegExp|string} [pattern] The pattern to match words.
  28282. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28283. * @returns {Array} Returns the words of `string`.
  28284. * @example
  28285. *
  28286. * _.words('fred, barney, & pebbles');
  28287. * // => ['fred', 'barney', 'pebbles']
  28288. *
  28289. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  28290. * // => ['fred', 'barney', '&', 'pebbles']
  28291. */
  28292. function words(string, pattern, guard) {
  28293. string = toString(string);
  28294. pattern = guard ? undefined : pattern;
  28295. if (pattern === undefined) {
  28296. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  28297. }
  28298. return string.match(pattern) || [];
  28299. }
  28300. /*------------------------------------------------------------------------*/
  28301. /**
  28302. * Attempts to invoke `func`, returning either the result or the caught error
  28303. * object. Any additional arguments are provided to `func` when it's invoked.
  28304. *
  28305. * @static
  28306. * @memberOf _
  28307. * @since 3.0.0
  28308. * @category Util
  28309. * @param {Function} func The function to attempt.
  28310. * @param {...*} [args] The arguments to invoke `func` with.
  28311. * @returns {*} Returns the `func` result or error object.
  28312. * @example
  28313. *
  28314. * // Avoid throwing errors for invalid selectors.
  28315. * var elements = _.attempt(function(selector) {
  28316. * return document.querySelectorAll(selector);
  28317. * }, '>_>');
  28318. *
  28319. * if (_.isError(elements)) {
  28320. * elements = [];
  28321. * }
  28322. */
  28323. var attempt = baseRest(function(func, args) {
  28324. try {
  28325. return apply(func, undefined, args);
  28326. } catch (e) {
  28327. return isError(e) ? e : new Error(e);
  28328. }
  28329. });
  28330. /**
  28331. * Binds methods of an object to the object itself, overwriting the existing
  28332. * method.
  28333. *
  28334. * **Note:** This method doesn't set the "length" property of bound functions.
  28335. *
  28336. * @static
  28337. * @since 0.1.0
  28338. * @memberOf _
  28339. * @category Util
  28340. * @param {Object} object The object to bind and assign the bound methods to.
  28341. * @param {...(string|string[])} methodNames The object method names to bind.
  28342. * @returns {Object} Returns `object`.
  28343. * @example
  28344. *
  28345. * var view = {
  28346. * 'label': 'docs',
  28347. * 'click': function() {
  28348. * console.log('clicked ' + this.label);
  28349. * }
  28350. * };
  28351. *
  28352. * _.bindAll(view, ['click']);
  28353. * jQuery(element).on('click', view.click);
  28354. * // => Logs 'clicked docs' when clicked.
  28355. */
  28356. var bindAll = flatRest(function(object, methodNames) {
  28357. arrayEach(methodNames, function(key) {
  28358. key = toKey(key);
  28359. baseAssignValue(object, key, bind(object[key], object));
  28360. });
  28361. return object;
  28362. });
  28363. /**
  28364. * Creates a function that iterates over `pairs` and invokes the corresponding
  28365. * function of the first predicate to return truthy. The predicate-function
  28366. * pairs are invoked with the `this` binding and arguments of the created
  28367. * function.
  28368. *
  28369. * @static
  28370. * @memberOf _
  28371. * @since 4.0.0
  28372. * @category Util
  28373. * @param {Array} pairs The predicate-function pairs.
  28374. * @returns {Function} Returns the new composite function.
  28375. * @example
  28376. *
  28377. * var func = _.cond([
  28378. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  28379. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  28380. * [_.stubTrue, _.constant('no match')]
  28381. * ]);
  28382. *
  28383. * func({ 'a': 1, 'b': 2 });
  28384. * // => 'matches A'
  28385. *
  28386. * func({ 'a': 0, 'b': 1 });
  28387. * // => 'matches B'
  28388. *
  28389. * func({ 'a': '1', 'b': '2' });
  28390. * // => 'no match'
  28391. */
  28392. function cond(pairs) {
  28393. var length = pairs == null ? 0 : pairs.length,
  28394. toIteratee = getIteratee();
  28395. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  28396. if (typeof pair[1] != 'function') {
  28397. throw new TypeError(FUNC_ERROR_TEXT);
  28398. }
  28399. return [toIteratee(pair[0]), pair[1]];
  28400. });
  28401. return baseRest(function(args) {
  28402. var index = -1;
  28403. while (++index < length) {
  28404. var pair = pairs[index];
  28405. if (apply(pair[0], this, args)) {
  28406. return apply(pair[1], this, args);
  28407. }
  28408. }
  28409. });
  28410. }
  28411. /**
  28412. * Creates a function that invokes the predicate properties of `source` with
  28413. * the corresponding property values of a given object, returning `true` if
  28414. * all predicates return truthy, else `false`.
  28415. *
  28416. * **Note:** The created function is equivalent to `_.conformsTo` with
  28417. * `source` partially applied.
  28418. *
  28419. * @static
  28420. * @memberOf _
  28421. * @since 4.0.0
  28422. * @category Util
  28423. * @param {Object} source The object of property predicates to conform to.
  28424. * @returns {Function} Returns the new spec function.
  28425. * @example
  28426. *
  28427. * var objects = [
  28428. * { 'a': 2, 'b': 1 },
  28429. * { 'a': 1, 'b': 2 }
  28430. * ];
  28431. *
  28432. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  28433. * // => [{ 'a': 1, 'b': 2 }]
  28434. */
  28435. function conforms(source) {
  28436. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  28437. }
  28438. /**
  28439. * Creates a function that returns `value`.
  28440. *
  28441. * @static
  28442. * @memberOf _
  28443. * @since 2.4.0
  28444. * @category Util
  28445. * @param {*} value The value to return from the new function.
  28446. * @returns {Function} Returns the new constant function.
  28447. * @example
  28448. *
  28449. * var objects = _.times(2, _.constant({ 'a': 1 }));
  28450. *
  28451. * console.log(objects);
  28452. * // => [{ 'a': 1 }, { 'a': 1 }]
  28453. *
  28454. * console.log(objects[0] === objects[1]);
  28455. * // => true
  28456. */
  28457. function constant(value) {
  28458. return function() {
  28459. return value;
  28460. };
  28461. }
  28462. /**
  28463. * Checks `value` to determine whether a default value should be returned in
  28464. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  28465. * or `undefined`.
  28466. *
  28467. * @static
  28468. * @memberOf _
  28469. * @since 4.14.0
  28470. * @category Util
  28471. * @param {*} value The value to check.
  28472. * @param {*} defaultValue The default value.
  28473. * @returns {*} Returns the resolved value.
  28474. * @example
  28475. *
  28476. * _.defaultTo(1, 10);
  28477. * // => 1
  28478. *
  28479. * _.defaultTo(undefined, 10);
  28480. * // => 10
  28481. */
  28482. function defaultTo(value, defaultValue) {
  28483. return (value == null || value !== value) ? defaultValue : value;
  28484. }
  28485. /**
  28486. * Creates a function that returns the result of invoking the given functions
  28487. * with the `this` binding of the created function, where each successive
  28488. * invocation is supplied the return value of the previous.
  28489. *
  28490. * @static
  28491. * @memberOf _
  28492. * @since 3.0.0
  28493. * @category Util
  28494. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28495. * @returns {Function} Returns the new composite function.
  28496. * @see _.flowRight
  28497. * @example
  28498. *
  28499. * function square(n) {
  28500. * return n * n;
  28501. * }
  28502. *
  28503. * var addSquare = _.flow([_.add, square]);
  28504. * addSquare(1, 2);
  28505. * // => 9
  28506. */
  28507. var flow = createFlow();
  28508. /**
  28509. * This method is like `_.flow` except that it creates a function that
  28510. * invokes the given functions from right to left.
  28511. *
  28512. * @static
  28513. * @since 3.0.0
  28514. * @memberOf _
  28515. * @category Util
  28516. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28517. * @returns {Function} Returns the new composite function.
  28518. * @see _.flow
  28519. * @example
  28520. *
  28521. * function square(n) {
  28522. * return n * n;
  28523. * }
  28524. *
  28525. * var addSquare = _.flowRight([square, _.add]);
  28526. * addSquare(1, 2);
  28527. * // => 9
  28528. */
  28529. var flowRight = createFlow(true);
  28530. /**
  28531. * This method returns the first argument it receives.
  28532. *
  28533. * @static
  28534. * @since 0.1.0
  28535. * @memberOf _
  28536. * @category Util
  28537. * @param {*} value Any value.
  28538. * @returns {*} Returns `value`.
  28539. * @example
  28540. *
  28541. * var object = { 'a': 1 };
  28542. *
  28543. * console.log(_.identity(object) === object);
  28544. * // => true
  28545. */
  28546. function identity(value) {
  28547. return value;
  28548. }
  28549. /**
  28550. * Creates a function that invokes `func` with the arguments of the created
  28551. * function. If `func` is a property name, the created function returns the
  28552. * property value for a given element. If `func` is an array or object, the
  28553. * created function returns `true` for elements that contain the equivalent
  28554. * source properties, otherwise it returns `false`.
  28555. *
  28556. * @static
  28557. * @since 4.0.0
  28558. * @memberOf _
  28559. * @category Util
  28560. * @param {*} [func=_.identity] The value to convert to a callback.
  28561. * @returns {Function} Returns the callback.
  28562. * @example
  28563. *
  28564. * var users = [
  28565. * { 'user': 'barney', 'age': 36, 'active': true },
  28566. * { 'user': 'fred', 'age': 40, 'active': false }
  28567. * ];
  28568. *
  28569. * // The `_.matches` iteratee shorthand.
  28570. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  28571. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  28572. *
  28573. * // The `_.matchesProperty` iteratee shorthand.
  28574. * _.filter(users, _.iteratee(['user', 'fred']));
  28575. * // => [{ 'user': 'fred', 'age': 40 }]
  28576. *
  28577. * // The `_.property` iteratee shorthand.
  28578. * _.map(users, _.iteratee('user'));
  28579. * // => ['barney', 'fred']
  28580. *
  28581. * // Create custom iteratee shorthands.
  28582. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  28583. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  28584. * return func.test(string);
  28585. * };
  28586. * });
  28587. *
  28588. * _.filter(['abc', 'def'], /ef/);
  28589. * // => ['def']
  28590. */
  28591. function iteratee(func) {
  28592. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  28593. }
  28594. /**
  28595. * Creates a function that performs a partial deep comparison between a given
  28596. * object and `source`, returning `true` if the given object has equivalent
  28597. * property values, else `false`.
  28598. *
  28599. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  28600. * partially applied.
  28601. *
  28602. * Partial comparisons will match empty array and empty object `source`
  28603. * values against any array or object value, respectively. See `_.isEqual`
  28604. * for a list of supported value comparisons.
  28605. *
  28606. * **Note:** Multiple values can be checked by combining several matchers
  28607. * using `_.overSome`
  28608. *
  28609. * @static
  28610. * @memberOf _
  28611. * @since 3.0.0
  28612. * @category Util
  28613. * @param {Object} source The object of property values to match.
  28614. * @returns {Function} Returns the new spec function.
  28615. * @example
  28616. *
  28617. * var objects = [
  28618. * { 'a': 1, 'b': 2, 'c': 3 },
  28619. * { 'a': 4, 'b': 5, 'c': 6 }
  28620. * ];
  28621. *
  28622. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  28623. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  28624. *
  28625. * // Checking for several possible values
  28626. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  28627. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  28628. */
  28629. function matches(source) {
  28630. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  28631. }
  28632. /**
  28633. * Creates a function that performs a partial deep comparison between the
  28634. * value at `path` of a given object to `srcValue`, returning `true` if the
  28635. * object value is equivalent, else `false`.
  28636. *
  28637. * **Note:** Partial comparisons will match empty array and empty object
  28638. * `srcValue` values against any array or object value, respectively. See
  28639. * `_.isEqual` for a list of supported value comparisons.
  28640. *
  28641. * **Note:** Multiple values can be checked by combining several matchers
  28642. * using `_.overSome`
  28643. *
  28644. * @static
  28645. * @memberOf _
  28646. * @since 3.2.0
  28647. * @category Util
  28648. * @param {Array|string} path The path of the property to get.
  28649. * @param {*} srcValue The value to match.
  28650. * @returns {Function} Returns the new spec function.
  28651. * @example
  28652. *
  28653. * var objects = [
  28654. * { 'a': 1, 'b': 2, 'c': 3 },
  28655. * { 'a': 4, 'b': 5, 'c': 6 }
  28656. * ];
  28657. *
  28658. * _.find(objects, _.matchesProperty('a', 4));
  28659. * // => { 'a': 4, 'b': 5, 'c': 6 }
  28660. *
  28661. * // Checking for several possible values
  28662. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  28663. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  28664. */
  28665. function matchesProperty(path, srcValue) {
  28666. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  28667. }
  28668. /**
  28669. * Creates a function that invokes the method at `path` of a given object.
  28670. * Any additional arguments are provided to the invoked method.
  28671. *
  28672. * @static
  28673. * @memberOf _
  28674. * @since 3.7.0
  28675. * @category Util
  28676. * @param {Array|string} path The path of the method to invoke.
  28677. * @param {...*} [args] The arguments to invoke the method with.
  28678. * @returns {Function} Returns the new invoker function.
  28679. * @example
  28680. *
  28681. * var objects = [
  28682. * { 'a': { 'b': _.constant(2) } },
  28683. * { 'a': { 'b': _.constant(1) } }
  28684. * ];
  28685. *
  28686. * _.map(objects, _.method('a.b'));
  28687. * // => [2, 1]
  28688. *
  28689. * _.map(objects, _.method(['a', 'b']));
  28690. * // => [2, 1]
  28691. */
  28692. var method = baseRest(function(path, args) {
  28693. return function(object) {
  28694. return baseInvoke(object, path, args);
  28695. };
  28696. });
  28697. /**
  28698. * The opposite of `_.method`; this method creates a function that invokes
  28699. * the method at a given path of `object`. Any additional arguments are
  28700. * provided to the invoked method.
  28701. *
  28702. * @static
  28703. * @memberOf _
  28704. * @since 3.7.0
  28705. * @category Util
  28706. * @param {Object} object The object to query.
  28707. * @param {...*} [args] The arguments to invoke the method with.
  28708. * @returns {Function} Returns the new invoker function.
  28709. * @example
  28710. *
  28711. * var array = _.times(3, _.constant),
  28712. * object = { 'a': array, 'b': array, 'c': array };
  28713. *
  28714. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  28715. * // => [2, 0]
  28716. *
  28717. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  28718. * // => [2, 0]
  28719. */
  28720. var methodOf = baseRest(function(object, args) {
  28721. return function(path) {
  28722. return baseInvoke(object, path, args);
  28723. };
  28724. });
  28725. /**
  28726. * Adds all own enumerable string keyed function properties of a source
  28727. * object to the destination object. If `object` is a function, then methods
  28728. * are added to its prototype as well.
  28729. *
  28730. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  28731. * avoid conflicts caused by modifying the original.
  28732. *
  28733. * @static
  28734. * @since 0.1.0
  28735. * @memberOf _
  28736. * @category Util
  28737. * @param {Function|Object} [object=lodash] The destination object.
  28738. * @param {Object} source The object of functions to add.
  28739. * @param {Object} [options={}] The options object.
  28740. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  28741. * @returns {Function|Object} Returns `object`.
  28742. * @example
  28743. *
  28744. * function vowels(string) {
  28745. * return _.filter(string, function(v) {
  28746. * return /[aeiou]/i.test(v);
  28747. * });
  28748. * }
  28749. *
  28750. * _.mixin({ 'vowels': vowels });
  28751. * _.vowels('fred');
  28752. * // => ['e']
  28753. *
  28754. * _('fred').vowels().value();
  28755. * // => ['e']
  28756. *
  28757. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  28758. * _('fred').vowels();
  28759. * // => ['e']
  28760. */
  28761. function mixin(object, source, options) {
  28762. var props = keys(source),
  28763. methodNames = baseFunctions(source, props);
  28764. if (options == null &&
  28765. !(isObject(source) && (methodNames.length || !props.length))) {
  28766. options = source;
  28767. source = object;
  28768. object = this;
  28769. methodNames = baseFunctions(source, keys(source));
  28770. }
  28771. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  28772. isFunc = isFunction(object);
  28773. arrayEach(methodNames, function(methodName) {
  28774. var func = source[methodName];
  28775. object[methodName] = func;
  28776. if (isFunc) {
  28777. object.prototype[methodName] = function() {
  28778. var chainAll = this.__chain__;
  28779. if (chain || chainAll) {
  28780. var result = object(this.__wrapped__),
  28781. actions = result.__actions__ = copyArray(this.__actions__);
  28782. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  28783. result.__chain__ = chainAll;
  28784. return result;
  28785. }
  28786. return func.apply(object, arrayPush([this.value()], arguments));
  28787. };
  28788. }
  28789. });
  28790. return object;
  28791. }
  28792. /**
  28793. * Reverts the `_` variable to its previous value and returns a reference to
  28794. * the `lodash` function.
  28795. *
  28796. * @static
  28797. * @since 0.1.0
  28798. * @memberOf _
  28799. * @category Util
  28800. * @returns {Function} Returns the `lodash` function.
  28801. * @example
  28802. *
  28803. * var lodash = _.noConflict();
  28804. */
  28805. function noConflict() {
  28806. if (root._ === this) {
  28807. root._ = oldDash;
  28808. }
  28809. return this;
  28810. }
  28811. /**
  28812. * This method returns `undefined`.
  28813. *
  28814. * @static
  28815. * @memberOf _
  28816. * @since 2.3.0
  28817. * @category Util
  28818. * @example
  28819. *
  28820. * _.times(2, _.noop);
  28821. * // => [undefined, undefined]
  28822. */
  28823. function noop() {
  28824. // No operation performed.
  28825. }
  28826. /**
  28827. * Creates a function that gets the argument at index `n`. If `n` is negative,
  28828. * the nth argument from the end is returned.
  28829. *
  28830. * @static
  28831. * @memberOf _
  28832. * @since 4.0.0
  28833. * @category Util
  28834. * @param {number} [n=0] The index of the argument to return.
  28835. * @returns {Function} Returns the new pass-thru function.
  28836. * @example
  28837. *
  28838. * var func = _.nthArg(1);
  28839. * func('a', 'b', 'c', 'd');
  28840. * // => 'b'
  28841. *
  28842. * var func = _.nthArg(-2);
  28843. * func('a', 'b', 'c', 'd');
  28844. * // => 'c'
  28845. */
  28846. function nthArg(n) {
  28847. n = toInteger(n);
  28848. return baseRest(function(args) {
  28849. return baseNth(args, n);
  28850. });
  28851. }
  28852. /**
  28853. * Creates a function that invokes `iteratees` with the arguments it receives
  28854. * and returns their results.
  28855. *
  28856. * @static
  28857. * @memberOf _
  28858. * @since 4.0.0
  28859. * @category Util
  28860. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28861. * The iteratees to invoke.
  28862. * @returns {Function} Returns the new function.
  28863. * @example
  28864. *
  28865. * var func = _.over([Math.max, Math.min]);
  28866. *
  28867. * func(1, 2, 3, 4);
  28868. * // => [4, 1]
  28869. */
  28870. var over = createOver(arrayMap);
  28871. /**
  28872. * Creates a function that checks if **all** of the `predicates` return
  28873. * truthy when invoked with the arguments it receives.
  28874. *
  28875. * Following shorthands are possible for providing predicates.
  28876. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  28877. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  28878. *
  28879. * @static
  28880. * @memberOf _
  28881. * @since 4.0.0
  28882. * @category Util
  28883. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28884. * The predicates to check.
  28885. * @returns {Function} Returns the new function.
  28886. * @example
  28887. *
  28888. * var func = _.overEvery([Boolean, isFinite]);
  28889. *
  28890. * func('1');
  28891. * // => true
  28892. *
  28893. * func(null);
  28894. * // => false
  28895. *
  28896. * func(NaN);
  28897. * // => false
  28898. */
  28899. var overEvery = createOver(arrayEvery);
  28900. /**
  28901. * Creates a function that checks if **any** of the `predicates` return
  28902. * truthy when invoked with the arguments it receives.
  28903. *
  28904. * Following shorthands are possible for providing predicates.
  28905. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  28906. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  28907. *
  28908. * @static
  28909. * @memberOf _
  28910. * @since 4.0.0
  28911. * @category Util
  28912. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28913. * The predicates to check.
  28914. * @returns {Function} Returns the new function.
  28915. * @example
  28916. *
  28917. * var func = _.overSome([Boolean, isFinite]);
  28918. *
  28919. * func('1');
  28920. * // => true
  28921. *
  28922. * func(null);
  28923. * // => true
  28924. *
  28925. * func(NaN);
  28926. * // => false
  28927. *
  28928. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  28929. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  28930. */
  28931. var overSome = createOver(arraySome);
  28932. /**
  28933. * Creates a function that returns the value at `path` of a given object.
  28934. *
  28935. * @static
  28936. * @memberOf _
  28937. * @since 2.4.0
  28938. * @category Util
  28939. * @param {Array|string} path The path of the property to get.
  28940. * @returns {Function} Returns the new accessor function.
  28941. * @example
  28942. *
  28943. * var objects = [
  28944. * { 'a': { 'b': 2 } },
  28945. * { 'a': { 'b': 1 } }
  28946. * ];
  28947. *
  28948. * _.map(objects, _.property('a.b'));
  28949. * // => [2, 1]
  28950. *
  28951. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  28952. * // => [1, 2]
  28953. */
  28954. function property(path) {
  28955. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  28956. }
  28957. /**
  28958. * The opposite of `_.property`; this method creates a function that returns
  28959. * the value at a given path of `object`.
  28960. *
  28961. * @static
  28962. * @memberOf _
  28963. * @since 3.0.0
  28964. * @category Util
  28965. * @param {Object} object The object to query.
  28966. * @returns {Function} Returns the new accessor function.
  28967. * @example
  28968. *
  28969. * var array = [0, 1, 2],
  28970. * object = { 'a': array, 'b': array, 'c': array };
  28971. *
  28972. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  28973. * // => [2, 0]
  28974. *
  28975. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  28976. * // => [2, 0]
  28977. */
  28978. function propertyOf(object) {
  28979. return function(path) {
  28980. return object == null ? undefined : baseGet(object, path);
  28981. };
  28982. }
  28983. /**
  28984. * Creates an array of numbers (positive and/or negative) progressing from
  28985. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  28986. * `start` is specified without an `end` or `step`. If `end` is not specified,
  28987. * it's set to `start` with `start` then set to `0`.
  28988. *
  28989. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  28990. * floating-point values which can produce unexpected results.
  28991. *
  28992. * @static
  28993. * @since 0.1.0
  28994. * @memberOf _
  28995. * @category Util
  28996. * @param {number} [start=0] The start of the range.
  28997. * @param {number} end The end of the range.
  28998. * @param {number} [step=1] The value to increment or decrement by.
  28999. * @returns {Array} Returns the range of numbers.
  29000. * @see _.inRange, _.rangeRight
  29001. * @example
  29002. *
  29003. * _.range(4);
  29004. * // => [0, 1, 2, 3]
  29005. *
  29006. * _.range(-4);
  29007. * // => [0, -1, -2, -3]
  29008. *
  29009. * _.range(1, 5);
  29010. * // => [1, 2, 3, 4]
  29011. *
  29012. * _.range(0, 20, 5);
  29013. * // => [0, 5, 10, 15]
  29014. *
  29015. * _.range(0, -4, -1);
  29016. * // => [0, -1, -2, -3]
  29017. *
  29018. * _.range(1, 4, 0);
  29019. * // => [1, 1, 1]
  29020. *
  29021. * _.range(0);
  29022. * // => []
  29023. */
  29024. var range = createRange();
  29025. /**
  29026. * This method is like `_.range` except that it populates values in
  29027. * descending order.
  29028. *
  29029. * @static
  29030. * @memberOf _
  29031. * @since 4.0.0
  29032. * @category Util
  29033. * @param {number} [start=0] The start of the range.
  29034. * @param {number} end The end of the range.
  29035. * @param {number} [step=1] The value to increment or decrement by.
  29036. * @returns {Array} Returns the range of numbers.
  29037. * @see _.inRange, _.range
  29038. * @example
  29039. *
  29040. * _.rangeRight(4);
  29041. * // => [3, 2, 1, 0]
  29042. *
  29043. * _.rangeRight(-4);
  29044. * // => [-3, -2, -1, 0]
  29045. *
  29046. * _.rangeRight(1, 5);
  29047. * // => [4, 3, 2, 1]
  29048. *
  29049. * _.rangeRight(0, 20, 5);
  29050. * // => [15, 10, 5, 0]
  29051. *
  29052. * _.rangeRight(0, -4, -1);
  29053. * // => [-3, -2, -1, 0]
  29054. *
  29055. * _.rangeRight(1, 4, 0);
  29056. * // => [1, 1, 1]
  29057. *
  29058. * _.rangeRight(0);
  29059. * // => []
  29060. */
  29061. var rangeRight = createRange(true);
  29062. /**
  29063. * This method returns a new empty array.
  29064. *
  29065. * @static
  29066. * @memberOf _
  29067. * @since 4.13.0
  29068. * @category Util
  29069. * @returns {Array} Returns the new empty array.
  29070. * @example
  29071. *
  29072. * var arrays = _.times(2, _.stubArray);
  29073. *
  29074. * console.log(arrays);
  29075. * // => [[], []]
  29076. *
  29077. * console.log(arrays[0] === arrays[1]);
  29078. * // => false
  29079. */
  29080. function stubArray() {
  29081. return [];
  29082. }
  29083. /**
  29084. * This method returns `false`.
  29085. *
  29086. * @static
  29087. * @memberOf _
  29088. * @since 4.13.0
  29089. * @category Util
  29090. * @returns {boolean} Returns `false`.
  29091. * @example
  29092. *
  29093. * _.times(2, _.stubFalse);
  29094. * // => [false, false]
  29095. */
  29096. function stubFalse() {
  29097. return false;
  29098. }
  29099. /**
  29100. * This method returns a new empty object.
  29101. *
  29102. * @static
  29103. * @memberOf _
  29104. * @since 4.13.0
  29105. * @category Util
  29106. * @returns {Object} Returns the new empty object.
  29107. * @example
  29108. *
  29109. * var objects = _.times(2, _.stubObject);
  29110. *
  29111. * console.log(objects);
  29112. * // => [{}, {}]
  29113. *
  29114. * console.log(objects[0] === objects[1]);
  29115. * // => false
  29116. */
  29117. function stubObject() {
  29118. return {};
  29119. }
  29120. /**
  29121. * This method returns an empty string.
  29122. *
  29123. * @static
  29124. * @memberOf _
  29125. * @since 4.13.0
  29126. * @category Util
  29127. * @returns {string} Returns the empty string.
  29128. * @example
  29129. *
  29130. * _.times(2, _.stubString);
  29131. * // => ['', '']
  29132. */
  29133. function stubString() {
  29134. return '';
  29135. }
  29136. /**
  29137. * This method returns `true`.
  29138. *
  29139. * @static
  29140. * @memberOf _
  29141. * @since 4.13.0
  29142. * @category Util
  29143. * @returns {boolean} Returns `true`.
  29144. * @example
  29145. *
  29146. * _.times(2, _.stubTrue);
  29147. * // => [true, true]
  29148. */
  29149. function stubTrue() {
  29150. return true;
  29151. }
  29152. /**
  29153. * Invokes the iteratee `n` times, returning an array of the results of
  29154. * each invocation. The iteratee is invoked with one argument; (index).
  29155. *
  29156. * @static
  29157. * @since 0.1.0
  29158. * @memberOf _
  29159. * @category Util
  29160. * @param {number} n The number of times to invoke `iteratee`.
  29161. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29162. * @returns {Array} Returns the array of results.
  29163. * @example
  29164. *
  29165. * _.times(3, String);
  29166. * // => ['0', '1', '2']
  29167. *
  29168. * _.times(4, _.constant(0));
  29169. * // => [0, 0, 0, 0]
  29170. */
  29171. function times(n, iteratee) {
  29172. n = toInteger(n);
  29173. if (n < 1 || n > MAX_SAFE_INTEGER) {
  29174. return [];
  29175. }
  29176. var index = MAX_ARRAY_LENGTH,
  29177. length = nativeMin(n, MAX_ARRAY_LENGTH);
  29178. iteratee = getIteratee(iteratee);
  29179. n -= MAX_ARRAY_LENGTH;
  29180. var result = baseTimes(length, iteratee);
  29181. while (++index < n) {
  29182. iteratee(index);
  29183. }
  29184. return result;
  29185. }
  29186. /**
  29187. * Converts `value` to a property path array.
  29188. *
  29189. * @static
  29190. * @memberOf _
  29191. * @since 4.0.0
  29192. * @category Util
  29193. * @param {*} value The value to convert.
  29194. * @returns {Array} Returns the new property path array.
  29195. * @example
  29196. *
  29197. * _.toPath('a.b.c');
  29198. * // => ['a', 'b', 'c']
  29199. *
  29200. * _.toPath('a[0].b.c');
  29201. * // => ['a', '0', 'b', 'c']
  29202. */
  29203. function toPath(value) {
  29204. if (isArray(value)) {
  29205. return arrayMap(value, toKey);
  29206. }
  29207. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  29208. }
  29209. /**
  29210. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  29211. *
  29212. * @static
  29213. * @since 0.1.0
  29214. * @memberOf _
  29215. * @category Util
  29216. * @param {string} [prefix=''] The value to prefix the ID with.
  29217. * @returns {string} Returns the unique ID.
  29218. * @example
  29219. *
  29220. * _.uniqueId('contact_');
  29221. * // => 'contact_104'
  29222. *
  29223. * _.uniqueId();
  29224. * // => '105'
  29225. */
  29226. function uniqueId(prefix) {
  29227. var id = ++idCounter;
  29228. return toString(prefix) + id;
  29229. }
  29230. /*------------------------------------------------------------------------*/
  29231. /**
  29232. * Adds two numbers.
  29233. *
  29234. * @static
  29235. * @memberOf _
  29236. * @since 3.4.0
  29237. * @category Math
  29238. * @param {number} augend The first number in an addition.
  29239. * @param {number} addend The second number in an addition.
  29240. * @returns {number} Returns the total.
  29241. * @example
  29242. *
  29243. * _.add(6, 4);
  29244. * // => 10
  29245. */
  29246. var add = createMathOperation(function(augend, addend) {
  29247. return augend + addend;
  29248. }, 0);
  29249. /**
  29250. * Computes `number` rounded up to `precision`.
  29251. *
  29252. * @static
  29253. * @memberOf _
  29254. * @since 3.10.0
  29255. * @category Math
  29256. * @param {number} number The number to round up.
  29257. * @param {number} [precision=0] The precision to round up to.
  29258. * @returns {number} Returns the rounded up number.
  29259. * @example
  29260. *
  29261. * _.ceil(4.006);
  29262. * // => 5
  29263. *
  29264. * _.ceil(6.004, 2);
  29265. * // => 6.01
  29266. *
  29267. * _.ceil(6040, -2);
  29268. * // => 6100
  29269. */
  29270. var ceil = createRound('ceil');
  29271. /**
  29272. * Divide two numbers.
  29273. *
  29274. * @static
  29275. * @memberOf _
  29276. * @since 4.7.0
  29277. * @category Math
  29278. * @param {number} dividend The first number in a division.
  29279. * @param {number} divisor The second number in a division.
  29280. * @returns {number} Returns the quotient.
  29281. * @example
  29282. *
  29283. * _.divide(6, 4);
  29284. * // => 1.5
  29285. */
  29286. var divide = createMathOperation(function(dividend, divisor) {
  29287. return dividend / divisor;
  29288. }, 1);
  29289. /**
  29290. * Computes `number` rounded down to `precision`.
  29291. *
  29292. * @static
  29293. * @memberOf _
  29294. * @since 3.10.0
  29295. * @category Math
  29296. * @param {number} number The number to round down.
  29297. * @param {number} [precision=0] The precision to round down to.
  29298. * @returns {number} Returns the rounded down number.
  29299. * @example
  29300. *
  29301. * _.floor(4.006);
  29302. * // => 4
  29303. *
  29304. * _.floor(0.046, 2);
  29305. * // => 0.04
  29306. *
  29307. * _.floor(4060, -2);
  29308. * // => 4000
  29309. */
  29310. var floor = createRound('floor');
  29311. /**
  29312. * Computes the maximum value of `array`. If `array` is empty or falsey,
  29313. * `undefined` is returned.
  29314. *
  29315. * @static
  29316. * @since 0.1.0
  29317. * @memberOf _
  29318. * @category Math
  29319. * @param {Array} array The array to iterate over.
  29320. * @returns {*} Returns the maximum value.
  29321. * @example
  29322. *
  29323. * _.max([4, 2, 8, 6]);
  29324. * // => 8
  29325. *
  29326. * _.max([]);
  29327. * // => undefined
  29328. */
  29329. function max(array) {
  29330. return (array && array.length)
  29331. ? baseExtremum(array, identity, baseGt)
  29332. : undefined;
  29333. }
  29334. /**
  29335. * This method is like `_.max` except that it accepts `iteratee` which is
  29336. * invoked for each element in `array` to generate the criterion by which
  29337. * the value is ranked. The iteratee is invoked with one argument: (value).
  29338. *
  29339. * @static
  29340. * @memberOf _
  29341. * @since 4.0.0
  29342. * @category Math
  29343. * @param {Array} array The array to iterate over.
  29344. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29345. * @returns {*} Returns the maximum value.
  29346. * @example
  29347. *
  29348. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29349. *
  29350. * _.maxBy(objects, function(o) { return o.n; });
  29351. * // => { 'n': 2 }
  29352. *
  29353. * // The `_.property` iteratee shorthand.
  29354. * _.maxBy(objects, 'n');
  29355. * // => { 'n': 2 }
  29356. */
  29357. function maxBy(array, iteratee) {
  29358. return (array && array.length)
  29359. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  29360. : undefined;
  29361. }
  29362. /**
  29363. * Computes the mean of the values in `array`.
  29364. *
  29365. * @static
  29366. * @memberOf _
  29367. * @since 4.0.0
  29368. * @category Math
  29369. * @param {Array} array The array to iterate over.
  29370. * @returns {number} Returns the mean.
  29371. * @example
  29372. *
  29373. * _.mean([4, 2, 8, 6]);
  29374. * // => 5
  29375. */
  29376. function mean(array) {
  29377. return baseMean(array, identity);
  29378. }
  29379. /**
  29380. * This method is like `_.mean` except that it accepts `iteratee` which is
  29381. * invoked for each element in `array` to generate the value to be averaged.
  29382. * The iteratee is invoked with one argument: (value).
  29383. *
  29384. * @static
  29385. * @memberOf _
  29386. * @since 4.7.0
  29387. * @category Math
  29388. * @param {Array} array The array to iterate over.
  29389. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29390. * @returns {number} Returns the mean.
  29391. * @example
  29392. *
  29393. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29394. *
  29395. * _.meanBy(objects, function(o) { return o.n; });
  29396. * // => 5
  29397. *
  29398. * // The `_.property` iteratee shorthand.
  29399. * _.meanBy(objects, 'n');
  29400. * // => 5
  29401. */
  29402. function meanBy(array, iteratee) {
  29403. return baseMean(array, getIteratee(iteratee, 2));
  29404. }
  29405. /**
  29406. * Computes the minimum value of `array`. If `array` is empty or falsey,
  29407. * `undefined` is returned.
  29408. *
  29409. * @static
  29410. * @since 0.1.0
  29411. * @memberOf _
  29412. * @category Math
  29413. * @param {Array} array The array to iterate over.
  29414. * @returns {*} Returns the minimum value.
  29415. * @example
  29416. *
  29417. * _.min([4, 2, 8, 6]);
  29418. * // => 2
  29419. *
  29420. * _.min([]);
  29421. * // => undefined
  29422. */
  29423. function min(array) {
  29424. return (array && array.length)
  29425. ? baseExtremum(array, identity, baseLt)
  29426. : undefined;
  29427. }
  29428. /**
  29429. * This method is like `_.min` except that it accepts `iteratee` which is
  29430. * invoked for each element in `array` to generate the criterion by which
  29431. * the value is ranked. The iteratee is invoked with one argument: (value).
  29432. *
  29433. * @static
  29434. * @memberOf _
  29435. * @since 4.0.0
  29436. * @category Math
  29437. * @param {Array} array The array to iterate over.
  29438. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29439. * @returns {*} Returns the minimum value.
  29440. * @example
  29441. *
  29442. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29443. *
  29444. * _.minBy(objects, function(o) { return o.n; });
  29445. * // => { 'n': 1 }
  29446. *
  29447. * // The `_.property` iteratee shorthand.
  29448. * _.minBy(objects, 'n');
  29449. * // => { 'n': 1 }
  29450. */
  29451. function minBy(array, iteratee) {
  29452. return (array && array.length)
  29453. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  29454. : undefined;
  29455. }
  29456. /**
  29457. * Multiply two numbers.
  29458. *
  29459. * @static
  29460. * @memberOf _
  29461. * @since 4.7.0
  29462. * @category Math
  29463. * @param {number} multiplier The first number in a multiplication.
  29464. * @param {number} multiplicand The second number in a multiplication.
  29465. * @returns {number} Returns the product.
  29466. * @example
  29467. *
  29468. * _.multiply(6, 4);
  29469. * // => 24
  29470. */
  29471. var multiply = createMathOperation(function(multiplier, multiplicand) {
  29472. return multiplier * multiplicand;
  29473. }, 1);
  29474. /**
  29475. * Computes `number` rounded to `precision`.
  29476. *
  29477. * @static
  29478. * @memberOf _
  29479. * @since 3.10.0
  29480. * @category Math
  29481. * @param {number} number The number to round.
  29482. * @param {number} [precision=0] The precision to round to.
  29483. * @returns {number} Returns the rounded number.
  29484. * @example
  29485. *
  29486. * _.round(4.006);
  29487. * // => 4
  29488. *
  29489. * _.round(4.006, 2);
  29490. * // => 4.01
  29491. *
  29492. * _.round(4060, -2);
  29493. * // => 4100
  29494. */
  29495. var round = createRound('round');
  29496. /**
  29497. * Subtract two numbers.
  29498. *
  29499. * @static
  29500. * @memberOf _
  29501. * @since 4.0.0
  29502. * @category Math
  29503. * @param {number} minuend The first number in a subtraction.
  29504. * @param {number} subtrahend The second number in a subtraction.
  29505. * @returns {number} Returns the difference.
  29506. * @example
  29507. *
  29508. * _.subtract(6, 4);
  29509. * // => 2
  29510. */
  29511. var subtract = createMathOperation(function(minuend, subtrahend) {
  29512. return minuend - subtrahend;
  29513. }, 0);
  29514. /**
  29515. * Computes the sum of the values in `array`.
  29516. *
  29517. * @static
  29518. * @memberOf _
  29519. * @since 3.4.0
  29520. * @category Math
  29521. * @param {Array} array The array to iterate over.
  29522. * @returns {number} Returns the sum.
  29523. * @example
  29524. *
  29525. * _.sum([4, 2, 8, 6]);
  29526. * // => 20
  29527. */
  29528. function sum(array) {
  29529. return (array && array.length)
  29530. ? baseSum(array, identity)
  29531. : 0;
  29532. }
  29533. /**
  29534. * This method is like `_.sum` except that it accepts `iteratee` which is
  29535. * invoked for each element in `array` to generate the value to be summed.
  29536. * The iteratee is invoked with one argument: (value).
  29537. *
  29538. * @static
  29539. * @memberOf _
  29540. * @since 4.0.0
  29541. * @category Math
  29542. * @param {Array} array The array to iterate over.
  29543. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29544. * @returns {number} Returns the sum.
  29545. * @example
  29546. *
  29547. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29548. *
  29549. * _.sumBy(objects, function(o) { return o.n; });
  29550. * // => 20
  29551. *
  29552. * // The `_.property` iteratee shorthand.
  29553. * _.sumBy(objects, 'n');
  29554. * // => 20
  29555. */
  29556. function sumBy(array, iteratee) {
  29557. return (array && array.length)
  29558. ? baseSum(array, getIteratee(iteratee, 2))
  29559. : 0;
  29560. }
  29561. /*------------------------------------------------------------------------*/
  29562. // Add methods that return wrapped values in chain sequences.
  29563. lodash.after = after;
  29564. lodash.ary = ary;
  29565. lodash.assign = assign;
  29566. lodash.assignIn = assignIn;
  29567. lodash.assignInWith = assignInWith;
  29568. lodash.assignWith = assignWith;
  29569. lodash.at = at;
  29570. lodash.before = before;
  29571. lodash.bind = bind;
  29572. lodash.bindAll = bindAll;
  29573. lodash.bindKey = bindKey;
  29574. lodash.castArray = castArray;
  29575. lodash.chain = chain;
  29576. lodash.chunk = chunk;
  29577. lodash.compact = compact;
  29578. lodash.concat = concat;
  29579. lodash.cond = cond;
  29580. lodash.conforms = conforms;
  29581. lodash.constant = constant;
  29582. lodash.countBy = countBy;
  29583. lodash.create = create;
  29584. lodash.curry = curry;
  29585. lodash.curryRight = curryRight;
  29586. lodash.debounce = debounce;
  29587. lodash.defaults = defaults;
  29588. lodash.defaultsDeep = defaultsDeep;
  29589. lodash.defer = defer;
  29590. lodash.delay = delay;
  29591. lodash.difference = difference;
  29592. lodash.differenceBy = differenceBy;
  29593. lodash.differenceWith = differenceWith;
  29594. lodash.drop = drop;
  29595. lodash.dropRight = dropRight;
  29596. lodash.dropRightWhile = dropRightWhile;
  29597. lodash.dropWhile = dropWhile;
  29598. lodash.fill = fill;
  29599. lodash.filter = filter;
  29600. lodash.flatMap = flatMap;
  29601. lodash.flatMapDeep = flatMapDeep;
  29602. lodash.flatMapDepth = flatMapDepth;
  29603. lodash.flatten = flatten;
  29604. lodash.flattenDeep = flattenDeep;
  29605. lodash.flattenDepth = flattenDepth;
  29606. lodash.flip = flip;
  29607. lodash.flow = flow;
  29608. lodash.flowRight = flowRight;
  29609. lodash.fromPairs = fromPairs;
  29610. lodash.functions = functions;
  29611. lodash.functionsIn = functionsIn;
  29612. lodash.groupBy = groupBy;
  29613. lodash.initial = initial;
  29614. lodash.intersection = intersection;
  29615. lodash.intersectionBy = intersectionBy;
  29616. lodash.intersectionWith = intersectionWith;
  29617. lodash.invert = invert;
  29618. lodash.invertBy = invertBy;
  29619. lodash.invokeMap = invokeMap;
  29620. lodash.iteratee = iteratee;
  29621. lodash.keyBy = keyBy;
  29622. lodash.keys = keys;
  29623. lodash.keysIn = keysIn;
  29624. lodash.map = map;
  29625. lodash.mapKeys = mapKeys;
  29626. lodash.mapValues = mapValues;
  29627. lodash.matches = matches;
  29628. lodash.matchesProperty = matchesProperty;
  29629. lodash.memoize = memoize;
  29630. lodash.merge = merge;
  29631. lodash.mergeWith = mergeWith;
  29632. lodash.method = method;
  29633. lodash.methodOf = methodOf;
  29634. lodash.mixin = mixin;
  29635. lodash.negate = negate;
  29636. lodash.nthArg = nthArg;
  29637. lodash.omit = omit;
  29638. lodash.omitBy = omitBy;
  29639. lodash.once = once;
  29640. lodash.orderBy = orderBy;
  29641. lodash.over = over;
  29642. lodash.overArgs = overArgs;
  29643. lodash.overEvery = overEvery;
  29644. lodash.overSome = overSome;
  29645. lodash.partial = partial;
  29646. lodash.partialRight = partialRight;
  29647. lodash.partition = partition;
  29648. lodash.pick = pick;
  29649. lodash.pickBy = pickBy;
  29650. lodash.property = property;
  29651. lodash.propertyOf = propertyOf;
  29652. lodash.pull = pull;
  29653. lodash.pullAll = pullAll;
  29654. lodash.pullAllBy = pullAllBy;
  29655. lodash.pullAllWith = pullAllWith;
  29656. lodash.pullAt = pullAt;
  29657. lodash.range = range;
  29658. lodash.rangeRight = rangeRight;
  29659. lodash.rearg = rearg;
  29660. lodash.reject = reject;
  29661. lodash.remove = remove;
  29662. lodash.rest = rest;
  29663. lodash.reverse = reverse;
  29664. lodash.sampleSize = sampleSize;
  29665. lodash.set = set;
  29666. lodash.setWith = setWith;
  29667. lodash.shuffle = shuffle;
  29668. lodash.slice = slice;
  29669. lodash.sortBy = sortBy;
  29670. lodash.sortedUniq = sortedUniq;
  29671. lodash.sortedUniqBy = sortedUniqBy;
  29672. lodash.split = split;
  29673. lodash.spread = spread;
  29674. lodash.tail = tail;
  29675. lodash.take = take;
  29676. lodash.takeRight = takeRight;
  29677. lodash.takeRightWhile = takeRightWhile;
  29678. lodash.takeWhile = takeWhile;
  29679. lodash.tap = tap;
  29680. lodash.throttle = throttle;
  29681. lodash.thru = thru;
  29682. lodash.toArray = toArray;
  29683. lodash.toPairs = toPairs;
  29684. lodash.toPairsIn = toPairsIn;
  29685. lodash.toPath = toPath;
  29686. lodash.toPlainObject = toPlainObject;
  29687. lodash.transform = transform;
  29688. lodash.unary = unary;
  29689. lodash.union = union;
  29690. lodash.unionBy = unionBy;
  29691. lodash.unionWith = unionWith;
  29692. lodash.uniq = uniq;
  29693. lodash.uniqBy = uniqBy;
  29694. lodash.uniqWith = uniqWith;
  29695. lodash.unset = unset;
  29696. lodash.unzip = unzip;
  29697. lodash.unzipWith = unzipWith;
  29698. lodash.update = update;
  29699. lodash.updateWith = updateWith;
  29700. lodash.values = values;
  29701. lodash.valuesIn = valuesIn;
  29702. lodash.without = without;
  29703. lodash.words = words;
  29704. lodash.wrap = wrap;
  29705. lodash.xor = xor;
  29706. lodash.xorBy = xorBy;
  29707. lodash.xorWith = xorWith;
  29708. lodash.zip = zip;
  29709. lodash.zipObject = zipObject;
  29710. lodash.zipObjectDeep = zipObjectDeep;
  29711. lodash.zipWith = zipWith;
  29712. // Add aliases.
  29713. lodash.entries = toPairs;
  29714. lodash.entriesIn = toPairsIn;
  29715. lodash.extend = assignIn;
  29716. lodash.extendWith = assignInWith;
  29717. // Add methods to `lodash.prototype`.
  29718. mixin(lodash, lodash);
  29719. /*------------------------------------------------------------------------*/
  29720. // Add methods that return unwrapped values in chain sequences.
  29721. lodash.add = add;
  29722. lodash.attempt = attempt;
  29723. lodash.camelCase = camelCase;
  29724. lodash.capitalize = capitalize;
  29725. lodash.ceil = ceil;
  29726. lodash.clamp = clamp;
  29727. lodash.clone = clone;
  29728. lodash.cloneDeep = cloneDeep;
  29729. lodash.cloneDeepWith = cloneDeepWith;
  29730. lodash.cloneWith = cloneWith;
  29731. lodash.conformsTo = conformsTo;
  29732. lodash.deburr = deburr;
  29733. lodash.defaultTo = defaultTo;
  29734. lodash.divide = divide;
  29735. lodash.endsWith = endsWith;
  29736. lodash.eq = eq;
  29737. lodash.escape = escape;
  29738. lodash.escapeRegExp = escapeRegExp;
  29739. lodash.every = every;
  29740. lodash.find = find;
  29741. lodash.findIndex = findIndex;
  29742. lodash.findKey = findKey;
  29743. lodash.findLast = findLast;
  29744. lodash.findLastIndex = findLastIndex;
  29745. lodash.findLastKey = findLastKey;
  29746. lodash.floor = floor;
  29747. lodash.forEach = forEach;
  29748. lodash.forEachRight = forEachRight;
  29749. lodash.forIn = forIn;
  29750. lodash.forInRight = forInRight;
  29751. lodash.forOwn = forOwn;
  29752. lodash.forOwnRight = forOwnRight;
  29753. lodash.get = get;
  29754. lodash.gt = gt;
  29755. lodash.gte = gte;
  29756. lodash.has = has;
  29757. lodash.hasIn = hasIn;
  29758. lodash.head = head;
  29759. lodash.identity = identity;
  29760. lodash.includes = includes;
  29761. lodash.indexOf = indexOf;
  29762. lodash.inRange = inRange;
  29763. lodash.invoke = invoke;
  29764. lodash.isArguments = isArguments;
  29765. lodash.isArray = isArray;
  29766. lodash.isArrayBuffer = isArrayBuffer;
  29767. lodash.isArrayLike = isArrayLike;
  29768. lodash.isArrayLikeObject = isArrayLikeObject;
  29769. lodash.isBoolean = isBoolean;
  29770. lodash.isBuffer = isBuffer;
  29771. lodash.isDate = isDate;
  29772. lodash.isElement = isElement;
  29773. lodash.isEmpty = isEmpty;
  29774. lodash.isEqual = isEqual;
  29775. lodash.isEqualWith = isEqualWith;
  29776. lodash.isError = isError;
  29777. lodash.isFinite = isFinite;
  29778. lodash.isFunction = isFunction;
  29779. lodash.isInteger = isInteger;
  29780. lodash.isLength = isLength;
  29781. lodash.isMap = isMap;
  29782. lodash.isMatch = isMatch;
  29783. lodash.isMatchWith = isMatchWith;
  29784. lodash.isNaN = isNaN;
  29785. lodash.isNative = isNative;
  29786. lodash.isNil = isNil;
  29787. lodash.isNull = isNull;
  29788. lodash.isNumber = isNumber;
  29789. lodash.isObject = isObject;
  29790. lodash.isObjectLike = isObjectLike;
  29791. lodash.isPlainObject = isPlainObject;
  29792. lodash.isRegExp = isRegExp;
  29793. lodash.isSafeInteger = isSafeInteger;
  29794. lodash.isSet = isSet;
  29795. lodash.isString = isString;
  29796. lodash.isSymbol = isSymbol;
  29797. lodash.isTypedArray = isTypedArray;
  29798. lodash.isUndefined = isUndefined;
  29799. lodash.isWeakMap = isWeakMap;
  29800. lodash.isWeakSet = isWeakSet;
  29801. lodash.join = join;
  29802. lodash.kebabCase = kebabCase;
  29803. lodash.last = last;
  29804. lodash.lastIndexOf = lastIndexOf;
  29805. lodash.lowerCase = lowerCase;
  29806. lodash.lowerFirst = lowerFirst;
  29807. lodash.lt = lt;
  29808. lodash.lte = lte;
  29809. lodash.max = max;
  29810. lodash.maxBy = maxBy;
  29811. lodash.mean = mean;
  29812. lodash.meanBy = meanBy;
  29813. lodash.min = min;
  29814. lodash.minBy = minBy;
  29815. lodash.stubArray = stubArray;
  29816. lodash.stubFalse = stubFalse;
  29817. lodash.stubObject = stubObject;
  29818. lodash.stubString = stubString;
  29819. lodash.stubTrue = stubTrue;
  29820. lodash.multiply = multiply;
  29821. lodash.nth = nth;
  29822. lodash.noConflict = noConflict;
  29823. lodash.noop = noop;
  29824. lodash.now = now;
  29825. lodash.pad = pad;
  29826. lodash.padEnd = padEnd;
  29827. lodash.padStart = padStart;
  29828. lodash.parseInt = parseInt;
  29829. lodash.random = random;
  29830. lodash.reduce = reduce;
  29831. lodash.reduceRight = reduceRight;
  29832. lodash.repeat = repeat;
  29833. lodash.replace = replace;
  29834. lodash.result = result;
  29835. lodash.round = round;
  29836. lodash.runInContext = runInContext;
  29837. lodash.sample = sample;
  29838. lodash.size = size;
  29839. lodash.snakeCase = snakeCase;
  29840. lodash.some = some;
  29841. lodash.sortedIndex = sortedIndex;
  29842. lodash.sortedIndexBy = sortedIndexBy;
  29843. lodash.sortedIndexOf = sortedIndexOf;
  29844. lodash.sortedLastIndex = sortedLastIndex;
  29845. lodash.sortedLastIndexBy = sortedLastIndexBy;
  29846. lodash.sortedLastIndexOf = sortedLastIndexOf;
  29847. lodash.startCase = startCase;
  29848. lodash.startsWith = startsWith;
  29849. lodash.subtract = subtract;
  29850. lodash.sum = sum;
  29851. lodash.sumBy = sumBy;
  29852. lodash.template = template;
  29853. lodash.times = times;
  29854. lodash.toFinite = toFinite;
  29855. lodash.toInteger = toInteger;
  29856. lodash.toLength = toLength;
  29857. lodash.toLower = toLower;
  29858. lodash.toNumber = toNumber;
  29859. lodash.toSafeInteger = toSafeInteger;
  29860. lodash.toString = toString;
  29861. lodash.toUpper = toUpper;
  29862. lodash.trim = trim;
  29863. lodash.trimEnd = trimEnd;
  29864. lodash.trimStart = trimStart;
  29865. lodash.truncate = truncate;
  29866. lodash.unescape = unescape;
  29867. lodash.uniqueId = uniqueId;
  29868. lodash.upperCase = upperCase;
  29869. lodash.upperFirst = upperFirst;
  29870. // Add aliases.
  29871. lodash.each = forEach;
  29872. lodash.eachRight = forEachRight;
  29873. lodash.first = head;
  29874. mixin(lodash, (function() {
  29875. var source = {};
  29876. baseForOwn(lodash, function(func, methodName) {
  29877. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  29878. source[methodName] = func;
  29879. }
  29880. });
  29881. return source;
  29882. }()), { 'chain': false });
  29883. /*------------------------------------------------------------------------*/
  29884. /**
  29885. * The semantic version number.
  29886. *
  29887. * @static
  29888. * @memberOf _
  29889. * @type {string}
  29890. */
  29891. lodash.VERSION = VERSION;
  29892. // Assign default placeholders.
  29893. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  29894. lodash[methodName].placeholder = lodash;
  29895. });
  29896. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  29897. arrayEach(['drop', 'take'], function(methodName, index) {
  29898. LazyWrapper.prototype[methodName] = function(n) {
  29899. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  29900. var result = (this.__filtered__ && !index)
  29901. ? new LazyWrapper(this)
  29902. : this.clone();
  29903. if (result.__filtered__) {
  29904. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  29905. } else {
  29906. result.__views__.push({
  29907. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  29908. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  29909. });
  29910. }
  29911. return result;
  29912. };
  29913. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  29914. return this.reverse()[methodName](n).reverse();
  29915. };
  29916. });
  29917. // Add `LazyWrapper` methods that accept an `iteratee` value.
  29918. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  29919. var type = index + 1,
  29920. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  29921. LazyWrapper.prototype[methodName] = function(iteratee) {
  29922. var result = this.clone();
  29923. result.__iteratees__.push({
  29924. 'iteratee': getIteratee(iteratee, 3),
  29925. 'type': type
  29926. });
  29927. result.__filtered__ = result.__filtered__ || isFilter;
  29928. return result;
  29929. };
  29930. });
  29931. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  29932. arrayEach(['head', 'last'], function(methodName, index) {
  29933. var takeName = 'take' + (index ? 'Right' : '');
  29934. LazyWrapper.prototype[methodName] = function() {
  29935. return this[takeName](1).value()[0];
  29936. };
  29937. });
  29938. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  29939. arrayEach(['initial', 'tail'], function(methodName, index) {
  29940. var dropName = 'drop' + (index ? '' : 'Right');
  29941. LazyWrapper.prototype[methodName] = function() {
  29942. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  29943. };
  29944. });
  29945. LazyWrapper.prototype.compact = function() {
  29946. return this.filter(identity);
  29947. };
  29948. LazyWrapper.prototype.find = function(predicate) {
  29949. return this.filter(predicate).head();
  29950. };
  29951. LazyWrapper.prototype.findLast = function(predicate) {
  29952. return this.reverse().find(predicate);
  29953. };
  29954. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  29955. if (typeof path == 'function') {
  29956. return new LazyWrapper(this);
  29957. }
  29958. return this.map(function(value) {
  29959. return baseInvoke(value, path, args);
  29960. });
  29961. });
  29962. LazyWrapper.prototype.reject = function(predicate) {
  29963. return this.filter(negate(getIteratee(predicate)));
  29964. };
  29965. LazyWrapper.prototype.slice = function(start, end) {
  29966. start = toInteger(start);
  29967. var result = this;
  29968. if (result.__filtered__ && (start > 0 || end < 0)) {
  29969. return new LazyWrapper(result);
  29970. }
  29971. if (start < 0) {
  29972. result = result.takeRight(-start);
  29973. } else if (start) {
  29974. result = result.drop(start);
  29975. }
  29976. if (end !== undefined) {
  29977. end = toInteger(end);
  29978. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  29979. }
  29980. return result;
  29981. };
  29982. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  29983. return this.reverse().takeWhile(predicate).reverse();
  29984. };
  29985. LazyWrapper.prototype.toArray = function() {
  29986. return this.take(MAX_ARRAY_LENGTH);
  29987. };
  29988. // Add `LazyWrapper` methods to `lodash.prototype`.
  29989. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29990. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  29991. isTaker = /^(?:head|last)$/.test(methodName),
  29992. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  29993. retUnwrapped = isTaker || /^find/.test(methodName);
  29994. if (!lodashFunc) {
  29995. return;
  29996. }
  29997. lodash.prototype[methodName] = function() {
  29998. var value = this.__wrapped__,
  29999. args = isTaker ? [1] : arguments,
  30000. isLazy = value instanceof LazyWrapper,
  30001. iteratee = args[0],
  30002. useLazy = isLazy || isArray(value);
  30003. var interceptor = function(value) {
  30004. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  30005. return (isTaker && chainAll) ? result[0] : result;
  30006. };
  30007. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  30008. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  30009. isLazy = useLazy = false;
  30010. }
  30011. var chainAll = this.__chain__,
  30012. isHybrid = !!this.__actions__.length,
  30013. isUnwrapped = retUnwrapped && !chainAll,
  30014. onlyLazy = isLazy && !isHybrid;
  30015. if (!retUnwrapped && useLazy) {
  30016. value = onlyLazy ? value : new LazyWrapper(this);
  30017. var result = func.apply(value, args);
  30018. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  30019. return new LodashWrapper(result, chainAll);
  30020. }
  30021. if (isUnwrapped && onlyLazy) {
  30022. return func.apply(this, args);
  30023. }
  30024. result = this.thru(interceptor);
  30025. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  30026. };
  30027. });
  30028. // Add `Array` methods to `lodash.prototype`.
  30029. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  30030. var func = arrayProto[methodName],
  30031. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  30032. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  30033. lodash.prototype[methodName] = function() {
  30034. var args = arguments;
  30035. if (retUnwrapped && !this.__chain__) {
  30036. var value = this.value();
  30037. return func.apply(isArray(value) ? value : [], args);
  30038. }
  30039. return this[chainName](function(value) {
  30040. return func.apply(isArray(value) ? value : [], args);
  30041. });
  30042. };
  30043. });
  30044. // Map minified method names to their real names.
  30045. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  30046. var lodashFunc = lodash[methodName];
  30047. if (lodashFunc) {
  30048. var key = lodashFunc.name + '';
  30049. if (!hasOwnProperty.call(realNames, key)) {
  30050. realNames[key] = [];
  30051. }
  30052. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  30053. }
  30054. });
  30055. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  30056. 'name': 'wrapper',
  30057. 'func': undefined
  30058. }];
  30059. // Add methods to `LazyWrapper`.
  30060. LazyWrapper.prototype.clone = lazyClone;
  30061. LazyWrapper.prototype.reverse = lazyReverse;
  30062. LazyWrapper.prototype.value = lazyValue;
  30063. // Add chain sequence methods to the `lodash` wrapper.
  30064. lodash.prototype.at = wrapperAt;
  30065. lodash.prototype.chain = wrapperChain;
  30066. lodash.prototype.commit = wrapperCommit;
  30067. lodash.prototype.next = wrapperNext;
  30068. lodash.prototype.plant = wrapperPlant;
  30069. lodash.prototype.reverse = wrapperReverse;
  30070. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  30071. // Add lazy aliases.
  30072. lodash.prototype.first = lodash.prototype.head;
  30073. if (symIterator) {
  30074. lodash.prototype[symIterator] = wrapperToIterator;
  30075. }
  30076. return lodash;
  30077. });
  30078. /*--------------------------------------------------------------------------*/
  30079. // Export lodash.
  30080. var _ = runInContext();
  30081. // Some AMD build optimizers, like r.js, check for condition patterns like:
  30082. if (true) {
  30083. // Expose Lodash on the global object to prevent errors when Lodash is
  30084. // loaded by a script tag in the presence of an AMD loader.
  30085. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  30086. // Use `_.noConflict` to remove Lodash from the global object.
  30087. root._ = _;
  30088. // Define as an anonymous module so, through path mapping, it can be
  30089. // referenced as the "underscore" module.
  30090. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  30091. return _;
  30092. }).call(exports, __webpack_require__, exports, module),
  30093. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  30094. }
  30095. // Check for `exports` after `define` in case a build optimizer adds it.
  30096. else {}
  30097. }.call(this));
  30098. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  30099. /***/ }),
  30100. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  30101. /*!***************************************************!*\
  30102. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  30103. \***************************************************/
  30104. /*! exports provided: default */
  30105. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  30106. "use strict";
  30107. __webpack_require__.r(__webpack_exports__);
  30108. /* WEBPACK VAR INJECTION */(function(global) {/**!
  30109. * @fileOverview Kickass library to create and place poppers near their reference elements.
  30110. * @version 1.16.1
  30111. * @license
  30112. * Copyright (c) 2016 Federico Zivolo and contributors
  30113. *
  30114. * Permission is hereby granted, free of charge, to any person obtaining a copy
  30115. * of this software and associated documentation files (the "Software"), to deal
  30116. * in the Software without restriction, including without limitation the rights
  30117. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30118. * copies of the Software, and to permit persons to whom the Software is
  30119. * furnished to do so, subject to the following conditions:
  30120. *
  30121. * The above copyright notice and this permission notice shall be included in all
  30122. * copies or substantial portions of the Software.
  30123. *
  30124. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  30125. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30126. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  30127. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30128. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  30129. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30130. * SOFTWARE.
  30131. */
  30132. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  30133. var timeoutDuration = function () {
  30134. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  30135. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  30136. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  30137. return 1;
  30138. }
  30139. }
  30140. return 0;
  30141. }();
  30142. function microtaskDebounce(fn) {
  30143. var called = false;
  30144. return function () {
  30145. if (called) {
  30146. return;
  30147. }
  30148. called = true;
  30149. window.Promise.resolve().then(function () {
  30150. called = false;
  30151. fn();
  30152. });
  30153. };
  30154. }
  30155. function taskDebounce(fn) {
  30156. var scheduled = false;
  30157. return function () {
  30158. if (!scheduled) {
  30159. scheduled = true;
  30160. setTimeout(function () {
  30161. scheduled = false;
  30162. fn();
  30163. }, timeoutDuration);
  30164. }
  30165. };
  30166. }
  30167. var supportsMicroTasks = isBrowser && window.Promise;
  30168. /**
  30169. * Create a debounced version of a method, that's asynchronously deferred
  30170. * but called in the minimum time possible.
  30171. *
  30172. * @method
  30173. * @memberof Popper.Utils
  30174. * @argument {Function} fn
  30175. * @returns {Function}
  30176. */
  30177. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  30178. /**
  30179. * Check if the given variable is a function
  30180. * @method
  30181. * @memberof Popper.Utils
  30182. * @argument {Any} functionToCheck - variable to check
  30183. * @returns {Boolean} answer to: is a function?
  30184. */
  30185. function isFunction(functionToCheck) {
  30186. var getType = {};
  30187. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  30188. }
  30189. /**
  30190. * Get CSS computed property of the given element
  30191. * @method
  30192. * @memberof Popper.Utils
  30193. * @argument {Eement} element
  30194. * @argument {String} property
  30195. */
  30196. function getStyleComputedProperty(element, property) {
  30197. if (element.nodeType !== 1) {
  30198. return [];
  30199. }
  30200. // NOTE: 1 DOM access here
  30201. var window = element.ownerDocument.defaultView;
  30202. var css = window.getComputedStyle(element, null);
  30203. return property ? css[property] : css;
  30204. }
  30205. /**
  30206. * Returns the parentNode or the host of the element
  30207. * @method
  30208. * @memberof Popper.Utils
  30209. * @argument {Element} element
  30210. * @returns {Element} parent
  30211. */
  30212. function getParentNode(element) {
  30213. if (element.nodeName === 'HTML') {
  30214. return element;
  30215. }
  30216. return element.parentNode || element.host;
  30217. }
  30218. /**
  30219. * Returns the scrolling parent of the given element
  30220. * @method
  30221. * @memberof Popper.Utils
  30222. * @argument {Element} element
  30223. * @returns {Element} scroll parent
  30224. */
  30225. function getScrollParent(element) {
  30226. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  30227. if (!element) {
  30228. return document.body;
  30229. }
  30230. switch (element.nodeName) {
  30231. case 'HTML':
  30232. case 'BODY':
  30233. return element.ownerDocument.body;
  30234. case '#document':
  30235. return element.body;
  30236. }
  30237. // Firefox want us to check `-x` and `-y` variations as well
  30238. var _getStyleComputedProp = getStyleComputedProperty(element),
  30239. overflow = _getStyleComputedProp.overflow,
  30240. overflowX = _getStyleComputedProp.overflowX,
  30241. overflowY = _getStyleComputedProp.overflowY;
  30242. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  30243. return element;
  30244. }
  30245. return getScrollParent(getParentNode(element));
  30246. }
  30247. /**
  30248. * Returns the reference node of the reference object, or the reference object itself.
  30249. * @method
  30250. * @memberof Popper.Utils
  30251. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  30252. * @returns {Element} parent
  30253. */
  30254. function getReferenceNode(reference) {
  30255. return reference && reference.referenceNode ? reference.referenceNode : reference;
  30256. }
  30257. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  30258. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  30259. /**
  30260. * Determines if the browser is Internet Explorer
  30261. * @method
  30262. * @memberof Popper.Utils
  30263. * @param {Number} version to check
  30264. * @returns {Boolean} isIE
  30265. */
  30266. function isIE(version) {
  30267. if (version === 11) {
  30268. return isIE11;
  30269. }
  30270. if (version === 10) {
  30271. return isIE10;
  30272. }
  30273. return isIE11 || isIE10;
  30274. }
  30275. /**
  30276. * Returns the offset parent of the given element
  30277. * @method
  30278. * @memberof Popper.Utils
  30279. * @argument {Element} element
  30280. * @returns {Element} offset parent
  30281. */
  30282. function getOffsetParent(element) {
  30283. if (!element) {
  30284. return document.documentElement;
  30285. }
  30286. var noOffsetParent = isIE(10) ? document.body : null;
  30287. // NOTE: 1 DOM access here
  30288. var offsetParent = element.offsetParent || null;
  30289. // Skip hidden elements which don't have an offsetParent
  30290. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  30291. offsetParent = (element = element.nextElementSibling).offsetParent;
  30292. }
  30293. var nodeName = offsetParent && offsetParent.nodeName;
  30294. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  30295. return element ? element.ownerDocument.documentElement : document.documentElement;
  30296. }
  30297. // .offsetParent will return the closest TH, TD or TABLE in case
  30298. // no offsetParent is present, I hate this job...
  30299. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  30300. return getOffsetParent(offsetParent);
  30301. }
  30302. return offsetParent;
  30303. }
  30304. function isOffsetContainer(element) {
  30305. var nodeName = element.nodeName;
  30306. if (nodeName === 'BODY') {
  30307. return false;
  30308. }
  30309. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  30310. }
  30311. /**
  30312. * Finds the root node (document, shadowDOM root) of the given element
  30313. * @method
  30314. * @memberof Popper.Utils
  30315. * @argument {Element} node
  30316. * @returns {Element} root node
  30317. */
  30318. function getRoot(node) {
  30319. if (node.parentNode !== null) {
  30320. return getRoot(node.parentNode);
  30321. }
  30322. return node;
  30323. }
  30324. /**
  30325. * Finds the offset parent common to the two provided nodes
  30326. * @method
  30327. * @memberof Popper.Utils
  30328. * @argument {Element} element1
  30329. * @argument {Element} element2
  30330. * @returns {Element} common offset parent
  30331. */
  30332. function findCommonOffsetParent(element1, element2) {
  30333. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30334. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  30335. return document.documentElement;
  30336. }
  30337. // Here we make sure to give as "start" the element that comes first in the DOM
  30338. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  30339. var start = order ? element1 : element2;
  30340. var end = order ? element2 : element1;
  30341. // Get common ancestor container
  30342. var range = document.createRange();
  30343. range.setStart(start, 0);
  30344. range.setEnd(end, 0);
  30345. var commonAncestorContainer = range.commonAncestorContainer;
  30346. // Both nodes are inside #document
  30347. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  30348. if (isOffsetContainer(commonAncestorContainer)) {
  30349. return commonAncestorContainer;
  30350. }
  30351. return getOffsetParent(commonAncestorContainer);
  30352. }
  30353. // one of the nodes is inside shadowDOM, find which one
  30354. var element1root = getRoot(element1);
  30355. if (element1root.host) {
  30356. return findCommonOffsetParent(element1root.host, element2);
  30357. } else {
  30358. return findCommonOffsetParent(element1, getRoot(element2).host);
  30359. }
  30360. }
  30361. /**
  30362. * Gets the scroll value of the given element in the given side (top and left)
  30363. * @method
  30364. * @memberof Popper.Utils
  30365. * @argument {Element} element
  30366. * @argument {String} side `top` or `left`
  30367. * @returns {number} amount of scrolled pixels
  30368. */
  30369. function getScroll(element) {
  30370. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  30371. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  30372. var nodeName = element.nodeName;
  30373. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30374. var html = element.ownerDocument.documentElement;
  30375. var scrollingElement = element.ownerDocument.scrollingElement || html;
  30376. return scrollingElement[upperSide];
  30377. }
  30378. return element[upperSide];
  30379. }
  30380. /*
  30381. * Sum or subtract the element scroll values (left and top) from a given rect object
  30382. * @method
  30383. * @memberof Popper.Utils
  30384. * @param {Object} rect - Rect object you want to change
  30385. * @param {HTMLElement} element - The element from the function reads the scroll values
  30386. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  30387. * @return {Object} rect - The modifier rect object
  30388. */
  30389. function includeScroll(rect, element) {
  30390. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30391. var scrollTop = getScroll(element, 'top');
  30392. var scrollLeft = getScroll(element, 'left');
  30393. var modifier = subtract ? -1 : 1;
  30394. rect.top += scrollTop * modifier;
  30395. rect.bottom += scrollTop * modifier;
  30396. rect.left += scrollLeft * modifier;
  30397. rect.right += scrollLeft * modifier;
  30398. return rect;
  30399. }
  30400. /*
  30401. * Helper to detect borders of a given element
  30402. * @method
  30403. * @memberof Popper.Utils
  30404. * @param {CSSStyleDeclaration} styles
  30405. * Result of `getStyleComputedProperty` on the given element
  30406. * @param {String} axis - `x` or `y`
  30407. * @return {number} borders - The borders size of the given axis
  30408. */
  30409. function getBordersSize(styles, axis) {
  30410. var sideA = axis === 'x' ? 'Left' : 'Top';
  30411. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  30412. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  30413. }
  30414. function getSize(axis, body, html, computedStyle) {
  30415. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  30416. }
  30417. function getWindowSizes(document) {
  30418. var body = document.body;
  30419. var html = document.documentElement;
  30420. var computedStyle = isIE(10) && getComputedStyle(html);
  30421. return {
  30422. height: getSize('Height', body, html, computedStyle),
  30423. width: getSize('Width', body, html, computedStyle)
  30424. };
  30425. }
  30426. var classCallCheck = function (instance, Constructor) {
  30427. if (!(instance instanceof Constructor)) {
  30428. throw new TypeError("Cannot call a class as a function");
  30429. }
  30430. };
  30431. var createClass = function () {
  30432. function defineProperties(target, props) {
  30433. for (var i = 0; i < props.length; i++) {
  30434. var descriptor = props[i];
  30435. descriptor.enumerable = descriptor.enumerable || false;
  30436. descriptor.configurable = true;
  30437. if ("value" in descriptor) descriptor.writable = true;
  30438. Object.defineProperty(target, descriptor.key, descriptor);
  30439. }
  30440. }
  30441. return function (Constructor, protoProps, staticProps) {
  30442. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  30443. if (staticProps) defineProperties(Constructor, staticProps);
  30444. return Constructor;
  30445. };
  30446. }();
  30447. var defineProperty = function (obj, key, value) {
  30448. if (key in obj) {
  30449. Object.defineProperty(obj, key, {
  30450. value: value,
  30451. enumerable: true,
  30452. configurable: true,
  30453. writable: true
  30454. });
  30455. } else {
  30456. obj[key] = value;
  30457. }
  30458. return obj;
  30459. };
  30460. var _extends = Object.assign || function (target) {
  30461. for (var i = 1; i < arguments.length; i++) {
  30462. var source = arguments[i];
  30463. for (var key in source) {
  30464. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30465. target[key] = source[key];
  30466. }
  30467. }
  30468. }
  30469. return target;
  30470. };
  30471. /**
  30472. * Given element offsets, generate an output similar to getBoundingClientRect
  30473. * @method
  30474. * @memberof Popper.Utils
  30475. * @argument {Object} offsets
  30476. * @returns {Object} ClientRect like output
  30477. */
  30478. function getClientRect(offsets) {
  30479. return _extends({}, offsets, {
  30480. right: offsets.left + offsets.width,
  30481. bottom: offsets.top + offsets.height
  30482. });
  30483. }
  30484. /**
  30485. * Get bounding client rect of given element
  30486. * @method
  30487. * @memberof Popper.Utils
  30488. * @param {HTMLElement} element
  30489. * @return {Object} client rect
  30490. */
  30491. function getBoundingClientRect(element) {
  30492. var rect = {};
  30493. // IE10 10 FIX: Please, don't ask, the element isn't
  30494. // considered in DOM in some circumstances...
  30495. // This isn't reproducible in IE10 compatibility mode of IE11
  30496. try {
  30497. if (isIE(10)) {
  30498. rect = element.getBoundingClientRect();
  30499. var scrollTop = getScroll(element, 'top');
  30500. var scrollLeft = getScroll(element, 'left');
  30501. rect.top += scrollTop;
  30502. rect.left += scrollLeft;
  30503. rect.bottom += scrollTop;
  30504. rect.right += scrollLeft;
  30505. } else {
  30506. rect = element.getBoundingClientRect();
  30507. }
  30508. } catch (e) {}
  30509. var result = {
  30510. left: rect.left,
  30511. top: rect.top,
  30512. width: rect.right - rect.left,
  30513. height: rect.bottom - rect.top
  30514. };
  30515. // subtract scrollbar size from sizes
  30516. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  30517. var width = sizes.width || element.clientWidth || result.width;
  30518. var height = sizes.height || element.clientHeight || result.height;
  30519. var horizScrollbar = element.offsetWidth - width;
  30520. var vertScrollbar = element.offsetHeight - height;
  30521. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  30522. // we make this check conditional for performance reasons
  30523. if (horizScrollbar || vertScrollbar) {
  30524. var styles = getStyleComputedProperty(element);
  30525. horizScrollbar -= getBordersSize(styles, 'x');
  30526. vertScrollbar -= getBordersSize(styles, 'y');
  30527. result.width -= horizScrollbar;
  30528. result.height -= vertScrollbar;
  30529. }
  30530. return getClientRect(result);
  30531. }
  30532. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  30533. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30534. var isIE10 = isIE(10);
  30535. var isHTML = parent.nodeName === 'HTML';
  30536. var childrenRect = getBoundingClientRect(children);
  30537. var parentRect = getBoundingClientRect(parent);
  30538. var scrollParent = getScrollParent(children);
  30539. var styles = getStyleComputedProperty(parent);
  30540. var borderTopWidth = parseFloat(styles.borderTopWidth);
  30541. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  30542. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  30543. if (fixedPosition && isHTML) {
  30544. parentRect.top = Math.max(parentRect.top, 0);
  30545. parentRect.left = Math.max(parentRect.left, 0);
  30546. }
  30547. var offsets = getClientRect({
  30548. top: childrenRect.top - parentRect.top - borderTopWidth,
  30549. left: childrenRect.left - parentRect.left - borderLeftWidth,
  30550. width: childrenRect.width,
  30551. height: childrenRect.height
  30552. });
  30553. offsets.marginTop = 0;
  30554. offsets.marginLeft = 0;
  30555. // Subtract margins of documentElement in case it's being used as parent
  30556. // we do this only on HTML because it's the only element that behaves
  30557. // differently when margins are applied to it. The margins are included in
  30558. // the box of the documentElement, in the other cases not.
  30559. if (!isIE10 && isHTML) {
  30560. var marginTop = parseFloat(styles.marginTop);
  30561. var marginLeft = parseFloat(styles.marginLeft);
  30562. offsets.top -= borderTopWidth - marginTop;
  30563. offsets.bottom -= borderTopWidth - marginTop;
  30564. offsets.left -= borderLeftWidth - marginLeft;
  30565. offsets.right -= borderLeftWidth - marginLeft;
  30566. // Attach marginTop and marginLeft because in some circumstances we may need them
  30567. offsets.marginTop = marginTop;
  30568. offsets.marginLeft = marginLeft;
  30569. }
  30570. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  30571. offsets = includeScroll(offsets, parent);
  30572. }
  30573. return offsets;
  30574. }
  30575. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  30576. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  30577. var html = element.ownerDocument.documentElement;
  30578. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  30579. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  30580. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  30581. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  30582. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  30583. var offset = {
  30584. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  30585. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  30586. width: width,
  30587. height: height
  30588. };
  30589. return getClientRect(offset);
  30590. }
  30591. /**
  30592. * Check if the given element is fixed or is inside a fixed parent
  30593. * @method
  30594. * @memberof Popper.Utils
  30595. * @argument {Element} element
  30596. * @argument {Element} customContainer
  30597. * @returns {Boolean} answer to "isFixed?"
  30598. */
  30599. function isFixed(element) {
  30600. var nodeName = element.nodeName;
  30601. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30602. return false;
  30603. }
  30604. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  30605. return true;
  30606. }
  30607. var parentNode = getParentNode(element);
  30608. if (!parentNode) {
  30609. return false;
  30610. }
  30611. return isFixed(parentNode);
  30612. }
  30613. /**
  30614. * Finds the first parent of an element that has a transformed property defined
  30615. * @method
  30616. * @memberof Popper.Utils
  30617. * @argument {Element} element
  30618. * @returns {Element} first transformed parent or documentElement
  30619. */
  30620. function getFixedPositionOffsetParent(element) {
  30621. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30622. if (!element || !element.parentElement || isIE()) {
  30623. return document.documentElement;
  30624. }
  30625. var el = element.parentElement;
  30626. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  30627. el = el.parentElement;
  30628. }
  30629. return el || document.documentElement;
  30630. }
  30631. /**
  30632. * Computed the boundaries limits and return them
  30633. * @method
  30634. * @memberof Popper.Utils
  30635. * @param {HTMLElement} popper
  30636. * @param {HTMLElement} reference
  30637. * @param {number} padding
  30638. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  30639. * @param {Boolean} fixedPosition - Is in fixed position mode
  30640. * @returns {Object} Coordinates of the boundaries
  30641. */
  30642. function getBoundaries(popper, reference, padding, boundariesElement) {
  30643. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  30644. // NOTE: 1 DOM access here
  30645. var boundaries = { top: 0, left: 0 };
  30646. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30647. // Handle viewport case
  30648. if (boundariesElement === 'viewport') {
  30649. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  30650. } else {
  30651. // Handle other cases based on DOM element used as boundaries
  30652. var boundariesNode = void 0;
  30653. if (boundariesElement === 'scrollParent') {
  30654. boundariesNode = getScrollParent(getParentNode(reference));
  30655. if (boundariesNode.nodeName === 'BODY') {
  30656. boundariesNode = popper.ownerDocument.documentElement;
  30657. }
  30658. } else if (boundariesElement === 'window') {
  30659. boundariesNode = popper.ownerDocument.documentElement;
  30660. } else {
  30661. boundariesNode = boundariesElement;
  30662. }
  30663. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  30664. // In case of HTML, we need a different computation
  30665. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  30666. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  30667. height = _getWindowSizes.height,
  30668. width = _getWindowSizes.width;
  30669. boundaries.top += offsets.top - offsets.marginTop;
  30670. boundaries.bottom = height + offsets.top;
  30671. boundaries.left += offsets.left - offsets.marginLeft;
  30672. boundaries.right = width + offsets.left;
  30673. } else {
  30674. // for all the other DOM elements, this one is good
  30675. boundaries = offsets;
  30676. }
  30677. }
  30678. // Add paddings
  30679. padding = padding || 0;
  30680. var isPaddingNumber = typeof padding === 'number';
  30681. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  30682. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  30683. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  30684. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  30685. return boundaries;
  30686. }
  30687. function getArea(_ref) {
  30688. var width = _ref.width,
  30689. height = _ref.height;
  30690. return width * height;
  30691. }
  30692. /**
  30693. * Utility used to transform the `auto` placement to the placement with more
  30694. * available space.
  30695. * @method
  30696. * @memberof Popper.Utils
  30697. * @argument {Object} data - The data object generated by update method
  30698. * @argument {Object} options - Modifiers configuration and options
  30699. * @returns {Object} The data object, properly modified
  30700. */
  30701. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  30702. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  30703. if (placement.indexOf('auto') === -1) {
  30704. return placement;
  30705. }
  30706. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  30707. var rects = {
  30708. top: {
  30709. width: boundaries.width,
  30710. height: refRect.top - boundaries.top
  30711. },
  30712. right: {
  30713. width: boundaries.right - refRect.right,
  30714. height: boundaries.height
  30715. },
  30716. bottom: {
  30717. width: boundaries.width,
  30718. height: boundaries.bottom - refRect.bottom
  30719. },
  30720. left: {
  30721. width: refRect.left - boundaries.left,
  30722. height: boundaries.height
  30723. }
  30724. };
  30725. var sortedAreas = Object.keys(rects).map(function (key) {
  30726. return _extends({
  30727. key: key
  30728. }, rects[key], {
  30729. area: getArea(rects[key])
  30730. });
  30731. }).sort(function (a, b) {
  30732. return b.area - a.area;
  30733. });
  30734. var filteredAreas = sortedAreas.filter(function (_ref2) {
  30735. var width = _ref2.width,
  30736. height = _ref2.height;
  30737. return width >= popper.clientWidth && height >= popper.clientHeight;
  30738. });
  30739. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  30740. var variation = placement.split('-')[1];
  30741. return computedPlacement + (variation ? '-' + variation : '');
  30742. }
  30743. /**
  30744. * Get offsets to the reference element
  30745. * @method
  30746. * @memberof Popper.Utils
  30747. * @param {Object} state
  30748. * @param {Element} popper - the popper element
  30749. * @param {Element} reference - the reference element (the popper will be relative to this)
  30750. * @param {Element} fixedPosition - is in fixed position mode
  30751. * @returns {Object} An object containing the offsets which will be applied to the popper
  30752. */
  30753. function getReferenceOffsets(state, popper, reference) {
  30754. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  30755. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30756. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  30757. }
  30758. /**
  30759. * Get the outer sizes of the given element (offset size + margins)
  30760. * @method
  30761. * @memberof Popper.Utils
  30762. * @argument {Element} element
  30763. * @returns {Object} object containing width and height properties
  30764. */
  30765. function getOuterSizes(element) {
  30766. var window = element.ownerDocument.defaultView;
  30767. var styles = window.getComputedStyle(element);
  30768. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  30769. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  30770. var result = {
  30771. width: element.offsetWidth + y,
  30772. height: element.offsetHeight + x
  30773. };
  30774. return result;
  30775. }
  30776. /**
  30777. * Get the opposite placement of the given one
  30778. * @method
  30779. * @memberof Popper.Utils
  30780. * @argument {String} placement
  30781. * @returns {String} flipped placement
  30782. */
  30783. function getOppositePlacement(placement) {
  30784. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  30785. return placement.replace(/left|right|bottom|top/g, function (matched) {
  30786. return hash[matched];
  30787. });
  30788. }
  30789. /**
  30790. * Get offsets to the popper
  30791. * @method
  30792. * @memberof Popper.Utils
  30793. * @param {Object} position - CSS position the Popper will get applied
  30794. * @param {HTMLElement} popper - the popper element
  30795. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  30796. * @param {String} placement - one of the valid placement options
  30797. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  30798. */
  30799. function getPopperOffsets(popper, referenceOffsets, placement) {
  30800. placement = placement.split('-')[0];
  30801. // Get popper node sizes
  30802. var popperRect = getOuterSizes(popper);
  30803. // Add position, width and height to our offsets object
  30804. var popperOffsets = {
  30805. width: popperRect.width,
  30806. height: popperRect.height
  30807. };
  30808. // depending by the popper placement we have to compute its offsets slightly differently
  30809. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  30810. var mainSide = isHoriz ? 'top' : 'left';
  30811. var secondarySide = isHoriz ? 'left' : 'top';
  30812. var measurement = isHoriz ? 'height' : 'width';
  30813. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  30814. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  30815. if (placement === secondarySide) {
  30816. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  30817. } else {
  30818. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  30819. }
  30820. return popperOffsets;
  30821. }
  30822. /**
  30823. * Mimics the `find` method of Array
  30824. * @method
  30825. * @memberof Popper.Utils
  30826. * @argument {Array} arr
  30827. * @argument prop
  30828. * @argument value
  30829. * @returns index or -1
  30830. */
  30831. function find(arr, check) {
  30832. // use native find if supported
  30833. if (Array.prototype.find) {
  30834. return arr.find(check);
  30835. }
  30836. // use `filter` to obtain the same behavior of `find`
  30837. return arr.filter(check)[0];
  30838. }
  30839. /**
  30840. * Return the index of the matching object
  30841. * @method
  30842. * @memberof Popper.Utils
  30843. * @argument {Array} arr
  30844. * @argument prop
  30845. * @argument value
  30846. * @returns index or -1
  30847. */
  30848. function findIndex(arr, prop, value) {
  30849. // use native findIndex if supported
  30850. if (Array.prototype.findIndex) {
  30851. return arr.findIndex(function (cur) {
  30852. return cur[prop] === value;
  30853. });
  30854. }
  30855. // use `find` + `indexOf` if `findIndex` isn't supported
  30856. var match = find(arr, function (obj) {
  30857. return obj[prop] === value;
  30858. });
  30859. return arr.indexOf(match);
  30860. }
  30861. /**
  30862. * Loop trough the list of modifiers and run them in order,
  30863. * each of them will then edit the data object.
  30864. * @method
  30865. * @memberof Popper.Utils
  30866. * @param {dataObject} data
  30867. * @param {Array} modifiers
  30868. * @param {String} ends - Optional modifier name used as stopper
  30869. * @returns {dataObject}
  30870. */
  30871. function runModifiers(modifiers, data, ends) {
  30872. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  30873. modifiersToRun.forEach(function (modifier) {
  30874. if (modifier['function']) {
  30875. // eslint-disable-line dot-notation
  30876. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  30877. }
  30878. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  30879. if (modifier.enabled && isFunction(fn)) {
  30880. // Add properties to offsets to make them a complete clientRect object
  30881. // we do this before each modifier to make sure the previous one doesn't
  30882. // mess with these values
  30883. data.offsets.popper = getClientRect(data.offsets.popper);
  30884. data.offsets.reference = getClientRect(data.offsets.reference);
  30885. data = fn(data, modifier);
  30886. }
  30887. });
  30888. return data;
  30889. }
  30890. /**
  30891. * Updates the position of the popper, computing the new offsets and applying
  30892. * the new style.<br />
  30893. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  30894. * @method
  30895. * @memberof Popper
  30896. */
  30897. function update() {
  30898. // if popper is destroyed, don't perform any further update
  30899. if (this.state.isDestroyed) {
  30900. return;
  30901. }
  30902. var data = {
  30903. instance: this,
  30904. styles: {},
  30905. arrowStyles: {},
  30906. attributes: {},
  30907. flipped: false,
  30908. offsets: {}
  30909. };
  30910. // compute reference element offsets
  30911. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  30912. // compute auto placement, store placement inside the data object,
  30913. // modifiers will be able to edit `placement` if needed
  30914. // and refer to originalPlacement to know the original value
  30915. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  30916. // store the computed placement inside `originalPlacement`
  30917. data.originalPlacement = data.placement;
  30918. data.positionFixed = this.options.positionFixed;
  30919. // compute the popper offsets
  30920. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  30921. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  30922. // run the modifiers
  30923. data = runModifiers(this.modifiers, data);
  30924. // the first `update` will call `onCreate` callback
  30925. // the other ones will call `onUpdate` callback
  30926. if (!this.state.isCreated) {
  30927. this.state.isCreated = true;
  30928. this.options.onCreate(data);
  30929. } else {
  30930. this.options.onUpdate(data);
  30931. }
  30932. }
  30933. /**
  30934. * Helper used to know if the given modifier is enabled.
  30935. * @method
  30936. * @memberof Popper.Utils
  30937. * @returns {Boolean}
  30938. */
  30939. function isModifierEnabled(modifiers, modifierName) {
  30940. return modifiers.some(function (_ref) {
  30941. var name = _ref.name,
  30942. enabled = _ref.enabled;
  30943. return enabled && name === modifierName;
  30944. });
  30945. }
  30946. /**
  30947. * Get the prefixed supported property name
  30948. * @method
  30949. * @memberof Popper.Utils
  30950. * @argument {String} property (camelCase)
  30951. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  30952. */
  30953. function getSupportedPropertyName(property) {
  30954. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  30955. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  30956. for (var i = 0; i < prefixes.length; i++) {
  30957. var prefix = prefixes[i];
  30958. var toCheck = prefix ? '' + prefix + upperProp : property;
  30959. if (typeof document.body.style[toCheck] !== 'undefined') {
  30960. return toCheck;
  30961. }
  30962. }
  30963. return null;
  30964. }
  30965. /**
  30966. * Destroys the popper.
  30967. * @method
  30968. * @memberof Popper
  30969. */
  30970. function destroy() {
  30971. this.state.isDestroyed = true;
  30972. // touch DOM only if `applyStyle` modifier is enabled
  30973. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  30974. this.popper.removeAttribute('x-placement');
  30975. this.popper.style.position = '';
  30976. this.popper.style.top = '';
  30977. this.popper.style.left = '';
  30978. this.popper.style.right = '';
  30979. this.popper.style.bottom = '';
  30980. this.popper.style.willChange = '';
  30981. this.popper.style[getSupportedPropertyName('transform')] = '';
  30982. }
  30983. this.disableEventListeners();
  30984. // remove the popper if user explicitly asked for the deletion on destroy
  30985. // do not use `remove` because IE11 doesn't support it
  30986. if (this.options.removeOnDestroy) {
  30987. this.popper.parentNode.removeChild(this.popper);
  30988. }
  30989. return this;
  30990. }
  30991. /**
  30992. * Get the window associated with the element
  30993. * @argument {Element} element
  30994. * @returns {Window}
  30995. */
  30996. function getWindow(element) {
  30997. var ownerDocument = element.ownerDocument;
  30998. return ownerDocument ? ownerDocument.defaultView : window;
  30999. }
  31000. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  31001. var isBody = scrollParent.nodeName === 'BODY';
  31002. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  31003. target.addEventListener(event, callback, { passive: true });
  31004. if (!isBody) {
  31005. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  31006. }
  31007. scrollParents.push(target);
  31008. }
  31009. /**
  31010. * Setup needed event listeners used to update the popper position
  31011. * @method
  31012. * @memberof Popper.Utils
  31013. * @private
  31014. */
  31015. function setupEventListeners(reference, options, state, updateBound) {
  31016. // Resize event listener on window
  31017. state.updateBound = updateBound;
  31018. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  31019. // Scroll event listener on scroll parents
  31020. var scrollElement = getScrollParent(reference);
  31021. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  31022. state.scrollElement = scrollElement;
  31023. state.eventsEnabled = true;
  31024. return state;
  31025. }
  31026. /**
  31027. * It will add resize/scroll events and start recalculating
  31028. * position of the popper element when they are triggered.
  31029. * @method
  31030. * @memberof Popper
  31031. */
  31032. function enableEventListeners() {
  31033. if (!this.state.eventsEnabled) {
  31034. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  31035. }
  31036. }
  31037. /**
  31038. * Remove event listeners used to update the popper position
  31039. * @method
  31040. * @memberof Popper.Utils
  31041. * @private
  31042. */
  31043. function removeEventListeners(reference, state) {
  31044. // Remove resize event listener on window
  31045. getWindow(reference).removeEventListener('resize', state.updateBound);
  31046. // Remove scroll event listener on scroll parents
  31047. state.scrollParents.forEach(function (target) {
  31048. target.removeEventListener('scroll', state.updateBound);
  31049. });
  31050. // Reset state
  31051. state.updateBound = null;
  31052. state.scrollParents = [];
  31053. state.scrollElement = null;
  31054. state.eventsEnabled = false;
  31055. return state;
  31056. }
  31057. /**
  31058. * It will remove resize/scroll events and won't recalculate popper position
  31059. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  31060. * unless you call `update` method manually.
  31061. * @method
  31062. * @memberof Popper
  31063. */
  31064. function disableEventListeners() {
  31065. if (this.state.eventsEnabled) {
  31066. cancelAnimationFrame(this.scheduleUpdate);
  31067. this.state = removeEventListeners(this.reference, this.state);
  31068. }
  31069. }
  31070. /**
  31071. * Tells if a given input is a number
  31072. * @method
  31073. * @memberof Popper.Utils
  31074. * @param {*} input to check
  31075. * @return {Boolean}
  31076. */
  31077. function isNumeric(n) {
  31078. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  31079. }
  31080. /**
  31081. * Set the style to the given popper
  31082. * @method
  31083. * @memberof Popper.Utils
  31084. * @argument {Element} element - Element to apply the style to
  31085. * @argument {Object} styles
  31086. * Object with a list of properties and values which will be applied to the element
  31087. */
  31088. function setStyles(element, styles) {
  31089. Object.keys(styles).forEach(function (prop) {
  31090. var unit = '';
  31091. // add unit if the value is numeric and is one of the following
  31092. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  31093. unit = 'px';
  31094. }
  31095. element.style[prop] = styles[prop] + unit;
  31096. });
  31097. }
  31098. /**
  31099. * Set the attributes to the given popper
  31100. * @method
  31101. * @memberof Popper.Utils
  31102. * @argument {Element} element - Element to apply the attributes to
  31103. * @argument {Object} styles
  31104. * Object with a list of properties and values which will be applied to the element
  31105. */
  31106. function setAttributes(element, attributes) {
  31107. Object.keys(attributes).forEach(function (prop) {
  31108. var value = attributes[prop];
  31109. if (value !== false) {
  31110. element.setAttribute(prop, attributes[prop]);
  31111. } else {
  31112. element.removeAttribute(prop);
  31113. }
  31114. });
  31115. }
  31116. /**
  31117. * @function
  31118. * @memberof Modifiers
  31119. * @argument {Object} data - The data object generated by `update` method
  31120. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  31121. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  31122. * @argument {Object} options - Modifiers configuration and options
  31123. * @returns {Object} The same data object
  31124. */
  31125. function applyStyle(data) {
  31126. // any property present in `data.styles` will be applied to the popper,
  31127. // in this way we can make the 3rd party modifiers add custom styles to it
  31128. // Be aware, modifiers could override the properties defined in the previous
  31129. // lines of this modifier!
  31130. setStyles(data.instance.popper, data.styles);
  31131. // any property present in `data.attributes` will be applied to the popper,
  31132. // they will be set as HTML attributes of the element
  31133. setAttributes(data.instance.popper, data.attributes);
  31134. // if arrowElement is defined and arrowStyles has some properties
  31135. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  31136. setStyles(data.arrowElement, data.arrowStyles);
  31137. }
  31138. return data;
  31139. }
  31140. /**
  31141. * Set the x-placement attribute before everything else because it could be used
  31142. * to add margins to the popper margins needs to be calculated to get the
  31143. * correct popper offsets.
  31144. * @method
  31145. * @memberof Popper.modifiers
  31146. * @param {HTMLElement} reference - The reference element used to position the popper
  31147. * @param {HTMLElement} popper - The HTML element used as popper
  31148. * @param {Object} options - Popper.js options
  31149. */
  31150. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  31151. // compute reference element offsets
  31152. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  31153. // compute auto placement, store placement inside the data object,
  31154. // modifiers will be able to edit `placement` if needed
  31155. // and refer to originalPlacement to know the original value
  31156. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  31157. popper.setAttribute('x-placement', placement);
  31158. // Apply `position` to popper before anything else because
  31159. // without the position applied we can't guarantee correct computations
  31160. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  31161. return options;
  31162. }
  31163. /**
  31164. * @function
  31165. * @memberof Popper.Utils
  31166. * @argument {Object} data - The data object generated by `update` method
  31167. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  31168. * @returns {Object} The popper's position offsets rounded
  31169. *
  31170. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  31171. * good as it can be within reason.
  31172. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  31173. *
  31174. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  31175. * as well on High DPI screens).
  31176. *
  31177. * Firefox prefers no rounding for positioning and does not have blurriness on
  31178. * high DPI screens.
  31179. *
  31180. * Only horizontal placement and left/right values need to be considered.
  31181. */
  31182. function getRoundedOffsets(data, shouldRound) {
  31183. var _data$offsets = data.offsets,
  31184. popper = _data$offsets.popper,
  31185. reference = _data$offsets.reference;
  31186. var round = Math.round,
  31187. floor = Math.floor;
  31188. var noRound = function noRound(v) {
  31189. return v;
  31190. };
  31191. var referenceWidth = round(reference.width);
  31192. var popperWidth = round(popper.width);
  31193. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  31194. var isVariation = data.placement.indexOf('-') !== -1;
  31195. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  31196. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  31197. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  31198. var verticalToInteger = !shouldRound ? noRound : round;
  31199. return {
  31200. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  31201. top: verticalToInteger(popper.top),
  31202. bottom: verticalToInteger(popper.bottom),
  31203. right: horizontalToInteger(popper.right)
  31204. };
  31205. }
  31206. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  31207. /**
  31208. * @function
  31209. * @memberof Modifiers
  31210. * @argument {Object} data - The data object generated by `update` method
  31211. * @argument {Object} options - Modifiers configuration and options
  31212. * @returns {Object} The data object, properly modified
  31213. */
  31214. function computeStyle(data, options) {
  31215. var x = options.x,
  31216. y = options.y;
  31217. var popper = data.offsets.popper;
  31218. // Remove this legacy support in Popper.js v2
  31219. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  31220. return modifier.name === 'applyStyle';
  31221. }).gpuAcceleration;
  31222. if (legacyGpuAccelerationOption !== undefined) {
  31223. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  31224. }
  31225. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  31226. var offsetParent = getOffsetParent(data.instance.popper);
  31227. var offsetParentRect = getBoundingClientRect(offsetParent);
  31228. // Styles
  31229. var styles = {
  31230. position: popper.position
  31231. };
  31232. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  31233. var sideA = x === 'bottom' ? 'top' : 'bottom';
  31234. var sideB = y === 'right' ? 'left' : 'right';
  31235. // if gpuAcceleration is set to `true` and transform is supported,
  31236. // we use `translate3d` to apply the position to the popper we
  31237. // automatically use the supported prefixed version if needed
  31238. var prefixedProperty = getSupportedPropertyName('transform');
  31239. // now, let's make a step back and look at this code closely (wtf?)
  31240. // If the content of the popper grows once it's been positioned, it
  31241. // may happen that the popper gets misplaced because of the new content
  31242. // overflowing its reference element
  31243. // To avoid this problem, we provide two options (x and y), which allow
  31244. // the consumer to define the offset origin.
  31245. // If we position a popper on top of a reference element, we can set
  31246. // `x` to `top` to make the popper grow towards its top instead of
  31247. // its bottom.
  31248. var left = void 0,
  31249. top = void 0;
  31250. if (sideA === 'bottom') {
  31251. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  31252. // and not the bottom of the html element
  31253. if (offsetParent.nodeName === 'HTML') {
  31254. top = -offsetParent.clientHeight + offsets.bottom;
  31255. } else {
  31256. top = -offsetParentRect.height + offsets.bottom;
  31257. }
  31258. } else {
  31259. top = offsets.top;
  31260. }
  31261. if (sideB === 'right') {
  31262. if (offsetParent.nodeName === 'HTML') {
  31263. left = -offsetParent.clientWidth + offsets.right;
  31264. } else {
  31265. left = -offsetParentRect.width + offsets.right;
  31266. }
  31267. } else {
  31268. left = offsets.left;
  31269. }
  31270. if (gpuAcceleration && prefixedProperty) {
  31271. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  31272. styles[sideA] = 0;
  31273. styles[sideB] = 0;
  31274. styles.willChange = 'transform';
  31275. } else {
  31276. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  31277. var invertTop = sideA === 'bottom' ? -1 : 1;
  31278. var invertLeft = sideB === 'right' ? -1 : 1;
  31279. styles[sideA] = top * invertTop;
  31280. styles[sideB] = left * invertLeft;
  31281. styles.willChange = sideA + ', ' + sideB;
  31282. }
  31283. // Attributes
  31284. var attributes = {
  31285. 'x-placement': data.placement
  31286. };
  31287. // Update `data` attributes, styles and arrowStyles
  31288. data.attributes = _extends({}, attributes, data.attributes);
  31289. data.styles = _extends({}, styles, data.styles);
  31290. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  31291. return data;
  31292. }
  31293. /**
  31294. * Helper used to know if the given modifier depends from another one.<br />
  31295. * It checks if the needed modifier is listed and enabled.
  31296. * @method
  31297. * @memberof Popper.Utils
  31298. * @param {Array} modifiers - list of modifiers
  31299. * @param {String} requestingName - name of requesting modifier
  31300. * @param {String} requestedName - name of requested modifier
  31301. * @returns {Boolean}
  31302. */
  31303. function isModifierRequired(modifiers, requestingName, requestedName) {
  31304. var requesting = find(modifiers, function (_ref) {
  31305. var name = _ref.name;
  31306. return name === requestingName;
  31307. });
  31308. var isRequired = !!requesting && modifiers.some(function (modifier) {
  31309. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  31310. });
  31311. if (!isRequired) {
  31312. var _requesting = '`' + requestingName + '`';
  31313. var requested = '`' + requestedName + '`';
  31314. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  31315. }
  31316. return isRequired;
  31317. }
  31318. /**
  31319. * @function
  31320. * @memberof Modifiers
  31321. * @argument {Object} data - The data object generated by update method
  31322. * @argument {Object} options - Modifiers configuration and options
  31323. * @returns {Object} The data object, properly modified
  31324. */
  31325. function arrow(data, options) {
  31326. var _data$offsets$arrow;
  31327. // arrow depends on keepTogether in order to work
  31328. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  31329. return data;
  31330. }
  31331. var arrowElement = options.element;
  31332. // if arrowElement is a string, suppose it's a CSS selector
  31333. if (typeof arrowElement === 'string') {
  31334. arrowElement = data.instance.popper.querySelector(arrowElement);
  31335. // if arrowElement is not found, don't run the modifier
  31336. if (!arrowElement) {
  31337. return data;
  31338. }
  31339. } else {
  31340. // if the arrowElement isn't a query selector we must check that the
  31341. // provided DOM node is child of its popper node
  31342. if (!data.instance.popper.contains(arrowElement)) {
  31343. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  31344. return data;
  31345. }
  31346. }
  31347. var placement = data.placement.split('-')[0];
  31348. var _data$offsets = data.offsets,
  31349. popper = _data$offsets.popper,
  31350. reference = _data$offsets.reference;
  31351. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  31352. var len = isVertical ? 'height' : 'width';
  31353. var sideCapitalized = isVertical ? 'Top' : 'Left';
  31354. var side = sideCapitalized.toLowerCase();
  31355. var altSide = isVertical ? 'left' : 'top';
  31356. var opSide = isVertical ? 'bottom' : 'right';
  31357. var arrowElementSize = getOuterSizes(arrowElement)[len];
  31358. //
  31359. // extends keepTogether behavior making sure the popper and its
  31360. // reference have enough pixels in conjunction
  31361. //
  31362. // top/left side
  31363. if (reference[opSide] - arrowElementSize < popper[side]) {
  31364. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  31365. }
  31366. // bottom/right side
  31367. if (reference[side] + arrowElementSize > popper[opSide]) {
  31368. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  31369. }
  31370. data.offsets.popper = getClientRect(data.offsets.popper);
  31371. // compute center of the popper
  31372. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  31373. // Compute the sideValue using the updated popper offsets
  31374. // take popper margin in account because we don't have this info available
  31375. var css = getStyleComputedProperty(data.instance.popper);
  31376. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  31377. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  31378. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  31379. // prevent arrowElement from being placed not contiguously to its popper
  31380. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  31381. data.arrowElement = arrowElement;
  31382. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  31383. return data;
  31384. }
  31385. /**
  31386. * Get the opposite placement variation of the given one
  31387. * @method
  31388. * @memberof Popper.Utils
  31389. * @argument {String} placement variation
  31390. * @returns {String} flipped placement variation
  31391. */
  31392. function getOppositeVariation(variation) {
  31393. if (variation === 'end') {
  31394. return 'start';
  31395. } else if (variation === 'start') {
  31396. return 'end';
  31397. }
  31398. return variation;
  31399. }
  31400. /**
  31401. * List of accepted placements to use as values of the `placement` option.<br />
  31402. * Valid placements are:
  31403. * - `auto`
  31404. * - `top`
  31405. * - `right`
  31406. * - `bottom`
  31407. * - `left`
  31408. *
  31409. * Each placement can have a variation from this list:
  31410. * - `-start`
  31411. * - `-end`
  31412. *
  31413. * Variations are interpreted easily if you think of them as the left to right
  31414. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  31415. * is right.<br />
  31416. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  31417. *
  31418. * Some valid examples are:
  31419. * - `top-end` (on top of reference, right aligned)
  31420. * - `right-start` (on right of reference, top aligned)
  31421. * - `bottom` (on bottom, centered)
  31422. * - `auto-end` (on the side with more space available, alignment depends by placement)
  31423. *
  31424. * @static
  31425. * @type {Array}
  31426. * @enum {String}
  31427. * @readonly
  31428. * @method placements
  31429. * @memberof Popper
  31430. */
  31431. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  31432. // Get rid of `auto` `auto-start` and `auto-end`
  31433. var validPlacements = placements.slice(3);
  31434. /**
  31435. * Given an initial placement, returns all the subsequent placements
  31436. * clockwise (or counter-clockwise).
  31437. *
  31438. * @method
  31439. * @memberof Popper.Utils
  31440. * @argument {String} placement - A valid placement (it accepts variations)
  31441. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  31442. * @returns {Array} placements including their variations
  31443. */
  31444. function clockwise(placement) {
  31445. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  31446. var index = validPlacements.indexOf(placement);
  31447. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  31448. return counter ? arr.reverse() : arr;
  31449. }
  31450. var BEHAVIORS = {
  31451. FLIP: 'flip',
  31452. CLOCKWISE: 'clockwise',
  31453. COUNTERCLOCKWISE: 'counterclockwise'
  31454. };
  31455. /**
  31456. * @function
  31457. * @memberof Modifiers
  31458. * @argument {Object} data - The data object generated by update method
  31459. * @argument {Object} options - Modifiers configuration and options
  31460. * @returns {Object} The data object, properly modified
  31461. */
  31462. function flip(data, options) {
  31463. // if `inner` modifier is enabled, we can't use the `flip` modifier
  31464. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  31465. return data;
  31466. }
  31467. if (data.flipped && data.placement === data.originalPlacement) {
  31468. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  31469. return data;
  31470. }
  31471. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  31472. var placement = data.placement.split('-')[0];
  31473. var placementOpposite = getOppositePlacement(placement);
  31474. var variation = data.placement.split('-')[1] || '';
  31475. var flipOrder = [];
  31476. switch (options.behavior) {
  31477. case BEHAVIORS.FLIP:
  31478. flipOrder = [placement, placementOpposite];
  31479. break;
  31480. case BEHAVIORS.CLOCKWISE:
  31481. flipOrder = clockwise(placement);
  31482. break;
  31483. case BEHAVIORS.COUNTERCLOCKWISE:
  31484. flipOrder = clockwise(placement, true);
  31485. break;
  31486. default:
  31487. flipOrder = options.behavior;
  31488. }
  31489. flipOrder.forEach(function (step, index) {
  31490. if (placement !== step || flipOrder.length === index + 1) {
  31491. return data;
  31492. }
  31493. placement = data.placement.split('-')[0];
  31494. placementOpposite = getOppositePlacement(placement);
  31495. var popperOffsets = data.offsets.popper;
  31496. var refOffsets = data.offsets.reference;
  31497. // using floor because the reference offsets may contain decimals we are not going to consider here
  31498. var floor = Math.floor;
  31499. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  31500. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  31501. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  31502. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  31503. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  31504. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  31505. // flip the variation if required
  31506. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31507. // flips variation if reference element overflows boundaries
  31508. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  31509. // flips variation if popper content overflows boundaries
  31510. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  31511. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  31512. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  31513. // this boolean to detect any flip loop
  31514. data.flipped = true;
  31515. if (overlapsRef || overflowsBoundaries) {
  31516. placement = flipOrder[index + 1];
  31517. }
  31518. if (flippedVariation) {
  31519. variation = getOppositeVariation(variation);
  31520. }
  31521. data.placement = placement + (variation ? '-' + variation : '');
  31522. // this object contains `position`, we want to preserve it along with
  31523. // any additional property we may add in the future
  31524. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  31525. data = runModifiers(data.instance.modifiers, data, 'flip');
  31526. }
  31527. });
  31528. return data;
  31529. }
  31530. /**
  31531. * @function
  31532. * @memberof Modifiers
  31533. * @argument {Object} data - The data object generated by update method
  31534. * @argument {Object} options - Modifiers configuration and options
  31535. * @returns {Object} The data object, properly modified
  31536. */
  31537. function keepTogether(data) {
  31538. var _data$offsets = data.offsets,
  31539. popper = _data$offsets.popper,
  31540. reference = _data$offsets.reference;
  31541. var placement = data.placement.split('-')[0];
  31542. var floor = Math.floor;
  31543. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31544. var side = isVertical ? 'right' : 'bottom';
  31545. var opSide = isVertical ? 'left' : 'top';
  31546. var measurement = isVertical ? 'width' : 'height';
  31547. if (popper[side] < floor(reference[opSide])) {
  31548. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  31549. }
  31550. if (popper[opSide] > floor(reference[side])) {
  31551. data.offsets.popper[opSide] = floor(reference[side]);
  31552. }
  31553. return data;
  31554. }
  31555. /**
  31556. * Converts a string containing value + unit into a px value number
  31557. * @function
  31558. * @memberof {modifiers~offset}
  31559. * @private
  31560. * @argument {String} str - Value + unit string
  31561. * @argument {String} measurement - `height` or `width`
  31562. * @argument {Object} popperOffsets
  31563. * @argument {Object} referenceOffsets
  31564. * @returns {Number|String}
  31565. * Value in pixels, or original string if no values were extracted
  31566. */
  31567. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  31568. // separate value from unit
  31569. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  31570. var value = +split[1];
  31571. var unit = split[2];
  31572. // If it's not a number it's an operator, I guess
  31573. if (!value) {
  31574. return str;
  31575. }
  31576. if (unit.indexOf('%') === 0) {
  31577. var element = void 0;
  31578. switch (unit) {
  31579. case '%p':
  31580. element = popperOffsets;
  31581. break;
  31582. case '%':
  31583. case '%r':
  31584. default:
  31585. element = referenceOffsets;
  31586. }
  31587. var rect = getClientRect(element);
  31588. return rect[measurement] / 100 * value;
  31589. } else if (unit === 'vh' || unit === 'vw') {
  31590. // if is a vh or vw, we calculate the size based on the viewport
  31591. var size = void 0;
  31592. if (unit === 'vh') {
  31593. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  31594. } else {
  31595. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  31596. }
  31597. return size / 100 * value;
  31598. } else {
  31599. // if is an explicit pixel unit, we get rid of the unit and keep the value
  31600. // if is an implicit unit, it's px, and we return just the value
  31601. return value;
  31602. }
  31603. }
  31604. /**
  31605. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  31606. * @function
  31607. * @memberof {modifiers~offset}
  31608. * @private
  31609. * @argument {String} offset
  31610. * @argument {Object} popperOffsets
  31611. * @argument {Object} referenceOffsets
  31612. * @argument {String} basePlacement
  31613. * @returns {Array} a two cells array with x and y offsets in numbers
  31614. */
  31615. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  31616. var offsets = [0, 0];
  31617. // Use height if placement is left or right and index is 0 otherwise use width
  31618. // in this way the first offset will use an axis and the second one
  31619. // will use the other one
  31620. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  31621. // Split the offset string to obtain a list of values and operands
  31622. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  31623. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  31624. return frag.trim();
  31625. });
  31626. // Detect if the offset string contains a pair of values or a single one
  31627. // they could be separated by comma or space
  31628. var divider = fragments.indexOf(find(fragments, function (frag) {
  31629. return frag.search(/,|\s/) !== -1;
  31630. }));
  31631. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  31632. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  31633. }
  31634. // If divider is found, we divide the list of values and operands to divide
  31635. // them by ofset X and Y.
  31636. var splitRegex = /\s*,\s*|\s+/;
  31637. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  31638. // Convert the values with units to absolute pixels to allow our computations
  31639. ops = ops.map(function (op, index) {
  31640. // Most of the units rely on the orientation of the popper
  31641. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  31642. var mergeWithPrevious = false;
  31643. return op
  31644. // This aggregates any `+` or `-` sign that aren't considered operators
  31645. // e.g.: 10 + +5 => [10, +, +5]
  31646. .reduce(function (a, b) {
  31647. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  31648. a[a.length - 1] = b;
  31649. mergeWithPrevious = true;
  31650. return a;
  31651. } else if (mergeWithPrevious) {
  31652. a[a.length - 1] += b;
  31653. mergeWithPrevious = false;
  31654. return a;
  31655. } else {
  31656. return a.concat(b);
  31657. }
  31658. }, [])
  31659. // Here we convert the string values into number values (in px)
  31660. .map(function (str) {
  31661. return toValue(str, measurement, popperOffsets, referenceOffsets);
  31662. });
  31663. });
  31664. // Loop trough the offsets arrays and execute the operations
  31665. ops.forEach(function (op, index) {
  31666. op.forEach(function (frag, index2) {
  31667. if (isNumeric(frag)) {
  31668. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  31669. }
  31670. });
  31671. });
  31672. return offsets;
  31673. }
  31674. /**
  31675. * @function
  31676. * @memberof Modifiers
  31677. * @argument {Object} data - The data object generated by update method
  31678. * @argument {Object} options - Modifiers configuration and options
  31679. * @argument {Number|String} options.offset=0
  31680. * The offset value as described in the modifier description
  31681. * @returns {Object} The data object, properly modified
  31682. */
  31683. function offset(data, _ref) {
  31684. var offset = _ref.offset;
  31685. var placement = data.placement,
  31686. _data$offsets = data.offsets,
  31687. popper = _data$offsets.popper,
  31688. reference = _data$offsets.reference;
  31689. var basePlacement = placement.split('-')[0];
  31690. var offsets = void 0;
  31691. if (isNumeric(+offset)) {
  31692. offsets = [+offset, 0];
  31693. } else {
  31694. offsets = parseOffset(offset, popper, reference, basePlacement);
  31695. }
  31696. if (basePlacement === 'left') {
  31697. popper.top += offsets[0];
  31698. popper.left -= offsets[1];
  31699. } else if (basePlacement === 'right') {
  31700. popper.top += offsets[0];
  31701. popper.left += offsets[1];
  31702. } else if (basePlacement === 'top') {
  31703. popper.left += offsets[0];
  31704. popper.top -= offsets[1];
  31705. } else if (basePlacement === 'bottom') {
  31706. popper.left += offsets[0];
  31707. popper.top += offsets[1];
  31708. }
  31709. data.popper = popper;
  31710. return data;
  31711. }
  31712. /**
  31713. * @function
  31714. * @memberof Modifiers
  31715. * @argument {Object} data - The data object generated by `update` method
  31716. * @argument {Object} options - Modifiers configuration and options
  31717. * @returns {Object} The data object, properly modified
  31718. */
  31719. function preventOverflow(data, options) {
  31720. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  31721. // If offsetParent is the reference element, we really want to
  31722. // go one step up and use the next offsetParent as reference to
  31723. // avoid to make this modifier completely useless and look like broken
  31724. if (data.instance.reference === boundariesElement) {
  31725. boundariesElement = getOffsetParent(boundariesElement);
  31726. }
  31727. // NOTE: DOM access here
  31728. // resets the popper's position so that the document size can be calculated excluding
  31729. // the size of the popper element itself
  31730. var transformProp = getSupportedPropertyName('transform');
  31731. var popperStyles = data.instance.popper.style; // assignment to help minification
  31732. var top = popperStyles.top,
  31733. left = popperStyles.left,
  31734. transform = popperStyles[transformProp];
  31735. popperStyles.top = '';
  31736. popperStyles.left = '';
  31737. popperStyles[transformProp] = '';
  31738. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  31739. // NOTE: DOM access here
  31740. // restores the original style properties after the offsets have been computed
  31741. popperStyles.top = top;
  31742. popperStyles.left = left;
  31743. popperStyles[transformProp] = transform;
  31744. options.boundaries = boundaries;
  31745. var order = options.priority;
  31746. var popper = data.offsets.popper;
  31747. var check = {
  31748. primary: function primary(placement) {
  31749. var value = popper[placement];
  31750. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  31751. value = Math.max(popper[placement], boundaries[placement]);
  31752. }
  31753. return defineProperty({}, placement, value);
  31754. },
  31755. secondary: function secondary(placement) {
  31756. var mainSide = placement === 'right' ? 'left' : 'top';
  31757. var value = popper[mainSide];
  31758. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  31759. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  31760. }
  31761. return defineProperty({}, mainSide, value);
  31762. }
  31763. };
  31764. order.forEach(function (placement) {
  31765. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  31766. popper = _extends({}, popper, check[side](placement));
  31767. });
  31768. data.offsets.popper = popper;
  31769. return data;
  31770. }
  31771. /**
  31772. * @function
  31773. * @memberof Modifiers
  31774. * @argument {Object} data - The data object generated by `update` method
  31775. * @argument {Object} options - Modifiers configuration and options
  31776. * @returns {Object} The data object, properly modified
  31777. */
  31778. function shift(data) {
  31779. var placement = data.placement;
  31780. var basePlacement = placement.split('-')[0];
  31781. var shiftvariation = placement.split('-')[1];
  31782. // if shift shiftvariation is specified, run the modifier
  31783. if (shiftvariation) {
  31784. var _data$offsets = data.offsets,
  31785. reference = _data$offsets.reference,
  31786. popper = _data$offsets.popper;
  31787. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  31788. var side = isVertical ? 'left' : 'top';
  31789. var measurement = isVertical ? 'width' : 'height';
  31790. var shiftOffsets = {
  31791. start: defineProperty({}, side, reference[side]),
  31792. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  31793. };
  31794. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  31795. }
  31796. return data;
  31797. }
  31798. /**
  31799. * @function
  31800. * @memberof Modifiers
  31801. * @argument {Object} data - The data object generated by update method
  31802. * @argument {Object} options - Modifiers configuration and options
  31803. * @returns {Object} The data object, properly modified
  31804. */
  31805. function hide(data) {
  31806. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  31807. return data;
  31808. }
  31809. var refRect = data.offsets.reference;
  31810. var bound = find(data.instance.modifiers, function (modifier) {
  31811. return modifier.name === 'preventOverflow';
  31812. }).boundaries;
  31813. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  31814. // Avoid unnecessary DOM access if visibility hasn't changed
  31815. if (data.hide === true) {
  31816. return data;
  31817. }
  31818. data.hide = true;
  31819. data.attributes['x-out-of-boundaries'] = '';
  31820. } else {
  31821. // Avoid unnecessary DOM access if visibility hasn't changed
  31822. if (data.hide === false) {
  31823. return data;
  31824. }
  31825. data.hide = false;
  31826. data.attributes['x-out-of-boundaries'] = false;
  31827. }
  31828. return data;
  31829. }
  31830. /**
  31831. * @function
  31832. * @memberof Modifiers
  31833. * @argument {Object} data - The data object generated by `update` method
  31834. * @argument {Object} options - Modifiers configuration and options
  31835. * @returns {Object} The data object, properly modified
  31836. */
  31837. function inner(data) {
  31838. var placement = data.placement;
  31839. var basePlacement = placement.split('-')[0];
  31840. var _data$offsets = data.offsets,
  31841. popper = _data$offsets.popper,
  31842. reference = _data$offsets.reference;
  31843. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  31844. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  31845. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  31846. data.placement = getOppositePlacement(placement);
  31847. data.offsets.popper = getClientRect(popper);
  31848. return data;
  31849. }
  31850. /**
  31851. * Modifier function, each modifier can have a function of this type assigned
  31852. * to its `fn` property.<br />
  31853. * These functions will be called on each update, this means that you must
  31854. * make sure they are performant enough to avoid performance bottlenecks.
  31855. *
  31856. * @function ModifierFn
  31857. * @argument {dataObject} data - The data object generated by `update` method
  31858. * @argument {Object} options - Modifiers configuration and options
  31859. * @returns {dataObject} The data object, properly modified
  31860. */
  31861. /**
  31862. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  31863. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  31864. * needed by the library.
  31865. *
  31866. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  31867. * All the other properties are configurations that could be tweaked.
  31868. * @namespace modifiers
  31869. */
  31870. var modifiers = {
  31871. /**
  31872. * Modifier used to shift the popper on the start or end of its reference
  31873. * element.<br />
  31874. * It will read the variation of the `placement` property.<br />
  31875. * It can be one either `-end` or `-start`.
  31876. * @memberof modifiers
  31877. * @inner
  31878. */
  31879. shift: {
  31880. /** @prop {number} order=100 - Index used to define the order of execution */
  31881. order: 100,
  31882. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31883. enabled: true,
  31884. /** @prop {ModifierFn} */
  31885. fn: shift
  31886. },
  31887. /**
  31888. * The `offset` modifier can shift your popper on both its axis.
  31889. *
  31890. * It accepts the following units:
  31891. * - `px` or unit-less, interpreted as pixels
  31892. * - `%` or `%r`, percentage relative to the length of the reference element
  31893. * - `%p`, percentage relative to the length of the popper element
  31894. * - `vw`, CSS viewport width unit
  31895. * - `vh`, CSS viewport height unit
  31896. *
  31897. * For length is intended the main axis relative to the placement of the popper.<br />
  31898. * This means that if the placement is `top` or `bottom`, the length will be the
  31899. * `width`. In case of `left` or `right`, it will be the `height`.
  31900. *
  31901. * You can provide a single value (as `Number` or `String`), or a pair of values
  31902. * as `String` divided by a comma or one (or more) white spaces.<br />
  31903. * The latter is a deprecated method because it leads to confusion and will be
  31904. * removed in v2.<br />
  31905. * Additionally, it accepts additions and subtractions between different units.
  31906. * Note that multiplications and divisions aren't supported.
  31907. *
  31908. * Valid examples are:
  31909. * ```
  31910. * 10
  31911. * '10%'
  31912. * '10, 10'
  31913. * '10%, 10'
  31914. * '10 + 10%'
  31915. * '10 - 5vh + 3%'
  31916. * '-10px + 5vh, 5px - 6%'
  31917. * ```
  31918. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  31919. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  31920. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  31921. *
  31922. * @memberof modifiers
  31923. * @inner
  31924. */
  31925. offset: {
  31926. /** @prop {number} order=200 - Index used to define the order of execution */
  31927. order: 200,
  31928. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31929. enabled: true,
  31930. /** @prop {ModifierFn} */
  31931. fn: offset,
  31932. /** @prop {Number|String} offset=0
  31933. * The offset value as described in the modifier description
  31934. */
  31935. offset: 0
  31936. },
  31937. /**
  31938. * Modifier used to prevent the popper from being positioned outside the boundary.
  31939. *
  31940. * A scenario exists where the reference itself is not within the boundaries.<br />
  31941. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  31942. * In this case we need to decide whether the popper should either:
  31943. *
  31944. * - detach from the reference and remain "trapped" in the boundaries, or
  31945. * - if it should ignore the boundary and "escape with its reference"
  31946. *
  31947. * When `escapeWithReference` is set to`true` and reference is completely
  31948. * outside its boundaries, the popper will overflow (or completely leave)
  31949. * the boundaries in order to remain attached to the edge of the reference.
  31950. *
  31951. * @memberof modifiers
  31952. * @inner
  31953. */
  31954. preventOverflow: {
  31955. /** @prop {number} order=300 - Index used to define the order of execution */
  31956. order: 300,
  31957. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31958. enabled: true,
  31959. /** @prop {ModifierFn} */
  31960. fn: preventOverflow,
  31961. /**
  31962. * @prop {Array} [priority=['left','right','top','bottom']]
  31963. * Popper will try to prevent overflow following these priorities by default,
  31964. * then, it could overflow on the left and on top of the `boundariesElement`
  31965. */
  31966. priority: ['left', 'right', 'top', 'bottom'],
  31967. /**
  31968. * @prop {number} padding=5
  31969. * Amount of pixel used to define a minimum distance between the boundaries
  31970. * and the popper. This makes sure the popper always has a little padding
  31971. * between the edges of its container
  31972. */
  31973. padding: 5,
  31974. /**
  31975. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  31976. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  31977. * `viewport` or any DOM element.
  31978. */
  31979. boundariesElement: 'scrollParent'
  31980. },
  31981. /**
  31982. * Modifier used to make sure the reference and its popper stay near each other
  31983. * without leaving any gap between the two. Especially useful when the arrow is
  31984. * enabled and you want to ensure that it points to its reference element.
  31985. * It cares only about the first axis. You can still have poppers with margin
  31986. * between the popper and its reference element.
  31987. * @memberof modifiers
  31988. * @inner
  31989. */
  31990. keepTogether: {
  31991. /** @prop {number} order=400 - Index used to define the order of execution */
  31992. order: 400,
  31993. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31994. enabled: true,
  31995. /** @prop {ModifierFn} */
  31996. fn: keepTogether
  31997. },
  31998. /**
  31999. * This modifier is used to move the `arrowElement` of the popper to make
  32000. * sure it is positioned between the reference element and its popper element.
  32001. * It will read the outer size of the `arrowElement` node to detect how many
  32002. * pixels of conjunction are needed.
  32003. *
  32004. * It has no effect if no `arrowElement` is provided.
  32005. * @memberof modifiers
  32006. * @inner
  32007. */
  32008. arrow: {
  32009. /** @prop {number} order=500 - Index used to define the order of execution */
  32010. order: 500,
  32011. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32012. enabled: true,
  32013. /** @prop {ModifierFn} */
  32014. fn: arrow,
  32015. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  32016. element: '[x-arrow]'
  32017. },
  32018. /**
  32019. * Modifier used to flip the popper's placement when it starts to overlap its
  32020. * reference element.
  32021. *
  32022. * Requires the `preventOverflow` modifier before it in order to work.
  32023. *
  32024. * **NOTE:** this modifier will interrupt the current update cycle and will
  32025. * restart it if it detects the need to flip the placement.
  32026. * @memberof modifiers
  32027. * @inner
  32028. */
  32029. flip: {
  32030. /** @prop {number} order=600 - Index used to define the order of execution */
  32031. order: 600,
  32032. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32033. enabled: true,
  32034. /** @prop {ModifierFn} */
  32035. fn: flip,
  32036. /**
  32037. * @prop {String|Array} behavior='flip'
  32038. * The behavior used to change the popper's placement. It can be one of
  32039. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  32040. * placements (with optional variations)
  32041. */
  32042. behavior: 'flip',
  32043. /**
  32044. * @prop {number} padding=5
  32045. * The popper will flip if it hits the edges of the `boundariesElement`
  32046. */
  32047. padding: 5,
  32048. /**
  32049. * @prop {String|HTMLElement} boundariesElement='viewport'
  32050. * The element which will define the boundaries of the popper position.
  32051. * The popper will never be placed outside of the defined boundaries
  32052. * (except if `keepTogether` is enabled)
  32053. */
  32054. boundariesElement: 'viewport',
  32055. /**
  32056. * @prop {Boolean} flipVariations=false
  32057. * The popper will switch placement variation between `-start` and `-end` when
  32058. * the reference element overlaps its boundaries.
  32059. *
  32060. * The original placement should have a set variation.
  32061. */
  32062. flipVariations: false,
  32063. /**
  32064. * @prop {Boolean} flipVariationsByContent=false
  32065. * The popper will switch placement variation between `-start` and `-end` when
  32066. * the popper element overlaps its reference boundaries.
  32067. *
  32068. * The original placement should have a set variation.
  32069. */
  32070. flipVariationsByContent: false
  32071. },
  32072. /**
  32073. * Modifier used to make the popper flow toward the inner of the reference element.
  32074. * By default, when this modifier is disabled, the popper will be placed outside
  32075. * the reference element.
  32076. * @memberof modifiers
  32077. * @inner
  32078. */
  32079. inner: {
  32080. /** @prop {number} order=700 - Index used to define the order of execution */
  32081. order: 700,
  32082. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  32083. enabled: false,
  32084. /** @prop {ModifierFn} */
  32085. fn: inner
  32086. },
  32087. /**
  32088. * Modifier used to hide the popper when its reference element is outside of the
  32089. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  32090. * be used to hide with a CSS selector the popper when its reference is
  32091. * out of boundaries.
  32092. *
  32093. * Requires the `preventOverflow` modifier before it in order to work.
  32094. * @memberof modifiers
  32095. * @inner
  32096. */
  32097. hide: {
  32098. /** @prop {number} order=800 - Index used to define the order of execution */
  32099. order: 800,
  32100. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32101. enabled: true,
  32102. /** @prop {ModifierFn} */
  32103. fn: hide
  32104. },
  32105. /**
  32106. * Computes the style that will be applied to the popper element to gets
  32107. * properly positioned.
  32108. *
  32109. * Note that this modifier will not touch the DOM, it just prepares the styles
  32110. * so that `applyStyle` modifier can apply it. This separation is useful
  32111. * in case you need to replace `applyStyle` with a custom implementation.
  32112. *
  32113. * This modifier has `850` as `order` value to maintain backward compatibility
  32114. * with previous versions of Popper.js. Expect the modifiers ordering method
  32115. * to change in future major versions of the library.
  32116. *
  32117. * @memberof modifiers
  32118. * @inner
  32119. */
  32120. computeStyle: {
  32121. /** @prop {number} order=850 - Index used to define the order of execution */
  32122. order: 850,
  32123. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32124. enabled: true,
  32125. /** @prop {ModifierFn} */
  32126. fn: computeStyle,
  32127. /**
  32128. * @prop {Boolean} gpuAcceleration=true
  32129. * If true, it uses the CSS 3D transformation to position the popper.
  32130. * Otherwise, it will use the `top` and `left` properties
  32131. */
  32132. gpuAcceleration: true,
  32133. /**
  32134. * @prop {string} [x='bottom']
  32135. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  32136. * Change this if your popper should grow in a direction different from `bottom`
  32137. */
  32138. x: 'bottom',
  32139. /**
  32140. * @prop {string} [x='left']
  32141. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  32142. * Change this if your popper should grow in a direction different from `right`
  32143. */
  32144. y: 'right'
  32145. },
  32146. /**
  32147. * Applies the computed styles to the popper element.
  32148. *
  32149. * All the DOM manipulations are limited to this modifier. This is useful in case
  32150. * you want to integrate Popper.js inside a framework or view library and you
  32151. * want to delegate all the DOM manipulations to it.
  32152. *
  32153. * Note that if you disable this modifier, you must make sure the popper element
  32154. * has its position set to `absolute` before Popper.js can do its work!
  32155. *
  32156. * Just disable this modifier and define your own to achieve the desired effect.
  32157. *
  32158. * @memberof modifiers
  32159. * @inner
  32160. */
  32161. applyStyle: {
  32162. /** @prop {number} order=900 - Index used to define the order of execution */
  32163. order: 900,
  32164. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32165. enabled: true,
  32166. /** @prop {ModifierFn} */
  32167. fn: applyStyle,
  32168. /** @prop {Function} */
  32169. onLoad: applyStyleOnLoad,
  32170. /**
  32171. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  32172. * @prop {Boolean} gpuAcceleration=true
  32173. * If true, it uses the CSS 3D transformation to position the popper.
  32174. * Otherwise, it will use the `top` and `left` properties
  32175. */
  32176. gpuAcceleration: undefined
  32177. }
  32178. };
  32179. /**
  32180. * The `dataObject` is an object containing all the information used by Popper.js.
  32181. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  32182. * @name dataObject
  32183. * @property {Object} data.instance The Popper.js instance
  32184. * @property {String} data.placement Placement applied to popper
  32185. * @property {String} data.originalPlacement Placement originally defined on init
  32186. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  32187. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  32188. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  32189. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32190. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32191. * @property {Object} data.boundaries Offsets of the popper boundaries
  32192. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  32193. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  32194. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  32195. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  32196. */
  32197. /**
  32198. * Default options provided to Popper.js constructor.<br />
  32199. * These can be overridden using the `options` argument of Popper.js.<br />
  32200. * To override an option, simply pass an object with the same
  32201. * structure of the `options` object, as the 3rd argument. For example:
  32202. * ```
  32203. * new Popper(ref, pop, {
  32204. * modifiers: {
  32205. * preventOverflow: { enabled: false }
  32206. * }
  32207. * })
  32208. * ```
  32209. * @type {Object}
  32210. * @static
  32211. * @memberof Popper
  32212. */
  32213. var Defaults = {
  32214. /**
  32215. * Popper's placement.
  32216. * @prop {Popper.placements} placement='bottom'
  32217. */
  32218. placement: 'bottom',
  32219. /**
  32220. * Set this to true if you want popper to position it self in 'fixed' mode
  32221. * @prop {Boolean} positionFixed=false
  32222. */
  32223. positionFixed: false,
  32224. /**
  32225. * Whether events (resize, scroll) are initially enabled.
  32226. * @prop {Boolean} eventsEnabled=true
  32227. */
  32228. eventsEnabled: true,
  32229. /**
  32230. * Set to true if you want to automatically remove the popper when
  32231. * you call the `destroy` method.
  32232. * @prop {Boolean} removeOnDestroy=false
  32233. */
  32234. removeOnDestroy: false,
  32235. /**
  32236. * Callback called when the popper is created.<br />
  32237. * By default, it is set to no-op.<br />
  32238. * Access Popper.js instance with `data.instance`.
  32239. * @prop {onCreate}
  32240. */
  32241. onCreate: function onCreate() {},
  32242. /**
  32243. * Callback called when the popper is updated. This callback is not called
  32244. * on the initialization/creation of the popper, but only on subsequent
  32245. * updates.<br />
  32246. * By default, it is set to no-op.<br />
  32247. * Access Popper.js instance with `data.instance`.
  32248. * @prop {onUpdate}
  32249. */
  32250. onUpdate: function onUpdate() {},
  32251. /**
  32252. * List of modifiers used to modify the offsets before they are applied to the popper.
  32253. * They provide most of the functionalities of Popper.js.
  32254. * @prop {modifiers}
  32255. */
  32256. modifiers: modifiers
  32257. };
  32258. /**
  32259. * @callback onCreate
  32260. * @param {dataObject} data
  32261. */
  32262. /**
  32263. * @callback onUpdate
  32264. * @param {dataObject} data
  32265. */
  32266. // Utils
  32267. // Methods
  32268. var Popper = function () {
  32269. /**
  32270. * Creates a new Popper.js instance.
  32271. * @class Popper
  32272. * @param {Element|referenceObject} reference - The reference element used to position the popper
  32273. * @param {Element} popper - The HTML / XML element used as the popper
  32274. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  32275. * @return {Object} instance - The generated Popper.js instance
  32276. */
  32277. function Popper(reference, popper) {
  32278. var _this = this;
  32279. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  32280. classCallCheck(this, Popper);
  32281. this.scheduleUpdate = function () {
  32282. return requestAnimationFrame(_this.update);
  32283. };
  32284. // make update() debounced, so that it only runs at most once-per-tick
  32285. this.update = debounce(this.update.bind(this));
  32286. // with {} we create a new object with the options inside it
  32287. this.options = _extends({}, Popper.Defaults, options);
  32288. // init state
  32289. this.state = {
  32290. isDestroyed: false,
  32291. isCreated: false,
  32292. scrollParents: []
  32293. };
  32294. // get reference and popper elements (allow jQuery wrappers)
  32295. this.reference = reference && reference.jquery ? reference[0] : reference;
  32296. this.popper = popper && popper.jquery ? popper[0] : popper;
  32297. // Deep merge modifiers options
  32298. this.options.modifiers = {};
  32299. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  32300. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  32301. });
  32302. // Refactoring modifiers' list (Object => Array)
  32303. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  32304. return _extends({
  32305. name: name
  32306. }, _this.options.modifiers[name]);
  32307. })
  32308. // sort the modifiers by order
  32309. .sort(function (a, b) {
  32310. return a.order - b.order;
  32311. });
  32312. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  32313. // such code is executed in the same order of its modifier
  32314. // they could add new properties to their options configuration
  32315. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  32316. this.modifiers.forEach(function (modifierOptions) {
  32317. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  32318. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  32319. }
  32320. });
  32321. // fire the first update to position the popper in the right place
  32322. this.update();
  32323. var eventsEnabled = this.options.eventsEnabled;
  32324. if (eventsEnabled) {
  32325. // setup event listeners, they will take care of update the position in specific situations
  32326. this.enableEventListeners();
  32327. }
  32328. this.state.eventsEnabled = eventsEnabled;
  32329. }
  32330. // We can't use class properties because they don't get listed in the
  32331. // class prototype and break stuff like Sinon stubs
  32332. createClass(Popper, [{
  32333. key: 'update',
  32334. value: function update$$1() {
  32335. return update.call(this);
  32336. }
  32337. }, {
  32338. key: 'destroy',
  32339. value: function destroy$$1() {
  32340. return destroy.call(this);
  32341. }
  32342. }, {
  32343. key: 'enableEventListeners',
  32344. value: function enableEventListeners$$1() {
  32345. return enableEventListeners.call(this);
  32346. }
  32347. }, {
  32348. key: 'disableEventListeners',
  32349. value: function disableEventListeners$$1() {
  32350. return disableEventListeners.call(this);
  32351. }
  32352. /**
  32353. * Schedules an update. It will run on the next UI update available.
  32354. * @method scheduleUpdate
  32355. * @memberof Popper
  32356. */
  32357. /**
  32358. * Collection of utilities useful when writing custom modifiers.
  32359. * Starting from version 1.7, this method is available only if you
  32360. * include `popper-utils.js` before `popper.js`.
  32361. *
  32362. * **DEPRECATION**: This way to access PopperUtils is deprecated
  32363. * and will be removed in v2! Use the PopperUtils module directly instead.
  32364. * Due to the high instability of the methods contained in Utils, we can't
  32365. * guarantee them to follow semver. Use them at your own risk!
  32366. * @static
  32367. * @private
  32368. * @type {Object}
  32369. * @deprecated since version 1.8
  32370. * @member Utils
  32371. * @memberof Popper
  32372. */
  32373. }]);
  32374. return Popper;
  32375. }();
  32376. /**
  32377. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  32378. * and lets you use it as replacement of a real DOM node.<br />
  32379. * You can use this method to position a popper relatively to a set of coordinates
  32380. * in case you don't have a DOM node to use as reference.
  32381. *
  32382. * ```
  32383. * new Popper(referenceObject, popperNode);
  32384. * ```
  32385. *
  32386. * NB: This feature isn't supported in Internet Explorer 10.
  32387. * @name referenceObject
  32388. * @property {Function} data.getBoundingClientRect
  32389. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  32390. * @property {number} data.clientWidth
  32391. * An ES6 getter that will return the width of the virtual reference element.
  32392. * @property {number} data.clientHeight
  32393. * An ES6 getter that will return the height of the virtual reference element.
  32394. */
  32395. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  32396. Popper.placements = placements;
  32397. Popper.Defaults = Defaults;
  32398. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  32399. //# sourceMappingURL=popper.js.map
  32400. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32401. /***/ }),
  32402. /***/ "./node_modules/process/browser.js":
  32403. /*!*****************************************!*\
  32404. !*** ./node_modules/process/browser.js ***!
  32405. \*****************************************/
  32406. /*! no static exports found */
  32407. /***/ (function(module, exports) {
  32408. // shim for using process in browser
  32409. var process = module.exports = {};
  32410. // cached from whatever global is present so that test runners that stub it
  32411. // don't break things. But we need to wrap it in a try catch in case it is
  32412. // wrapped in strict mode code which doesn't define any globals. It's inside a
  32413. // function because try/catches deoptimize in certain engines.
  32414. var cachedSetTimeout;
  32415. var cachedClearTimeout;
  32416. function defaultSetTimout() {
  32417. throw new Error('setTimeout has not been defined');
  32418. }
  32419. function defaultClearTimeout () {
  32420. throw new Error('clearTimeout has not been defined');
  32421. }
  32422. (function () {
  32423. try {
  32424. if (typeof setTimeout === 'function') {
  32425. cachedSetTimeout = setTimeout;
  32426. } else {
  32427. cachedSetTimeout = defaultSetTimout;
  32428. }
  32429. } catch (e) {
  32430. cachedSetTimeout = defaultSetTimout;
  32431. }
  32432. try {
  32433. if (typeof clearTimeout === 'function') {
  32434. cachedClearTimeout = clearTimeout;
  32435. } else {
  32436. cachedClearTimeout = defaultClearTimeout;
  32437. }
  32438. } catch (e) {
  32439. cachedClearTimeout = defaultClearTimeout;
  32440. }
  32441. } ())
  32442. function runTimeout(fun) {
  32443. if (cachedSetTimeout === setTimeout) {
  32444. //normal enviroments in sane situations
  32445. return setTimeout(fun, 0);
  32446. }
  32447. // if setTimeout wasn't available but was latter defined
  32448. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  32449. cachedSetTimeout = setTimeout;
  32450. return setTimeout(fun, 0);
  32451. }
  32452. try {
  32453. // when when somebody has screwed with setTimeout but no I.E. maddness
  32454. return cachedSetTimeout(fun, 0);
  32455. } catch(e){
  32456. try {
  32457. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32458. return cachedSetTimeout.call(null, fun, 0);
  32459. } catch(e){
  32460. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  32461. return cachedSetTimeout.call(this, fun, 0);
  32462. }
  32463. }
  32464. }
  32465. function runClearTimeout(marker) {
  32466. if (cachedClearTimeout === clearTimeout) {
  32467. //normal enviroments in sane situations
  32468. return clearTimeout(marker);
  32469. }
  32470. // if clearTimeout wasn't available but was latter defined
  32471. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  32472. cachedClearTimeout = clearTimeout;
  32473. return clearTimeout(marker);
  32474. }
  32475. try {
  32476. // when when somebody has screwed with setTimeout but no I.E. maddness
  32477. return cachedClearTimeout(marker);
  32478. } catch (e){
  32479. try {
  32480. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32481. return cachedClearTimeout.call(null, marker);
  32482. } catch (e){
  32483. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  32484. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  32485. return cachedClearTimeout.call(this, marker);
  32486. }
  32487. }
  32488. }
  32489. var queue = [];
  32490. var draining = false;
  32491. var currentQueue;
  32492. var queueIndex = -1;
  32493. function cleanUpNextTick() {
  32494. if (!draining || !currentQueue) {
  32495. return;
  32496. }
  32497. draining = false;
  32498. if (currentQueue.length) {
  32499. queue = currentQueue.concat(queue);
  32500. } else {
  32501. queueIndex = -1;
  32502. }
  32503. if (queue.length) {
  32504. drainQueue();
  32505. }
  32506. }
  32507. function drainQueue() {
  32508. if (draining) {
  32509. return;
  32510. }
  32511. var timeout = runTimeout(cleanUpNextTick);
  32512. draining = true;
  32513. var len = queue.length;
  32514. while(len) {
  32515. currentQueue = queue;
  32516. queue = [];
  32517. while (++queueIndex < len) {
  32518. if (currentQueue) {
  32519. currentQueue[queueIndex].run();
  32520. }
  32521. }
  32522. queueIndex = -1;
  32523. len = queue.length;
  32524. }
  32525. currentQueue = null;
  32526. draining = false;
  32527. runClearTimeout(timeout);
  32528. }
  32529. process.nextTick = function (fun) {
  32530. var args = new Array(arguments.length - 1);
  32531. if (arguments.length > 1) {
  32532. for (var i = 1; i < arguments.length; i++) {
  32533. args[i - 1] = arguments[i];
  32534. }
  32535. }
  32536. queue.push(new Item(fun, args));
  32537. if (queue.length === 1 && !draining) {
  32538. runTimeout(drainQueue);
  32539. }
  32540. };
  32541. // v8 likes predictible objects
  32542. function Item(fun, array) {
  32543. this.fun = fun;
  32544. this.array = array;
  32545. }
  32546. Item.prototype.run = function () {
  32547. this.fun.apply(null, this.array);
  32548. };
  32549. process.title = 'browser';
  32550. process.browser = true;
  32551. process.env = {};
  32552. process.argv = [];
  32553. process.version = ''; // empty string to avoid regexp issues
  32554. process.versions = {};
  32555. function noop() {}
  32556. process.on = noop;
  32557. process.addListener = noop;
  32558. process.once = noop;
  32559. process.off = noop;
  32560. process.removeListener = noop;
  32561. process.removeAllListeners = noop;
  32562. process.emit = noop;
  32563. process.prependListener = noop;
  32564. process.prependOnceListener = noop;
  32565. process.listeners = function (name) { return [] }
  32566. process.binding = function (name) {
  32567. throw new Error('process.binding is not supported');
  32568. };
  32569. process.cwd = function () { return '/' };
  32570. process.chdir = function (dir) {
  32571. throw new Error('process.chdir is not supported');
  32572. };
  32573. process.umask = function() { return 0; };
  32574. /***/ }),
  32575. /***/ "./node_modules/setimmediate/setImmediate.js":
  32576. /*!***************************************************!*\
  32577. !*** ./node_modules/setimmediate/setImmediate.js ***!
  32578. \***************************************************/
  32579. /*! no static exports found */
  32580. /***/ (function(module, exports, __webpack_require__) {
  32581. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  32582. "use strict";
  32583. if (global.setImmediate) {
  32584. return;
  32585. }
  32586. var nextHandle = 1; // Spec says greater than zero
  32587. var tasksByHandle = {};
  32588. var currentlyRunningATask = false;
  32589. var doc = global.document;
  32590. var registerImmediate;
  32591. function setImmediate(callback) {
  32592. // Callback can either be a function or a string
  32593. if (typeof callback !== "function") {
  32594. callback = new Function("" + callback);
  32595. }
  32596. // Copy function arguments
  32597. var args = new Array(arguments.length - 1);
  32598. for (var i = 0; i < args.length; i++) {
  32599. args[i] = arguments[i + 1];
  32600. }
  32601. // Store and register the task
  32602. var task = { callback: callback, args: args };
  32603. tasksByHandle[nextHandle] = task;
  32604. registerImmediate(nextHandle);
  32605. return nextHandle++;
  32606. }
  32607. function clearImmediate(handle) {
  32608. delete tasksByHandle[handle];
  32609. }
  32610. function run(task) {
  32611. var callback = task.callback;
  32612. var args = task.args;
  32613. switch (args.length) {
  32614. case 0:
  32615. callback();
  32616. break;
  32617. case 1:
  32618. callback(args[0]);
  32619. break;
  32620. case 2:
  32621. callback(args[0], args[1]);
  32622. break;
  32623. case 3:
  32624. callback(args[0], args[1], args[2]);
  32625. break;
  32626. default:
  32627. callback.apply(undefined, args);
  32628. break;
  32629. }
  32630. }
  32631. function runIfPresent(handle) {
  32632. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  32633. // So if we're currently running a task, we'll need to delay this invocation.
  32634. if (currentlyRunningATask) {
  32635. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  32636. // "too much recursion" error.
  32637. setTimeout(runIfPresent, 0, handle);
  32638. } else {
  32639. var task = tasksByHandle[handle];
  32640. if (task) {
  32641. currentlyRunningATask = true;
  32642. try {
  32643. run(task);
  32644. } finally {
  32645. clearImmediate(handle);
  32646. currentlyRunningATask = false;
  32647. }
  32648. }
  32649. }
  32650. }
  32651. function installNextTickImplementation() {
  32652. registerImmediate = function(handle) {
  32653. process.nextTick(function () { runIfPresent(handle); });
  32654. };
  32655. }
  32656. function canUsePostMessage() {
  32657. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  32658. // where `global.postMessage` means something completely different and can't be used for this purpose.
  32659. if (global.postMessage && !global.importScripts) {
  32660. var postMessageIsAsynchronous = true;
  32661. var oldOnMessage = global.onmessage;
  32662. global.onmessage = function() {
  32663. postMessageIsAsynchronous = false;
  32664. };
  32665. global.postMessage("", "*");
  32666. global.onmessage = oldOnMessage;
  32667. return postMessageIsAsynchronous;
  32668. }
  32669. }
  32670. function installPostMessageImplementation() {
  32671. // Installs an event handler on `global` for the `message` event: see
  32672. // * https://developer.mozilla.org/en/DOM/window.postMessage
  32673. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  32674. var messagePrefix = "setImmediate$" + Math.random() + "$";
  32675. var onGlobalMessage = function(event) {
  32676. if (event.source === global &&
  32677. typeof event.data === "string" &&
  32678. event.data.indexOf(messagePrefix) === 0) {
  32679. runIfPresent(+event.data.slice(messagePrefix.length));
  32680. }
  32681. };
  32682. if (global.addEventListener) {
  32683. global.addEventListener("message", onGlobalMessage, false);
  32684. } else {
  32685. global.attachEvent("onmessage", onGlobalMessage);
  32686. }
  32687. registerImmediate = function(handle) {
  32688. global.postMessage(messagePrefix + handle, "*");
  32689. };
  32690. }
  32691. function installMessageChannelImplementation() {
  32692. var channel = new MessageChannel();
  32693. channel.port1.onmessage = function(event) {
  32694. var handle = event.data;
  32695. runIfPresent(handle);
  32696. };
  32697. registerImmediate = function(handle) {
  32698. channel.port2.postMessage(handle);
  32699. };
  32700. }
  32701. function installReadyStateChangeImplementation() {
  32702. var html = doc.documentElement;
  32703. registerImmediate = function(handle) {
  32704. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  32705. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  32706. var script = doc.createElement("script");
  32707. script.onreadystatechange = function () {
  32708. runIfPresent(handle);
  32709. script.onreadystatechange = null;
  32710. html.removeChild(script);
  32711. script = null;
  32712. };
  32713. html.appendChild(script);
  32714. };
  32715. }
  32716. function installSetTimeoutImplementation() {
  32717. registerImmediate = function(handle) {
  32718. setTimeout(runIfPresent, 0, handle);
  32719. };
  32720. }
  32721. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  32722. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  32723. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  32724. // Don't get fooled by e.g. browserify environments.
  32725. if ({}.toString.call(global.process) === "[object process]") {
  32726. // For Node.js before 0.9
  32727. installNextTickImplementation();
  32728. } else if (canUsePostMessage()) {
  32729. // For non-IE10 modern browsers
  32730. installPostMessageImplementation();
  32731. } else if (global.MessageChannel) {
  32732. // For web workers, where supported
  32733. installMessageChannelImplementation();
  32734. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  32735. // For IE 6–8
  32736. installReadyStateChangeImplementation();
  32737. } else {
  32738. // For older browsers
  32739. installSetTimeoutImplementation();
  32740. }
  32741. attachTo.setImmediate = setImmediate;
  32742. attachTo.clearImmediate = clearImmediate;
  32743. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  32744. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
  32745. /***/ }),
  32746. /***/ "./node_modules/timers-browserify/main.js":
  32747. /*!************************************************!*\
  32748. !*** ./node_modules/timers-browserify/main.js ***!
  32749. \************************************************/
  32750. /*! no static exports found */
  32751. /***/ (function(module, exports, __webpack_require__) {
  32752. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  32753. (typeof self !== "undefined" && self) ||
  32754. window;
  32755. var apply = Function.prototype.apply;
  32756. // DOM APIs, for completeness
  32757. exports.setTimeout = function() {
  32758. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  32759. };
  32760. exports.setInterval = function() {
  32761. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  32762. };
  32763. exports.clearTimeout =
  32764. exports.clearInterval = function(timeout) {
  32765. if (timeout) {
  32766. timeout.close();
  32767. }
  32768. };
  32769. function Timeout(id, clearFn) {
  32770. this._id = id;
  32771. this._clearFn = clearFn;
  32772. }
  32773. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  32774. Timeout.prototype.close = function() {
  32775. this._clearFn.call(scope, this._id);
  32776. };
  32777. // Does not start the time, just sets up the members needed.
  32778. exports.enroll = function(item, msecs) {
  32779. clearTimeout(item._idleTimeoutId);
  32780. item._idleTimeout = msecs;
  32781. };
  32782. exports.unenroll = function(item) {
  32783. clearTimeout(item._idleTimeoutId);
  32784. item._idleTimeout = -1;
  32785. };
  32786. exports._unrefActive = exports.active = function(item) {
  32787. clearTimeout(item._idleTimeoutId);
  32788. var msecs = item._idleTimeout;
  32789. if (msecs >= 0) {
  32790. item._idleTimeoutId = setTimeout(function onTimeout() {
  32791. if (item._onTimeout)
  32792. item._onTimeout();
  32793. }, msecs);
  32794. }
  32795. };
  32796. // setimmediate attaches itself to the global object
  32797. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  32798. // On some exotic environments, it's not clear which object `setimmediate` was
  32799. // able to install onto. Search each possibility in the same order as the
  32800. // `setimmediate` library.
  32801. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  32802. (typeof global !== "undefined" && global.setImmediate) ||
  32803. (this && this.setImmediate);
  32804. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  32805. (typeof global !== "undefined" && global.clearImmediate) ||
  32806. (this && this.clearImmediate);
  32807. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32808. /***/ }),
  32809. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/FollowButton.vue?vue&type=template&id=426ba0ae&":
  32810. /*!***************************************************************************************************************************************************************************************************************!*\
  32811. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/FollowButton.vue?vue&type=template&id=426ba0ae& ***!
  32812. \***************************************************************************************************************************************************************************************************************/
  32813. /*! exports provided: render, staticRenderFns */
  32814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32815. "use strict";
  32816. __webpack_require__.r(__webpack_exports__);
  32817. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  32818. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  32819. var render = function() {
  32820. var _vm = this
  32821. var _h = _vm.$createElement
  32822. var _c = _vm._self._c || _h
  32823. return _c("div", [
  32824. _c("button", {
  32825. staticClass: "btn btn-primary ml-4",
  32826. domProps: { textContent: _vm._s(_vm.ButtonText) },
  32827. on: { click: _vm.followUser }
  32828. })
  32829. ])
  32830. }
  32831. var staticRenderFns = []
  32832. render._withStripped = true
  32833. /***/ }),
  32834. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  32835. /*!********************************************************************!*\
  32836. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  32837. \********************************************************************/
  32838. /*! exports provided: default */
  32839. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32840. "use strict";
  32841. __webpack_require__.r(__webpack_exports__);
  32842. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  32843. /* globals __VUE_SSR_CONTEXT__ */
  32844. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  32845. // This module is a runtime utility for cleaner component module output and will
  32846. // be included in the final webpack user bundle.
  32847. function normalizeComponent (
  32848. scriptExports,
  32849. render,
  32850. staticRenderFns,
  32851. functionalTemplate,
  32852. injectStyles,
  32853. scopeId,
  32854. moduleIdentifier, /* server only */
  32855. shadowMode /* vue-cli only */
  32856. ) {
  32857. // Vue.extend constructor export interop
  32858. var options = typeof scriptExports === 'function'
  32859. ? scriptExports.options
  32860. : scriptExports
  32861. // render functions
  32862. if (render) {
  32863. options.render = render
  32864. options.staticRenderFns = staticRenderFns
  32865. options._compiled = true
  32866. }
  32867. // functional template
  32868. if (functionalTemplate) {
  32869. options.functional = true
  32870. }
  32871. // scopedId
  32872. if (scopeId) {
  32873. options._scopeId = 'data-v-' + scopeId
  32874. }
  32875. var hook
  32876. if (moduleIdentifier) { // server build
  32877. hook = function (context) {
  32878. // 2.3 injection
  32879. context =
  32880. context || // cached call
  32881. (this.$vnode && this.$vnode.ssrContext) || // stateful
  32882. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  32883. // 2.2 with runInNewContext: true
  32884. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  32885. context = __VUE_SSR_CONTEXT__
  32886. }
  32887. // inject component styles
  32888. if (injectStyles) {
  32889. injectStyles.call(this, context)
  32890. }
  32891. // register component module identifier for async chunk inferrence
  32892. if (context && context._registeredComponents) {
  32893. context._registeredComponents.add(moduleIdentifier)
  32894. }
  32895. }
  32896. // used by ssr in case component is cached and beforeCreate
  32897. // never gets called
  32898. options._ssrRegister = hook
  32899. } else if (injectStyles) {
  32900. hook = shadowMode
  32901. ? function () {
  32902. injectStyles.call(
  32903. this,
  32904. (options.functional ? this.parent : this).$root.$options.shadowRoot
  32905. )
  32906. }
  32907. : injectStyles
  32908. }
  32909. if (hook) {
  32910. if (options.functional) {
  32911. // for template-only hot-reload because in that case the render fn doesn't
  32912. // go through the normalizer
  32913. options._injectStyles = hook
  32914. // register for functional component in vue file
  32915. var originalRender = options.render
  32916. options.render = function renderWithStyleInjection (h, context) {
  32917. hook.call(context)
  32918. return originalRender(h, context)
  32919. }
  32920. } else {
  32921. // inject component registration as beforeCreate hook
  32922. var existing = options.beforeCreate
  32923. options.beforeCreate = existing
  32924. ? [].concat(existing, hook)
  32925. : [hook]
  32926. }
  32927. }
  32928. return {
  32929. exports: scriptExports,
  32930. options: options
  32931. }
  32932. }
  32933. /***/ }),
  32934. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  32935. /*!*************************************************!*\
  32936. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  32937. \*************************************************/
  32938. /*! no static exports found */
  32939. /***/ (function(module, exports, __webpack_require__) {
  32940. "use strict";
  32941. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  32942. * Vue.js v2.6.12
  32943. * (c) 2014-2020 Evan You
  32944. * Released under the MIT License.
  32945. */
  32946. /* */
  32947. var emptyObject = Object.freeze({});
  32948. // These helpers produce better VM code in JS engines due to their
  32949. // explicitness and function inlining.
  32950. function isUndef (v) {
  32951. return v === undefined || v === null
  32952. }
  32953. function isDef (v) {
  32954. return v !== undefined && v !== null
  32955. }
  32956. function isTrue (v) {
  32957. return v === true
  32958. }
  32959. function isFalse (v) {
  32960. return v === false
  32961. }
  32962. /**
  32963. * Check if value is primitive.
  32964. */
  32965. function isPrimitive (value) {
  32966. return (
  32967. typeof value === 'string' ||
  32968. typeof value === 'number' ||
  32969. // $flow-disable-line
  32970. typeof value === 'symbol' ||
  32971. typeof value === 'boolean'
  32972. )
  32973. }
  32974. /**
  32975. * Quick object check - this is primarily used to tell
  32976. * Objects from primitive values when we know the value
  32977. * is a JSON-compliant type.
  32978. */
  32979. function isObject (obj) {
  32980. return obj !== null && typeof obj === 'object'
  32981. }
  32982. /**
  32983. * Get the raw type string of a value, e.g., [object Object].
  32984. */
  32985. var _toString = Object.prototype.toString;
  32986. function toRawType (value) {
  32987. return _toString.call(value).slice(8, -1)
  32988. }
  32989. /**
  32990. * Strict object type check. Only returns true
  32991. * for plain JavaScript objects.
  32992. */
  32993. function isPlainObject (obj) {
  32994. return _toString.call(obj) === '[object Object]'
  32995. }
  32996. function isRegExp (v) {
  32997. return _toString.call(v) === '[object RegExp]'
  32998. }
  32999. /**
  33000. * Check if val is a valid array index.
  33001. */
  33002. function isValidArrayIndex (val) {
  33003. var n = parseFloat(String(val));
  33004. return n >= 0 && Math.floor(n) === n && isFinite(val)
  33005. }
  33006. function isPromise (val) {
  33007. return (
  33008. isDef(val) &&
  33009. typeof val.then === 'function' &&
  33010. typeof val.catch === 'function'
  33011. )
  33012. }
  33013. /**
  33014. * Convert a value to a string that is actually rendered.
  33015. */
  33016. function toString (val) {
  33017. return val == null
  33018. ? ''
  33019. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  33020. ? JSON.stringify(val, null, 2)
  33021. : String(val)
  33022. }
  33023. /**
  33024. * Convert an input value to a number for persistence.
  33025. * If the conversion fails, return original string.
  33026. */
  33027. function toNumber (val) {
  33028. var n = parseFloat(val);
  33029. return isNaN(n) ? val : n
  33030. }
  33031. /**
  33032. * Make a map and return a function for checking if a key
  33033. * is in that map.
  33034. */
  33035. function makeMap (
  33036. str,
  33037. expectsLowerCase
  33038. ) {
  33039. var map = Object.create(null);
  33040. var list = str.split(',');
  33041. for (var i = 0; i < list.length; i++) {
  33042. map[list[i]] = true;
  33043. }
  33044. return expectsLowerCase
  33045. ? function (val) { return map[val.toLowerCase()]; }
  33046. : function (val) { return map[val]; }
  33047. }
  33048. /**
  33049. * Check if a tag is a built-in tag.
  33050. */
  33051. var isBuiltInTag = makeMap('slot,component', true);
  33052. /**
  33053. * Check if an attribute is a reserved attribute.
  33054. */
  33055. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  33056. /**
  33057. * Remove an item from an array.
  33058. */
  33059. function remove (arr, item) {
  33060. if (arr.length) {
  33061. var index = arr.indexOf(item);
  33062. if (index > -1) {
  33063. return arr.splice(index, 1)
  33064. }
  33065. }
  33066. }
  33067. /**
  33068. * Check whether an object has the property.
  33069. */
  33070. var hasOwnProperty = Object.prototype.hasOwnProperty;
  33071. function hasOwn (obj, key) {
  33072. return hasOwnProperty.call(obj, key)
  33073. }
  33074. /**
  33075. * Create a cached version of a pure function.
  33076. */
  33077. function cached (fn) {
  33078. var cache = Object.create(null);
  33079. return (function cachedFn (str) {
  33080. var hit = cache[str];
  33081. return hit || (cache[str] = fn(str))
  33082. })
  33083. }
  33084. /**
  33085. * Camelize a hyphen-delimited string.
  33086. */
  33087. var camelizeRE = /-(\w)/g;
  33088. var camelize = cached(function (str) {
  33089. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  33090. });
  33091. /**
  33092. * Capitalize a string.
  33093. */
  33094. var capitalize = cached(function (str) {
  33095. return str.charAt(0).toUpperCase() + str.slice(1)
  33096. });
  33097. /**
  33098. * Hyphenate a camelCase string.
  33099. */
  33100. var hyphenateRE = /\B([A-Z])/g;
  33101. var hyphenate = cached(function (str) {
  33102. return str.replace(hyphenateRE, '-$1').toLowerCase()
  33103. });
  33104. /**
  33105. * Simple bind polyfill for environments that do not support it,
  33106. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  33107. * since native bind is now performant enough in most browsers.
  33108. * But removing it would mean breaking code that was able to run in
  33109. * PhantomJS 1.x, so this must be kept for backward compatibility.
  33110. */
  33111. /* istanbul ignore next */
  33112. function polyfillBind (fn, ctx) {
  33113. function boundFn (a) {
  33114. var l = arguments.length;
  33115. return l
  33116. ? l > 1
  33117. ? fn.apply(ctx, arguments)
  33118. : fn.call(ctx, a)
  33119. : fn.call(ctx)
  33120. }
  33121. boundFn._length = fn.length;
  33122. return boundFn
  33123. }
  33124. function nativeBind (fn, ctx) {
  33125. return fn.bind(ctx)
  33126. }
  33127. var bind = Function.prototype.bind
  33128. ? nativeBind
  33129. : polyfillBind;
  33130. /**
  33131. * Convert an Array-like object to a real Array.
  33132. */
  33133. function toArray (list, start) {
  33134. start = start || 0;
  33135. var i = list.length - start;
  33136. var ret = new Array(i);
  33137. while (i--) {
  33138. ret[i] = list[i + start];
  33139. }
  33140. return ret
  33141. }
  33142. /**
  33143. * Mix properties into target object.
  33144. */
  33145. function extend (to, _from) {
  33146. for (var key in _from) {
  33147. to[key] = _from[key];
  33148. }
  33149. return to
  33150. }
  33151. /**
  33152. * Merge an Array of Objects into a single Object.
  33153. */
  33154. function toObject (arr) {
  33155. var res = {};
  33156. for (var i = 0; i < arr.length; i++) {
  33157. if (arr[i]) {
  33158. extend(res, arr[i]);
  33159. }
  33160. }
  33161. return res
  33162. }
  33163. /* eslint-disable no-unused-vars */
  33164. /**
  33165. * Perform no operation.
  33166. * Stubbing args to make Flow happy without leaving useless transpiled code
  33167. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  33168. */
  33169. function noop (a, b, c) {}
  33170. /**
  33171. * Always return false.
  33172. */
  33173. var no = function (a, b, c) { return false; };
  33174. /* eslint-enable no-unused-vars */
  33175. /**
  33176. * Return the same value.
  33177. */
  33178. var identity = function (_) { return _; };
  33179. /**
  33180. * Generate a string containing static keys from compiler modules.
  33181. */
  33182. function genStaticKeys (modules) {
  33183. return modules.reduce(function (keys, m) {
  33184. return keys.concat(m.staticKeys || [])
  33185. }, []).join(',')
  33186. }
  33187. /**
  33188. * Check if two values are loosely equal - that is,
  33189. * if they are plain objects, do they have the same shape?
  33190. */
  33191. function looseEqual (a, b) {
  33192. if (a === b) { return true }
  33193. var isObjectA = isObject(a);
  33194. var isObjectB = isObject(b);
  33195. if (isObjectA && isObjectB) {
  33196. try {
  33197. var isArrayA = Array.isArray(a);
  33198. var isArrayB = Array.isArray(b);
  33199. if (isArrayA && isArrayB) {
  33200. return a.length === b.length && a.every(function (e, i) {
  33201. return looseEqual(e, b[i])
  33202. })
  33203. } else if (a instanceof Date && b instanceof Date) {
  33204. return a.getTime() === b.getTime()
  33205. } else if (!isArrayA && !isArrayB) {
  33206. var keysA = Object.keys(a);
  33207. var keysB = Object.keys(b);
  33208. return keysA.length === keysB.length && keysA.every(function (key) {
  33209. return looseEqual(a[key], b[key])
  33210. })
  33211. } else {
  33212. /* istanbul ignore next */
  33213. return false
  33214. }
  33215. } catch (e) {
  33216. /* istanbul ignore next */
  33217. return false
  33218. }
  33219. } else if (!isObjectA && !isObjectB) {
  33220. return String(a) === String(b)
  33221. } else {
  33222. return false
  33223. }
  33224. }
  33225. /**
  33226. * Return the first index at which a loosely equal value can be
  33227. * found in the array (if value is a plain object, the array must
  33228. * contain an object of the same shape), or -1 if it is not present.
  33229. */
  33230. function looseIndexOf (arr, val) {
  33231. for (var i = 0; i < arr.length; i++) {
  33232. if (looseEqual(arr[i], val)) { return i }
  33233. }
  33234. return -1
  33235. }
  33236. /**
  33237. * Ensure a function is called only once.
  33238. */
  33239. function once (fn) {
  33240. var called = false;
  33241. return function () {
  33242. if (!called) {
  33243. called = true;
  33244. fn.apply(this, arguments);
  33245. }
  33246. }
  33247. }
  33248. var SSR_ATTR = 'data-server-rendered';
  33249. var ASSET_TYPES = [
  33250. 'component',
  33251. 'directive',
  33252. 'filter'
  33253. ];
  33254. var LIFECYCLE_HOOKS = [
  33255. 'beforeCreate',
  33256. 'created',
  33257. 'beforeMount',
  33258. 'mounted',
  33259. 'beforeUpdate',
  33260. 'updated',
  33261. 'beforeDestroy',
  33262. 'destroyed',
  33263. 'activated',
  33264. 'deactivated',
  33265. 'errorCaptured',
  33266. 'serverPrefetch'
  33267. ];
  33268. /* */
  33269. var config = ({
  33270. /**
  33271. * Option merge strategies (used in core/util/options)
  33272. */
  33273. // $flow-disable-line
  33274. optionMergeStrategies: Object.create(null),
  33275. /**
  33276. * Whether to suppress warnings.
  33277. */
  33278. silent: false,
  33279. /**
  33280. * Show production mode tip message on boot?
  33281. */
  33282. productionTip: "development" !== 'production',
  33283. /**
  33284. * Whether to enable devtools
  33285. */
  33286. devtools: "development" !== 'production',
  33287. /**
  33288. * Whether to record perf
  33289. */
  33290. performance: false,
  33291. /**
  33292. * Error handler for watcher errors
  33293. */
  33294. errorHandler: null,
  33295. /**
  33296. * Warn handler for watcher warns
  33297. */
  33298. warnHandler: null,
  33299. /**
  33300. * Ignore certain custom elements
  33301. */
  33302. ignoredElements: [],
  33303. /**
  33304. * Custom user key aliases for v-on
  33305. */
  33306. // $flow-disable-line
  33307. keyCodes: Object.create(null),
  33308. /**
  33309. * Check if a tag is reserved so that it cannot be registered as a
  33310. * component. This is platform-dependent and may be overwritten.
  33311. */
  33312. isReservedTag: no,
  33313. /**
  33314. * Check if an attribute is reserved so that it cannot be used as a component
  33315. * prop. This is platform-dependent and may be overwritten.
  33316. */
  33317. isReservedAttr: no,
  33318. /**
  33319. * Check if a tag is an unknown element.
  33320. * Platform-dependent.
  33321. */
  33322. isUnknownElement: no,
  33323. /**
  33324. * Get the namespace of an element
  33325. */
  33326. getTagNamespace: noop,
  33327. /**
  33328. * Parse the real tag name for the specific platform.
  33329. */
  33330. parsePlatformTagName: identity,
  33331. /**
  33332. * Check if an attribute must be bound using property, e.g. value
  33333. * Platform-dependent.
  33334. */
  33335. mustUseProp: no,
  33336. /**
  33337. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  33338. * This will significantly reduce performance if set to false.
  33339. */
  33340. async: true,
  33341. /**
  33342. * Exposed for legacy reasons
  33343. */
  33344. _lifecycleHooks: LIFECYCLE_HOOKS
  33345. });
  33346. /* */
  33347. /**
  33348. * unicode letters used for parsing html tags, component names and property paths.
  33349. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  33350. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  33351. */
  33352. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  33353. /**
  33354. * Check if a string starts with $ or _
  33355. */
  33356. function isReserved (str) {
  33357. var c = (str + '').charCodeAt(0);
  33358. return c === 0x24 || c === 0x5F
  33359. }
  33360. /**
  33361. * Define a property.
  33362. */
  33363. function def (obj, key, val, enumerable) {
  33364. Object.defineProperty(obj, key, {
  33365. value: val,
  33366. enumerable: !!enumerable,
  33367. writable: true,
  33368. configurable: true
  33369. });
  33370. }
  33371. /**
  33372. * Parse simple path.
  33373. */
  33374. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  33375. function parsePath (path) {
  33376. if (bailRE.test(path)) {
  33377. return
  33378. }
  33379. var segments = path.split('.');
  33380. return function (obj) {
  33381. for (var i = 0; i < segments.length; i++) {
  33382. if (!obj) { return }
  33383. obj = obj[segments[i]];
  33384. }
  33385. return obj
  33386. }
  33387. }
  33388. /* */
  33389. // can we use __proto__?
  33390. var hasProto = '__proto__' in {};
  33391. // Browser environment sniffing
  33392. var inBrowser = typeof window !== 'undefined';
  33393. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  33394. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  33395. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  33396. var isIE = UA && /msie|trident/.test(UA);
  33397. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  33398. var isEdge = UA && UA.indexOf('edge/') > 0;
  33399. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  33400. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  33401. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  33402. var isPhantomJS = UA && /phantomjs/.test(UA);
  33403. var isFF = UA && UA.match(/firefox\/(\d+)/);
  33404. // Firefox has a "watch" function on Object.prototype...
  33405. var nativeWatch = ({}).watch;
  33406. var supportsPassive = false;
  33407. if (inBrowser) {
  33408. try {
  33409. var opts = {};
  33410. Object.defineProperty(opts, 'passive', ({
  33411. get: function get () {
  33412. /* istanbul ignore next */
  33413. supportsPassive = true;
  33414. }
  33415. })); // https://github.com/facebook/flow/issues/285
  33416. window.addEventListener('test-passive', null, opts);
  33417. } catch (e) {}
  33418. }
  33419. // this needs to be lazy-evaled because vue may be required before
  33420. // vue-server-renderer can set VUE_ENV
  33421. var _isServer;
  33422. var isServerRendering = function () {
  33423. if (_isServer === undefined) {
  33424. /* istanbul ignore if */
  33425. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  33426. // detect presence of vue-server-renderer and avoid
  33427. // Webpack shimming the process
  33428. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  33429. } else {
  33430. _isServer = false;
  33431. }
  33432. }
  33433. return _isServer
  33434. };
  33435. // detect devtools
  33436. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  33437. /* istanbul ignore next */
  33438. function isNative (Ctor) {
  33439. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  33440. }
  33441. var hasSymbol =
  33442. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  33443. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  33444. var _Set;
  33445. /* istanbul ignore if */ // $flow-disable-line
  33446. if (typeof Set !== 'undefined' && isNative(Set)) {
  33447. // use native Set when available.
  33448. _Set = Set;
  33449. } else {
  33450. // a non-standard Set polyfill that only works with primitive keys.
  33451. _Set = /*@__PURE__*/(function () {
  33452. function Set () {
  33453. this.set = Object.create(null);
  33454. }
  33455. Set.prototype.has = function has (key) {
  33456. return this.set[key] === true
  33457. };
  33458. Set.prototype.add = function add (key) {
  33459. this.set[key] = true;
  33460. };
  33461. Set.prototype.clear = function clear () {
  33462. this.set = Object.create(null);
  33463. };
  33464. return Set;
  33465. }());
  33466. }
  33467. /* */
  33468. var warn = noop;
  33469. var tip = noop;
  33470. var generateComponentTrace = (noop); // work around flow check
  33471. var formatComponentName = (noop);
  33472. {
  33473. var hasConsole = typeof console !== 'undefined';
  33474. var classifyRE = /(?:^|[-_])(\w)/g;
  33475. var classify = function (str) { return str
  33476. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  33477. .replace(/[-_]/g, ''); };
  33478. warn = function (msg, vm) {
  33479. var trace = vm ? generateComponentTrace(vm) : '';
  33480. if (config.warnHandler) {
  33481. config.warnHandler.call(null, msg, vm, trace);
  33482. } else if (hasConsole && (!config.silent)) {
  33483. console.error(("[Vue warn]: " + msg + trace));
  33484. }
  33485. };
  33486. tip = function (msg, vm) {
  33487. if (hasConsole && (!config.silent)) {
  33488. console.warn("[Vue tip]: " + msg + (
  33489. vm ? generateComponentTrace(vm) : ''
  33490. ));
  33491. }
  33492. };
  33493. formatComponentName = function (vm, includeFile) {
  33494. if (vm.$root === vm) {
  33495. return '<Root>'
  33496. }
  33497. var options = typeof vm === 'function' && vm.cid != null
  33498. ? vm.options
  33499. : vm._isVue
  33500. ? vm.$options || vm.constructor.options
  33501. : vm;
  33502. var name = options.name || options._componentTag;
  33503. var file = options.__file;
  33504. if (!name && file) {
  33505. var match = file.match(/([^/\\]+)\.vue$/);
  33506. name = match && match[1];
  33507. }
  33508. return (
  33509. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  33510. (file && includeFile !== false ? (" at " + file) : '')
  33511. )
  33512. };
  33513. var repeat = function (str, n) {
  33514. var res = '';
  33515. while (n) {
  33516. if (n % 2 === 1) { res += str; }
  33517. if (n > 1) { str += str; }
  33518. n >>= 1;
  33519. }
  33520. return res
  33521. };
  33522. generateComponentTrace = function (vm) {
  33523. if (vm._isVue && vm.$parent) {
  33524. var tree = [];
  33525. var currentRecursiveSequence = 0;
  33526. while (vm) {
  33527. if (tree.length > 0) {
  33528. var last = tree[tree.length - 1];
  33529. if (last.constructor === vm.constructor) {
  33530. currentRecursiveSequence++;
  33531. vm = vm.$parent;
  33532. continue
  33533. } else if (currentRecursiveSequence > 0) {
  33534. tree[tree.length - 1] = [last, currentRecursiveSequence];
  33535. currentRecursiveSequence = 0;
  33536. }
  33537. }
  33538. tree.push(vm);
  33539. vm = vm.$parent;
  33540. }
  33541. return '\n\nfound in\n\n' + tree
  33542. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  33543. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  33544. : formatComponentName(vm))); })
  33545. .join('\n')
  33546. } else {
  33547. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  33548. }
  33549. };
  33550. }
  33551. /* */
  33552. var uid = 0;
  33553. /**
  33554. * A dep is an observable that can have multiple
  33555. * directives subscribing to it.
  33556. */
  33557. var Dep = function Dep () {
  33558. this.id = uid++;
  33559. this.subs = [];
  33560. };
  33561. Dep.prototype.addSub = function addSub (sub) {
  33562. this.subs.push(sub);
  33563. };
  33564. Dep.prototype.removeSub = function removeSub (sub) {
  33565. remove(this.subs, sub);
  33566. };
  33567. Dep.prototype.depend = function depend () {
  33568. if (Dep.target) {
  33569. Dep.target.addDep(this);
  33570. }
  33571. };
  33572. Dep.prototype.notify = function notify () {
  33573. // stabilize the subscriber list first
  33574. var subs = this.subs.slice();
  33575. if (!config.async) {
  33576. // subs aren't sorted in scheduler if not running async
  33577. // we need to sort them now to make sure they fire in correct
  33578. // order
  33579. subs.sort(function (a, b) { return a.id - b.id; });
  33580. }
  33581. for (var i = 0, l = subs.length; i < l; i++) {
  33582. subs[i].update();
  33583. }
  33584. };
  33585. // The current target watcher being evaluated.
  33586. // This is globally unique because only one watcher
  33587. // can be evaluated at a time.
  33588. Dep.target = null;
  33589. var targetStack = [];
  33590. function pushTarget (target) {
  33591. targetStack.push(target);
  33592. Dep.target = target;
  33593. }
  33594. function popTarget () {
  33595. targetStack.pop();
  33596. Dep.target = targetStack[targetStack.length - 1];
  33597. }
  33598. /* */
  33599. var VNode = function VNode (
  33600. tag,
  33601. data,
  33602. children,
  33603. text,
  33604. elm,
  33605. context,
  33606. componentOptions,
  33607. asyncFactory
  33608. ) {
  33609. this.tag = tag;
  33610. this.data = data;
  33611. this.children = children;
  33612. this.text = text;
  33613. this.elm = elm;
  33614. this.ns = undefined;
  33615. this.context = context;
  33616. this.fnContext = undefined;
  33617. this.fnOptions = undefined;
  33618. this.fnScopeId = undefined;
  33619. this.key = data && data.key;
  33620. this.componentOptions = componentOptions;
  33621. this.componentInstance = undefined;
  33622. this.parent = undefined;
  33623. this.raw = false;
  33624. this.isStatic = false;
  33625. this.isRootInsert = true;
  33626. this.isComment = false;
  33627. this.isCloned = false;
  33628. this.isOnce = false;
  33629. this.asyncFactory = asyncFactory;
  33630. this.asyncMeta = undefined;
  33631. this.isAsyncPlaceholder = false;
  33632. };
  33633. var prototypeAccessors = { child: { configurable: true } };
  33634. // DEPRECATED: alias for componentInstance for backwards compat.
  33635. /* istanbul ignore next */
  33636. prototypeAccessors.child.get = function () {
  33637. return this.componentInstance
  33638. };
  33639. Object.defineProperties( VNode.prototype, prototypeAccessors );
  33640. var createEmptyVNode = function (text) {
  33641. if ( text === void 0 ) text = '';
  33642. var node = new VNode();
  33643. node.text = text;
  33644. node.isComment = true;
  33645. return node
  33646. };
  33647. function createTextVNode (val) {
  33648. return new VNode(undefined, undefined, undefined, String(val))
  33649. }
  33650. // optimized shallow clone
  33651. // used for static nodes and slot nodes because they may be reused across
  33652. // multiple renders, cloning them avoids errors when DOM manipulations rely
  33653. // on their elm reference.
  33654. function cloneVNode (vnode) {
  33655. var cloned = new VNode(
  33656. vnode.tag,
  33657. vnode.data,
  33658. // #7975
  33659. // clone children array to avoid mutating original in case of cloning
  33660. // a child.
  33661. vnode.children && vnode.children.slice(),
  33662. vnode.text,
  33663. vnode.elm,
  33664. vnode.context,
  33665. vnode.componentOptions,
  33666. vnode.asyncFactory
  33667. );
  33668. cloned.ns = vnode.ns;
  33669. cloned.isStatic = vnode.isStatic;
  33670. cloned.key = vnode.key;
  33671. cloned.isComment = vnode.isComment;
  33672. cloned.fnContext = vnode.fnContext;
  33673. cloned.fnOptions = vnode.fnOptions;
  33674. cloned.fnScopeId = vnode.fnScopeId;
  33675. cloned.asyncMeta = vnode.asyncMeta;
  33676. cloned.isCloned = true;
  33677. return cloned
  33678. }
  33679. /*
  33680. * not type checking this file because flow doesn't play well with
  33681. * dynamically accessing methods on Array prototype
  33682. */
  33683. var arrayProto = Array.prototype;
  33684. var arrayMethods = Object.create(arrayProto);
  33685. var methodsToPatch = [
  33686. 'push',
  33687. 'pop',
  33688. 'shift',
  33689. 'unshift',
  33690. 'splice',
  33691. 'sort',
  33692. 'reverse'
  33693. ];
  33694. /**
  33695. * Intercept mutating methods and emit events
  33696. */
  33697. methodsToPatch.forEach(function (method) {
  33698. // cache original method
  33699. var original = arrayProto[method];
  33700. def(arrayMethods, method, function mutator () {
  33701. var args = [], len = arguments.length;
  33702. while ( len-- ) args[ len ] = arguments[ len ];
  33703. var result = original.apply(this, args);
  33704. var ob = this.__ob__;
  33705. var inserted;
  33706. switch (method) {
  33707. case 'push':
  33708. case 'unshift':
  33709. inserted = args;
  33710. break
  33711. case 'splice':
  33712. inserted = args.slice(2);
  33713. break
  33714. }
  33715. if (inserted) { ob.observeArray(inserted); }
  33716. // notify change
  33717. ob.dep.notify();
  33718. return result
  33719. });
  33720. });
  33721. /* */
  33722. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  33723. /**
  33724. * In some cases we may want to disable observation inside a component's
  33725. * update computation.
  33726. */
  33727. var shouldObserve = true;
  33728. function toggleObserving (value) {
  33729. shouldObserve = value;
  33730. }
  33731. /**
  33732. * Observer class that is attached to each observed
  33733. * object. Once attached, the observer converts the target
  33734. * object's property keys into getter/setters that
  33735. * collect dependencies and dispatch updates.
  33736. */
  33737. var Observer = function Observer (value) {
  33738. this.value = value;
  33739. this.dep = new Dep();
  33740. this.vmCount = 0;
  33741. def(value, '__ob__', this);
  33742. if (Array.isArray(value)) {
  33743. if (hasProto) {
  33744. protoAugment(value, arrayMethods);
  33745. } else {
  33746. copyAugment(value, arrayMethods, arrayKeys);
  33747. }
  33748. this.observeArray(value);
  33749. } else {
  33750. this.walk(value);
  33751. }
  33752. };
  33753. /**
  33754. * Walk through all properties and convert them into
  33755. * getter/setters. This method should only be called when
  33756. * value type is Object.
  33757. */
  33758. Observer.prototype.walk = function walk (obj) {
  33759. var keys = Object.keys(obj);
  33760. for (var i = 0; i < keys.length; i++) {
  33761. defineReactive$$1(obj, keys[i]);
  33762. }
  33763. };
  33764. /**
  33765. * Observe a list of Array items.
  33766. */
  33767. Observer.prototype.observeArray = function observeArray (items) {
  33768. for (var i = 0, l = items.length; i < l; i++) {
  33769. observe(items[i]);
  33770. }
  33771. };
  33772. // helpers
  33773. /**
  33774. * Augment a target Object or Array by intercepting
  33775. * the prototype chain using __proto__
  33776. */
  33777. function protoAugment (target, src) {
  33778. /* eslint-disable no-proto */
  33779. target.__proto__ = src;
  33780. /* eslint-enable no-proto */
  33781. }
  33782. /**
  33783. * Augment a target Object or Array by defining
  33784. * hidden properties.
  33785. */
  33786. /* istanbul ignore next */
  33787. function copyAugment (target, src, keys) {
  33788. for (var i = 0, l = keys.length; i < l; i++) {
  33789. var key = keys[i];
  33790. def(target, key, src[key]);
  33791. }
  33792. }
  33793. /**
  33794. * Attempt to create an observer instance for a value,
  33795. * returns the new observer if successfully observed,
  33796. * or the existing observer if the value already has one.
  33797. */
  33798. function observe (value, asRootData) {
  33799. if (!isObject(value) || value instanceof VNode) {
  33800. return
  33801. }
  33802. var ob;
  33803. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  33804. ob = value.__ob__;
  33805. } else if (
  33806. shouldObserve &&
  33807. !isServerRendering() &&
  33808. (Array.isArray(value) || isPlainObject(value)) &&
  33809. Object.isExtensible(value) &&
  33810. !value._isVue
  33811. ) {
  33812. ob = new Observer(value);
  33813. }
  33814. if (asRootData && ob) {
  33815. ob.vmCount++;
  33816. }
  33817. return ob
  33818. }
  33819. /**
  33820. * Define a reactive property on an Object.
  33821. */
  33822. function defineReactive$$1 (
  33823. obj,
  33824. key,
  33825. val,
  33826. customSetter,
  33827. shallow
  33828. ) {
  33829. var dep = new Dep();
  33830. var property = Object.getOwnPropertyDescriptor(obj, key);
  33831. if (property && property.configurable === false) {
  33832. return
  33833. }
  33834. // cater for pre-defined getter/setters
  33835. var getter = property && property.get;
  33836. var setter = property && property.set;
  33837. if ((!getter || setter) && arguments.length === 2) {
  33838. val = obj[key];
  33839. }
  33840. var childOb = !shallow && observe(val);
  33841. Object.defineProperty(obj, key, {
  33842. enumerable: true,
  33843. configurable: true,
  33844. get: function reactiveGetter () {
  33845. var value = getter ? getter.call(obj) : val;
  33846. if (Dep.target) {
  33847. dep.depend();
  33848. if (childOb) {
  33849. childOb.dep.depend();
  33850. if (Array.isArray(value)) {
  33851. dependArray(value);
  33852. }
  33853. }
  33854. }
  33855. return value
  33856. },
  33857. set: function reactiveSetter (newVal) {
  33858. var value = getter ? getter.call(obj) : val;
  33859. /* eslint-disable no-self-compare */
  33860. if (newVal === value || (newVal !== newVal && value !== value)) {
  33861. return
  33862. }
  33863. /* eslint-enable no-self-compare */
  33864. if (customSetter) {
  33865. customSetter();
  33866. }
  33867. // #7981: for accessor properties without setter
  33868. if (getter && !setter) { return }
  33869. if (setter) {
  33870. setter.call(obj, newVal);
  33871. } else {
  33872. val = newVal;
  33873. }
  33874. childOb = !shallow && observe(newVal);
  33875. dep.notify();
  33876. }
  33877. });
  33878. }
  33879. /**
  33880. * Set a property on an object. Adds the new property and
  33881. * triggers change notification if the property doesn't
  33882. * already exist.
  33883. */
  33884. function set (target, key, val) {
  33885. if (isUndef(target) || isPrimitive(target)
  33886. ) {
  33887. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  33888. }
  33889. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33890. target.length = Math.max(target.length, key);
  33891. target.splice(key, 1, val);
  33892. return val
  33893. }
  33894. if (key in target && !(key in Object.prototype)) {
  33895. target[key] = val;
  33896. return val
  33897. }
  33898. var ob = (target).__ob__;
  33899. if (target._isVue || (ob && ob.vmCount)) {
  33900. warn(
  33901. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  33902. 'at runtime - declare it upfront in the data option.'
  33903. );
  33904. return val
  33905. }
  33906. if (!ob) {
  33907. target[key] = val;
  33908. return val
  33909. }
  33910. defineReactive$$1(ob.value, key, val);
  33911. ob.dep.notify();
  33912. return val
  33913. }
  33914. /**
  33915. * Delete a property and trigger change if necessary.
  33916. */
  33917. function del (target, key) {
  33918. if (isUndef(target) || isPrimitive(target)
  33919. ) {
  33920. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  33921. }
  33922. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33923. target.splice(key, 1);
  33924. return
  33925. }
  33926. var ob = (target).__ob__;
  33927. if (target._isVue || (ob && ob.vmCount)) {
  33928. warn(
  33929. 'Avoid deleting properties on a Vue instance or its root $data ' +
  33930. '- just set it to null.'
  33931. );
  33932. return
  33933. }
  33934. if (!hasOwn(target, key)) {
  33935. return
  33936. }
  33937. delete target[key];
  33938. if (!ob) {
  33939. return
  33940. }
  33941. ob.dep.notify();
  33942. }
  33943. /**
  33944. * Collect dependencies on array elements when the array is touched, since
  33945. * we cannot intercept array element access like property getters.
  33946. */
  33947. function dependArray (value) {
  33948. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  33949. e = value[i];
  33950. e && e.__ob__ && e.__ob__.dep.depend();
  33951. if (Array.isArray(e)) {
  33952. dependArray(e);
  33953. }
  33954. }
  33955. }
  33956. /* */
  33957. /**
  33958. * Option overwriting strategies are functions that handle
  33959. * how to merge a parent option value and a child option
  33960. * value into the final value.
  33961. */
  33962. var strats = config.optionMergeStrategies;
  33963. /**
  33964. * Options with restrictions
  33965. */
  33966. {
  33967. strats.el = strats.propsData = function (parent, child, vm, key) {
  33968. if (!vm) {
  33969. warn(
  33970. "option \"" + key + "\" can only be used during instance " +
  33971. 'creation with the `new` keyword.'
  33972. );
  33973. }
  33974. return defaultStrat(parent, child)
  33975. };
  33976. }
  33977. /**
  33978. * Helper that recursively merges two data objects together.
  33979. */
  33980. function mergeData (to, from) {
  33981. if (!from) { return to }
  33982. var key, toVal, fromVal;
  33983. var keys = hasSymbol
  33984. ? Reflect.ownKeys(from)
  33985. : Object.keys(from);
  33986. for (var i = 0; i < keys.length; i++) {
  33987. key = keys[i];
  33988. // in case the object is already observed...
  33989. if (key === '__ob__') { continue }
  33990. toVal = to[key];
  33991. fromVal = from[key];
  33992. if (!hasOwn(to, key)) {
  33993. set(to, key, fromVal);
  33994. } else if (
  33995. toVal !== fromVal &&
  33996. isPlainObject(toVal) &&
  33997. isPlainObject(fromVal)
  33998. ) {
  33999. mergeData(toVal, fromVal);
  34000. }
  34001. }
  34002. return to
  34003. }
  34004. /**
  34005. * Data
  34006. */
  34007. function mergeDataOrFn (
  34008. parentVal,
  34009. childVal,
  34010. vm
  34011. ) {
  34012. if (!vm) {
  34013. // in a Vue.extend merge, both should be functions
  34014. if (!childVal) {
  34015. return parentVal
  34016. }
  34017. if (!parentVal) {
  34018. return childVal
  34019. }
  34020. // when parentVal & childVal are both present,
  34021. // we need to return a function that returns the
  34022. // merged result of both functions... no need to
  34023. // check if parentVal is a function here because
  34024. // it has to be a function to pass previous merges.
  34025. return function mergedDataFn () {
  34026. return mergeData(
  34027. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  34028. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  34029. )
  34030. }
  34031. } else {
  34032. return function mergedInstanceDataFn () {
  34033. // instance merge
  34034. var instanceData = typeof childVal === 'function'
  34035. ? childVal.call(vm, vm)
  34036. : childVal;
  34037. var defaultData = typeof parentVal === 'function'
  34038. ? parentVal.call(vm, vm)
  34039. : parentVal;
  34040. if (instanceData) {
  34041. return mergeData(instanceData, defaultData)
  34042. } else {
  34043. return defaultData
  34044. }
  34045. }
  34046. }
  34047. }
  34048. strats.data = function (
  34049. parentVal,
  34050. childVal,
  34051. vm
  34052. ) {
  34053. if (!vm) {
  34054. if (childVal && typeof childVal !== 'function') {
  34055. warn(
  34056. 'The "data" option should be a function ' +
  34057. 'that returns a per-instance value in component ' +
  34058. 'definitions.',
  34059. vm
  34060. );
  34061. return parentVal
  34062. }
  34063. return mergeDataOrFn(parentVal, childVal)
  34064. }
  34065. return mergeDataOrFn(parentVal, childVal, vm)
  34066. };
  34067. /**
  34068. * Hooks and props are merged as arrays.
  34069. */
  34070. function mergeHook (
  34071. parentVal,
  34072. childVal
  34073. ) {
  34074. var res = childVal
  34075. ? parentVal
  34076. ? parentVal.concat(childVal)
  34077. : Array.isArray(childVal)
  34078. ? childVal
  34079. : [childVal]
  34080. : parentVal;
  34081. return res
  34082. ? dedupeHooks(res)
  34083. : res
  34084. }
  34085. function dedupeHooks (hooks) {
  34086. var res = [];
  34087. for (var i = 0; i < hooks.length; i++) {
  34088. if (res.indexOf(hooks[i]) === -1) {
  34089. res.push(hooks[i]);
  34090. }
  34091. }
  34092. return res
  34093. }
  34094. LIFECYCLE_HOOKS.forEach(function (hook) {
  34095. strats[hook] = mergeHook;
  34096. });
  34097. /**
  34098. * Assets
  34099. *
  34100. * When a vm is present (instance creation), we need to do
  34101. * a three-way merge between constructor options, instance
  34102. * options and parent options.
  34103. */
  34104. function mergeAssets (
  34105. parentVal,
  34106. childVal,
  34107. vm,
  34108. key
  34109. ) {
  34110. var res = Object.create(parentVal || null);
  34111. if (childVal) {
  34112. assertObjectType(key, childVal, vm);
  34113. return extend(res, childVal)
  34114. } else {
  34115. return res
  34116. }
  34117. }
  34118. ASSET_TYPES.forEach(function (type) {
  34119. strats[type + 's'] = mergeAssets;
  34120. });
  34121. /**
  34122. * Watchers.
  34123. *
  34124. * Watchers hashes should not overwrite one
  34125. * another, so we merge them as arrays.
  34126. */
  34127. strats.watch = function (
  34128. parentVal,
  34129. childVal,
  34130. vm,
  34131. key
  34132. ) {
  34133. // work around Firefox's Object.prototype.watch...
  34134. if (parentVal === nativeWatch) { parentVal = undefined; }
  34135. if (childVal === nativeWatch) { childVal = undefined; }
  34136. /* istanbul ignore if */
  34137. if (!childVal) { return Object.create(parentVal || null) }
  34138. {
  34139. assertObjectType(key, childVal, vm);
  34140. }
  34141. if (!parentVal) { return childVal }
  34142. var ret = {};
  34143. extend(ret, parentVal);
  34144. for (var key$1 in childVal) {
  34145. var parent = ret[key$1];
  34146. var child = childVal[key$1];
  34147. if (parent && !Array.isArray(parent)) {
  34148. parent = [parent];
  34149. }
  34150. ret[key$1] = parent
  34151. ? parent.concat(child)
  34152. : Array.isArray(child) ? child : [child];
  34153. }
  34154. return ret
  34155. };
  34156. /**
  34157. * Other object hashes.
  34158. */
  34159. strats.props =
  34160. strats.methods =
  34161. strats.inject =
  34162. strats.computed = function (
  34163. parentVal,
  34164. childVal,
  34165. vm,
  34166. key
  34167. ) {
  34168. if (childVal && "development" !== 'production') {
  34169. assertObjectType(key, childVal, vm);
  34170. }
  34171. if (!parentVal) { return childVal }
  34172. var ret = Object.create(null);
  34173. extend(ret, parentVal);
  34174. if (childVal) { extend(ret, childVal); }
  34175. return ret
  34176. };
  34177. strats.provide = mergeDataOrFn;
  34178. /**
  34179. * Default strategy.
  34180. */
  34181. var defaultStrat = function (parentVal, childVal) {
  34182. return childVal === undefined
  34183. ? parentVal
  34184. : childVal
  34185. };
  34186. /**
  34187. * Validate component names
  34188. */
  34189. function checkComponents (options) {
  34190. for (var key in options.components) {
  34191. validateComponentName(key);
  34192. }
  34193. }
  34194. function validateComponentName (name) {
  34195. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  34196. warn(
  34197. 'Invalid component name: "' + name + '". Component names ' +
  34198. 'should conform to valid custom element name in html5 specification.'
  34199. );
  34200. }
  34201. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  34202. warn(
  34203. 'Do not use built-in or reserved HTML elements as component ' +
  34204. 'id: ' + name
  34205. );
  34206. }
  34207. }
  34208. /**
  34209. * Ensure all props option syntax are normalized into the
  34210. * Object-based format.
  34211. */
  34212. function normalizeProps (options, vm) {
  34213. var props = options.props;
  34214. if (!props) { return }
  34215. var res = {};
  34216. var i, val, name;
  34217. if (Array.isArray(props)) {
  34218. i = props.length;
  34219. while (i--) {
  34220. val = props[i];
  34221. if (typeof val === 'string') {
  34222. name = camelize(val);
  34223. res[name] = { type: null };
  34224. } else {
  34225. warn('props must be strings when using array syntax.');
  34226. }
  34227. }
  34228. } else if (isPlainObject(props)) {
  34229. for (var key in props) {
  34230. val = props[key];
  34231. name = camelize(key);
  34232. res[name] = isPlainObject(val)
  34233. ? val
  34234. : { type: val };
  34235. }
  34236. } else {
  34237. warn(
  34238. "Invalid value for option \"props\": expected an Array or an Object, " +
  34239. "but got " + (toRawType(props)) + ".",
  34240. vm
  34241. );
  34242. }
  34243. options.props = res;
  34244. }
  34245. /**
  34246. * Normalize all injections into Object-based format
  34247. */
  34248. function normalizeInject (options, vm) {
  34249. var inject = options.inject;
  34250. if (!inject) { return }
  34251. var normalized = options.inject = {};
  34252. if (Array.isArray(inject)) {
  34253. for (var i = 0; i < inject.length; i++) {
  34254. normalized[inject[i]] = { from: inject[i] };
  34255. }
  34256. } else if (isPlainObject(inject)) {
  34257. for (var key in inject) {
  34258. var val = inject[key];
  34259. normalized[key] = isPlainObject(val)
  34260. ? extend({ from: key }, val)
  34261. : { from: val };
  34262. }
  34263. } else {
  34264. warn(
  34265. "Invalid value for option \"inject\": expected an Array or an Object, " +
  34266. "but got " + (toRawType(inject)) + ".",
  34267. vm
  34268. );
  34269. }
  34270. }
  34271. /**
  34272. * Normalize raw function directives into object format.
  34273. */
  34274. function normalizeDirectives (options) {
  34275. var dirs = options.directives;
  34276. if (dirs) {
  34277. for (var key in dirs) {
  34278. var def$$1 = dirs[key];
  34279. if (typeof def$$1 === 'function') {
  34280. dirs[key] = { bind: def$$1, update: def$$1 };
  34281. }
  34282. }
  34283. }
  34284. }
  34285. function assertObjectType (name, value, vm) {
  34286. if (!isPlainObject(value)) {
  34287. warn(
  34288. "Invalid value for option \"" + name + "\": expected an Object, " +
  34289. "but got " + (toRawType(value)) + ".",
  34290. vm
  34291. );
  34292. }
  34293. }
  34294. /**
  34295. * Merge two option objects into a new one.
  34296. * Core utility used in both instantiation and inheritance.
  34297. */
  34298. function mergeOptions (
  34299. parent,
  34300. child,
  34301. vm
  34302. ) {
  34303. {
  34304. checkComponents(child);
  34305. }
  34306. if (typeof child === 'function') {
  34307. child = child.options;
  34308. }
  34309. normalizeProps(child, vm);
  34310. normalizeInject(child, vm);
  34311. normalizeDirectives(child);
  34312. // Apply extends and mixins on the child options,
  34313. // but only if it is a raw options object that isn't
  34314. // the result of another mergeOptions call.
  34315. // Only merged options has the _base property.
  34316. if (!child._base) {
  34317. if (child.extends) {
  34318. parent = mergeOptions(parent, child.extends, vm);
  34319. }
  34320. if (child.mixins) {
  34321. for (var i = 0, l = child.mixins.length; i < l; i++) {
  34322. parent = mergeOptions(parent, child.mixins[i], vm);
  34323. }
  34324. }
  34325. }
  34326. var options = {};
  34327. var key;
  34328. for (key in parent) {
  34329. mergeField(key);
  34330. }
  34331. for (key in child) {
  34332. if (!hasOwn(parent, key)) {
  34333. mergeField(key);
  34334. }
  34335. }
  34336. function mergeField (key) {
  34337. var strat = strats[key] || defaultStrat;
  34338. options[key] = strat(parent[key], child[key], vm, key);
  34339. }
  34340. return options
  34341. }
  34342. /**
  34343. * Resolve an asset.
  34344. * This function is used because child instances need access
  34345. * to assets defined in its ancestor chain.
  34346. */
  34347. function resolveAsset (
  34348. options,
  34349. type,
  34350. id,
  34351. warnMissing
  34352. ) {
  34353. /* istanbul ignore if */
  34354. if (typeof id !== 'string') {
  34355. return
  34356. }
  34357. var assets = options[type];
  34358. // check local registration variations first
  34359. if (hasOwn(assets, id)) { return assets[id] }
  34360. var camelizedId = camelize(id);
  34361. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  34362. var PascalCaseId = capitalize(camelizedId);
  34363. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  34364. // fallback to prototype chain
  34365. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  34366. if (warnMissing && !res) {
  34367. warn(
  34368. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  34369. options
  34370. );
  34371. }
  34372. return res
  34373. }
  34374. /* */
  34375. function validateProp (
  34376. key,
  34377. propOptions,
  34378. propsData,
  34379. vm
  34380. ) {
  34381. var prop = propOptions[key];
  34382. var absent = !hasOwn(propsData, key);
  34383. var value = propsData[key];
  34384. // boolean casting
  34385. var booleanIndex = getTypeIndex(Boolean, prop.type);
  34386. if (booleanIndex > -1) {
  34387. if (absent && !hasOwn(prop, 'default')) {
  34388. value = false;
  34389. } else if (value === '' || value === hyphenate(key)) {
  34390. // only cast empty string / same name to boolean if
  34391. // boolean has higher priority
  34392. var stringIndex = getTypeIndex(String, prop.type);
  34393. if (stringIndex < 0 || booleanIndex < stringIndex) {
  34394. value = true;
  34395. }
  34396. }
  34397. }
  34398. // check default value
  34399. if (value === undefined) {
  34400. value = getPropDefaultValue(vm, prop, key);
  34401. // since the default value is a fresh copy,
  34402. // make sure to observe it.
  34403. var prevShouldObserve = shouldObserve;
  34404. toggleObserving(true);
  34405. observe(value);
  34406. toggleObserving(prevShouldObserve);
  34407. }
  34408. {
  34409. assertProp(prop, key, value, vm, absent);
  34410. }
  34411. return value
  34412. }
  34413. /**
  34414. * Get the default value of a prop.
  34415. */
  34416. function getPropDefaultValue (vm, prop, key) {
  34417. // no default, return undefined
  34418. if (!hasOwn(prop, 'default')) {
  34419. return undefined
  34420. }
  34421. var def = prop.default;
  34422. // warn against non-factory defaults for Object & Array
  34423. if (isObject(def)) {
  34424. warn(
  34425. 'Invalid default value for prop "' + key + '": ' +
  34426. 'Props with type Object/Array must use a factory function ' +
  34427. 'to return the default value.',
  34428. vm
  34429. );
  34430. }
  34431. // the raw prop value was also undefined from previous render,
  34432. // return previous default value to avoid unnecessary watcher trigger
  34433. if (vm && vm.$options.propsData &&
  34434. vm.$options.propsData[key] === undefined &&
  34435. vm._props[key] !== undefined
  34436. ) {
  34437. return vm._props[key]
  34438. }
  34439. // call factory function for non-Function types
  34440. // a value is Function if its prototype is function even across different execution context
  34441. return typeof def === 'function' && getType(prop.type) !== 'Function'
  34442. ? def.call(vm)
  34443. : def
  34444. }
  34445. /**
  34446. * Assert whether a prop is valid.
  34447. */
  34448. function assertProp (
  34449. prop,
  34450. name,
  34451. value,
  34452. vm,
  34453. absent
  34454. ) {
  34455. if (prop.required && absent) {
  34456. warn(
  34457. 'Missing required prop: "' + name + '"',
  34458. vm
  34459. );
  34460. return
  34461. }
  34462. if (value == null && !prop.required) {
  34463. return
  34464. }
  34465. var type = prop.type;
  34466. var valid = !type || type === true;
  34467. var expectedTypes = [];
  34468. if (type) {
  34469. if (!Array.isArray(type)) {
  34470. type = [type];
  34471. }
  34472. for (var i = 0; i < type.length && !valid; i++) {
  34473. var assertedType = assertType(value, type[i]);
  34474. expectedTypes.push(assertedType.expectedType || '');
  34475. valid = assertedType.valid;
  34476. }
  34477. }
  34478. if (!valid) {
  34479. warn(
  34480. getInvalidTypeMessage(name, value, expectedTypes),
  34481. vm
  34482. );
  34483. return
  34484. }
  34485. var validator = prop.validator;
  34486. if (validator) {
  34487. if (!validator(value)) {
  34488. warn(
  34489. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  34490. vm
  34491. );
  34492. }
  34493. }
  34494. }
  34495. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  34496. function assertType (value, type) {
  34497. var valid;
  34498. var expectedType = getType(type);
  34499. if (simpleCheckRE.test(expectedType)) {
  34500. var t = typeof value;
  34501. valid = t === expectedType.toLowerCase();
  34502. // for primitive wrapper objects
  34503. if (!valid && t === 'object') {
  34504. valid = value instanceof type;
  34505. }
  34506. } else if (expectedType === 'Object') {
  34507. valid = isPlainObject(value);
  34508. } else if (expectedType === 'Array') {
  34509. valid = Array.isArray(value);
  34510. } else {
  34511. valid = value instanceof type;
  34512. }
  34513. return {
  34514. valid: valid,
  34515. expectedType: expectedType
  34516. }
  34517. }
  34518. /**
  34519. * Use function string name to check built-in types,
  34520. * because a simple equality check will fail when running
  34521. * across different vms / iframes.
  34522. */
  34523. function getType (fn) {
  34524. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  34525. return match ? match[1] : ''
  34526. }
  34527. function isSameType (a, b) {
  34528. return getType(a) === getType(b)
  34529. }
  34530. function getTypeIndex (type, expectedTypes) {
  34531. if (!Array.isArray(expectedTypes)) {
  34532. return isSameType(expectedTypes, type) ? 0 : -1
  34533. }
  34534. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  34535. if (isSameType(expectedTypes[i], type)) {
  34536. return i
  34537. }
  34538. }
  34539. return -1
  34540. }
  34541. function getInvalidTypeMessage (name, value, expectedTypes) {
  34542. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  34543. " Expected " + (expectedTypes.map(capitalize).join(', '));
  34544. var expectedType = expectedTypes[0];
  34545. var receivedType = toRawType(value);
  34546. var expectedValue = styleValue(value, expectedType);
  34547. var receivedValue = styleValue(value, receivedType);
  34548. // check if we need to specify expected value
  34549. if (expectedTypes.length === 1 &&
  34550. isExplicable(expectedType) &&
  34551. !isBoolean(expectedType, receivedType)) {
  34552. message += " with value " + expectedValue;
  34553. }
  34554. message += ", got " + receivedType + " ";
  34555. // check if we need to specify received value
  34556. if (isExplicable(receivedType)) {
  34557. message += "with value " + receivedValue + ".";
  34558. }
  34559. return message
  34560. }
  34561. function styleValue (value, type) {
  34562. if (type === 'String') {
  34563. return ("\"" + value + "\"")
  34564. } else if (type === 'Number') {
  34565. return ("" + (Number(value)))
  34566. } else {
  34567. return ("" + value)
  34568. }
  34569. }
  34570. function isExplicable (value) {
  34571. var explicitTypes = ['string', 'number', 'boolean'];
  34572. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  34573. }
  34574. function isBoolean () {
  34575. var args = [], len = arguments.length;
  34576. while ( len-- ) args[ len ] = arguments[ len ];
  34577. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  34578. }
  34579. /* */
  34580. function handleError (err, vm, info) {
  34581. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  34582. // See: https://github.com/vuejs/vuex/issues/1505
  34583. pushTarget();
  34584. try {
  34585. if (vm) {
  34586. var cur = vm;
  34587. while ((cur = cur.$parent)) {
  34588. var hooks = cur.$options.errorCaptured;
  34589. if (hooks) {
  34590. for (var i = 0; i < hooks.length; i++) {
  34591. try {
  34592. var capture = hooks[i].call(cur, err, vm, info) === false;
  34593. if (capture) { return }
  34594. } catch (e) {
  34595. globalHandleError(e, cur, 'errorCaptured hook');
  34596. }
  34597. }
  34598. }
  34599. }
  34600. }
  34601. globalHandleError(err, vm, info);
  34602. } finally {
  34603. popTarget();
  34604. }
  34605. }
  34606. function invokeWithErrorHandling (
  34607. handler,
  34608. context,
  34609. args,
  34610. vm,
  34611. info
  34612. ) {
  34613. var res;
  34614. try {
  34615. res = args ? handler.apply(context, args) : handler.call(context);
  34616. if (res && !res._isVue && isPromise(res) && !res._handled) {
  34617. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  34618. // issue #9511
  34619. // avoid catch triggering multiple times when nested calls
  34620. res._handled = true;
  34621. }
  34622. } catch (e) {
  34623. handleError(e, vm, info);
  34624. }
  34625. return res
  34626. }
  34627. function globalHandleError (err, vm, info) {
  34628. if (config.errorHandler) {
  34629. try {
  34630. return config.errorHandler.call(null, err, vm, info)
  34631. } catch (e) {
  34632. // if the user intentionally throws the original error in the handler,
  34633. // do not log it twice
  34634. if (e !== err) {
  34635. logError(e, null, 'config.errorHandler');
  34636. }
  34637. }
  34638. }
  34639. logError(err, vm, info);
  34640. }
  34641. function logError (err, vm, info) {
  34642. {
  34643. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  34644. }
  34645. /* istanbul ignore else */
  34646. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  34647. console.error(err);
  34648. } else {
  34649. throw err
  34650. }
  34651. }
  34652. /* */
  34653. var isUsingMicroTask = false;
  34654. var callbacks = [];
  34655. var pending = false;
  34656. function flushCallbacks () {
  34657. pending = false;
  34658. var copies = callbacks.slice(0);
  34659. callbacks.length = 0;
  34660. for (var i = 0; i < copies.length; i++) {
  34661. copies[i]();
  34662. }
  34663. }
  34664. // Here we have async deferring wrappers using microtasks.
  34665. // In 2.5 we used (macro) tasks (in combination with microtasks).
  34666. // However, it has subtle problems when state is changed right before repaint
  34667. // (e.g. #6813, out-in transitions).
  34668. // Also, using (macro) tasks in event handler would cause some weird behaviors
  34669. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  34670. // So we now use microtasks everywhere, again.
  34671. // A major drawback of this tradeoff is that there are some scenarios
  34672. // where microtasks have too high a priority and fire in between supposedly
  34673. // sequential events (e.g. #4521, #6690, which have workarounds)
  34674. // or even between bubbling of the same event (#6566).
  34675. var timerFunc;
  34676. // The nextTick behavior leverages the microtask queue, which can be accessed
  34677. // via either native Promise.then or MutationObserver.
  34678. // MutationObserver has wider support, however it is seriously bugged in
  34679. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  34680. // completely stops working after triggering a few times... so, if native
  34681. // Promise is available, we will use it:
  34682. /* istanbul ignore next, $flow-disable-line */
  34683. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  34684. var p = Promise.resolve();
  34685. timerFunc = function () {
  34686. p.then(flushCallbacks);
  34687. // In problematic UIWebViews, Promise.then doesn't completely break, but
  34688. // it can get stuck in a weird state where callbacks are pushed into the
  34689. // microtask queue but the queue isn't being flushed, until the browser
  34690. // needs to do some other work, e.g. handle a timer. Therefore we can
  34691. // "force" the microtask queue to be flushed by adding an empty timer.
  34692. if (isIOS) { setTimeout(noop); }
  34693. };
  34694. isUsingMicroTask = true;
  34695. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  34696. isNative(MutationObserver) ||
  34697. // PhantomJS and iOS 7.x
  34698. MutationObserver.toString() === '[object MutationObserverConstructor]'
  34699. )) {
  34700. // Use MutationObserver where native Promise is not available,
  34701. // e.g. PhantomJS, iOS7, Android 4.4
  34702. // (#6466 MutationObserver is unreliable in IE11)
  34703. var counter = 1;
  34704. var observer = new MutationObserver(flushCallbacks);
  34705. var textNode = document.createTextNode(String(counter));
  34706. observer.observe(textNode, {
  34707. characterData: true
  34708. });
  34709. timerFunc = function () {
  34710. counter = (counter + 1) % 2;
  34711. textNode.data = String(counter);
  34712. };
  34713. isUsingMicroTask = true;
  34714. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  34715. // Fallback to setImmediate.
  34716. // Technically it leverages the (macro) task queue,
  34717. // but it is still a better choice than setTimeout.
  34718. timerFunc = function () {
  34719. setImmediate(flushCallbacks);
  34720. };
  34721. } else {
  34722. // Fallback to setTimeout.
  34723. timerFunc = function () {
  34724. setTimeout(flushCallbacks, 0);
  34725. };
  34726. }
  34727. function nextTick (cb, ctx) {
  34728. var _resolve;
  34729. callbacks.push(function () {
  34730. if (cb) {
  34731. try {
  34732. cb.call(ctx);
  34733. } catch (e) {
  34734. handleError(e, ctx, 'nextTick');
  34735. }
  34736. } else if (_resolve) {
  34737. _resolve(ctx);
  34738. }
  34739. });
  34740. if (!pending) {
  34741. pending = true;
  34742. timerFunc();
  34743. }
  34744. // $flow-disable-line
  34745. if (!cb && typeof Promise !== 'undefined') {
  34746. return new Promise(function (resolve) {
  34747. _resolve = resolve;
  34748. })
  34749. }
  34750. }
  34751. /* */
  34752. var mark;
  34753. var measure;
  34754. {
  34755. var perf = inBrowser && window.performance;
  34756. /* istanbul ignore if */
  34757. if (
  34758. perf &&
  34759. perf.mark &&
  34760. perf.measure &&
  34761. perf.clearMarks &&
  34762. perf.clearMeasures
  34763. ) {
  34764. mark = function (tag) { return perf.mark(tag); };
  34765. measure = function (name, startTag, endTag) {
  34766. perf.measure(name, startTag, endTag);
  34767. perf.clearMarks(startTag);
  34768. perf.clearMarks(endTag);
  34769. // perf.clearMeasures(name)
  34770. };
  34771. }
  34772. }
  34773. /* not type checking this file because flow doesn't play well with Proxy */
  34774. var initProxy;
  34775. {
  34776. var allowedGlobals = makeMap(
  34777. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  34778. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  34779. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  34780. 'require' // for Webpack/Browserify
  34781. );
  34782. var warnNonPresent = function (target, key) {
  34783. warn(
  34784. "Property or method \"" + key + "\" is not defined on the instance but " +
  34785. 'referenced during render. Make sure that this property is reactive, ' +
  34786. 'either in the data option, or for class-based components, by ' +
  34787. 'initializing the property. ' +
  34788. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  34789. target
  34790. );
  34791. };
  34792. var warnReservedPrefix = function (target, key) {
  34793. warn(
  34794. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  34795. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  34796. 'prevent conflicts with Vue internals. ' +
  34797. 'See: https://vuejs.org/v2/api/#data',
  34798. target
  34799. );
  34800. };
  34801. var hasProxy =
  34802. typeof Proxy !== 'undefined' && isNative(Proxy);
  34803. if (hasProxy) {
  34804. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  34805. config.keyCodes = new Proxy(config.keyCodes, {
  34806. set: function set (target, key, value) {
  34807. if (isBuiltInModifier(key)) {
  34808. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  34809. return false
  34810. } else {
  34811. target[key] = value;
  34812. return true
  34813. }
  34814. }
  34815. });
  34816. }
  34817. var hasHandler = {
  34818. has: function has (target, key) {
  34819. var has = key in target;
  34820. var isAllowed = allowedGlobals(key) ||
  34821. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  34822. if (!has && !isAllowed) {
  34823. if (key in target.$data) { warnReservedPrefix(target, key); }
  34824. else { warnNonPresent(target, key); }
  34825. }
  34826. return has || !isAllowed
  34827. }
  34828. };
  34829. var getHandler = {
  34830. get: function get (target, key) {
  34831. if (typeof key === 'string' && !(key in target)) {
  34832. if (key in target.$data) { warnReservedPrefix(target, key); }
  34833. else { warnNonPresent(target, key); }
  34834. }
  34835. return target[key]
  34836. }
  34837. };
  34838. initProxy = function initProxy (vm) {
  34839. if (hasProxy) {
  34840. // determine which proxy handler to use
  34841. var options = vm.$options;
  34842. var handlers = options.render && options.render._withStripped
  34843. ? getHandler
  34844. : hasHandler;
  34845. vm._renderProxy = new Proxy(vm, handlers);
  34846. } else {
  34847. vm._renderProxy = vm;
  34848. }
  34849. };
  34850. }
  34851. /* */
  34852. var seenObjects = new _Set();
  34853. /**
  34854. * Recursively traverse an object to evoke all converted
  34855. * getters, so that every nested property inside the object
  34856. * is collected as a "deep" dependency.
  34857. */
  34858. function traverse (val) {
  34859. _traverse(val, seenObjects);
  34860. seenObjects.clear();
  34861. }
  34862. function _traverse (val, seen) {
  34863. var i, keys;
  34864. var isA = Array.isArray(val);
  34865. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  34866. return
  34867. }
  34868. if (val.__ob__) {
  34869. var depId = val.__ob__.dep.id;
  34870. if (seen.has(depId)) {
  34871. return
  34872. }
  34873. seen.add(depId);
  34874. }
  34875. if (isA) {
  34876. i = val.length;
  34877. while (i--) { _traverse(val[i], seen); }
  34878. } else {
  34879. keys = Object.keys(val);
  34880. i = keys.length;
  34881. while (i--) { _traverse(val[keys[i]], seen); }
  34882. }
  34883. }
  34884. /* */
  34885. var normalizeEvent = cached(function (name) {
  34886. var passive = name.charAt(0) === '&';
  34887. name = passive ? name.slice(1) : name;
  34888. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  34889. name = once$$1 ? name.slice(1) : name;
  34890. var capture = name.charAt(0) === '!';
  34891. name = capture ? name.slice(1) : name;
  34892. return {
  34893. name: name,
  34894. once: once$$1,
  34895. capture: capture,
  34896. passive: passive
  34897. }
  34898. });
  34899. function createFnInvoker (fns, vm) {
  34900. function invoker () {
  34901. var arguments$1 = arguments;
  34902. var fns = invoker.fns;
  34903. if (Array.isArray(fns)) {
  34904. var cloned = fns.slice();
  34905. for (var i = 0; i < cloned.length; i++) {
  34906. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  34907. }
  34908. } else {
  34909. // return handler return value for single handlers
  34910. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  34911. }
  34912. }
  34913. invoker.fns = fns;
  34914. return invoker
  34915. }
  34916. function updateListeners (
  34917. on,
  34918. oldOn,
  34919. add,
  34920. remove$$1,
  34921. createOnceHandler,
  34922. vm
  34923. ) {
  34924. var name, def$$1, cur, old, event;
  34925. for (name in on) {
  34926. def$$1 = cur = on[name];
  34927. old = oldOn[name];
  34928. event = normalizeEvent(name);
  34929. if (isUndef(cur)) {
  34930. warn(
  34931. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  34932. vm
  34933. );
  34934. } else if (isUndef(old)) {
  34935. if (isUndef(cur.fns)) {
  34936. cur = on[name] = createFnInvoker(cur, vm);
  34937. }
  34938. if (isTrue(event.once)) {
  34939. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  34940. }
  34941. add(event.name, cur, event.capture, event.passive, event.params);
  34942. } else if (cur !== old) {
  34943. old.fns = cur;
  34944. on[name] = old;
  34945. }
  34946. }
  34947. for (name in oldOn) {
  34948. if (isUndef(on[name])) {
  34949. event = normalizeEvent(name);
  34950. remove$$1(event.name, oldOn[name], event.capture);
  34951. }
  34952. }
  34953. }
  34954. /* */
  34955. function mergeVNodeHook (def, hookKey, hook) {
  34956. if (def instanceof VNode) {
  34957. def = def.data.hook || (def.data.hook = {});
  34958. }
  34959. var invoker;
  34960. var oldHook = def[hookKey];
  34961. function wrappedHook () {
  34962. hook.apply(this, arguments);
  34963. // important: remove merged hook to ensure it's called only once
  34964. // and prevent memory leak
  34965. remove(invoker.fns, wrappedHook);
  34966. }
  34967. if (isUndef(oldHook)) {
  34968. // no existing hook
  34969. invoker = createFnInvoker([wrappedHook]);
  34970. } else {
  34971. /* istanbul ignore if */
  34972. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  34973. // already a merged invoker
  34974. invoker = oldHook;
  34975. invoker.fns.push(wrappedHook);
  34976. } else {
  34977. // existing plain hook
  34978. invoker = createFnInvoker([oldHook, wrappedHook]);
  34979. }
  34980. }
  34981. invoker.merged = true;
  34982. def[hookKey] = invoker;
  34983. }
  34984. /* */
  34985. function extractPropsFromVNodeData (
  34986. data,
  34987. Ctor,
  34988. tag
  34989. ) {
  34990. // we are only extracting raw values here.
  34991. // validation and default values are handled in the child
  34992. // component itself.
  34993. var propOptions = Ctor.options.props;
  34994. if (isUndef(propOptions)) {
  34995. return
  34996. }
  34997. var res = {};
  34998. var attrs = data.attrs;
  34999. var props = data.props;
  35000. if (isDef(attrs) || isDef(props)) {
  35001. for (var key in propOptions) {
  35002. var altKey = hyphenate(key);
  35003. {
  35004. var keyInLowerCase = key.toLowerCase();
  35005. if (
  35006. key !== keyInLowerCase &&
  35007. attrs && hasOwn(attrs, keyInLowerCase)
  35008. ) {
  35009. tip(
  35010. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  35011. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  35012. " \"" + key + "\". " +
  35013. "Note that HTML attributes are case-insensitive and camelCased " +
  35014. "props need to use their kebab-case equivalents when using in-DOM " +
  35015. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  35016. );
  35017. }
  35018. }
  35019. checkProp(res, props, key, altKey, true) ||
  35020. checkProp(res, attrs, key, altKey, false);
  35021. }
  35022. }
  35023. return res
  35024. }
  35025. function checkProp (
  35026. res,
  35027. hash,
  35028. key,
  35029. altKey,
  35030. preserve
  35031. ) {
  35032. if (isDef(hash)) {
  35033. if (hasOwn(hash, key)) {
  35034. res[key] = hash[key];
  35035. if (!preserve) {
  35036. delete hash[key];
  35037. }
  35038. return true
  35039. } else if (hasOwn(hash, altKey)) {
  35040. res[key] = hash[altKey];
  35041. if (!preserve) {
  35042. delete hash[altKey];
  35043. }
  35044. return true
  35045. }
  35046. }
  35047. return false
  35048. }
  35049. /* */
  35050. // The template compiler attempts to minimize the need for normalization by
  35051. // statically analyzing the template at compile time.
  35052. //
  35053. // For plain HTML markup, normalization can be completely skipped because the
  35054. // generated render function is guaranteed to return Array<VNode>. There are
  35055. // two cases where extra normalization is needed:
  35056. // 1. When the children contains components - because a functional component
  35057. // may return an Array instead of a single root. In this case, just a simple
  35058. // normalization is needed - if any child is an Array, we flatten the whole
  35059. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  35060. // because functional components already normalize their own children.
  35061. function simpleNormalizeChildren (children) {
  35062. for (var i = 0; i < children.length; i++) {
  35063. if (Array.isArray(children[i])) {
  35064. return Array.prototype.concat.apply([], children)
  35065. }
  35066. }
  35067. return children
  35068. }
  35069. // 2. When the children contains constructs that always generated nested Arrays,
  35070. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  35071. // with hand-written render functions / JSX. In such cases a full normalization
  35072. // is needed to cater to all possible types of children values.
  35073. function normalizeChildren (children) {
  35074. return isPrimitive(children)
  35075. ? [createTextVNode(children)]
  35076. : Array.isArray(children)
  35077. ? normalizeArrayChildren(children)
  35078. : undefined
  35079. }
  35080. function isTextNode (node) {
  35081. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  35082. }
  35083. function normalizeArrayChildren (children, nestedIndex) {
  35084. var res = [];
  35085. var i, c, lastIndex, last;
  35086. for (i = 0; i < children.length; i++) {
  35087. c = children[i];
  35088. if (isUndef(c) || typeof c === 'boolean') { continue }
  35089. lastIndex = res.length - 1;
  35090. last = res[lastIndex];
  35091. // nested
  35092. if (Array.isArray(c)) {
  35093. if (c.length > 0) {
  35094. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  35095. // merge adjacent text nodes
  35096. if (isTextNode(c[0]) && isTextNode(last)) {
  35097. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  35098. c.shift();
  35099. }
  35100. res.push.apply(res, c);
  35101. }
  35102. } else if (isPrimitive(c)) {
  35103. if (isTextNode(last)) {
  35104. // merge adjacent text nodes
  35105. // this is necessary for SSR hydration because text nodes are
  35106. // essentially merged when rendered to HTML strings
  35107. res[lastIndex] = createTextVNode(last.text + c);
  35108. } else if (c !== '') {
  35109. // convert primitive to vnode
  35110. res.push(createTextVNode(c));
  35111. }
  35112. } else {
  35113. if (isTextNode(c) && isTextNode(last)) {
  35114. // merge adjacent text nodes
  35115. res[lastIndex] = createTextVNode(last.text + c.text);
  35116. } else {
  35117. // default key for nested array children (likely generated by v-for)
  35118. if (isTrue(children._isVList) &&
  35119. isDef(c.tag) &&
  35120. isUndef(c.key) &&
  35121. isDef(nestedIndex)) {
  35122. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  35123. }
  35124. res.push(c);
  35125. }
  35126. }
  35127. }
  35128. return res
  35129. }
  35130. /* */
  35131. function initProvide (vm) {
  35132. var provide = vm.$options.provide;
  35133. if (provide) {
  35134. vm._provided = typeof provide === 'function'
  35135. ? provide.call(vm)
  35136. : provide;
  35137. }
  35138. }
  35139. function initInjections (vm) {
  35140. var result = resolveInject(vm.$options.inject, vm);
  35141. if (result) {
  35142. toggleObserving(false);
  35143. Object.keys(result).forEach(function (key) {
  35144. /* istanbul ignore else */
  35145. {
  35146. defineReactive$$1(vm, key, result[key], function () {
  35147. warn(
  35148. "Avoid mutating an injected value directly since the changes will be " +
  35149. "overwritten whenever the provided component re-renders. " +
  35150. "injection being mutated: \"" + key + "\"",
  35151. vm
  35152. );
  35153. });
  35154. }
  35155. });
  35156. toggleObserving(true);
  35157. }
  35158. }
  35159. function resolveInject (inject, vm) {
  35160. if (inject) {
  35161. // inject is :any because flow is not smart enough to figure out cached
  35162. var result = Object.create(null);
  35163. var keys = hasSymbol
  35164. ? Reflect.ownKeys(inject)
  35165. : Object.keys(inject);
  35166. for (var i = 0; i < keys.length; i++) {
  35167. var key = keys[i];
  35168. // #6574 in case the inject object is observed...
  35169. if (key === '__ob__') { continue }
  35170. var provideKey = inject[key].from;
  35171. var source = vm;
  35172. while (source) {
  35173. if (source._provided && hasOwn(source._provided, provideKey)) {
  35174. result[key] = source._provided[provideKey];
  35175. break
  35176. }
  35177. source = source.$parent;
  35178. }
  35179. if (!source) {
  35180. if ('default' in inject[key]) {
  35181. var provideDefault = inject[key].default;
  35182. result[key] = typeof provideDefault === 'function'
  35183. ? provideDefault.call(vm)
  35184. : provideDefault;
  35185. } else {
  35186. warn(("Injection \"" + key + "\" not found"), vm);
  35187. }
  35188. }
  35189. }
  35190. return result
  35191. }
  35192. }
  35193. /* */
  35194. /**
  35195. * Runtime helper for resolving raw children VNodes into a slot object.
  35196. */
  35197. function resolveSlots (
  35198. children,
  35199. context
  35200. ) {
  35201. if (!children || !children.length) {
  35202. return {}
  35203. }
  35204. var slots = {};
  35205. for (var i = 0, l = children.length; i < l; i++) {
  35206. var child = children[i];
  35207. var data = child.data;
  35208. // remove slot attribute if the node is resolved as a Vue slot node
  35209. if (data && data.attrs && data.attrs.slot) {
  35210. delete data.attrs.slot;
  35211. }
  35212. // named slots should only be respected if the vnode was rendered in the
  35213. // same context.
  35214. if ((child.context === context || child.fnContext === context) &&
  35215. data && data.slot != null
  35216. ) {
  35217. var name = data.slot;
  35218. var slot = (slots[name] || (slots[name] = []));
  35219. if (child.tag === 'template') {
  35220. slot.push.apply(slot, child.children || []);
  35221. } else {
  35222. slot.push(child);
  35223. }
  35224. } else {
  35225. (slots.default || (slots.default = [])).push(child);
  35226. }
  35227. }
  35228. // ignore slots that contains only whitespace
  35229. for (var name$1 in slots) {
  35230. if (slots[name$1].every(isWhitespace)) {
  35231. delete slots[name$1];
  35232. }
  35233. }
  35234. return slots
  35235. }
  35236. function isWhitespace (node) {
  35237. return (node.isComment && !node.asyncFactory) || node.text === ' '
  35238. }
  35239. /* */
  35240. function normalizeScopedSlots (
  35241. slots,
  35242. normalSlots,
  35243. prevSlots
  35244. ) {
  35245. var res;
  35246. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  35247. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  35248. var key = slots && slots.$key;
  35249. if (!slots) {
  35250. res = {};
  35251. } else if (slots._normalized) {
  35252. // fast path 1: child component re-render only, parent did not change
  35253. return slots._normalized
  35254. } else if (
  35255. isStable &&
  35256. prevSlots &&
  35257. prevSlots !== emptyObject &&
  35258. key === prevSlots.$key &&
  35259. !hasNormalSlots &&
  35260. !prevSlots.$hasNormal
  35261. ) {
  35262. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  35263. // only need to normalize once
  35264. return prevSlots
  35265. } else {
  35266. res = {};
  35267. for (var key$1 in slots) {
  35268. if (slots[key$1] && key$1[0] !== '$') {
  35269. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  35270. }
  35271. }
  35272. }
  35273. // expose normal slots on scopedSlots
  35274. for (var key$2 in normalSlots) {
  35275. if (!(key$2 in res)) {
  35276. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  35277. }
  35278. }
  35279. // avoriaz seems to mock a non-extensible $scopedSlots object
  35280. // and when that is passed down this would cause an error
  35281. if (slots && Object.isExtensible(slots)) {
  35282. (slots)._normalized = res;
  35283. }
  35284. def(res, '$stable', isStable);
  35285. def(res, '$key', key);
  35286. def(res, '$hasNormal', hasNormalSlots);
  35287. return res
  35288. }
  35289. function normalizeScopedSlot(normalSlots, key, fn) {
  35290. var normalized = function () {
  35291. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  35292. res = res && typeof res === 'object' && !Array.isArray(res)
  35293. ? [res] // single vnode
  35294. : normalizeChildren(res);
  35295. return res && (
  35296. res.length === 0 ||
  35297. (res.length === 1 && res[0].isComment) // #9658
  35298. ) ? undefined
  35299. : res
  35300. };
  35301. // this is a slot using the new v-slot syntax without scope. although it is
  35302. // compiled as a scoped slot, render fn users would expect it to be present
  35303. // on this.$slots because the usage is semantically a normal slot.
  35304. if (fn.proxy) {
  35305. Object.defineProperty(normalSlots, key, {
  35306. get: normalized,
  35307. enumerable: true,
  35308. configurable: true
  35309. });
  35310. }
  35311. return normalized
  35312. }
  35313. function proxyNormalSlot(slots, key) {
  35314. return function () { return slots[key]; }
  35315. }
  35316. /* */
  35317. /**
  35318. * Runtime helper for rendering v-for lists.
  35319. */
  35320. function renderList (
  35321. val,
  35322. render
  35323. ) {
  35324. var ret, i, l, keys, key;
  35325. if (Array.isArray(val) || typeof val === 'string') {
  35326. ret = new Array(val.length);
  35327. for (i = 0, l = val.length; i < l; i++) {
  35328. ret[i] = render(val[i], i);
  35329. }
  35330. } else if (typeof val === 'number') {
  35331. ret = new Array(val);
  35332. for (i = 0; i < val; i++) {
  35333. ret[i] = render(i + 1, i);
  35334. }
  35335. } else if (isObject(val)) {
  35336. if (hasSymbol && val[Symbol.iterator]) {
  35337. ret = [];
  35338. var iterator = val[Symbol.iterator]();
  35339. var result = iterator.next();
  35340. while (!result.done) {
  35341. ret.push(render(result.value, ret.length));
  35342. result = iterator.next();
  35343. }
  35344. } else {
  35345. keys = Object.keys(val);
  35346. ret = new Array(keys.length);
  35347. for (i = 0, l = keys.length; i < l; i++) {
  35348. key = keys[i];
  35349. ret[i] = render(val[key], key, i);
  35350. }
  35351. }
  35352. }
  35353. if (!isDef(ret)) {
  35354. ret = [];
  35355. }
  35356. (ret)._isVList = true;
  35357. return ret
  35358. }
  35359. /* */
  35360. /**
  35361. * Runtime helper for rendering <slot>
  35362. */
  35363. function renderSlot (
  35364. name,
  35365. fallback,
  35366. props,
  35367. bindObject
  35368. ) {
  35369. var scopedSlotFn = this.$scopedSlots[name];
  35370. var nodes;
  35371. if (scopedSlotFn) { // scoped slot
  35372. props = props || {};
  35373. if (bindObject) {
  35374. if (!isObject(bindObject)) {
  35375. warn(
  35376. 'slot v-bind without argument expects an Object',
  35377. this
  35378. );
  35379. }
  35380. props = extend(extend({}, bindObject), props);
  35381. }
  35382. nodes = scopedSlotFn(props) || fallback;
  35383. } else {
  35384. nodes = this.$slots[name] || fallback;
  35385. }
  35386. var target = props && props.slot;
  35387. if (target) {
  35388. return this.$createElement('template', { slot: target }, nodes)
  35389. } else {
  35390. return nodes
  35391. }
  35392. }
  35393. /* */
  35394. /**
  35395. * Runtime helper for resolving filters
  35396. */
  35397. function resolveFilter (id) {
  35398. return resolveAsset(this.$options, 'filters', id, true) || identity
  35399. }
  35400. /* */
  35401. function isKeyNotMatch (expect, actual) {
  35402. if (Array.isArray(expect)) {
  35403. return expect.indexOf(actual) === -1
  35404. } else {
  35405. return expect !== actual
  35406. }
  35407. }
  35408. /**
  35409. * Runtime helper for checking keyCodes from config.
  35410. * exposed as Vue.prototype._k
  35411. * passing in eventKeyName as last argument separately for backwards compat
  35412. */
  35413. function checkKeyCodes (
  35414. eventKeyCode,
  35415. key,
  35416. builtInKeyCode,
  35417. eventKeyName,
  35418. builtInKeyName
  35419. ) {
  35420. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  35421. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  35422. return isKeyNotMatch(builtInKeyName, eventKeyName)
  35423. } else if (mappedKeyCode) {
  35424. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  35425. } else if (eventKeyName) {
  35426. return hyphenate(eventKeyName) !== key
  35427. }
  35428. }
  35429. /* */
  35430. /**
  35431. * Runtime helper for merging v-bind="object" into a VNode's data.
  35432. */
  35433. function bindObjectProps (
  35434. data,
  35435. tag,
  35436. value,
  35437. asProp,
  35438. isSync
  35439. ) {
  35440. if (value) {
  35441. if (!isObject(value)) {
  35442. warn(
  35443. 'v-bind without argument expects an Object or Array value',
  35444. this
  35445. );
  35446. } else {
  35447. if (Array.isArray(value)) {
  35448. value = toObject(value);
  35449. }
  35450. var hash;
  35451. var loop = function ( key ) {
  35452. if (
  35453. key === 'class' ||
  35454. key === 'style' ||
  35455. isReservedAttribute(key)
  35456. ) {
  35457. hash = data;
  35458. } else {
  35459. var type = data.attrs && data.attrs.type;
  35460. hash = asProp || config.mustUseProp(tag, type, key)
  35461. ? data.domProps || (data.domProps = {})
  35462. : data.attrs || (data.attrs = {});
  35463. }
  35464. var camelizedKey = camelize(key);
  35465. var hyphenatedKey = hyphenate(key);
  35466. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  35467. hash[key] = value[key];
  35468. if (isSync) {
  35469. var on = data.on || (data.on = {});
  35470. on[("update:" + key)] = function ($event) {
  35471. value[key] = $event;
  35472. };
  35473. }
  35474. }
  35475. };
  35476. for (var key in value) loop( key );
  35477. }
  35478. }
  35479. return data
  35480. }
  35481. /* */
  35482. /**
  35483. * Runtime helper for rendering static trees.
  35484. */
  35485. function renderStatic (
  35486. index,
  35487. isInFor
  35488. ) {
  35489. var cached = this._staticTrees || (this._staticTrees = []);
  35490. var tree = cached[index];
  35491. // if has already-rendered static tree and not inside v-for,
  35492. // we can reuse the same tree.
  35493. if (tree && !isInFor) {
  35494. return tree
  35495. }
  35496. // otherwise, render a fresh tree.
  35497. tree = cached[index] = this.$options.staticRenderFns[index].call(
  35498. this._renderProxy,
  35499. null,
  35500. this // for render fns generated for functional component templates
  35501. );
  35502. markStatic(tree, ("__static__" + index), false);
  35503. return tree
  35504. }
  35505. /**
  35506. * Runtime helper for v-once.
  35507. * Effectively it means marking the node as static with a unique key.
  35508. */
  35509. function markOnce (
  35510. tree,
  35511. index,
  35512. key
  35513. ) {
  35514. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  35515. return tree
  35516. }
  35517. function markStatic (
  35518. tree,
  35519. key,
  35520. isOnce
  35521. ) {
  35522. if (Array.isArray(tree)) {
  35523. for (var i = 0; i < tree.length; i++) {
  35524. if (tree[i] && typeof tree[i] !== 'string') {
  35525. markStaticNode(tree[i], (key + "_" + i), isOnce);
  35526. }
  35527. }
  35528. } else {
  35529. markStaticNode(tree, key, isOnce);
  35530. }
  35531. }
  35532. function markStaticNode (node, key, isOnce) {
  35533. node.isStatic = true;
  35534. node.key = key;
  35535. node.isOnce = isOnce;
  35536. }
  35537. /* */
  35538. function bindObjectListeners (data, value) {
  35539. if (value) {
  35540. if (!isPlainObject(value)) {
  35541. warn(
  35542. 'v-on without argument expects an Object value',
  35543. this
  35544. );
  35545. } else {
  35546. var on = data.on = data.on ? extend({}, data.on) : {};
  35547. for (var key in value) {
  35548. var existing = on[key];
  35549. var ours = value[key];
  35550. on[key] = existing ? [].concat(existing, ours) : ours;
  35551. }
  35552. }
  35553. }
  35554. return data
  35555. }
  35556. /* */
  35557. function resolveScopedSlots (
  35558. fns, // see flow/vnode
  35559. res,
  35560. // the following are added in 2.6
  35561. hasDynamicKeys,
  35562. contentHashKey
  35563. ) {
  35564. res = res || { $stable: !hasDynamicKeys };
  35565. for (var i = 0; i < fns.length; i++) {
  35566. var slot = fns[i];
  35567. if (Array.isArray(slot)) {
  35568. resolveScopedSlots(slot, res, hasDynamicKeys);
  35569. } else if (slot) {
  35570. // marker for reverse proxying v-slot without scope on this.$slots
  35571. if (slot.proxy) {
  35572. slot.fn.proxy = true;
  35573. }
  35574. res[slot.key] = slot.fn;
  35575. }
  35576. }
  35577. if (contentHashKey) {
  35578. (res).$key = contentHashKey;
  35579. }
  35580. return res
  35581. }
  35582. /* */
  35583. function bindDynamicKeys (baseObj, values) {
  35584. for (var i = 0; i < values.length; i += 2) {
  35585. var key = values[i];
  35586. if (typeof key === 'string' && key) {
  35587. baseObj[values[i]] = values[i + 1];
  35588. } else if (key !== '' && key !== null) {
  35589. // null is a special value for explicitly removing a binding
  35590. warn(
  35591. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  35592. this
  35593. );
  35594. }
  35595. }
  35596. return baseObj
  35597. }
  35598. // helper to dynamically append modifier runtime markers to event names.
  35599. // ensure only append when value is already string, otherwise it will be cast
  35600. // to string and cause the type check to miss.
  35601. function prependModifier (value, symbol) {
  35602. return typeof value === 'string' ? symbol + value : value
  35603. }
  35604. /* */
  35605. function installRenderHelpers (target) {
  35606. target._o = markOnce;
  35607. target._n = toNumber;
  35608. target._s = toString;
  35609. target._l = renderList;
  35610. target._t = renderSlot;
  35611. target._q = looseEqual;
  35612. target._i = looseIndexOf;
  35613. target._m = renderStatic;
  35614. target._f = resolveFilter;
  35615. target._k = checkKeyCodes;
  35616. target._b = bindObjectProps;
  35617. target._v = createTextVNode;
  35618. target._e = createEmptyVNode;
  35619. target._u = resolveScopedSlots;
  35620. target._g = bindObjectListeners;
  35621. target._d = bindDynamicKeys;
  35622. target._p = prependModifier;
  35623. }
  35624. /* */
  35625. function FunctionalRenderContext (
  35626. data,
  35627. props,
  35628. children,
  35629. parent,
  35630. Ctor
  35631. ) {
  35632. var this$1 = this;
  35633. var options = Ctor.options;
  35634. // ensure the createElement function in functional components
  35635. // gets a unique context - this is necessary for correct named slot check
  35636. var contextVm;
  35637. if (hasOwn(parent, '_uid')) {
  35638. contextVm = Object.create(parent);
  35639. // $flow-disable-line
  35640. contextVm._original = parent;
  35641. } else {
  35642. // the context vm passed in is a functional context as well.
  35643. // in this case we want to make sure we are able to get a hold to the
  35644. // real context instance.
  35645. contextVm = parent;
  35646. // $flow-disable-line
  35647. parent = parent._original;
  35648. }
  35649. var isCompiled = isTrue(options._compiled);
  35650. var needNormalization = !isCompiled;
  35651. this.data = data;
  35652. this.props = props;
  35653. this.children = children;
  35654. this.parent = parent;
  35655. this.listeners = data.on || emptyObject;
  35656. this.injections = resolveInject(options.inject, parent);
  35657. this.slots = function () {
  35658. if (!this$1.$slots) {
  35659. normalizeScopedSlots(
  35660. data.scopedSlots,
  35661. this$1.$slots = resolveSlots(children, parent)
  35662. );
  35663. }
  35664. return this$1.$slots
  35665. };
  35666. Object.defineProperty(this, 'scopedSlots', ({
  35667. enumerable: true,
  35668. get: function get () {
  35669. return normalizeScopedSlots(data.scopedSlots, this.slots())
  35670. }
  35671. }));
  35672. // support for compiled functional template
  35673. if (isCompiled) {
  35674. // exposing $options for renderStatic()
  35675. this.$options = options;
  35676. // pre-resolve slots for renderSlot()
  35677. this.$slots = this.slots();
  35678. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  35679. }
  35680. if (options._scopeId) {
  35681. this._c = function (a, b, c, d) {
  35682. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  35683. if (vnode && !Array.isArray(vnode)) {
  35684. vnode.fnScopeId = options._scopeId;
  35685. vnode.fnContext = parent;
  35686. }
  35687. return vnode
  35688. };
  35689. } else {
  35690. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  35691. }
  35692. }
  35693. installRenderHelpers(FunctionalRenderContext.prototype);
  35694. function createFunctionalComponent (
  35695. Ctor,
  35696. propsData,
  35697. data,
  35698. contextVm,
  35699. children
  35700. ) {
  35701. var options = Ctor.options;
  35702. var props = {};
  35703. var propOptions = options.props;
  35704. if (isDef(propOptions)) {
  35705. for (var key in propOptions) {
  35706. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  35707. }
  35708. } else {
  35709. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  35710. if (isDef(data.props)) { mergeProps(props, data.props); }
  35711. }
  35712. var renderContext = new FunctionalRenderContext(
  35713. data,
  35714. props,
  35715. children,
  35716. contextVm,
  35717. Ctor
  35718. );
  35719. var vnode = options.render.call(null, renderContext._c, renderContext);
  35720. if (vnode instanceof VNode) {
  35721. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  35722. } else if (Array.isArray(vnode)) {
  35723. var vnodes = normalizeChildren(vnode) || [];
  35724. var res = new Array(vnodes.length);
  35725. for (var i = 0; i < vnodes.length; i++) {
  35726. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  35727. }
  35728. return res
  35729. }
  35730. }
  35731. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  35732. // #7817 clone node before setting fnContext, otherwise if the node is reused
  35733. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  35734. // that should not be matched to match.
  35735. var clone = cloneVNode(vnode);
  35736. clone.fnContext = contextVm;
  35737. clone.fnOptions = options;
  35738. {
  35739. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  35740. }
  35741. if (data.slot) {
  35742. (clone.data || (clone.data = {})).slot = data.slot;
  35743. }
  35744. return clone
  35745. }
  35746. function mergeProps (to, from) {
  35747. for (var key in from) {
  35748. to[camelize(key)] = from[key];
  35749. }
  35750. }
  35751. /* */
  35752. /* */
  35753. /* */
  35754. /* */
  35755. // inline hooks to be invoked on component VNodes during patch
  35756. var componentVNodeHooks = {
  35757. init: function init (vnode, hydrating) {
  35758. if (
  35759. vnode.componentInstance &&
  35760. !vnode.componentInstance._isDestroyed &&
  35761. vnode.data.keepAlive
  35762. ) {
  35763. // kept-alive components, treat as a patch
  35764. var mountedNode = vnode; // work around flow
  35765. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  35766. } else {
  35767. var child = vnode.componentInstance = createComponentInstanceForVnode(
  35768. vnode,
  35769. activeInstance
  35770. );
  35771. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  35772. }
  35773. },
  35774. prepatch: function prepatch (oldVnode, vnode) {
  35775. var options = vnode.componentOptions;
  35776. var child = vnode.componentInstance = oldVnode.componentInstance;
  35777. updateChildComponent(
  35778. child,
  35779. options.propsData, // updated props
  35780. options.listeners, // updated listeners
  35781. vnode, // new parent vnode
  35782. options.children // new children
  35783. );
  35784. },
  35785. insert: function insert (vnode) {
  35786. var context = vnode.context;
  35787. var componentInstance = vnode.componentInstance;
  35788. if (!componentInstance._isMounted) {
  35789. componentInstance._isMounted = true;
  35790. callHook(componentInstance, 'mounted');
  35791. }
  35792. if (vnode.data.keepAlive) {
  35793. if (context._isMounted) {
  35794. // vue-router#1212
  35795. // During updates, a kept-alive component's child components may
  35796. // change, so directly walking the tree here may call activated hooks
  35797. // on incorrect children. Instead we push them into a queue which will
  35798. // be processed after the whole patch process ended.
  35799. queueActivatedComponent(componentInstance);
  35800. } else {
  35801. activateChildComponent(componentInstance, true /* direct */);
  35802. }
  35803. }
  35804. },
  35805. destroy: function destroy (vnode) {
  35806. var componentInstance = vnode.componentInstance;
  35807. if (!componentInstance._isDestroyed) {
  35808. if (!vnode.data.keepAlive) {
  35809. componentInstance.$destroy();
  35810. } else {
  35811. deactivateChildComponent(componentInstance, true /* direct */);
  35812. }
  35813. }
  35814. }
  35815. };
  35816. var hooksToMerge = Object.keys(componentVNodeHooks);
  35817. function createComponent (
  35818. Ctor,
  35819. data,
  35820. context,
  35821. children,
  35822. tag
  35823. ) {
  35824. if (isUndef(Ctor)) {
  35825. return
  35826. }
  35827. var baseCtor = context.$options._base;
  35828. // plain options object: turn it into a constructor
  35829. if (isObject(Ctor)) {
  35830. Ctor = baseCtor.extend(Ctor);
  35831. }
  35832. // if at this stage it's not a constructor or an async component factory,
  35833. // reject.
  35834. if (typeof Ctor !== 'function') {
  35835. {
  35836. warn(("Invalid Component definition: " + (String(Ctor))), context);
  35837. }
  35838. return
  35839. }
  35840. // async component
  35841. var asyncFactory;
  35842. if (isUndef(Ctor.cid)) {
  35843. asyncFactory = Ctor;
  35844. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  35845. if (Ctor === undefined) {
  35846. // return a placeholder node for async component, which is rendered
  35847. // as a comment node but preserves all the raw information for the node.
  35848. // the information will be used for async server-rendering and hydration.
  35849. return createAsyncPlaceholder(
  35850. asyncFactory,
  35851. data,
  35852. context,
  35853. children,
  35854. tag
  35855. )
  35856. }
  35857. }
  35858. data = data || {};
  35859. // resolve constructor options in case global mixins are applied after
  35860. // component constructor creation
  35861. resolveConstructorOptions(Ctor);
  35862. // transform component v-model data into props & events
  35863. if (isDef(data.model)) {
  35864. transformModel(Ctor.options, data);
  35865. }
  35866. // extract props
  35867. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  35868. // functional component
  35869. if (isTrue(Ctor.options.functional)) {
  35870. return createFunctionalComponent(Ctor, propsData, data, context, children)
  35871. }
  35872. // extract listeners, since these needs to be treated as
  35873. // child component listeners instead of DOM listeners
  35874. var listeners = data.on;
  35875. // replace with listeners with .native modifier
  35876. // so it gets processed during parent component patch.
  35877. data.on = data.nativeOn;
  35878. if (isTrue(Ctor.options.abstract)) {
  35879. // abstract components do not keep anything
  35880. // other than props & listeners & slot
  35881. // work around flow
  35882. var slot = data.slot;
  35883. data = {};
  35884. if (slot) {
  35885. data.slot = slot;
  35886. }
  35887. }
  35888. // install component management hooks onto the placeholder node
  35889. installComponentHooks(data);
  35890. // return a placeholder vnode
  35891. var name = Ctor.options.name || tag;
  35892. var vnode = new VNode(
  35893. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  35894. data, undefined, undefined, undefined, context,
  35895. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  35896. asyncFactory
  35897. );
  35898. return vnode
  35899. }
  35900. function createComponentInstanceForVnode (
  35901. vnode, // we know it's MountedComponentVNode but flow doesn't
  35902. parent // activeInstance in lifecycle state
  35903. ) {
  35904. var options = {
  35905. _isComponent: true,
  35906. _parentVnode: vnode,
  35907. parent: parent
  35908. };
  35909. // check inline-template render functions
  35910. var inlineTemplate = vnode.data.inlineTemplate;
  35911. if (isDef(inlineTemplate)) {
  35912. options.render = inlineTemplate.render;
  35913. options.staticRenderFns = inlineTemplate.staticRenderFns;
  35914. }
  35915. return new vnode.componentOptions.Ctor(options)
  35916. }
  35917. function installComponentHooks (data) {
  35918. var hooks = data.hook || (data.hook = {});
  35919. for (var i = 0; i < hooksToMerge.length; i++) {
  35920. var key = hooksToMerge[i];
  35921. var existing = hooks[key];
  35922. var toMerge = componentVNodeHooks[key];
  35923. if (existing !== toMerge && !(existing && existing._merged)) {
  35924. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  35925. }
  35926. }
  35927. }
  35928. function mergeHook$1 (f1, f2) {
  35929. var merged = function (a, b) {
  35930. // flow complains about extra args which is why we use any
  35931. f1(a, b);
  35932. f2(a, b);
  35933. };
  35934. merged._merged = true;
  35935. return merged
  35936. }
  35937. // transform component v-model info (value and callback) into
  35938. // prop and event handler respectively.
  35939. function transformModel (options, data) {
  35940. var prop = (options.model && options.model.prop) || 'value';
  35941. var event = (options.model && options.model.event) || 'input'
  35942. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  35943. var on = data.on || (data.on = {});
  35944. var existing = on[event];
  35945. var callback = data.model.callback;
  35946. if (isDef(existing)) {
  35947. if (
  35948. Array.isArray(existing)
  35949. ? existing.indexOf(callback) === -1
  35950. : existing !== callback
  35951. ) {
  35952. on[event] = [callback].concat(existing);
  35953. }
  35954. } else {
  35955. on[event] = callback;
  35956. }
  35957. }
  35958. /* */
  35959. var SIMPLE_NORMALIZE = 1;
  35960. var ALWAYS_NORMALIZE = 2;
  35961. // wrapper function for providing a more flexible interface
  35962. // without getting yelled at by flow
  35963. function createElement (
  35964. context,
  35965. tag,
  35966. data,
  35967. children,
  35968. normalizationType,
  35969. alwaysNormalize
  35970. ) {
  35971. if (Array.isArray(data) || isPrimitive(data)) {
  35972. normalizationType = children;
  35973. children = data;
  35974. data = undefined;
  35975. }
  35976. if (isTrue(alwaysNormalize)) {
  35977. normalizationType = ALWAYS_NORMALIZE;
  35978. }
  35979. return _createElement(context, tag, data, children, normalizationType)
  35980. }
  35981. function _createElement (
  35982. context,
  35983. tag,
  35984. data,
  35985. children,
  35986. normalizationType
  35987. ) {
  35988. if (isDef(data) && isDef((data).__ob__)) {
  35989. warn(
  35990. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  35991. 'Always create fresh vnode data objects in each render!',
  35992. context
  35993. );
  35994. return createEmptyVNode()
  35995. }
  35996. // object syntax in v-bind
  35997. if (isDef(data) && isDef(data.is)) {
  35998. tag = data.is;
  35999. }
  36000. if (!tag) {
  36001. // in case of component :is set to falsy value
  36002. return createEmptyVNode()
  36003. }
  36004. // warn against non-primitive key
  36005. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  36006. ) {
  36007. {
  36008. warn(
  36009. 'Avoid using non-primitive value as key, ' +
  36010. 'use string/number value instead.',
  36011. context
  36012. );
  36013. }
  36014. }
  36015. // support single function children as default scoped slot
  36016. if (Array.isArray(children) &&
  36017. typeof children[0] === 'function'
  36018. ) {
  36019. data = data || {};
  36020. data.scopedSlots = { default: children[0] };
  36021. children.length = 0;
  36022. }
  36023. if (normalizationType === ALWAYS_NORMALIZE) {
  36024. children = normalizeChildren(children);
  36025. } else if (normalizationType === SIMPLE_NORMALIZE) {
  36026. children = simpleNormalizeChildren(children);
  36027. }
  36028. var vnode, ns;
  36029. if (typeof tag === 'string') {
  36030. var Ctor;
  36031. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  36032. if (config.isReservedTag(tag)) {
  36033. // platform built-in elements
  36034. if (isDef(data) && isDef(data.nativeOn)) {
  36035. warn(
  36036. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  36037. context
  36038. );
  36039. }
  36040. vnode = new VNode(
  36041. config.parsePlatformTagName(tag), data, children,
  36042. undefined, undefined, context
  36043. );
  36044. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  36045. // component
  36046. vnode = createComponent(Ctor, data, context, children, tag);
  36047. } else {
  36048. // unknown or unlisted namespaced elements
  36049. // check at runtime because it may get assigned a namespace when its
  36050. // parent normalizes children
  36051. vnode = new VNode(
  36052. tag, data, children,
  36053. undefined, undefined, context
  36054. );
  36055. }
  36056. } else {
  36057. // direct component options / constructor
  36058. vnode = createComponent(tag, data, context, children);
  36059. }
  36060. if (Array.isArray(vnode)) {
  36061. return vnode
  36062. } else if (isDef(vnode)) {
  36063. if (isDef(ns)) { applyNS(vnode, ns); }
  36064. if (isDef(data)) { registerDeepBindings(data); }
  36065. return vnode
  36066. } else {
  36067. return createEmptyVNode()
  36068. }
  36069. }
  36070. function applyNS (vnode, ns, force) {
  36071. vnode.ns = ns;
  36072. if (vnode.tag === 'foreignObject') {
  36073. // use default namespace inside foreignObject
  36074. ns = undefined;
  36075. force = true;
  36076. }
  36077. if (isDef(vnode.children)) {
  36078. for (var i = 0, l = vnode.children.length; i < l; i++) {
  36079. var child = vnode.children[i];
  36080. if (isDef(child.tag) && (
  36081. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  36082. applyNS(child, ns, force);
  36083. }
  36084. }
  36085. }
  36086. }
  36087. // ref #5318
  36088. // necessary to ensure parent re-render when deep bindings like :style and
  36089. // :class are used on slot nodes
  36090. function registerDeepBindings (data) {
  36091. if (isObject(data.style)) {
  36092. traverse(data.style);
  36093. }
  36094. if (isObject(data.class)) {
  36095. traverse(data.class);
  36096. }
  36097. }
  36098. /* */
  36099. function initRender (vm) {
  36100. vm._vnode = null; // the root of the child tree
  36101. vm._staticTrees = null; // v-once cached trees
  36102. var options = vm.$options;
  36103. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  36104. var renderContext = parentVnode && parentVnode.context;
  36105. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  36106. vm.$scopedSlots = emptyObject;
  36107. // bind the createElement fn to this instance
  36108. // so that we get proper render context inside it.
  36109. // args order: tag, data, children, normalizationType, alwaysNormalize
  36110. // internal version is used by render functions compiled from templates
  36111. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  36112. // normalization is always applied for the public version, used in
  36113. // user-written render functions.
  36114. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  36115. // $attrs & $listeners are exposed for easier HOC creation.
  36116. // they need to be reactive so that HOCs using them are always updated
  36117. var parentData = parentVnode && parentVnode.data;
  36118. /* istanbul ignore else */
  36119. {
  36120. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  36121. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  36122. }, true);
  36123. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  36124. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  36125. }, true);
  36126. }
  36127. }
  36128. var currentRenderingInstance = null;
  36129. function renderMixin (Vue) {
  36130. // install runtime convenience helpers
  36131. installRenderHelpers(Vue.prototype);
  36132. Vue.prototype.$nextTick = function (fn) {
  36133. return nextTick(fn, this)
  36134. };
  36135. Vue.prototype._render = function () {
  36136. var vm = this;
  36137. var ref = vm.$options;
  36138. var render = ref.render;
  36139. var _parentVnode = ref._parentVnode;
  36140. if (_parentVnode) {
  36141. vm.$scopedSlots = normalizeScopedSlots(
  36142. _parentVnode.data.scopedSlots,
  36143. vm.$slots,
  36144. vm.$scopedSlots
  36145. );
  36146. }
  36147. // set parent vnode. this allows render functions to have access
  36148. // to the data on the placeholder node.
  36149. vm.$vnode = _parentVnode;
  36150. // render self
  36151. var vnode;
  36152. try {
  36153. // There's no need to maintain a stack because all render fns are called
  36154. // separately from one another. Nested component's render fns are called
  36155. // when parent component is patched.
  36156. currentRenderingInstance = vm;
  36157. vnode = render.call(vm._renderProxy, vm.$createElement);
  36158. } catch (e) {
  36159. handleError(e, vm, "render");
  36160. // return error render result,
  36161. // or previous vnode to prevent render error causing blank component
  36162. /* istanbul ignore else */
  36163. if (vm.$options.renderError) {
  36164. try {
  36165. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  36166. } catch (e) {
  36167. handleError(e, vm, "renderError");
  36168. vnode = vm._vnode;
  36169. }
  36170. } else {
  36171. vnode = vm._vnode;
  36172. }
  36173. } finally {
  36174. currentRenderingInstance = null;
  36175. }
  36176. // if the returned array contains only a single node, allow it
  36177. if (Array.isArray(vnode) && vnode.length === 1) {
  36178. vnode = vnode[0];
  36179. }
  36180. // return empty vnode in case the render function errored out
  36181. if (!(vnode instanceof VNode)) {
  36182. if (Array.isArray(vnode)) {
  36183. warn(
  36184. 'Multiple root nodes returned from render function. Render function ' +
  36185. 'should return a single root node.',
  36186. vm
  36187. );
  36188. }
  36189. vnode = createEmptyVNode();
  36190. }
  36191. // set parent
  36192. vnode.parent = _parentVnode;
  36193. return vnode
  36194. };
  36195. }
  36196. /* */
  36197. function ensureCtor (comp, base) {
  36198. if (
  36199. comp.__esModule ||
  36200. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  36201. ) {
  36202. comp = comp.default;
  36203. }
  36204. return isObject(comp)
  36205. ? base.extend(comp)
  36206. : comp
  36207. }
  36208. function createAsyncPlaceholder (
  36209. factory,
  36210. data,
  36211. context,
  36212. children,
  36213. tag
  36214. ) {
  36215. var node = createEmptyVNode();
  36216. node.asyncFactory = factory;
  36217. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  36218. return node
  36219. }
  36220. function resolveAsyncComponent (
  36221. factory,
  36222. baseCtor
  36223. ) {
  36224. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  36225. return factory.errorComp
  36226. }
  36227. if (isDef(factory.resolved)) {
  36228. return factory.resolved
  36229. }
  36230. var owner = currentRenderingInstance;
  36231. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  36232. // already pending
  36233. factory.owners.push(owner);
  36234. }
  36235. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  36236. return factory.loadingComp
  36237. }
  36238. if (owner && !isDef(factory.owners)) {
  36239. var owners = factory.owners = [owner];
  36240. var sync = true;
  36241. var timerLoading = null;
  36242. var timerTimeout = null
  36243. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  36244. var forceRender = function (renderCompleted) {
  36245. for (var i = 0, l = owners.length; i < l; i++) {
  36246. (owners[i]).$forceUpdate();
  36247. }
  36248. if (renderCompleted) {
  36249. owners.length = 0;
  36250. if (timerLoading !== null) {
  36251. clearTimeout(timerLoading);
  36252. timerLoading = null;
  36253. }
  36254. if (timerTimeout !== null) {
  36255. clearTimeout(timerTimeout);
  36256. timerTimeout = null;
  36257. }
  36258. }
  36259. };
  36260. var resolve = once(function (res) {
  36261. // cache resolved
  36262. factory.resolved = ensureCtor(res, baseCtor);
  36263. // invoke callbacks only if this is not a synchronous resolve
  36264. // (async resolves are shimmed as synchronous during SSR)
  36265. if (!sync) {
  36266. forceRender(true);
  36267. } else {
  36268. owners.length = 0;
  36269. }
  36270. });
  36271. var reject = once(function (reason) {
  36272. warn(
  36273. "Failed to resolve async component: " + (String(factory)) +
  36274. (reason ? ("\nReason: " + reason) : '')
  36275. );
  36276. if (isDef(factory.errorComp)) {
  36277. factory.error = true;
  36278. forceRender(true);
  36279. }
  36280. });
  36281. var res = factory(resolve, reject);
  36282. if (isObject(res)) {
  36283. if (isPromise(res)) {
  36284. // () => Promise
  36285. if (isUndef(factory.resolved)) {
  36286. res.then(resolve, reject);
  36287. }
  36288. } else if (isPromise(res.component)) {
  36289. res.component.then(resolve, reject);
  36290. if (isDef(res.error)) {
  36291. factory.errorComp = ensureCtor(res.error, baseCtor);
  36292. }
  36293. if (isDef(res.loading)) {
  36294. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  36295. if (res.delay === 0) {
  36296. factory.loading = true;
  36297. } else {
  36298. timerLoading = setTimeout(function () {
  36299. timerLoading = null;
  36300. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  36301. factory.loading = true;
  36302. forceRender(false);
  36303. }
  36304. }, res.delay || 200);
  36305. }
  36306. }
  36307. if (isDef(res.timeout)) {
  36308. timerTimeout = setTimeout(function () {
  36309. timerTimeout = null;
  36310. if (isUndef(factory.resolved)) {
  36311. reject(
  36312. "timeout (" + (res.timeout) + "ms)"
  36313. );
  36314. }
  36315. }, res.timeout);
  36316. }
  36317. }
  36318. }
  36319. sync = false;
  36320. // return in case resolved synchronously
  36321. return factory.loading
  36322. ? factory.loadingComp
  36323. : factory.resolved
  36324. }
  36325. }
  36326. /* */
  36327. function isAsyncPlaceholder (node) {
  36328. return node.isComment && node.asyncFactory
  36329. }
  36330. /* */
  36331. function getFirstComponentChild (children) {
  36332. if (Array.isArray(children)) {
  36333. for (var i = 0; i < children.length; i++) {
  36334. var c = children[i];
  36335. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  36336. return c
  36337. }
  36338. }
  36339. }
  36340. }
  36341. /* */
  36342. /* */
  36343. function initEvents (vm) {
  36344. vm._events = Object.create(null);
  36345. vm._hasHookEvent = false;
  36346. // init parent attached events
  36347. var listeners = vm.$options._parentListeners;
  36348. if (listeners) {
  36349. updateComponentListeners(vm, listeners);
  36350. }
  36351. }
  36352. var target;
  36353. function add (event, fn) {
  36354. target.$on(event, fn);
  36355. }
  36356. function remove$1 (event, fn) {
  36357. target.$off(event, fn);
  36358. }
  36359. function createOnceHandler (event, fn) {
  36360. var _target = target;
  36361. return function onceHandler () {
  36362. var res = fn.apply(null, arguments);
  36363. if (res !== null) {
  36364. _target.$off(event, onceHandler);
  36365. }
  36366. }
  36367. }
  36368. function updateComponentListeners (
  36369. vm,
  36370. listeners,
  36371. oldListeners
  36372. ) {
  36373. target = vm;
  36374. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  36375. target = undefined;
  36376. }
  36377. function eventsMixin (Vue) {
  36378. var hookRE = /^hook:/;
  36379. Vue.prototype.$on = function (event, fn) {
  36380. var vm = this;
  36381. if (Array.isArray(event)) {
  36382. for (var i = 0, l = event.length; i < l; i++) {
  36383. vm.$on(event[i], fn);
  36384. }
  36385. } else {
  36386. (vm._events[event] || (vm._events[event] = [])).push(fn);
  36387. // optimize hook:event cost by using a boolean flag marked at registration
  36388. // instead of a hash lookup
  36389. if (hookRE.test(event)) {
  36390. vm._hasHookEvent = true;
  36391. }
  36392. }
  36393. return vm
  36394. };
  36395. Vue.prototype.$once = function (event, fn) {
  36396. var vm = this;
  36397. function on () {
  36398. vm.$off(event, on);
  36399. fn.apply(vm, arguments);
  36400. }
  36401. on.fn = fn;
  36402. vm.$on(event, on);
  36403. return vm
  36404. };
  36405. Vue.prototype.$off = function (event, fn) {
  36406. var vm = this;
  36407. // all
  36408. if (!arguments.length) {
  36409. vm._events = Object.create(null);
  36410. return vm
  36411. }
  36412. // array of events
  36413. if (Array.isArray(event)) {
  36414. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  36415. vm.$off(event[i$1], fn);
  36416. }
  36417. return vm
  36418. }
  36419. // specific event
  36420. var cbs = vm._events[event];
  36421. if (!cbs) {
  36422. return vm
  36423. }
  36424. if (!fn) {
  36425. vm._events[event] = null;
  36426. return vm
  36427. }
  36428. // specific handler
  36429. var cb;
  36430. var i = cbs.length;
  36431. while (i--) {
  36432. cb = cbs[i];
  36433. if (cb === fn || cb.fn === fn) {
  36434. cbs.splice(i, 1);
  36435. break
  36436. }
  36437. }
  36438. return vm
  36439. };
  36440. Vue.prototype.$emit = function (event) {
  36441. var vm = this;
  36442. {
  36443. var lowerCaseEvent = event.toLowerCase();
  36444. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  36445. tip(
  36446. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  36447. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  36448. "Note that HTML attributes are case-insensitive and you cannot use " +
  36449. "v-on to listen to camelCase events when using in-DOM templates. " +
  36450. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  36451. );
  36452. }
  36453. }
  36454. var cbs = vm._events[event];
  36455. if (cbs) {
  36456. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  36457. var args = toArray(arguments, 1);
  36458. var info = "event handler for \"" + event + "\"";
  36459. for (var i = 0, l = cbs.length; i < l; i++) {
  36460. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  36461. }
  36462. }
  36463. return vm
  36464. };
  36465. }
  36466. /* */
  36467. var activeInstance = null;
  36468. var isUpdatingChildComponent = false;
  36469. function setActiveInstance(vm) {
  36470. var prevActiveInstance = activeInstance;
  36471. activeInstance = vm;
  36472. return function () {
  36473. activeInstance = prevActiveInstance;
  36474. }
  36475. }
  36476. function initLifecycle (vm) {
  36477. var options = vm.$options;
  36478. // locate first non-abstract parent
  36479. var parent = options.parent;
  36480. if (parent && !options.abstract) {
  36481. while (parent.$options.abstract && parent.$parent) {
  36482. parent = parent.$parent;
  36483. }
  36484. parent.$children.push(vm);
  36485. }
  36486. vm.$parent = parent;
  36487. vm.$root = parent ? parent.$root : vm;
  36488. vm.$children = [];
  36489. vm.$refs = {};
  36490. vm._watcher = null;
  36491. vm._inactive = null;
  36492. vm._directInactive = false;
  36493. vm._isMounted = false;
  36494. vm._isDestroyed = false;
  36495. vm._isBeingDestroyed = false;
  36496. }
  36497. function lifecycleMixin (Vue) {
  36498. Vue.prototype._update = function (vnode, hydrating) {
  36499. var vm = this;
  36500. var prevEl = vm.$el;
  36501. var prevVnode = vm._vnode;
  36502. var restoreActiveInstance = setActiveInstance(vm);
  36503. vm._vnode = vnode;
  36504. // Vue.prototype.__patch__ is injected in entry points
  36505. // based on the rendering backend used.
  36506. if (!prevVnode) {
  36507. // initial render
  36508. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  36509. } else {
  36510. // updates
  36511. vm.$el = vm.__patch__(prevVnode, vnode);
  36512. }
  36513. restoreActiveInstance();
  36514. // update __vue__ reference
  36515. if (prevEl) {
  36516. prevEl.__vue__ = null;
  36517. }
  36518. if (vm.$el) {
  36519. vm.$el.__vue__ = vm;
  36520. }
  36521. // if parent is an HOC, update its $el as well
  36522. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  36523. vm.$parent.$el = vm.$el;
  36524. }
  36525. // updated hook is called by the scheduler to ensure that children are
  36526. // updated in a parent's updated hook.
  36527. };
  36528. Vue.prototype.$forceUpdate = function () {
  36529. var vm = this;
  36530. if (vm._watcher) {
  36531. vm._watcher.update();
  36532. }
  36533. };
  36534. Vue.prototype.$destroy = function () {
  36535. var vm = this;
  36536. if (vm._isBeingDestroyed) {
  36537. return
  36538. }
  36539. callHook(vm, 'beforeDestroy');
  36540. vm._isBeingDestroyed = true;
  36541. // remove self from parent
  36542. var parent = vm.$parent;
  36543. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  36544. remove(parent.$children, vm);
  36545. }
  36546. // teardown watchers
  36547. if (vm._watcher) {
  36548. vm._watcher.teardown();
  36549. }
  36550. var i = vm._watchers.length;
  36551. while (i--) {
  36552. vm._watchers[i].teardown();
  36553. }
  36554. // remove reference from data ob
  36555. // frozen object may not have observer.
  36556. if (vm._data.__ob__) {
  36557. vm._data.__ob__.vmCount--;
  36558. }
  36559. // call the last hook...
  36560. vm._isDestroyed = true;
  36561. // invoke destroy hooks on current rendered tree
  36562. vm.__patch__(vm._vnode, null);
  36563. // fire destroyed hook
  36564. callHook(vm, 'destroyed');
  36565. // turn off all instance listeners.
  36566. vm.$off();
  36567. // remove __vue__ reference
  36568. if (vm.$el) {
  36569. vm.$el.__vue__ = null;
  36570. }
  36571. // release circular reference (#6759)
  36572. if (vm.$vnode) {
  36573. vm.$vnode.parent = null;
  36574. }
  36575. };
  36576. }
  36577. function mountComponent (
  36578. vm,
  36579. el,
  36580. hydrating
  36581. ) {
  36582. vm.$el = el;
  36583. if (!vm.$options.render) {
  36584. vm.$options.render = createEmptyVNode;
  36585. {
  36586. /* istanbul ignore if */
  36587. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  36588. vm.$options.el || el) {
  36589. warn(
  36590. 'You are using the runtime-only build of Vue where the template ' +
  36591. 'compiler is not available. Either pre-compile the templates into ' +
  36592. 'render functions, or use the compiler-included build.',
  36593. vm
  36594. );
  36595. } else {
  36596. warn(
  36597. 'Failed to mount component: template or render function not defined.',
  36598. vm
  36599. );
  36600. }
  36601. }
  36602. }
  36603. callHook(vm, 'beforeMount');
  36604. var updateComponent;
  36605. /* istanbul ignore if */
  36606. if (config.performance && mark) {
  36607. updateComponent = function () {
  36608. var name = vm._name;
  36609. var id = vm._uid;
  36610. var startTag = "vue-perf-start:" + id;
  36611. var endTag = "vue-perf-end:" + id;
  36612. mark(startTag);
  36613. var vnode = vm._render();
  36614. mark(endTag);
  36615. measure(("vue " + name + " render"), startTag, endTag);
  36616. mark(startTag);
  36617. vm._update(vnode, hydrating);
  36618. mark(endTag);
  36619. measure(("vue " + name + " patch"), startTag, endTag);
  36620. };
  36621. } else {
  36622. updateComponent = function () {
  36623. vm._update(vm._render(), hydrating);
  36624. };
  36625. }
  36626. // we set this to vm._watcher inside the watcher's constructor
  36627. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  36628. // component's mounted hook), which relies on vm._watcher being already defined
  36629. new Watcher(vm, updateComponent, noop, {
  36630. before: function before () {
  36631. if (vm._isMounted && !vm._isDestroyed) {
  36632. callHook(vm, 'beforeUpdate');
  36633. }
  36634. }
  36635. }, true /* isRenderWatcher */);
  36636. hydrating = false;
  36637. // manually mounted instance, call mounted on self
  36638. // mounted is called for render-created child components in its inserted hook
  36639. if (vm.$vnode == null) {
  36640. vm._isMounted = true;
  36641. callHook(vm, 'mounted');
  36642. }
  36643. return vm
  36644. }
  36645. function updateChildComponent (
  36646. vm,
  36647. propsData,
  36648. listeners,
  36649. parentVnode,
  36650. renderChildren
  36651. ) {
  36652. {
  36653. isUpdatingChildComponent = true;
  36654. }
  36655. // determine whether component has slot children
  36656. // we need to do this before overwriting $options._renderChildren.
  36657. // check if there are dynamic scopedSlots (hand-written or compiled but with
  36658. // dynamic slot names). Static scoped slots compiled from template has the
  36659. // "$stable" marker.
  36660. var newScopedSlots = parentVnode.data.scopedSlots;
  36661. var oldScopedSlots = vm.$scopedSlots;
  36662. var hasDynamicScopedSlot = !!(
  36663. (newScopedSlots && !newScopedSlots.$stable) ||
  36664. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  36665. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  36666. );
  36667. // Any static slot children from the parent may have changed during parent's
  36668. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  36669. // update is necessary to ensure correctness.
  36670. var needsForceUpdate = !!(
  36671. renderChildren || // has new static slots
  36672. vm.$options._renderChildren || // has old static slots
  36673. hasDynamicScopedSlot
  36674. );
  36675. vm.$options._parentVnode = parentVnode;
  36676. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  36677. if (vm._vnode) { // update child tree's parent
  36678. vm._vnode.parent = parentVnode;
  36679. }
  36680. vm.$options._renderChildren = renderChildren;
  36681. // update $attrs and $listeners hash
  36682. // these are also reactive so they may trigger child update if the child
  36683. // used them during render
  36684. vm.$attrs = parentVnode.data.attrs || emptyObject;
  36685. vm.$listeners = listeners || emptyObject;
  36686. // update props
  36687. if (propsData && vm.$options.props) {
  36688. toggleObserving(false);
  36689. var props = vm._props;
  36690. var propKeys = vm.$options._propKeys || [];
  36691. for (var i = 0; i < propKeys.length; i++) {
  36692. var key = propKeys[i];
  36693. var propOptions = vm.$options.props; // wtf flow?
  36694. props[key] = validateProp(key, propOptions, propsData, vm);
  36695. }
  36696. toggleObserving(true);
  36697. // keep a copy of raw propsData
  36698. vm.$options.propsData = propsData;
  36699. }
  36700. // update listeners
  36701. listeners = listeners || emptyObject;
  36702. var oldListeners = vm.$options._parentListeners;
  36703. vm.$options._parentListeners = listeners;
  36704. updateComponentListeners(vm, listeners, oldListeners);
  36705. // resolve slots + force update if has children
  36706. if (needsForceUpdate) {
  36707. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  36708. vm.$forceUpdate();
  36709. }
  36710. {
  36711. isUpdatingChildComponent = false;
  36712. }
  36713. }
  36714. function isInInactiveTree (vm) {
  36715. while (vm && (vm = vm.$parent)) {
  36716. if (vm._inactive) { return true }
  36717. }
  36718. return false
  36719. }
  36720. function activateChildComponent (vm, direct) {
  36721. if (direct) {
  36722. vm._directInactive = false;
  36723. if (isInInactiveTree(vm)) {
  36724. return
  36725. }
  36726. } else if (vm._directInactive) {
  36727. return
  36728. }
  36729. if (vm._inactive || vm._inactive === null) {
  36730. vm._inactive = false;
  36731. for (var i = 0; i < vm.$children.length; i++) {
  36732. activateChildComponent(vm.$children[i]);
  36733. }
  36734. callHook(vm, 'activated');
  36735. }
  36736. }
  36737. function deactivateChildComponent (vm, direct) {
  36738. if (direct) {
  36739. vm._directInactive = true;
  36740. if (isInInactiveTree(vm)) {
  36741. return
  36742. }
  36743. }
  36744. if (!vm._inactive) {
  36745. vm._inactive = true;
  36746. for (var i = 0; i < vm.$children.length; i++) {
  36747. deactivateChildComponent(vm.$children[i]);
  36748. }
  36749. callHook(vm, 'deactivated');
  36750. }
  36751. }
  36752. function callHook (vm, hook) {
  36753. // #7573 disable dep collection when invoking lifecycle hooks
  36754. pushTarget();
  36755. var handlers = vm.$options[hook];
  36756. var info = hook + " hook";
  36757. if (handlers) {
  36758. for (var i = 0, j = handlers.length; i < j; i++) {
  36759. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  36760. }
  36761. }
  36762. if (vm._hasHookEvent) {
  36763. vm.$emit('hook:' + hook);
  36764. }
  36765. popTarget();
  36766. }
  36767. /* */
  36768. var MAX_UPDATE_COUNT = 100;
  36769. var queue = [];
  36770. var activatedChildren = [];
  36771. var has = {};
  36772. var circular = {};
  36773. var waiting = false;
  36774. var flushing = false;
  36775. var index = 0;
  36776. /**
  36777. * Reset the scheduler's state.
  36778. */
  36779. function resetSchedulerState () {
  36780. index = queue.length = activatedChildren.length = 0;
  36781. has = {};
  36782. {
  36783. circular = {};
  36784. }
  36785. waiting = flushing = false;
  36786. }
  36787. // Async edge case #6566 requires saving the timestamp when event listeners are
  36788. // attached. However, calling performance.now() has a perf overhead especially
  36789. // if the page has thousands of event listeners. Instead, we take a timestamp
  36790. // every time the scheduler flushes and use that for all event listeners
  36791. // attached during that flush.
  36792. var currentFlushTimestamp = 0;
  36793. // Async edge case fix requires storing an event listener's attach timestamp.
  36794. var getNow = Date.now;
  36795. // Determine what event timestamp the browser is using. Annoyingly, the
  36796. // timestamp can either be hi-res (relative to page load) or low-res
  36797. // (relative to UNIX epoch), so in order to compare time we have to use the
  36798. // same timestamp type when saving the flush timestamp.
  36799. // All IE versions use low-res event timestamps, and have problematic clock
  36800. // implementations (#9632)
  36801. if (inBrowser && !isIE) {
  36802. var performance = window.performance;
  36803. if (
  36804. performance &&
  36805. typeof performance.now === 'function' &&
  36806. getNow() > document.createEvent('Event').timeStamp
  36807. ) {
  36808. // if the event timestamp, although evaluated AFTER the Date.now(), is
  36809. // smaller than it, it means the event is using a hi-res timestamp,
  36810. // and we need to use the hi-res version for event listener timestamps as
  36811. // well.
  36812. getNow = function () { return performance.now(); };
  36813. }
  36814. }
  36815. /**
  36816. * Flush both queues and run the watchers.
  36817. */
  36818. function flushSchedulerQueue () {
  36819. currentFlushTimestamp = getNow();
  36820. flushing = true;
  36821. var watcher, id;
  36822. // Sort queue before flush.
  36823. // This ensures that:
  36824. // 1. Components are updated from parent to child. (because parent is always
  36825. // created before the child)
  36826. // 2. A component's user watchers are run before its render watcher (because
  36827. // user watchers are created before the render watcher)
  36828. // 3. If a component is destroyed during a parent component's watcher run,
  36829. // its watchers can be skipped.
  36830. queue.sort(function (a, b) { return a.id - b.id; });
  36831. // do not cache length because more watchers might be pushed
  36832. // as we run existing watchers
  36833. for (index = 0; index < queue.length; index++) {
  36834. watcher = queue[index];
  36835. if (watcher.before) {
  36836. watcher.before();
  36837. }
  36838. id = watcher.id;
  36839. has[id] = null;
  36840. watcher.run();
  36841. // in dev build, check and stop circular updates.
  36842. if (has[id] != null) {
  36843. circular[id] = (circular[id] || 0) + 1;
  36844. if (circular[id] > MAX_UPDATE_COUNT) {
  36845. warn(
  36846. 'You may have an infinite update loop ' + (
  36847. watcher.user
  36848. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  36849. : "in a component render function."
  36850. ),
  36851. watcher.vm
  36852. );
  36853. break
  36854. }
  36855. }
  36856. }
  36857. // keep copies of post queues before resetting state
  36858. var activatedQueue = activatedChildren.slice();
  36859. var updatedQueue = queue.slice();
  36860. resetSchedulerState();
  36861. // call component updated and activated hooks
  36862. callActivatedHooks(activatedQueue);
  36863. callUpdatedHooks(updatedQueue);
  36864. // devtool hook
  36865. /* istanbul ignore if */
  36866. if (devtools && config.devtools) {
  36867. devtools.emit('flush');
  36868. }
  36869. }
  36870. function callUpdatedHooks (queue) {
  36871. var i = queue.length;
  36872. while (i--) {
  36873. var watcher = queue[i];
  36874. var vm = watcher.vm;
  36875. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  36876. callHook(vm, 'updated');
  36877. }
  36878. }
  36879. }
  36880. /**
  36881. * Queue a kept-alive component that was activated during patch.
  36882. * The queue will be processed after the entire tree has been patched.
  36883. */
  36884. function queueActivatedComponent (vm) {
  36885. // setting _inactive to false here so that a render function can
  36886. // rely on checking whether it's in an inactive tree (e.g. router-view)
  36887. vm._inactive = false;
  36888. activatedChildren.push(vm);
  36889. }
  36890. function callActivatedHooks (queue) {
  36891. for (var i = 0; i < queue.length; i++) {
  36892. queue[i]._inactive = true;
  36893. activateChildComponent(queue[i], true /* true */);
  36894. }
  36895. }
  36896. /**
  36897. * Push a watcher into the watcher queue.
  36898. * Jobs with duplicate IDs will be skipped unless it's
  36899. * pushed when the queue is being flushed.
  36900. */
  36901. function queueWatcher (watcher) {
  36902. var id = watcher.id;
  36903. if (has[id] == null) {
  36904. has[id] = true;
  36905. if (!flushing) {
  36906. queue.push(watcher);
  36907. } else {
  36908. // if already flushing, splice the watcher based on its id
  36909. // if already past its id, it will be run next immediately.
  36910. var i = queue.length - 1;
  36911. while (i > index && queue[i].id > watcher.id) {
  36912. i--;
  36913. }
  36914. queue.splice(i + 1, 0, watcher);
  36915. }
  36916. // queue the flush
  36917. if (!waiting) {
  36918. waiting = true;
  36919. if (!config.async) {
  36920. flushSchedulerQueue();
  36921. return
  36922. }
  36923. nextTick(flushSchedulerQueue);
  36924. }
  36925. }
  36926. }
  36927. /* */
  36928. var uid$2 = 0;
  36929. /**
  36930. * A watcher parses an expression, collects dependencies,
  36931. * and fires callback when the expression value changes.
  36932. * This is used for both the $watch() api and directives.
  36933. */
  36934. var Watcher = function Watcher (
  36935. vm,
  36936. expOrFn,
  36937. cb,
  36938. options,
  36939. isRenderWatcher
  36940. ) {
  36941. this.vm = vm;
  36942. if (isRenderWatcher) {
  36943. vm._watcher = this;
  36944. }
  36945. vm._watchers.push(this);
  36946. // options
  36947. if (options) {
  36948. this.deep = !!options.deep;
  36949. this.user = !!options.user;
  36950. this.lazy = !!options.lazy;
  36951. this.sync = !!options.sync;
  36952. this.before = options.before;
  36953. } else {
  36954. this.deep = this.user = this.lazy = this.sync = false;
  36955. }
  36956. this.cb = cb;
  36957. this.id = ++uid$2; // uid for batching
  36958. this.active = true;
  36959. this.dirty = this.lazy; // for lazy watchers
  36960. this.deps = [];
  36961. this.newDeps = [];
  36962. this.depIds = new _Set();
  36963. this.newDepIds = new _Set();
  36964. this.expression = expOrFn.toString();
  36965. // parse expression for getter
  36966. if (typeof expOrFn === 'function') {
  36967. this.getter = expOrFn;
  36968. } else {
  36969. this.getter = parsePath(expOrFn);
  36970. if (!this.getter) {
  36971. this.getter = noop;
  36972. warn(
  36973. "Failed watching path: \"" + expOrFn + "\" " +
  36974. 'Watcher only accepts simple dot-delimited paths. ' +
  36975. 'For full control, use a function instead.',
  36976. vm
  36977. );
  36978. }
  36979. }
  36980. this.value = this.lazy
  36981. ? undefined
  36982. : this.get();
  36983. };
  36984. /**
  36985. * Evaluate the getter, and re-collect dependencies.
  36986. */
  36987. Watcher.prototype.get = function get () {
  36988. pushTarget(this);
  36989. var value;
  36990. var vm = this.vm;
  36991. try {
  36992. value = this.getter.call(vm, vm);
  36993. } catch (e) {
  36994. if (this.user) {
  36995. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  36996. } else {
  36997. throw e
  36998. }
  36999. } finally {
  37000. // "touch" every property so they are all tracked as
  37001. // dependencies for deep watching
  37002. if (this.deep) {
  37003. traverse(value);
  37004. }
  37005. popTarget();
  37006. this.cleanupDeps();
  37007. }
  37008. return value
  37009. };
  37010. /**
  37011. * Add a dependency to this directive.
  37012. */
  37013. Watcher.prototype.addDep = function addDep (dep) {
  37014. var id = dep.id;
  37015. if (!this.newDepIds.has(id)) {
  37016. this.newDepIds.add(id);
  37017. this.newDeps.push(dep);
  37018. if (!this.depIds.has(id)) {
  37019. dep.addSub(this);
  37020. }
  37021. }
  37022. };
  37023. /**
  37024. * Clean up for dependency collection.
  37025. */
  37026. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  37027. var i = this.deps.length;
  37028. while (i--) {
  37029. var dep = this.deps[i];
  37030. if (!this.newDepIds.has(dep.id)) {
  37031. dep.removeSub(this);
  37032. }
  37033. }
  37034. var tmp = this.depIds;
  37035. this.depIds = this.newDepIds;
  37036. this.newDepIds = tmp;
  37037. this.newDepIds.clear();
  37038. tmp = this.deps;
  37039. this.deps = this.newDeps;
  37040. this.newDeps = tmp;
  37041. this.newDeps.length = 0;
  37042. };
  37043. /**
  37044. * Subscriber interface.
  37045. * Will be called when a dependency changes.
  37046. */
  37047. Watcher.prototype.update = function update () {
  37048. /* istanbul ignore else */
  37049. if (this.lazy) {
  37050. this.dirty = true;
  37051. } else if (this.sync) {
  37052. this.run();
  37053. } else {
  37054. queueWatcher(this);
  37055. }
  37056. };
  37057. /**
  37058. * Scheduler job interface.
  37059. * Will be called by the scheduler.
  37060. */
  37061. Watcher.prototype.run = function run () {
  37062. if (this.active) {
  37063. var value = this.get();
  37064. if (
  37065. value !== this.value ||
  37066. // Deep watchers and watchers on Object/Arrays should fire even
  37067. // when the value is the same, because the value may
  37068. // have mutated.
  37069. isObject(value) ||
  37070. this.deep
  37071. ) {
  37072. // set new value
  37073. var oldValue = this.value;
  37074. this.value = value;
  37075. if (this.user) {
  37076. try {
  37077. this.cb.call(this.vm, value, oldValue);
  37078. } catch (e) {
  37079. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  37080. }
  37081. } else {
  37082. this.cb.call(this.vm, value, oldValue);
  37083. }
  37084. }
  37085. }
  37086. };
  37087. /**
  37088. * Evaluate the value of the watcher.
  37089. * This only gets called for lazy watchers.
  37090. */
  37091. Watcher.prototype.evaluate = function evaluate () {
  37092. this.value = this.get();
  37093. this.dirty = false;
  37094. };
  37095. /**
  37096. * Depend on all deps collected by this watcher.
  37097. */
  37098. Watcher.prototype.depend = function depend () {
  37099. var i = this.deps.length;
  37100. while (i--) {
  37101. this.deps[i].depend();
  37102. }
  37103. };
  37104. /**
  37105. * Remove self from all dependencies' subscriber list.
  37106. */
  37107. Watcher.prototype.teardown = function teardown () {
  37108. if (this.active) {
  37109. // remove self from vm's watcher list
  37110. // this is a somewhat expensive operation so we skip it
  37111. // if the vm is being destroyed.
  37112. if (!this.vm._isBeingDestroyed) {
  37113. remove(this.vm._watchers, this);
  37114. }
  37115. var i = this.deps.length;
  37116. while (i--) {
  37117. this.deps[i].removeSub(this);
  37118. }
  37119. this.active = false;
  37120. }
  37121. };
  37122. /* */
  37123. var sharedPropertyDefinition = {
  37124. enumerable: true,
  37125. configurable: true,
  37126. get: noop,
  37127. set: noop
  37128. };
  37129. function proxy (target, sourceKey, key) {
  37130. sharedPropertyDefinition.get = function proxyGetter () {
  37131. return this[sourceKey][key]
  37132. };
  37133. sharedPropertyDefinition.set = function proxySetter (val) {
  37134. this[sourceKey][key] = val;
  37135. };
  37136. Object.defineProperty(target, key, sharedPropertyDefinition);
  37137. }
  37138. function initState (vm) {
  37139. vm._watchers = [];
  37140. var opts = vm.$options;
  37141. if (opts.props) { initProps(vm, opts.props); }
  37142. if (opts.methods) { initMethods(vm, opts.methods); }
  37143. if (opts.data) {
  37144. initData(vm);
  37145. } else {
  37146. observe(vm._data = {}, true /* asRootData */);
  37147. }
  37148. if (opts.computed) { initComputed(vm, opts.computed); }
  37149. if (opts.watch && opts.watch !== nativeWatch) {
  37150. initWatch(vm, opts.watch);
  37151. }
  37152. }
  37153. function initProps (vm, propsOptions) {
  37154. var propsData = vm.$options.propsData || {};
  37155. var props = vm._props = {};
  37156. // cache prop keys so that future props updates can iterate using Array
  37157. // instead of dynamic object key enumeration.
  37158. var keys = vm.$options._propKeys = [];
  37159. var isRoot = !vm.$parent;
  37160. // root instance props should be converted
  37161. if (!isRoot) {
  37162. toggleObserving(false);
  37163. }
  37164. var loop = function ( key ) {
  37165. keys.push(key);
  37166. var value = validateProp(key, propsOptions, propsData, vm);
  37167. /* istanbul ignore else */
  37168. {
  37169. var hyphenatedKey = hyphenate(key);
  37170. if (isReservedAttribute(hyphenatedKey) ||
  37171. config.isReservedAttr(hyphenatedKey)) {
  37172. warn(
  37173. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  37174. vm
  37175. );
  37176. }
  37177. defineReactive$$1(props, key, value, function () {
  37178. if (!isRoot && !isUpdatingChildComponent) {
  37179. warn(
  37180. "Avoid mutating a prop directly since the value will be " +
  37181. "overwritten whenever the parent component re-renders. " +
  37182. "Instead, use a data or computed property based on the prop's " +
  37183. "value. Prop being mutated: \"" + key + "\"",
  37184. vm
  37185. );
  37186. }
  37187. });
  37188. }
  37189. // static props are already proxied on the component's prototype
  37190. // during Vue.extend(). We only need to proxy props defined at
  37191. // instantiation here.
  37192. if (!(key in vm)) {
  37193. proxy(vm, "_props", key);
  37194. }
  37195. };
  37196. for (var key in propsOptions) loop( key );
  37197. toggleObserving(true);
  37198. }
  37199. function initData (vm) {
  37200. var data = vm.$options.data;
  37201. data = vm._data = typeof data === 'function'
  37202. ? getData(data, vm)
  37203. : data || {};
  37204. if (!isPlainObject(data)) {
  37205. data = {};
  37206. warn(
  37207. 'data functions should return an object:\n' +
  37208. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  37209. vm
  37210. );
  37211. }
  37212. // proxy data on instance
  37213. var keys = Object.keys(data);
  37214. var props = vm.$options.props;
  37215. var methods = vm.$options.methods;
  37216. var i = keys.length;
  37217. while (i--) {
  37218. var key = keys[i];
  37219. {
  37220. if (methods && hasOwn(methods, key)) {
  37221. warn(
  37222. ("Method \"" + key + "\" has already been defined as a data property."),
  37223. vm
  37224. );
  37225. }
  37226. }
  37227. if (props && hasOwn(props, key)) {
  37228. warn(
  37229. "The data property \"" + key + "\" is already declared as a prop. " +
  37230. "Use prop default value instead.",
  37231. vm
  37232. );
  37233. } else if (!isReserved(key)) {
  37234. proxy(vm, "_data", key);
  37235. }
  37236. }
  37237. // observe data
  37238. observe(data, true /* asRootData */);
  37239. }
  37240. function getData (data, vm) {
  37241. // #7573 disable dep collection when invoking data getters
  37242. pushTarget();
  37243. try {
  37244. return data.call(vm, vm)
  37245. } catch (e) {
  37246. handleError(e, vm, "data()");
  37247. return {}
  37248. } finally {
  37249. popTarget();
  37250. }
  37251. }
  37252. var computedWatcherOptions = { lazy: true };
  37253. function initComputed (vm, computed) {
  37254. // $flow-disable-line
  37255. var watchers = vm._computedWatchers = Object.create(null);
  37256. // computed properties are just getters during SSR
  37257. var isSSR = isServerRendering();
  37258. for (var key in computed) {
  37259. var userDef = computed[key];
  37260. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  37261. if (getter == null) {
  37262. warn(
  37263. ("Getter is missing for computed property \"" + key + "\"."),
  37264. vm
  37265. );
  37266. }
  37267. if (!isSSR) {
  37268. // create internal watcher for the computed property.
  37269. watchers[key] = new Watcher(
  37270. vm,
  37271. getter || noop,
  37272. noop,
  37273. computedWatcherOptions
  37274. );
  37275. }
  37276. // component-defined computed properties are already defined on the
  37277. // component prototype. We only need to define computed properties defined
  37278. // at instantiation here.
  37279. if (!(key in vm)) {
  37280. defineComputed(vm, key, userDef);
  37281. } else {
  37282. if (key in vm.$data) {
  37283. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  37284. } else if (vm.$options.props && key in vm.$options.props) {
  37285. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  37286. }
  37287. }
  37288. }
  37289. }
  37290. function defineComputed (
  37291. target,
  37292. key,
  37293. userDef
  37294. ) {
  37295. var shouldCache = !isServerRendering();
  37296. if (typeof userDef === 'function') {
  37297. sharedPropertyDefinition.get = shouldCache
  37298. ? createComputedGetter(key)
  37299. : createGetterInvoker(userDef);
  37300. sharedPropertyDefinition.set = noop;
  37301. } else {
  37302. sharedPropertyDefinition.get = userDef.get
  37303. ? shouldCache && userDef.cache !== false
  37304. ? createComputedGetter(key)
  37305. : createGetterInvoker(userDef.get)
  37306. : noop;
  37307. sharedPropertyDefinition.set = userDef.set || noop;
  37308. }
  37309. if (sharedPropertyDefinition.set === noop) {
  37310. sharedPropertyDefinition.set = function () {
  37311. warn(
  37312. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  37313. this
  37314. );
  37315. };
  37316. }
  37317. Object.defineProperty(target, key, sharedPropertyDefinition);
  37318. }
  37319. function createComputedGetter (key) {
  37320. return function computedGetter () {
  37321. var watcher = this._computedWatchers && this._computedWatchers[key];
  37322. if (watcher) {
  37323. if (watcher.dirty) {
  37324. watcher.evaluate();
  37325. }
  37326. if (Dep.target) {
  37327. watcher.depend();
  37328. }
  37329. return watcher.value
  37330. }
  37331. }
  37332. }
  37333. function createGetterInvoker(fn) {
  37334. return function computedGetter () {
  37335. return fn.call(this, this)
  37336. }
  37337. }
  37338. function initMethods (vm, methods) {
  37339. var props = vm.$options.props;
  37340. for (var key in methods) {
  37341. {
  37342. if (typeof methods[key] !== 'function') {
  37343. warn(
  37344. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  37345. "Did you reference the function correctly?",
  37346. vm
  37347. );
  37348. }
  37349. if (props && hasOwn(props, key)) {
  37350. warn(
  37351. ("Method \"" + key + "\" has already been defined as a prop."),
  37352. vm
  37353. );
  37354. }
  37355. if ((key in vm) && isReserved(key)) {
  37356. warn(
  37357. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  37358. "Avoid defining component methods that start with _ or $."
  37359. );
  37360. }
  37361. }
  37362. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  37363. }
  37364. }
  37365. function initWatch (vm, watch) {
  37366. for (var key in watch) {
  37367. var handler = watch[key];
  37368. if (Array.isArray(handler)) {
  37369. for (var i = 0; i < handler.length; i++) {
  37370. createWatcher(vm, key, handler[i]);
  37371. }
  37372. } else {
  37373. createWatcher(vm, key, handler);
  37374. }
  37375. }
  37376. }
  37377. function createWatcher (
  37378. vm,
  37379. expOrFn,
  37380. handler,
  37381. options
  37382. ) {
  37383. if (isPlainObject(handler)) {
  37384. options = handler;
  37385. handler = handler.handler;
  37386. }
  37387. if (typeof handler === 'string') {
  37388. handler = vm[handler];
  37389. }
  37390. return vm.$watch(expOrFn, handler, options)
  37391. }
  37392. function stateMixin (Vue) {
  37393. // flow somehow has problems with directly declared definition object
  37394. // when using Object.defineProperty, so we have to procedurally build up
  37395. // the object here.
  37396. var dataDef = {};
  37397. dataDef.get = function () { return this._data };
  37398. var propsDef = {};
  37399. propsDef.get = function () { return this._props };
  37400. {
  37401. dataDef.set = function () {
  37402. warn(
  37403. 'Avoid replacing instance root $data. ' +
  37404. 'Use nested data properties instead.',
  37405. this
  37406. );
  37407. };
  37408. propsDef.set = function () {
  37409. warn("$props is readonly.", this);
  37410. };
  37411. }
  37412. Object.defineProperty(Vue.prototype, '$data', dataDef);
  37413. Object.defineProperty(Vue.prototype, '$props', propsDef);
  37414. Vue.prototype.$set = set;
  37415. Vue.prototype.$delete = del;
  37416. Vue.prototype.$watch = function (
  37417. expOrFn,
  37418. cb,
  37419. options
  37420. ) {
  37421. var vm = this;
  37422. if (isPlainObject(cb)) {
  37423. return createWatcher(vm, expOrFn, cb, options)
  37424. }
  37425. options = options || {};
  37426. options.user = true;
  37427. var watcher = new Watcher(vm, expOrFn, cb, options);
  37428. if (options.immediate) {
  37429. try {
  37430. cb.call(vm, watcher.value);
  37431. } catch (error) {
  37432. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  37433. }
  37434. }
  37435. return function unwatchFn () {
  37436. watcher.teardown();
  37437. }
  37438. };
  37439. }
  37440. /* */
  37441. var uid$3 = 0;
  37442. function initMixin (Vue) {
  37443. Vue.prototype._init = function (options) {
  37444. var vm = this;
  37445. // a uid
  37446. vm._uid = uid$3++;
  37447. var startTag, endTag;
  37448. /* istanbul ignore if */
  37449. if (config.performance && mark) {
  37450. startTag = "vue-perf-start:" + (vm._uid);
  37451. endTag = "vue-perf-end:" + (vm._uid);
  37452. mark(startTag);
  37453. }
  37454. // a flag to avoid this being observed
  37455. vm._isVue = true;
  37456. // merge options
  37457. if (options && options._isComponent) {
  37458. // optimize internal component instantiation
  37459. // since dynamic options merging is pretty slow, and none of the
  37460. // internal component options needs special treatment.
  37461. initInternalComponent(vm, options);
  37462. } else {
  37463. vm.$options = mergeOptions(
  37464. resolveConstructorOptions(vm.constructor),
  37465. options || {},
  37466. vm
  37467. );
  37468. }
  37469. /* istanbul ignore else */
  37470. {
  37471. initProxy(vm);
  37472. }
  37473. // expose real self
  37474. vm._self = vm;
  37475. initLifecycle(vm);
  37476. initEvents(vm);
  37477. initRender(vm);
  37478. callHook(vm, 'beforeCreate');
  37479. initInjections(vm); // resolve injections before data/props
  37480. initState(vm);
  37481. initProvide(vm); // resolve provide after data/props
  37482. callHook(vm, 'created');
  37483. /* istanbul ignore if */
  37484. if (config.performance && mark) {
  37485. vm._name = formatComponentName(vm, false);
  37486. mark(endTag);
  37487. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  37488. }
  37489. if (vm.$options.el) {
  37490. vm.$mount(vm.$options.el);
  37491. }
  37492. };
  37493. }
  37494. function initInternalComponent (vm, options) {
  37495. var opts = vm.$options = Object.create(vm.constructor.options);
  37496. // doing this because it's faster than dynamic enumeration.
  37497. var parentVnode = options._parentVnode;
  37498. opts.parent = options.parent;
  37499. opts._parentVnode = parentVnode;
  37500. var vnodeComponentOptions = parentVnode.componentOptions;
  37501. opts.propsData = vnodeComponentOptions.propsData;
  37502. opts._parentListeners = vnodeComponentOptions.listeners;
  37503. opts._renderChildren = vnodeComponentOptions.children;
  37504. opts._componentTag = vnodeComponentOptions.tag;
  37505. if (options.render) {
  37506. opts.render = options.render;
  37507. opts.staticRenderFns = options.staticRenderFns;
  37508. }
  37509. }
  37510. function resolveConstructorOptions (Ctor) {
  37511. var options = Ctor.options;
  37512. if (Ctor.super) {
  37513. var superOptions = resolveConstructorOptions(Ctor.super);
  37514. var cachedSuperOptions = Ctor.superOptions;
  37515. if (superOptions !== cachedSuperOptions) {
  37516. // super option changed,
  37517. // need to resolve new options.
  37518. Ctor.superOptions = superOptions;
  37519. // check if there are any late-modified/attached options (#4976)
  37520. var modifiedOptions = resolveModifiedOptions(Ctor);
  37521. // update base extend options
  37522. if (modifiedOptions) {
  37523. extend(Ctor.extendOptions, modifiedOptions);
  37524. }
  37525. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  37526. if (options.name) {
  37527. options.components[options.name] = Ctor;
  37528. }
  37529. }
  37530. }
  37531. return options
  37532. }
  37533. function resolveModifiedOptions (Ctor) {
  37534. var modified;
  37535. var latest = Ctor.options;
  37536. var sealed = Ctor.sealedOptions;
  37537. for (var key in latest) {
  37538. if (latest[key] !== sealed[key]) {
  37539. if (!modified) { modified = {}; }
  37540. modified[key] = latest[key];
  37541. }
  37542. }
  37543. return modified
  37544. }
  37545. function Vue (options) {
  37546. if (!(this instanceof Vue)
  37547. ) {
  37548. warn('Vue is a constructor and should be called with the `new` keyword');
  37549. }
  37550. this._init(options);
  37551. }
  37552. initMixin(Vue);
  37553. stateMixin(Vue);
  37554. eventsMixin(Vue);
  37555. lifecycleMixin(Vue);
  37556. renderMixin(Vue);
  37557. /* */
  37558. function initUse (Vue) {
  37559. Vue.use = function (plugin) {
  37560. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  37561. if (installedPlugins.indexOf(plugin) > -1) {
  37562. return this
  37563. }
  37564. // additional parameters
  37565. var args = toArray(arguments, 1);
  37566. args.unshift(this);
  37567. if (typeof plugin.install === 'function') {
  37568. plugin.install.apply(plugin, args);
  37569. } else if (typeof plugin === 'function') {
  37570. plugin.apply(null, args);
  37571. }
  37572. installedPlugins.push(plugin);
  37573. return this
  37574. };
  37575. }
  37576. /* */
  37577. function initMixin$1 (Vue) {
  37578. Vue.mixin = function (mixin) {
  37579. this.options = mergeOptions(this.options, mixin);
  37580. return this
  37581. };
  37582. }
  37583. /* */
  37584. function initExtend (Vue) {
  37585. /**
  37586. * Each instance constructor, including Vue, has a unique
  37587. * cid. This enables us to create wrapped "child
  37588. * constructors" for prototypal inheritance and cache them.
  37589. */
  37590. Vue.cid = 0;
  37591. var cid = 1;
  37592. /**
  37593. * Class inheritance
  37594. */
  37595. Vue.extend = function (extendOptions) {
  37596. extendOptions = extendOptions || {};
  37597. var Super = this;
  37598. var SuperId = Super.cid;
  37599. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  37600. if (cachedCtors[SuperId]) {
  37601. return cachedCtors[SuperId]
  37602. }
  37603. var name = extendOptions.name || Super.options.name;
  37604. if (name) {
  37605. validateComponentName(name);
  37606. }
  37607. var Sub = function VueComponent (options) {
  37608. this._init(options);
  37609. };
  37610. Sub.prototype = Object.create(Super.prototype);
  37611. Sub.prototype.constructor = Sub;
  37612. Sub.cid = cid++;
  37613. Sub.options = mergeOptions(
  37614. Super.options,
  37615. extendOptions
  37616. );
  37617. Sub['super'] = Super;
  37618. // For props and computed properties, we define the proxy getters on
  37619. // the Vue instances at extension time, on the extended prototype. This
  37620. // avoids Object.defineProperty calls for each instance created.
  37621. if (Sub.options.props) {
  37622. initProps$1(Sub);
  37623. }
  37624. if (Sub.options.computed) {
  37625. initComputed$1(Sub);
  37626. }
  37627. // allow further extension/mixin/plugin usage
  37628. Sub.extend = Super.extend;
  37629. Sub.mixin = Super.mixin;
  37630. Sub.use = Super.use;
  37631. // create asset registers, so extended classes
  37632. // can have their private assets too.
  37633. ASSET_TYPES.forEach(function (type) {
  37634. Sub[type] = Super[type];
  37635. });
  37636. // enable recursive self-lookup
  37637. if (name) {
  37638. Sub.options.components[name] = Sub;
  37639. }
  37640. // keep a reference to the super options at extension time.
  37641. // later at instantiation we can check if Super's options have
  37642. // been updated.
  37643. Sub.superOptions = Super.options;
  37644. Sub.extendOptions = extendOptions;
  37645. Sub.sealedOptions = extend({}, Sub.options);
  37646. // cache constructor
  37647. cachedCtors[SuperId] = Sub;
  37648. return Sub
  37649. };
  37650. }
  37651. function initProps$1 (Comp) {
  37652. var props = Comp.options.props;
  37653. for (var key in props) {
  37654. proxy(Comp.prototype, "_props", key);
  37655. }
  37656. }
  37657. function initComputed$1 (Comp) {
  37658. var computed = Comp.options.computed;
  37659. for (var key in computed) {
  37660. defineComputed(Comp.prototype, key, computed[key]);
  37661. }
  37662. }
  37663. /* */
  37664. function initAssetRegisters (Vue) {
  37665. /**
  37666. * Create asset registration methods.
  37667. */
  37668. ASSET_TYPES.forEach(function (type) {
  37669. Vue[type] = function (
  37670. id,
  37671. definition
  37672. ) {
  37673. if (!definition) {
  37674. return this.options[type + 's'][id]
  37675. } else {
  37676. /* istanbul ignore if */
  37677. if (type === 'component') {
  37678. validateComponentName(id);
  37679. }
  37680. if (type === 'component' && isPlainObject(definition)) {
  37681. definition.name = definition.name || id;
  37682. definition = this.options._base.extend(definition);
  37683. }
  37684. if (type === 'directive' && typeof definition === 'function') {
  37685. definition = { bind: definition, update: definition };
  37686. }
  37687. this.options[type + 's'][id] = definition;
  37688. return definition
  37689. }
  37690. };
  37691. });
  37692. }
  37693. /* */
  37694. function getComponentName (opts) {
  37695. return opts && (opts.Ctor.options.name || opts.tag)
  37696. }
  37697. function matches (pattern, name) {
  37698. if (Array.isArray(pattern)) {
  37699. return pattern.indexOf(name) > -1
  37700. } else if (typeof pattern === 'string') {
  37701. return pattern.split(',').indexOf(name) > -1
  37702. } else if (isRegExp(pattern)) {
  37703. return pattern.test(name)
  37704. }
  37705. /* istanbul ignore next */
  37706. return false
  37707. }
  37708. function pruneCache (keepAliveInstance, filter) {
  37709. var cache = keepAliveInstance.cache;
  37710. var keys = keepAliveInstance.keys;
  37711. var _vnode = keepAliveInstance._vnode;
  37712. for (var key in cache) {
  37713. var cachedNode = cache[key];
  37714. if (cachedNode) {
  37715. var name = getComponentName(cachedNode.componentOptions);
  37716. if (name && !filter(name)) {
  37717. pruneCacheEntry(cache, key, keys, _vnode);
  37718. }
  37719. }
  37720. }
  37721. }
  37722. function pruneCacheEntry (
  37723. cache,
  37724. key,
  37725. keys,
  37726. current
  37727. ) {
  37728. var cached$$1 = cache[key];
  37729. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  37730. cached$$1.componentInstance.$destroy();
  37731. }
  37732. cache[key] = null;
  37733. remove(keys, key);
  37734. }
  37735. var patternTypes = [String, RegExp, Array];
  37736. var KeepAlive = {
  37737. name: 'keep-alive',
  37738. abstract: true,
  37739. props: {
  37740. include: patternTypes,
  37741. exclude: patternTypes,
  37742. max: [String, Number]
  37743. },
  37744. created: function created () {
  37745. this.cache = Object.create(null);
  37746. this.keys = [];
  37747. },
  37748. destroyed: function destroyed () {
  37749. for (var key in this.cache) {
  37750. pruneCacheEntry(this.cache, key, this.keys);
  37751. }
  37752. },
  37753. mounted: function mounted () {
  37754. var this$1 = this;
  37755. this.$watch('include', function (val) {
  37756. pruneCache(this$1, function (name) { return matches(val, name); });
  37757. });
  37758. this.$watch('exclude', function (val) {
  37759. pruneCache(this$1, function (name) { return !matches(val, name); });
  37760. });
  37761. },
  37762. render: function render () {
  37763. var slot = this.$slots.default;
  37764. var vnode = getFirstComponentChild(slot);
  37765. var componentOptions = vnode && vnode.componentOptions;
  37766. if (componentOptions) {
  37767. // check pattern
  37768. var name = getComponentName(componentOptions);
  37769. var ref = this;
  37770. var include = ref.include;
  37771. var exclude = ref.exclude;
  37772. if (
  37773. // not included
  37774. (include && (!name || !matches(include, name))) ||
  37775. // excluded
  37776. (exclude && name && matches(exclude, name))
  37777. ) {
  37778. return vnode
  37779. }
  37780. var ref$1 = this;
  37781. var cache = ref$1.cache;
  37782. var keys = ref$1.keys;
  37783. var key = vnode.key == null
  37784. // same constructor may get registered as different local components
  37785. // so cid alone is not enough (#3269)
  37786. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  37787. : vnode.key;
  37788. if (cache[key]) {
  37789. vnode.componentInstance = cache[key].componentInstance;
  37790. // make current key freshest
  37791. remove(keys, key);
  37792. keys.push(key);
  37793. } else {
  37794. cache[key] = vnode;
  37795. keys.push(key);
  37796. // prune oldest entry
  37797. if (this.max && keys.length > parseInt(this.max)) {
  37798. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  37799. }
  37800. }
  37801. vnode.data.keepAlive = true;
  37802. }
  37803. return vnode || (slot && slot[0])
  37804. }
  37805. };
  37806. var builtInComponents = {
  37807. KeepAlive: KeepAlive
  37808. };
  37809. /* */
  37810. function initGlobalAPI (Vue) {
  37811. // config
  37812. var configDef = {};
  37813. configDef.get = function () { return config; };
  37814. {
  37815. configDef.set = function () {
  37816. warn(
  37817. 'Do not replace the Vue.config object, set individual fields instead.'
  37818. );
  37819. };
  37820. }
  37821. Object.defineProperty(Vue, 'config', configDef);
  37822. // exposed util methods.
  37823. // NOTE: these are not considered part of the public API - avoid relying on
  37824. // them unless you are aware of the risk.
  37825. Vue.util = {
  37826. warn: warn,
  37827. extend: extend,
  37828. mergeOptions: mergeOptions,
  37829. defineReactive: defineReactive$$1
  37830. };
  37831. Vue.set = set;
  37832. Vue.delete = del;
  37833. Vue.nextTick = nextTick;
  37834. // 2.6 explicit observable API
  37835. Vue.observable = function (obj) {
  37836. observe(obj);
  37837. return obj
  37838. };
  37839. Vue.options = Object.create(null);
  37840. ASSET_TYPES.forEach(function (type) {
  37841. Vue.options[type + 's'] = Object.create(null);
  37842. });
  37843. // this is used to identify the "base" constructor to extend all plain-object
  37844. // components with in Weex's multi-instance scenarios.
  37845. Vue.options._base = Vue;
  37846. extend(Vue.options.components, builtInComponents);
  37847. initUse(Vue);
  37848. initMixin$1(Vue);
  37849. initExtend(Vue);
  37850. initAssetRegisters(Vue);
  37851. }
  37852. initGlobalAPI(Vue);
  37853. Object.defineProperty(Vue.prototype, '$isServer', {
  37854. get: isServerRendering
  37855. });
  37856. Object.defineProperty(Vue.prototype, '$ssrContext', {
  37857. get: function get () {
  37858. /* istanbul ignore next */
  37859. return this.$vnode && this.$vnode.ssrContext
  37860. }
  37861. });
  37862. // expose FunctionalRenderContext for ssr runtime helper installation
  37863. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  37864. value: FunctionalRenderContext
  37865. });
  37866. Vue.version = '2.6.12';
  37867. /* */
  37868. // these are reserved for web because they are directly compiled away
  37869. // during template compilation
  37870. var isReservedAttr = makeMap('style,class');
  37871. // attributes that should be using props for binding
  37872. var acceptValue = makeMap('input,textarea,option,select,progress');
  37873. var mustUseProp = function (tag, type, attr) {
  37874. return (
  37875. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  37876. (attr === 'selected' && tag === 'option') ||
  37877. (attr === 'checked' && tag === 'input') ||
  37878. (attr === 'muted' && tag === 'video')
  37879. )
  37880. };
  37881. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  37882. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  37883. var convertEnumeratedValue = function (key, value) {
  37884. return isFalsyAttrValue(value) || value === 'false'
  37885. ? 'false'
  37886. // allow arbitrary string value for contenteditable
  37887. : key === 'contenteditable' && isValidContentEditableValue(value)
  37888. ? value
  37889. : 'true'
  37890. };
  37891. var isBooleanAttr = makeMap(
  37892. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  37893. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  37894. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  37895. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  37896. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  37897. 'truespeed,typemustmatch,visible'
  37898. );
  37899. var xlinkNS = 'http://www.w3.org/1999/xlink';
  37900. var isXlink = function (name) {
  37901. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  37902. };
  37903. var getXlinkProp = function (name) {
  37904. return isXlink(name) ? name.slice(6, name.length) : ''
  37905. };
  37906. var isFalsyAttrValue = function (val) {
  37907. return val == null || val === false
  37908. };
  37909. /* */
  37910. function genClassForVnode (vnode) {
  37911. var data = vnode.data;
  37912. var parentNode = vnode;
  37913. var childNode = vnode;
  37914. while (isDef(childNode.componentInstance)) {
  37915. childNode = childNode.componentInstance._vnode;
  37916. if (childNode && childNode.data) {
  37917. data = mergeClassData(childNode.data, data);
  37918. }
  37919. }
  37920. while (isDef(parentNode = parentNode.parent)) {
  37921. if (parentNode && parentNode.data) {
  37922. data = mergeClassData(data, parentNode.data);
  37923. }
  37924. }
  37925. return renderClass(data.staticClass, data.class)
  37926. }
  37927. function mergeClassData (child, parent) {
  37928. return {
  37929. staticClass: concat(child.staticClass, parent.staticClass),
  37930. class: isDef(child.class)
  37931. ? [child.class, parent.class]
  37932. : parent.class
  37933. }
  37934. }
  37935. function renderClass (
  37936. staticClass,
  37937. dynamicClass
  37938. ) {
  37939. if (isDef(staticClass) || isDef(dynamicClass)) {
  37940. return concat(staticClass, stringifyClass(dynamicClass))
  37941. }
  37942. /* istanbul ignore next */
  37943. return ''
  37944. }
  37945. function concat (a, b) {
  37946. return a ? b ? (a + ' ' + b) : a : (b || '')
  37947. }
  37948. function stringifyClass (value) {
  37949. if (Array.isArray(value)) {
  37950. return stringifyArray(value)
  37951. }
  37952. if (isObject(value)) {
  37953. return stringifyObject(value)
  37954. }
  37955. if (typeof value === 'string') {
  37956. return value
  37957. }
  37958. /* istanbul ignore next */
  37959. return ''
  37960. }
  37961. function stringifyArray (value) {
  37962. var res = '';
  37963. var stringified;
  37964. for (var i = 0, l = value.length; i < l; i++) {
  37965. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  37966. if (res) { res += ' '; }
  37967. res += stringified;
  37968. }
  37969. }
  37970. return res
  37971. }
  37972. function stringifyObject (value) {
  37973. var res = '';
  37974. for (var key in value) {
  37975. if (value[key]) {
  37976. if (res) { res += ' '; }
  37977. res += key;
  37978. }
  37979. }
  37980. return res
  37981. }
  37982. /* */
  37983. var namespaceMap = {
  37984. svg: 'http://www.w3.org/2000/svg',
  37985. math: 'http://www.w3.org/1998/Math/MathML'
  37986. };
  37987. var isHTMLTag = makeMap(
  37988. 'html,body,base,head,link,meta,style,title,' +
  37989. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  37990. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  37991. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  37992. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  37993. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  37994. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  37995. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  37996. 'output,progress,select,textarea,' +
  37997. 'details,dialog,menu,menuitem,summary,' +
  37998. 'content,element,shadow,template,blockquote,iframe,tfoot'
  37999. );
  38000. // this map is intentionally selective, only covering SVG elements that may
  38001. // contain child elements.
  38002. var isSVG = makeMap(
  38003. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  38004. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  38005. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  38006. true
  38007. );
  38008. var isPreTag = function (tag) { return tag === 'pre'; };
  38009. var isReservedTag = function (tag) {
  38010. return isHTMLTag(tag) || isSVG(tag)
  38011. };
  38012. function getTagNamespace (tag) {
  38013. if (isSVG(tag)) {
  38014. return 'svg'
  38015. }
  38016. // basic support for MathML
  38017. // note it doesn't support other MathML elements being component roots
  38018. if (tag === 'math') {
  38019. return 'math'
  38020. }
  38021. }
  38022. var unknownElementCache = Object.create(null);
  38023. function isUnknownElement (tag) {
  38024. /* istanbul ignore if */
  38025. if (!inBrowser) {
  38026. return true
  38027. }
  38028. if (isReservedTag(tag)) {
  38029. return false
  38030. }
  38031. tag = tag.toLowerCase();
  38032. /* istanbul ignore if */
  38033. if (unknownElementCache[tag] != null) {
  38034. return unknownElementCache[tag]
  38035. }
  38036. var el = document.createElement(tag);
  38037. if (tag.indexOf('-') > -1) {
  38038. // http://stackoverflow.com/a/28210364/1070244
  38039. return (unknownElementCache[tag] = (
  38040. el.constructor === window.HTMLUnknownElement ||
  38041. el.constructor === window.HTMLElement
  38042. ))
  38043. } else {
  38044. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  38045. }
  38046. }
  38047. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  38048. /* */
  38049. /**
  38050. * Query an element selector if it's not an element already.
  38051. */
  38052. function query (el) {
  38053. if (typeof el === 'string') {
  38054. var selected = document.querySelector(el);
  38055. if (!selected) {
  38056. warn(
  38057. 'Cannot find element: ' + el
  38058. );
  38059. return document.createElement('div')
  38060. }
  38061. return selected
  38062. } else {
  38063. return el
  38064. }
  38065. }
  38066. /* */
  38067. function createElement$1 (tagName, vnode) {
  38068. var elm = document.createElement(tagName);
  38069. if (tagName !== 'select') {
  38070. return elm
  38071. }
  38072. // false or null will remove the attribute but undefined will not
  38073. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  38074. elm.setAttribute('multiple', 'multiple');
  38075. }
  38076. return elm
  38077. }
  38078. function createElementNS (namespace, tagName) {
  38079. return document.createElementNS(namespaceMap[namespace], tagName)
  38080. }
  38081. function createTextNode (text) {
  38082. return document.createTextNode(text)
  38083. }
  38084. function createComment (text) {
  38085. return document.createComment(text)
  38086. }
  38087. function insertBefore (parentNode, newNode, referenceNode) {
  38088. parentNode.insertBefore(newNode, referenceNode);
  38089. }
  38090. function removeChild (node, child) {
  38091. node.removeChild(child);
  38092. }
  38093. function appendChild (node, child) {
  38094. node.appendChild(child);
  38095. }
  38096. function parentNode (node) {
  38097. return node.parentNode
  38098. }
  38099. function nextSibling (node) {
  38100. return node.nextSibling
  38101. }
  38102. function tagName (node) {
  38103. return node.tagName
  38104. }
  38105. function setTextContent (node, text) {
  38106. node.textContent = text;
  38107. }
  38108. function setStyleScope (node, scopeId) {
  38109. node.setAttribute(scopeId, '');
  38110. }
  38111. var nodeOps = /*#__PURE__*/Object.freeze({
  38112. createElement: createElement$1,
  38113. createElementNS: createElementNS,
  38114. createTextNode: createTextNode,
  38115. createComment: createComment,
  38116. insertBefore: insertBefore,
  38117. removeChild: removeChild,
  38118. appendChild: appendChild,
  38119. parentNode: parentNode,
  38120. nextSibling: nextSibling,
  38121. tagName: tagName,
  38122. setTextContent: setTextContent,
  38123. setStyleScope: setStyleScope
  38124. });
  38125. /* */
  38126. var ref = {
  38127. create: function create (_, vnode) {
  38128. registerRef(vnode);
  38129. },
  38130. update: function update (oldVnode, vnode) {
  38131. if (oldVnode.data.ref !== vnode.data.ref) {
  38132. registerRef(oldVnode, true);
  38133. registerRef(vnode);
  38134. }
  38135. },
  38136. destroy: function destroy (vnode) {
  38137. registerRef(vnode, true);
  38138. }
  38139. };
  38140. function registerRef (vnode, isRemoval) {
  38141. var key = vnode.data.ref;
  38142. if (!isDef(key)) { return }
  38143. var vm = vnode.context;
  38144. var ref = vnode.componentInstance || vnode.elm;
  38145. var refs = vm.$refs;
  38146. if (isRemoval) {
  38147. if (Array.isArray(refs[key])) {
  38148. remove(refs[key], ref);
  38149. } else if (refs[key] === ref) {
  38150. refs[key] = undefined;
  38151. }
  38152. } else {
  38153. if (vnode.data.refInFor) {
  38154. if (!Array.isArray(refs[key])) {
  38155. refs[key] = [ref];
  38156. } else if (refs[key].indexOf(ref) < 0) {
  38157. // $flow-disable-line
  38158. refs[key].push(ref);
  38159. }
  38160. } else {
  38161. refs[key] = ref;
  38162. }
  38163. }
  38164. }
  38165. /**
  38166. * Virtual DOM patching algorithm based on Snabbdom by
  38167. * Simon Friis Vindum (@paldepind)
  38168. * Licensed under the MIT License
  38169. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  38170. *
  38171. * modified by Evan You (@yyx990803)
  38172. *
  38173. * Not type-checking this because this file is perf-critical and the cost
  38174. * of making flow understand it is not worth it.
  38175. */
  38176. var emptyNode = new VNode('', {}, []);
  38177. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  38178. function sameVnode (a, b) {
  38179. return (
  38180. a.key === b.key && (
  38181. (
  38182. a.tag === b.tag &&
  38183. a.isComment === b.isComment &&
  38184. isDef(a.data) === isDef(b.data) &&
  38185. sameInputType(a, b)
  38186. ) || (
  38187. isTrue(a.isAsyncPlaceholder) &&
  38188. a.asyncFactory === b.asyncFactory &&
  38189. isUndef(b.asyncFactory.error)
  38190. )
  38191. )
  38192. )
  38193. }
  38194. function sameInputType (a, b) {
  38195. if (a.tag !== 'input') { return true }
  38196. var i;
  38197. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  38198. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  38199. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  38200. }
  38201. function createKeyToOldIdx (children, beginIdx, endIdx) {
  38202. var i, key;
  38203. var map = {};
  38204. for (i = beginIdx; i <= endIdx; ++i) {
  38205. key = children[i].key;
  38206. if (isDef(key)) { map[key] = i; }
  38207. }
  38208. return map
  38209. }
  38210. function createPatchFunction (backend) {
  38211. var i, j;
  38212. var cbs = {};
  38213. var modules = backend.modules;
  38214. var nodeOps = backend.nodeOps;
  38215. for (i = 0; i < hooks.length; ++i) {
  38216. cbs[hooks[i]] = [];
  38217. for (j = 0; j < modules.length; ++j) {
  38218. if (isDef(modules[j][hooks[i]])) {
  38219. cbs[hooks[i]].push(modules[j][hooks[i]]);
  38220. }
  38221. }
  38222. }
  38223. function emptyNodeAt (elm) {
  38224. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  38225. }
  38226. function createRmCb (childElm, listeners) {
  38227. function remove$$1 () {
  38228. if (--remove$$1.listeners === 0) {
  38229. removeNode(childElm);
  38230. }
  38231. }
  38232. remove$$1.listeners = listeners;
  38233. return remove$$1
  38234. }
  38235. function removeNode (el) {
  38236. var parent = nodeOps.parentNode(el);
  38237. // element may have already been removed due to v-html / v-text
  38238. if (isDef(parent)) {
  38239. nodeOps.removeChild(parent, el);
  38240. }
  38241. }
  38242. function isUnknownElement$$1 (vnode, inVPre) {
  38243. return (
  38244. !inVPre &&
  38245. !vnode.ns &&
  38246. !(
  38247. config.ignoredElements.length &&
  38248. config.ignoredElements.some(function (ignore) {
  38249. return isRegExp(ignore)
  38250. ? ignore.test(vnode.tag)
  38251. : ignore === vnode.tag
  38252. })
  38253. ) &&
  38254. config.isUnknownElement(vnode.tag)
  38255. )
  38256. }
  38257. var creatingElmInVPre = 0;
  38258. function createElm (
  38259. vnode,
  38260. insertedVnodeQueue,
  38261. parentElm,
  38262. refElm,
  38263. nested,
  38264. ownerArray,
  38265. index
  38266. ) {
  38267. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38268. // This vnode was used in a previous render!
  38269. // now it's used as a new node, overwriting its elm would cause
  38270. // potential patch errors down the road when it's used as an insertion
  38271. // reference node. Instead, we clone the node on-demand before creating
  38272. // associated DOM element for it.
  38273. vnode = ownerArray[index] = cloneVNode(vnode);
  38274. }
  38275. vnode.isRootInsert = !nested; // for transition enter check
  38276. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  38277. return
  38278. }
  38279. var data = vnode.data;
  38280. var children = vnode.children;
  38281. var tag = vnode.tag;
  38282. if (isDef(tag)) {
  38283. {
  38284. if (data && data.pre) {
  38285. creatingElmInVPre++;
  38286. }
  38287. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  38288. warn(
  38289. 'Unknown custom element: <' + tag + '> - did you ' +
  38290. 'register the component correctly? For recursive components, ' +
  38291. 'make sure to provide the "name" option.',
  38292. vnode.context
  38293. );
  38294. }
  38295. }
  38296. vnode.elm = vnode.ns
  38297. ? nodeOps.createElementNS(vnode.ns, tag)
  38298. : nodeOps.createElement(tag, vnode);
  38299. setScope(vnode);
  38300. /* istanbul ignore if */
  38301. {
  38302. createChildren(vnode, children, insertedVnodeQueue);
  38303. if (isDef(data)) {
  38304. invokeCreateHooks(vnode, insertedVnodeQueue);
  38305. }
  38306. insert(parentElm, vnode.elm, refElm);
  38307. }
  38308. if (data && data.pre) {
  38309. creatingElmInVPre--;
  38310. }
  38311. } else if (isTrue(vnode.isComment)) {
  38312. vnode.elm = nodeOps.createComment(vnode.text);
  38313. insert(parentElm, vnode.elm, refElm);
  38314. } else {
  38315. vnode.elm = nodeOps.createTextNode(vnode.text);
  38316. insert(parentElm, vnode.elm, refElm);
  38317. }
  38318. }
  38319. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38320. var i = vnode.data;
  38321. if (isDef(i)) {
  38322. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  38323. if (isDef(i = i.hook) && isDef(i = i.init)) {
  38324. i(vnode, false /* hydrating */);
  38325. }
  38326. // after calling the init hook, if the vnode is a child component
  38327. // it should've created a child instance and mounted it. the child
  38328. // component also has set the placeholder vnode's elm.
  38329. // in that case we can just return the element and be done.
  38330. if (isDef(vnode.componentInstance)) {
  38331. initComponent(vnode, insertedVnodeQueue);
  38332. insert(parentElm, vnode.elm, refElm);
  38333. if (isTrue(isReactivated)) {
  38334. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  38335. }
  38336. return true
  38337. }
  38338. }
  38339. }
  38340. function initComponent (vnode, insertedVnodeQueue) {
  38341. if (isDef(vnode.data.pendingInsert)) {
  38342. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  38343. vnode.data.pendingInsert = null;
  38344. }
  38345. vnode.elm = vnode.componentInstance.$el;
  38346. if (isPatchable(vnode)) {
  38347. invokeCreateHooks(vnode, insertedVnodeQueue);
  38348. setScope(vnode);
  38349. } else {
  38350. // empty component root.
  38351. // skip all element-related modules except for ref (#3455)
  38352. registerRef(vnode);
  38353. // make sure to invoke the insert hook
  38354. insertedVnodeQueue.push(vnode);
  38355. }
  38356. }
  38357. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38358. var i;
  38359. // hack for #4339: a reactivated component with inner transition
  38360. // does not trigger because the inner node's created hooks are not called
  38361. // again. It's not ideal to involve module-specific logic in here but
  38362. // there doesn't seem to be a better way to do it.
  38363. var innerNode = vnode;
  38364. while (innerNode.componentInstance) {
  38365. innerNode = innerNode.componentInstance._vnode;
  38366. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  38367. for (i = 0; i < cbs.activate.length; ++i) {
  38368. cbs.activate[i](emptyNode, innerNode);
  38369. }
  38370. insertedVnodeQueue.push(innerNode);
  38371. break
  38372. }
  38373. }
  38374. // unlike a newly created component,
  38375. // a reactivated keep-alive component doesn't insert itself
  38376. insert(parentElm, vnode.elm, refElm);
  38377. }
  38378. function insert (parent, elm, ref$$1) {
  38379. if (isDef(parent)) {
  38380. if (isDef(ref$$1)) {
  38381. if (nodeOps.parentNode(ref$$1) === parent) {
  38382. nodeOps.insertBefore(parent, elm, ref$$1);
  38383. }
  38384. } else {
  38385. nodeOps.appendChild(parent, elm);
  38386. }
  38387. }
  38388. }
  38389. function createChildren (vnode, children, insertedVnodeQueue) {
  38390. if (Array.isArray(children)) {
  38391. {
  38392. checkDuplicateKeys(children);
  38393. }
  38394. for (var i = 0; i < children.length; ++i) {
  38395. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  38396. }
  38397. } else if (isPrimitive(vnode.text)) {
  38398. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  38399. }
  38400. }
  38401. function isPatchable (vnode) {
  38402. while (vnode.componentInstance) {
  38403. vnode = vnode.componentInstance._vnode;
  38404. }
  38405. return isDef(vnode.tag)
  38406. }
  38407. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  38408. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38409. cbs.create[i$1](emptyNode, vnode);
  38410. }
  38411. i = vnode.data.hook; // Reuse variable
  38412. if (isDef(i)) {
  38413. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  38414. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  38415. }
  38416. }
  38417. // set scope id attribute for scoped CSS.
  38418. // this is implemented as a special case to avoid the overhead
  38419. // of going through the normal attribute patching process.
  38420. function setScope (vnode) {
  38421. var i;
  38422. if (isDef(i = vnode.fnScopeId)) {
  38423. nodeOps.setStyleScope(vnode.elm, i);
  38424. } else {
  38425. var ancestor = vnode;
  38426. while (ancestor) {
  38427. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  38428. nodeOps.setStyleScope(vnode.elm, i);
  38429. }
  38430. ancestor = ancestor.parent;
  38431. }
  38432. }
  38433. // for slot content they should also get the scopeId from the host instance.
  38434. if (isDef(i = activeInstance) &&
  38435. i !== vnode.context &&
  38436. i !== vnode.fnContext &&
  38437. isDef(i = i.$options._scopeId)
  38438. ) {
  38439. nodeOps.setStyleScope(vnode.elm, i);
  38440. }
  38441. }
  38442. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  38443. for (; startIdx <= endIdx; ++startIdx) {
  38444. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  38445. }
  38446. }
  38447. function invokeDestroyHook (vnode) {
  38448. var i, j;
  38449. var data = vnode.data;
  38450. if (isDef(data)) {
  38451. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  38452. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  38453. }
  38454. if (isDef(i = vnode.children)) {
  38455. for (j = 0; j < vnode.children.length; ++j) {
  38456. invokeDestroyHook(vnode.children[j]);
  38457. }
  38458. }
  38459. }
  38460. function removeVnodes (vnodes, startIdx, endIdx) {
  38461. for (; startIdx <= endIdx; ++startIdx) {
  38462. var ch = vnodes[startIdx];
  38463. if (isDef(ch)) {
  38464. if (isDef(ch.tag)) {
  38465. removeAndInvokeRemoveHook(ch);
  38466. invokeDestroyHook(ch);
  38467. } else { // Text node
  38468. removeNode(ch.elm);
  38469. }
  38470. }
  38471. }
  38472. }
  38473. function removeAndInvokeRemoveHook (vnode, rm) {
  38474. if (isDef(rm) || isDef(vnode.data)) {
  38475. var i;
  38476. var listeners = cbs.remove.length + 1;
  38477. if (isDef(rm)) {
  38478. // we have a recursively passed down rm callback
  38479. // increase the listeners count
  38480. rm.listeners += listeners;
  38481. } else {
  38482. // directly removing
  38483. rm = createRmCb(vnode.elm, listeners);
  38484. }
  38485. // recursively invoke hooks on child component root node
  38486. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  38487. removeAndInvokeRemoveHook(i, rm);
  38488. }
  38489. for (i = 0; i < cbs.remove.length; ++i) {
  38490. cbs.remove[i](vnode, rm);
  38491. }
  38492. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  38493. i(vnode, rm);
  38494. } else {
  38495. rm();
  38496. }
  38497. } else {
  38498. removeNode(vnode.elm);
  38499. }
  38500. }
  38501. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  38502. var oldStartIdx = 0;
  38503. var newStartIdx = 0;
  38504. var oldEndIdx = oldCh.length - 1;
  38505. var oldStartVnode = oldCh[0];
  38506. var oldEndVnode = oldCh[oldEndIdx];
  38507. var newEndIdx = newCh.length - 1;
  38508. var newStartVnode = newCh[0];
  38509. var newEndVnode = newCh[newEndIdx];
  38510. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  38511. // removeOnly is a special flag used only by <transition-group>
  38512. // to ensure removed elements stay in correct relative positions
  38513. // during leaving transitions
  38514. var canMove = !removeOnly;
  38515. {
  38516. checkDuplicateKeys(newCh);
  38517. }
  38518. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  38519. if (isUndef(oldStartVnode)) {
  38520. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  38521. } else if (isUndef(oldEndVnode)) {
  38522. oldEndVnode = oldCh[--oldEndIdx];
  38523. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  38524. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38525. oldStartVnode = oldCh[++oldStartIdx];
  38526. newStartVnode = newCh[++newStartIdx];
  38527. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  38528. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38529. oldEndVnode = oldCh[--oldEndIdx];
  38530. newEndVnode = newCh[--newEndIdx];
  38531. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  38532. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38533. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  38534. oldStartVnode = oldCh[++oldStartIdx];
  38535. newEndVnode = newCh[--newEndIdx];
  38536. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  38537. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38538. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  38539. oldEndVnode = oldCh[--oldEndIdx];
  38540. newStartVnode = newCh[++newStartIdx];
  38541. } else {
  38542. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  38543. idxInOld = isDef(newStartVnode.key)
  38544. ? oldKeyToIdx[newStartVnode.key]
  38545. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  38546. if (isUndef(idxInOld)) { // New element
  38547. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38548. } else {
  38549. vnodeToMove = oldCh[idxInOld];
  38550. if (sameVnode(vnodeToMove, newStartVnode)) {
  38551. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38552. oldCh[idxInOld] = undefined;
  38553. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  38554. } else {
  38555. // same key but different element. treat as new element
  38556. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38557. }
  38558. }
  38559. newStartVnode = newCh[++newStartIdx];
  38560. }
  38561. }
  38562. if (oldStartIdx > oldEndIdx) {
  38563. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  38564. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  38565. } else if (newStartIdx > newEndIdx) {
  38566. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  38567. }
  38568. }
  38569. function checkDuplicateKeys (children) {
  38570. var seenKeys = {};
  38571. for (var i = 0; i < children.length; i++) {
  38572. var vnode = children[i];
  38573. var key = vnode.key;
  38574. if (isDef(key)) {
  38575. if (seenKeys[key]) {
  38576. warn(
  38577. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  38578. vnode.context
  38579. );
  38580. } else {
  38581. seenKeys[key] = true;
  38582. }
  38583. }
  38584. }
  38585. }
  38586. function findIdxInOld (node, oldCh, start, end) {
  38587. for (var i = start; i < end; i++) {
  38588. var c = oldCh[i];
  38589. if (isDef(c) && sameVnode(node, c)) { return i }
  38590. }
  38591. }
  38592. function patchVnode (
  38593. oldVnode,
  38594. vnode,
  38595. insertedVnodeQueue,
  38596. ownerArray,
  38597. index,
  38598. removeOnly
  38599. ) {
  38600. if (oldVnode === vnode) {
  38601. return
  38602. }
  38603. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38604. // clone reused vnode
  38605. vnode = ownerArray[index] = cloneVNode(vnode);
  38606. }
  38607. var elm = vnode.elm = oldVnode.elm;
  38608. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  38609. if (isDef(vnode.asyncFactory.resolved)) {
  38610. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  38611. } else {
  38612. vnode.isAsyncPlaceholder = true;
  38613. }
  38614. return
  38615. }
  38616. // reuse element for static trees.
  38617. // note we only do this if the vnode is cloned -
  38618. // if the new node is not cloned it means the render functions have been
  38619. // reset by the hot-reload-api and we need to do a proper re-render.
  38620. if (isTrue(vnode.isStatic) &&
  38621. isTrue(oldVnode.isStatic) &&
  38622. vnode.key === oldVnode.key &&
  38623. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  38624. ) {
  38625. vnode.componentInstance = oldVnode.componentInstance;
  38626. return
  38627. }
  38628. var i;
  38629. var data = vnode.data;
  38630. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  38631. i(oldVnode, vnode);
  38632. }
  38633. var oldCh = oldVnode.children;
  38634. var ch = vnode.children;
  38635. if (isDef(data) && isPatchable(vnode)) {
  38636. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  38637. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  38638. }
  38639. if (isUndef(vnode.text)) {
  38640. if (isDef(oldCh) && isDef(ch)) {
  38641. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  38642. } else if (isDef(ch)) {
  38643. {
  38644. checkDuplicateKeys(ch);
  38645. }
  38646. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  38647. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  38648. } else if (isDef(oldCh)) {
  38649. removeVnodes(oldCh, 0, oldCh.length - 1);
  38650. } else if (isDef(oldVnode.text)) {
  38651. nodeOps.setTextContent(elm, '');
  38652. }
  38653. } else if (oldVnode.text !== vnode.text) {
  38654. nodeOps.setTextContent(elm, vnode.text);
  38655. }
  38656. if (isDef(data)) {
  38657. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  38658. }
  38659. }
  38660. function invokeInsertHook (vnode, queue, initial) {
  38661. // delay insert hooks for component root nodes, invoke them after the
  38662. // element is really inserted
  38663. if (isTrue(initial) && isDef(vnode.parent)) {
  38664. vnode.parent.data.pendingInsert = queue;
  38665. } else {
  38666. for (var i = 0; i < queue.length; ++i) {
  38667. queue[i].data.hook.insert(queue[i]);
  38668. }
  38669. }
  38670. }
  38671. var hydrationBailed = false;
  38672. // list of modules that can skip create hook during hydration because they
  38673. // are already rendered on the client or has no need for initialization
  38674. // Note: style is excluded because it relies on initial clone for future
  38675. // deep updates (#7063).
  38676. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  38677. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  38678. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  38679. var i;
  38680. var tag = vnode.tag;
  38681. var data = vnode.data;
  38682. var children = vnode.children;
  38683. inVPre = inVPre || (data && data.pre);
  38684. vnode.elm = elm;
  38685. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  38686. vnode.isAsyncPlaceholder = true;
  38687. return true
  38688. }
  38689. // assert node match
  38690. {
  38691. if (!assertNodeMatch(elm, vnode, inVPre)) {
  38692. return false
  38693. }
  38694. }
  38695. if (isDef(data)) {
  38696. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  38697. if (isDef(i = vnode.componentInstance)) {
  38698. // child component. it should have hydrated its own tree.
  38699. initComponent(vnode, insertedVnodeQueue);
  38700. return true
  38701. }
  38702. }
  38703. if (isDef(tag)) {
  38704. if (isDef(children)) {
  38705. // empty element, allow client to pick up and populate children
  38706. if (!elm.hasChildNodes()) {
  38707. createChildren(vnode, children, insertedVnodeQueue);
  38708. } else {
  38709. // v-html and domProps: innerHTML
  38710. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  38711. if (i !== elm.innerHTML) {
  38712. /* istanbul ignore if */
  38713. if (typeof console !== 'undefined' &&
  38714. !hydrationBailed
  38715. ) {
  38716. hydrationBailed = true;
  38717. console.warn('Parent: ', elm);
  38718. console.warn('server innerHTML: ', i);
  38719. console.warn('client innerHTML: ', elm.innerHTML);
  38720. }
  38721. return false
  38722. }
  38723. } else {
  38724. // iterate and compare children lists
  38725. var childrenMatch = true;
  38726. var childNode = elm.firstChild;
  38727. for (var i$1 = 0; i$1 < children.length; i$1++) {
  38728. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  38729. childrenMatch = false;
  38730. break
  38731. }
  38732. childNode = childNode.nextSibling;
  38733. }
  38734. // if childNode is not null, it means the actual childNodes list is
  38735. // longer than the virtual children list.
  38736. if (!childrenMatch || childNode) {
  38737. /* istanbul ignore if */
  38738. if (typeof console !== 'undefined' &&
  38739. !hydrationBailed
  38740. ) {
  38741. hydrationBailed = true;
  38742. console.warn('Parent: ', elm);
  38743. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  38744. }
  38745. return false
  38746. }
  38747. }
  38748. }
  38749. }
  38750. if (isDef(data)) {
  38751. var fullInvoke = false;
  38752. for (var key in data) {
  38753. if (!isRenderedModule(key)) {
  38754. fullInvoke = true;
  38755. invokeCreateHooks(vnode, insertedVnodeQueue);
  38756. break
  38757. }
  38758. }
  38759. if (!fullInvoke && data['class']) {
  38760. // ensure collecting deps for deep class bindings for future updates
  38761. traverse(data['class']);
  38762. }
  38763. }
  38764. } else if (elm.data !== vnode.text) {
  38765. elm.data = vnode.text;
  38766. }
  38767. return true
  38768. }
  38769. function assertNodeMatch (node, vnode, inVPre) {
  38770. if (isDef(vnode.tag)) {
  38771. return vnode.tag.indexOf('vue-component') === 0 || (
  38772. !isUnknownElement$$1(vnode, inVPre) &&
  38773. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  38774. )
  38775. } else {
  38776. return node.nodeType === (vnode.isComment ? 8 : 3)
  38777. }
  38778. }
  38779. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  38780. if (isUndef(vnode)) {
  38781. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  38782. return
  38783. }
  38784. var isInitialPatch = false;
  38785. var insertedVnodeQueue = [];
  38786. if (isUndef(oldVnode)) {
  38787. // empty mount (likely as component), create new root element
  38788. isInitialPatch = true;
  38789. createElm(vnode, insertedVnodeQueue);
  38790. } else {
  38791. var isRealElement = isDef(oldVnode.nodeType);
  38792. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  38793. // patch existing root node
  38794. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  38795. } else {
  38796. if (isRealElement) {
  38797. // mounting to a real element
  38798. // check if this is server-rendered content and if we can perform
  38799. // a successful hydration.
  38800. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  38801. oldVnode.removeAttribute(SSR_ATTR);
  38802. hydrating = true;
  38803. }
  38804. if (isTrue(hydrating)) {
  38805. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  38806. invokeInsertHook(vnode, insertedVnodeQueue, true);
  38807. return oldVnode
  38808. } else {
  38809. warn(
  38810. 'The client-side rendered virtual DOM tree is not matching ' +
  38811. 'server-rendered content. This is likely caused by incorrect ' +
  38812. 'HTML markup, for example nesting block-level elements inside ' +
  38813. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  38814. 'full client-side render.'
  38815. );
  38816. }
  38817. }
  38818. // either not server-rendered, or hydration failed.
  38819. // create an empty node and replace it
  38820. oldVnode = emptyNodeAt(oldVnode);
  38821. }
  38822. // replacing existing element
  38823. var oldElm = oldVnode.elm;
  38824. var parentElm = nodeOps.parentNode(oldElm);
  38825. // create new node
  38826. createElm(
  38827. vnode,
  38828. insertedVnodeQueue,
  38829. // extremely rare edge case: do not insert if old element is in a
  38830. // leaving transition. Only happens when combining transition +
  38831. // keep-alive + HOCs. (#4590)
  38832. oldElm._leaveCb ? null : parentElm,
  38833. nodeOps.nextSibling(oldElm)
  38834. );
  38835. // update parent placeholder node element, recursively
  38836. if (isDef(vnode.parent)) {
  38837. var ancestor = vnode.parent;
  38838. var patchable = isPatchable(vnode);
  38839. while (ancestor) {
  38840. for (var i = 0; i < cbs.destroy.length; ++i) {
  38841. cbs.destroy[i](ancestor);
  38842. }
  38843. ancestor.elm = vnode.elm;
  38844. if (patchable) {
  38845. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38846. cbs.create[i$1](emptyNode, ancestor);
  38847. }
  38848. // #6513
  38849. // invoke insert hooks that may have been merged by create hooks.
  38850. // e.g. for directives that uses the "inserted" hook.
  38851. var insert = ancestor.data.hook.insert;
  38852. if (insert.merged) {
  38853. // start at index 1 to avoid re-invoking component mounted hook
  38854. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  38855. insert.fns[i$2]();
  38856. }
  38857. }
  38858. } else {
  38859. registerRef(ancestor);
  38860. }
  38861. ancestor = ancestor.parent;
  38862. }
  38863. }
  38864. // destroy old node
  38865. if (isDef(parentElm)) {
  38866. removeVnodes([oldVnode], 0, 0);
  38867. } else if (isDef(oldVnode.tag)) {
  38868. invokeDestroyHook(oldVnode);
  38869. }
  38870. }
  38871. }
  38872. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  38873. return vnode.elm
  38874. }
  38875. }
  38876. /* */
  38877. var directives = {
  38878. create: updateDirectives,
  38879. update: updateDirectives,
  38880. destroy: function unbindDirectives (vnode) {
  38881. updateDirectives(vnode, emptyNode);
  38882. }
  38883. };
  38884. function updateDirectives (oldVnode, vnode) {
  38885. if (oldVnode.data.directives || vnode.data.directives) {
  38886. _update(oldVnode, vnode);
  38887. }
  38888. }
  38889. function _update (oldVnode, vnode) {
  38890. var isCreate = oldVnode === emptyNode;
  38891. var isDestroy = vnode === emptyNode;
  38892. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  38893. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  38894. var dirsWithInsert = [];
  38895. var dirsWithPostpatch = [];
  38896. var key, oldDir, dir;
  38897. for (key in newDirs) {
  38898. oldDir = oldDirs[key];
  38899. dir = newDirs[key];
  38900. if (!oldDir) {
  38901. // new directive, bind
  38902. callHook$1(dir, 'bind', vnode, oldVnode);
  38903. if (dir.def && dir.def.inserted) {
  38904. dirsWithInsert.push(dir);
  38905. }
  38906. } else {
  38907. // existing directive, update
  38908. dir.oldValue = oldDir.value;
  38909. dir.oldArg = oldDir.arg;
  38910. callHook$1(dir, 'update', vnode, oldVnode);
  38911. if (dir.def && dir.def.componentUpdated) {
  38912. dirsWithPostpatch.push(dir);
  38913. }
  38914. }
  38915. }
  38916. if (dirsWithInsert.length) {
  38917. var callInsert = function () {
  38918. for (var i = 0; i < dirsWithInsert.length; i++) {
  38919. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  38920. }
  38921. };
  38922. if (isCreate) {
  38923. mergeVNodeHook(vnode, 'insert', callInsert);
  38924. } else {
  38925. callInsert();
  38926. }
  38927. }
  38928. if (dirsWithPostpatch.length) {
  38929. mergeVNodeHook(vnode, 'postpatch', function () {
  38930. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  38931. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  38932. }
  38933. });
  38934. }
  38935. if (!isCreate) {
  38936. for (key in oldDirs) {
  38937. if (!newDirs[key]) {
  38938. // no longer present, unbind
  38939. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  38940. }
  38941. }
  38942. }
  38943. }
  38944. var emptyModifiers = Object.create(null);
  38945. function normalizeDirectives$1 (
  38946. dirs,
  38947. vm
  38948. ) {
  38949. var res = Object.create(null);
  38950. if (!dirs) {
  38951. // $flow-disable-line
  38952. return res
  38953. }
  38954. var i, dir;
  38955. for (i = 0; i < dirs.length; i++) {
  38956. dir = dirs[i];
  38957. if (!dir.modifiers) {
  38958. // $flow-disable-line
  38959. dir.modifiers = emptyModifiers;
  38960. }
  38961. res[getRawDirName(dir)] = dir;
  38962. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  38963. }
  38964. // $flow-disable-line
  38965. return res
  38966. }
  38967. function getRawDirName (dir) {
  38968. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  38969. }
  38970. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  38971. var fn = dir.def && dir.def[hook];
  38972. if (fn) {
  38973. try {
  38974. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  38975. } catch (e) {
  38976. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  38977. }
  38978. }
  38979. }
  38980. var baseModules = [
  38981. ref,
  38982. directives
  38983. ];
  38984. /* */
  38985. function updateAttrs (oldVnode, vnode) {
  38986. var opts = vnode.componentOptions;
  38987. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  38988. return
  38989. }
  38990. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  38991. return
  38992. }
  38993. var key, cur, old;
  38994. var elm = vnode.elm;
  38995. var oldAttrs = oldVnode.data.attrs || {};
  38996. var attrs = vnode.data.attrs || {};
  38997. // clone observed objects, as the user probably wants to mutate it
  38998. if (isDef(attrs.__ob__)) {
  38999. attrs = vnode.data.attrs = extend({}, attrs);
  39000. }
  39001. for (key in attrs) {
  39002. cur = attrs[key];
  39003. old = oldAttrs[key];
  39004. if (old !== cur) {
  39005. setAttr(elm, key, cur);
  39006. }
  39007. }
  39008. // #4391: in IE9, setting type can reset value for input[type=radio]
  39009. // #6666: IE/Edge forces progress value down to 1 before setting a max
  39010. /* istanbul ignore if */
  39011. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  39012. setAttr(elm, 'value', attrs.value);
  39013. }
  39014. for (key in oldAttrs) {
  39015. if (isUndef(attrs[key])) {
  39016. if (isXlink(key)) {
  39017. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  39018. } else if (!isEnumeratedAttr(key)) {
  39019. elm.removeAttribute(key);
  39020. }
  39021. }
  39022. }
  39023. }
  39024. function setAttr (el, key, value) {
  39025. if (el.tagName.indexOf('-') > -1) {
  39026. baseSetAttr(el, key, value);
  39027. } else if (isBooleanAttr(key)) {
  39028. // set attribute for blank value
  39029. // e.g. <option disabled>Select one</option>
  39030. if (isFalsyAttrValue(value)) {
  39031. el.removeAttribute(key);
  39032. } else {
  39033. // technically allowfullscreen is a boolean attribute for <iframe>,
  39034. // but Flash expects a value of "true" when used on <embed> tag
  39035. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  39036. ? 'true'
  39037. : key;
  39038. el.setAttribute(key, value);
  39039. }
  39040. } else if (isEnumeratedAttr(key)) {
  39041. el.setAttribute(key, convertEnumeratedValue(key, value));
  39042. } else if (isXlink(key)) {
  39043. if (isFalsyAttrValue(value)) {
  39044. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  39045. } else {
  39046. el.setAttributeNS(xlinkNS, key, value);
  39047. }
  39048. } else {
  39049. baseSetAttr(el, key, value);
  39050. }
  39051. }
  39052. function baseSetAttr (el, key, value) {
  39053. if (isFalsyAttrValue(value)) {
  39054. el.removeAttribute(key);
  39055. } else {
  39056. // #7138: IE10 & 11 fires input event when setting placeholder on
  39057. // <textarea>... block the first input event and remove the blocker
  39058. // immediately.
  39059. /* istanbul ignore if */
  39060. if (
  39061. isIE && !isIE9 &&
  39062. el.tagName === 'TEXTAREA' &&
  39063. key === 'placeholder' && value !== '' && !el.__ieph
  39064. ) {
  39065. var blocker = function (e) {
  39066. e.stopImmediatePropagation();
  39067. el.removeEventListener('input', blocker);
  39068. };
  39069. el.addEventListener('input', blocker);
  39070. // $flow-disable-line
  39071. el.__ieph = true; /* IE placeholder patched */
  39072. }
  39073. el.setAttribute(key, value);
  39074. }
  39075. }
  39076. var attrs = {
  39077. create: updateAttrs,
  39078. update: updateAttrs
  39079. };
  39080. /* */
  39081. function updateClass (oldVnode, vnode) {
  39082. var el = vnode.elm;
  39083. var data = vnode.data;
  39084. var oldData = oldVnode.data;
  39085. if (
  39086. isUndef(data.staticClass) &&
  39087. isUndef(data.class) && (
  39088. isUndef(oldData) || (
  39089. isUndef(oldData.staticClass) &&
  39090. isUndef(oldData.class)
  39091. )
  39092. )
  39093. ) {
  39094. return
  39095. }
  39096. var cls = genClassForVnode(vnode);
  39097. // handle transition classes
  39098. var transitionClass = el._transitionClasses;
  39099. if (isDef(transitionClass)) {
  39100. cls = concat(cls, stringifyClass(transitionClass));
  39101. }
  39102. // set the class
  39103. if (cls !== el._prevClass) {
  39104. el.setAttribute('class', cls);
  39105. el._prevClass = cls;
  39106. }
  39107. }
  39108. var klass = {
  39109. create: updateClass,
  39110. update: updateClass
  39111. };
  39112. /* */
  39113. var validDivisionCharRE = /[\w).+\-_$\]]/;
  39114. function parseFilters (exp) {
  39115. var inSingle = false;
  39116. var inDouble = false;
  39117. var inTemplateString = false;
  39118. var inRegex = false;
  39119. var curly = 0;
  39120. var square = 0;
  39121. var paren = 0;
  39122. var lastFilterIndex = 0;
  39123. var c, prev, i, expression, filters;
  39124. for (i = 0; i < exp.length; i++) {
  39125. prev = c;
  39126. c = exp.charCodeAt(i);
  39127. if (inSingle) {
  39128. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  39129. } else if (inDouble) {
  39130. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  39131. } else if (inTemplateString) {
  39132. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  39133. } else if (inRegex) {
  39134. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  39135. } else if (
  39136. c === 0x7C && // pipe
  39137. exp.charCodeAt(i + 1) !== 0x7C &&
  39138. exp.charCodeAt(i - 1) !== 0x7C &&
  39139. !curly && !square && !paren
  39140. ) {
  39141. if (expression === undefined) {
  39142. // first filter, end of expression
  39143. lastFilterIndex = i + 1;
  39144. expression = exp.slice(0, i).trim();
  39145. } else {
  39146. pushFilter();
  39147. }
  39148. } else {
  39149. switch (c) {
  39150. case 0x22: inDouble = true; break // "
  39151. case 0x27: inSingle = true; break // '
  39152. case 0x60: inTemplateString = true; break // `
  39153. case 0x28: paren++; break // (
  39154. case 0x29: paren--; break // )
  39155. case 0x5B: square++; break // [
  39156. case 0x5D: square--; break // ]
  39157. case 0x7B: curly++; break // {
  39158. case 0x7D: curly--; break // }
  39159. }
  39160. if (c === 0x2f) { // /
  39161. var j = i - 1;
  39162. var p = (void 0);
  39163. // find first non-whitespace prev char
  39164. for (; j >= 0; j--) {
  39165. p = exp.charAt(j);
  39166. if (p !== ' ') { break }
  39167. }
  39168. if (!p || !validDivisionCharRE.test(p)) {
  39169. inRegex = true;
  39170. }
  39171. }
  39172. }
  39173. }
  39174. if (expression === undefined) {
  39175. expression = exp.slice(0, i).trim();
  39176. } else if (lastFilterIndex !== 0) {
  39177. pushFilter();
  39178. }
  39179. function pushFilter () {
  39180. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  39181. lastFilterIndex = i + 1;
  39182. }
  39183. if (filters) {
  39184. for (i = 0; i < filters.length; i++) {
  39185. expression = wrapFilter(expression, filters[i]);
  39186. }
  39187. }
  39188. return expression
  39189. }
  39190. function wrapFilter (exp, filter) {
  39191. var i = filter.indexOf('(');
  39192. if (i < 0) {
  39193. // _f: resolveFilter
  39194. return ("_f(\"" + filter + "\")(" + exp + ")")
  39195. } else {
  39196. var name = filter.slice(0, i);
  39197. var args = filter.slice(i + 1);
  39198. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  39199. }
  39200. }
  39201. /* */
  39202. /* eslint-disable no-unused-vars */
  39203. function baseWarn (msg, range) {
  39204. console.error(("[Vue compiler]: " + msg));
  39205. }
  39206. /* eslint-enable no-unused-vars */
  39207. function pluckModuleFunction (
  39208. modules,
  39209. key
  39210. ) {
  39211. return modules
  39212. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  39213. : []
  39214. }
  39215. function addProp (el, name, value, range, dynamic) {
  39216. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39217. el.plain = false;
  39218. }
  39219. function addAttr (el, name, value, range, dynamic) {
  39220. var attrs = dynamic
  39221. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  39222. : (el.attrs || (el.attrs = []));
  39223. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39224. el.plain = false;
  39225. }
  39226. // add a raw attr (use this in preTransforms)
  39227. function addRawAttr (el, name, value, range) {
  39228. el.attrsMap[name] = value;
  39229. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  39230. }
  39231. function addDirective (
  39232. el,
  39233. name,
  39234. rawName,
  39235. value,
  39236. arg,
  39237. isDynamicArg,
  39238. modifiers,
  39239. range
  39240. ) {
  39241. (el.directives || (el.directives = [])).push(rangeSetItem({
  39242. name: name,
  39243. rawName: rawName,
  39244. value: value,
  39245. arg: arg,
  39246. isDynamicArg: isDynamicArg,
  39247. modifiers: modifiers
  39248. }, range));
  39249. el.plain = false;
  39250. }
  39251. function prependModifierMarker (symbol, name, dynamic) {
  39252. return dynamic
  39253. ? ("_p(" + name + ",\"" + symbol + "\")")
  39254. : symbol + name // mark the event as captured
  39255. }
  39256. function addHandler (
  39257. el,
  39258. name,
  39259. value,
  39260. modifiers,
  39261. important,
  39262. warn,
  39263. range,
  39264. dynamic
  39265. ) {
  39266. modifiers = modifiers || emptyObject;
  39267. // warn prevent and passive modifier
  39268. /* istanbul ignore if */
  39269. if (
  39270. warn &&
  39271. modifiers.prevent && modifiers.passive
  39272. ) {
  39273. warn(
  39274. 'passive and prevent can\'t be used together. ' +
  39275. 'Passive handler can\'t prevent default event.',
  39276. range
  39277. );
  39278. }
  39279. // normalize click.right and click.middle since they don't actually fire
  39280. // this is technically browser-specific, but at least for now browsers are
  39281. // the only target envs that have right/middle clicks.
  39282. if (modifiers.right) {
  39283. if (dynamic) {
  39284. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  39285. } else if (name === 'click') {
  39286. name = 'contextmenu';
  39287. delete modifiers.right;
  39288. }
  39289. } else if (modifiers.middle) {
  39290. if (dynamic) {
  39291. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  39292. } else if (name === 'click') {
  39293. name = 'mouseup';
  39294. }
  39295. }
  39296. // check capture modifier
  39297. if (modifiers.capture) {
  39298. delete modifiers.capture;
  39299. name = prependModifierMarker('!', name, dynamic);
  39300. }
  39301. if (modifiers.once) {
  39302. delete modifiers.once;
  39303. name = prependModifierMarker('~', name, dynamic);
  39304. }
  39305. /* istanbul ignore if */
  39306. if (modifiers.passive) {
  39307. delete modifiers.passive;
  39308. name = prependModifierMarker('&', name, dynamic);
  39309. }
  39310. var events;
  39311. if (modifiers.native) {
  39312. delete modifiers.native;
  39313. events = el.nativeEvents || (el.nativeEvents = {});
  39314. } else {
  39315. events = el.events || (el.events = {});
  39316. }
  39317. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  39318. if (modifiers !== emptyObject) {
  39319. newHandler.modifiers = modifiers;
  39320. }
  39321. var handlers = events[name];
  39322. /* istanbul ignore if */
  39323. if (Array.isArray(handlers)) {
  39324. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  39325. } else if (handlers) {
  39326. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  39327. } else {
  39328. events[name] = newHandler;
  39329. }
  39330. el.plain = false;
  39331. }
  39332. function getRawBindingAttr (
  39333. el,
  39334. name
  39335. ) {
  39336. return el.rawAttrsMap[':' + name] ||
  39337. el.rawAttrsMap['v-bind:' + name] ||
  39338. el.rawAttrsMap[name]
  39339. }
  39340. function getBindingAttr (
  39341. el,
  39342. name,
  39343. getStatic
  39344. ) {
  39345. var dynamicValue =
  39346. getAndRemoveAttr(el, ':' + name) ||
  39347. getAndRemoveAttr(el, 'v-bind:' + name);
  39348. if (dynamicValue != null) {
  39349. return parseFilters(dynamicValue)
  39350. } else if (getStatic !== false) {
  39351. var staticValue = getAndRemoveAttr(el, name);
  39352. if (staticValue != null) {
  39353. return JSON.stringify(staticValue)
  39354. }
  39355. }
  39356. }
  39357. // note: this only removes the attr from the Array (attrsList) so that it
  39358. // doesn't get processed by processAttrs.
  39359. // By default it does NOT remove it from the map (attrsMap) because the map is
  39360. // needed during codegen.
  39361. function getAndRemoveAttr (
  39362. el,
  39363. name,
  39364. removeFromMap
  39365. ) {
  39366. var val;
  39367. if ((val = el.attrsMap[name]) != null) {
  39368. var list = el.attrsList;
  39369. for (var i = 0, l = list.length; i < l; i++) {
  39370. if (list[i].name === name) {
  39371. list.splice(i, 1);
  39372. break
  39373. }
  39374. }
  39375. }
  39376. if (removeFromMap) {
  39377. delete el.attrsMap[name];
  39378. }
  39379. return val
  39380. }
  39381. function getAndRemoveAttrByRegex (
  39382. el,
  39383. name
  39384. ) {
  39385. var list = el.attrsList;
  39386. for (var i = 0, l = list.length; i < l; i++) {
  39387. var attr = list[i];
  39388. if (name.test(attr.name)) {
  39389. list.splice(i, 1);
  39390. return attr
  39391. }
  39392. }
  39393. }
  39394. function rangeSetItem (
  39395. item,
  39396. range
  39397. ) {
  39398. if (range) {
  39399. if (range.start != null) {
  39400. item.start = range.start;
  39401. }
  39402. if (range.end != null) {
  39403. item.end = range.end;
  39404. }
  39405. }
  39406. return item
  39407. }
  39408. /* */
  39409. /**
  39410. * Cross-platform code generation for component v-model
  39411. */
  39412. function genComponentModel (
  39413. el,
  39414. value,
  39415. modifiers
  39416. ) {
  39417. var ref = modifiers || {};
  39418. var number = ref.number;
  39419. var trim = ref.trim;
  39420. var baseValueExpression = '$$v';
  39421. var valueExpression = baseValueExpression;
  39422. if (trim) {
  39423. valueExpression =
  39424. "(typeof " + baseValueExpression + " === 'string'" +
  39425. "? " + baseValueExpression + ".trim()" +
  39426. ": " + baseValueExpression + ")";
  39427. }
  39428. if (number) {
  39429. valueExpression = "_n(" + valueExpression + ")";
  39430. }
  39431. var assignment = genAssignmentCode(value, valueExpression);
  39432. el.model = {
  39433. value: ("(" + value + ")"),
  39434. expression: JSON.stringify(value),
  39435. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  39436. };
  39437. }
  39438. /**
  39439. * Cross-platform codegen helper for generating v-model value assignment code.
  39440. */
  39441. function genAssignmentCode (
  39442. value,
  39443. assignment
  39444. ) {
  39445. var res = parseModel(value);
  39446. if (res.key === null) {
  39447. return (value + "=" + assignment)
  39448. } else {
  39449. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  39450. }
  39451. }
  39452. /**
  39453. * Parse a v-model expression into a base path and a final key segment.
  39454. * Handles both dot-path and possible square brackets.
  39455. *
  39456. * Possible cases:
  39457. *
  39458. * - test
  39459. * - test[key]
  39460. * - test[test1[key]]
  39461. * - test["a"][key]
  39462. * - xxx.test[a[a].test1[key]]
  39463. * - test.xxx.a["asa"][test1[key]]
  39464. *
  39465. */
  39466. var len, str, chr, index$1, expressionPos, expressionEndPos;
  39467. function parseModel (val) {
  39468. // Fix https://github.com/vuejs/vue/pull/7730
  39469. // allow v-model="obj.val " (trailing whitespace)
  39470. val = val.trim();
  39471. len = val.length;
  39472. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  39473. index$1 = val.lastIndexOf('.');
  39474. if (index$1 > -1) {
  39475. return {
  39476. exp: val.slice(0, index$1),
  39477. key: '"' + val.slice(index$1 + 1) + '"'
  39478. }
  39479. } else {
  39480. return {
  39481. exp: val,
  39482. key: null
  39483. }
  39484. }
  39485. }
  39486. str = val;
  39487. index$1 = expressionPos = expressionEndPos = 0;
  39488. while (!eof()) {
  39489. chr = next();
  39490. /* istanbul ignore if */
  39491. if (isStringStart(chr)) {
  39492. parseString(chr);
  39493. } else if (chr === 0x5B) {
  39494. parseBracket(chr);
  39495. }
  39496. }
  39497. return {
  39498. exp: val.slice(0, expressionPos),
  39499. key: val.slice(expressionPos + 1, expressionEndPos)
  39500. }
  39501. }
  39502. function next () {
  39503. return str.charCodeAt(++index$1)
  39504. }
  39505. function eof () {
  39506. return index$1 >= len
  39507. }
  39508. function isStringStart (chr) {
  39509. return chr === 0x22 || chr === 0x27
  39510. }
  39511. function parseBracket (chr) {
  39512. var inBracket = 1;
  39513. expressionPos = index$1;
  39514. while (!eof()) {
  39515. chr = next();
  39516. if (isStringStart(chr)) {
  39517. parseString(chr);
  39518. continue
  39519. }
  39520. if (chr === 0x5B) { inBracket++; }
  39521. if (chr === 0x5D) { inBracket--; }
  39522. if (inBracket === 0) {
  39523. expressionEndPos = index$1;
  39524. break
  39525. }
  39526. }
  39527. }
  39528. function parseString (chr) {
  39529. var stringQuote = chr;
  39530. while (!eof()) {
  39531. chr = next();
  39532. if (chr === stringQuote) {
  39533. break
  39534. }
  39535. }
  39536. }
  39537. /* */
  39538. var warn$1;
  39539. // in some cases, the event used has to be determined at runtime
  39540. // so we used some reserved tokens during compile.
  39541. var RANGE_TOKEN = '__r';
  39542. var CHECKBOX_RADIO_TOKEN = '__c';
  39543. function model (
  39544. el,
  39545. dir,
  39546. _warn
  39547. ) {
  39548. warn$1 = _warn;
  39549. var value = dir.value;
  39550. var modifiers = dir.modifiers;
  39551. var tag = el.tag;
  39552. var type = el.attrsMap.type;
  39553. {
  39554. // inputs with type="file" are read only and setting the input's
  39555. // value will throw an error.
  39556. if (tag === 'input' && type === 'file') {
  39557. warn$1(
  39558. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  39559. "File inputs are read only. Use a v-on:change listener instead.",
  39560. el.rawAttrsMap['v-model']
  39561. );
  39562. }
  39563. }
  39564. if (el.component) {
  39565. genComponentModel(el, value, modifiers);
  39566. // component v-model doesn't need extra runtime
  39567. return false
  39568. } else if (tag === 'select') {
  39569. genSelect(el, value, modifiers);
  39570. } else if (tag === 'input' && type === 'checkbox') {
  39571. genCheckboxModel(el, value, modifiers);
  39572. } else if (tag === 'input' && type === 'radio') {
  39573. genRadioModel(el, value, modifiers);
  39574. } else if (tag === 'input' || tag === 'textarea') {
  39575. genDefaultModel(el, value, modifiers);
  39576. } else if (!config.isReservedTag(tag)) {
  39577. genComponentModel(el, value, modifiers);
  39578. // component v-model doesn't need extra runtime
  39579. return false
  39580. } else {
  39581. warn$1(
  39582. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  39583. "v-model is not supported on this element type. " +
  39584. 'If you are working with contenteditable, it\'s recommended to ' +
  39585. 'wrap a library dedicated for that purpose inside a custom component.',
  39586. el.rawAttrsMap['v-model']
  39587. );
  39588. }
  39589. // ensure runtime directive metadata
  39590. return true
  39591. }
  39592. function genCheckboxModel (
  39593. el,
  39594. value,
  39595. modifiers
  39596. ) {
  39597. var number = modifiers && modifiers.number;
  39598. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39599. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  39600. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  39601. addProp(el, 'checked',
  39602. "Array.isArray(" + value + ")" +
  39603. "?_i(" + value + "," + valueBinding + ")>-1" + (
  39604. trueValueBinding === 'true'
  39605. ? (":(" + value + ")")
  39606. : (":_q(" + value + "," + trueValueBinding + ")")
  39607. )
  39608. );
  39609. addHandler(el, 'change',
  39610. "var $$a=" + value + "," +
  39611. '$$el=$event.target,' +
  39612. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  39613. 'if(Array.isArray($$a)){' +
  39614. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  39615. '$$i=_i($$a,$$v);' +
  39616. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  39617. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  39618. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  39619. null, true
  39620. );
  39621. }
  39622. function genRadioModel (
  39623. el,
  39624. value,
  39625. modifiers
  39626. ) {
  39627. var number = modifiers && modifiers.number;
  39628. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39629. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  39630. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  39631. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  39632. }
  39633. function genSelect (
  39634. el,
  39635. value,
  39636. modifiers
  39637. ) {
  39638. var number = modifiers && modifiers.number;
  39639. var selectedVal = "Array.prototype.filter" +
  39640. ".call($event.target.options,function(o){return o.selected})" +
  39641. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  39642. "return " + (number ? '_n(val)' : 'val') + "})";
  39643. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  39644. var code = "var $$selectedVal = " + selectedVal + ";";
  39645. code = code + " " + (genAssignmentCode(value, assignment));
  39646. addHandler(el, 'change', code, null, true);
  39647. }
  39648. function genDefaultModel (
  39649. el,
  39650. value,
  39651. modifiers
  39652. ) {
  39653. var type = el.attrsMap.type;
  39654. // warn if v-bind:value conflicts with v-model
  39655. // except for inputs with v-bind:type
  39656. {
  39657. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  39658. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  39659. if (value$1 && !typeBinding) {
  39660. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  39661. warn$1(
  39662. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  39663. 'because the latter already expands to a value binding internally',
  39664. el.rawAttrsMap[binding]
  39665. );
  39666. }
  39667. }
  39668. var ref = modifiers || {};
  39669. var lazy = ref.lazy;
  39670. var number = ref.number;
  39671. var trim = ref.trim;
  39672. var needCompositionGuard = !lazy && type !== 'range';
  39673. var event = lazy
  39674. ? 'change'
  39675. : type === 'range'
  39676. ? RANGE_TOKEN
  39677. : 'input';
  39678. var valueExpression = '$event.target.value';
  39679. if (trim) {
  39680. valueExpression = "$event.target.value.trim()";
  39681. }
  39682. if (number) {
  39683. valueExpression = "_n(" + valueExpression + ")";
  39684. }
  39685. var code = genAssignmentCode(value, valueExpression);
  39686. if (needCompositionGuard) {
  39687. code = "if($event.target.composing)return;" + code;
  39688. }
  39689. addProp(el, 'value', ("(" + value + ")"));
  39690. addHandler(el, event, code, null, true);
  39691. if (trim || number) {
  39692. addHandler(el, 'blur', '$forceUpdate()');
  39693. }
  39694. }
  39695. /* */
  39696. // normalize v-model event tokens that can only be determined at runtime.
  39697. // it's important to place the event as the first in the array because
  39698. // the whole point is ensuring the v-model callback gets called before
  39699. // user-attached handlers.
  39700. function normalizeEvents (on) {
  39701. /* istanbul ignore if */
  39702. if (isDef(on[RANGE_TOKEN])) {
  39703. // IE input[type=range] only supports `change` event
  39704. var event = isIE ? 'change' : 'input';
  39705. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  39706. delete on[RANGE_TOKEN];
  39707. }
  39708. // This was originally intended to fix #4521 but no longer necessary
  39709. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  39710. /* istanbul ignore if */
  39711. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  39712. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  39713. delete on[CHECKBOX_RADIO_TOKEN];
  39714. }
  39715. }
  39716. var target$1;
  39717. function createOnceHandler$1 (event, handler, capture) {
  39718. var _target = target$1; // save current target element in closure
  39719. return function onceHandler () {
  39720. var res = handler.apply(null, arguments);
  39721. if (res !== null) {
  39722. remove$2(event, onceHandler, capture, _target);
  39723. }
  39724. }
  39725. }
  39726. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  39727. // implementation and does not fire microtasks in between event propagation, so
  39728. // safe to exclude.
  39729. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  39730. function add$1 (
  39731. name,
  39732. handler,
  39733. capture,
  39734. passive
  39735. ) {
  39736. // async edge case #6566: inner click event triggers patch, event handler
  39737. // attached to outer element during patch, and triggered again. This
  39738. // happens because browsers fire microtask ticks between event propagation.
  39739. // the solution is simple: we save the timestamp when a handler is attached,
  39740. // and the handler would only fire if the event passed to it was fired
  39741. // AFTER it was attached.
  39742. if (useMicrotaskFix) {
  39743. var attachedTimestamp = currentFlushTimestamp;
  39744. var original = handler;
  39745. handler = original._wrapper = function (e) {
  39746. if (
  39747. // no bubbling, should always fire.
  39748. // this is just a safety net in case event.timeStamp is unreliable in
  39749. // certain weird environments...
  39750. e.target === e.currentTarget ||
  39751. // event is fired after handler attachment
  39752. e.timeStamp >= attachedTimestamp ||
  39753. // bail for environments that have buggy event.timeStamp implementations
  39754. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  39755. // #9681 QtWebEngine event.timeStamp is negative value
  39756. e.timeStamp <= 0 ||
  39757. // #9448 bail if event is fired in another document in a multi-page
  39758. // electron/nw.js app, since event.timeStamp will be using a different
  39759. // starting reference
  39760. e.target.ownerDocument !== document
  39761. ) {
  39762. return original.apply(this, arguments)
  39763. }
  39764. };
  39765. }
  39766. target$1.addEventListener(
  39767. name,
  39768. handler,
  39769. supportsPassive
  39770. ? { capture: capture, passive: passive }
  39771. : capture
  39772. );
  39773. }
  39774. function remove$2 (
  39775. name,
  39776. handler,
  39777. capture,
  39778. _target
  39779. ) {
  39780. (_target || target$1).removeEventListener(
  39781. name,
  39782. handler._wrapper || handler,
  39783. capture
  39784. );
  39785. }
  39786. function updateDOMListeners (oldVnode, vnode) {
  39787. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  39788. return
  39789. }
  39790. var on = vnode.data.on || {};
  39791. var oldOn = oldVnode.data.on || {};
  39792. target$1 = vnode.elm;
  39793. normalizeEvents(on);
  39794. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  39795. target$1 = undefined;
  39796. }
  39797. var events = {
  39798. create: updateDOMListeners,
  39799. update: updateDOMListeners
  39800. };
  39801. /* */
  39802. var svgContainer;
  39803. function updateDOMProps (oldVnode, vnode) {
  39804. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  39805. return
  39806. }
  39807. var key, cur;
  39808. var elm = vnode.elm;
  39809. var oldProps = oldVnode.data.domProps || {};
  39810. var props = vnode.data.domProps || {};
  39811. // clone observed objects, as the user probably wants to mutate it
  39812. if (isDef(props.__ob__)) {
  39813. props = vnode.data.domProps = extend({}, props);
  39814. }
  39815. for (key in oldProps) {
  39816. if (!(key in props)) {
  39817. elm[key] = '';
  39818. }
  39819. }
  39820. for (key in props) {
  39821. cur = props[key];
  39822. // ignore children if the node has textContent or innerHTML,
  39823. // as these will throw away existing DOM nodes and cause removal errors
  39824. // on subsequent patches (#3360)
  39825. if (key === 'textContent' || key === 'innerHTML') {
  39826. if (vnode.children) { vnode.children.length = 0; }
  39827. if (cur === oldProps[key]) { continue }
  39828. // #6601 work around Chrome version <= 55 bug where single textNode
  39829. // replaced by innerHTML/textContent retains its parentNode property
  39830. if (elm.childNodes.length === 1) {
  39831. elm.removeChild(elm.childNodes[0]);
  39832. }
  39833. }
  39834. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  39835. // store value as _value as well since
  39836. // non-string values will be stringified
  39837. elm._value = cur;
  39838. // avoid resetting cursor position when value is the same
  39839. var strCur = isUndef(cur) ? '' : String(cur);
  39840. if (shouldUpdateValue(elm, strCur)) {
  39841. elm.value = strCur;
  39842. }
  39843. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  39844. // IE doesn't support innerHTML for SVG elements
  39845. svgContainer = svgContainer || document.createElement('div');
  39846. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  39847. var svg = svgContainer.firstChild;
  39848. while (elm.firstChild) {
  39849. elm.removeChild(elm.firstChild);
  39850. }
  39851. while (svg.firstChild) {
  39852. elm.appendChild(svg.firstChild);
  39853. }
  39854. } else if (
  39855. // skip the update if old and new VDOM state is the same.
  39856. // `value` is handled separately because the DOM value may be temporarily
  39857. // out of sync with VDOM state due to focus, composition and modifiers.
  39858. // This #4521 by skipping the unnecessary `checked` update.
  39859. cur !== oldProps[key]
  39860. ) {
  39861. // some property updates can throw
  39862. // e.g. `value` on <progress> w/ non-finite value
  39863. try {
  39864. elm[key] = cur;
  39865. } catch (e) {}
  39866. }
  39867. }
  39868. }
  39869. // check platforms/web/util/attrs.js acceptValue
  39870. function shouldUpdateValue (elm, checkVal) {
  39871. return (!elm.composing && (
  39872. elm.tagName === 'OPTION' ||
  39873. isNotInFocusAndDirty(elm, checkVal) ||
  39874. isDirtyWithModifiers(elm, checkVal)
  39875. ))
  39876. }
  39877. function isNotInFocusAndDirty (elm, checkVal) {
  39878. // return true when textbox (.number and .trim) loses focus and its value is
  39879. // not equal to the updated value
  39880. var notInFocus = true;
  39881. // #6157
  39882. // work around IE bug when accessing document.activeElement in an iframe
  39883. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  39884. return notInFocus && elm.value !== checkVal
  39885. }
  39886. function isDirtyWithModifiers (elm, newVal) {
  39887. var value = elm.value;
  39888. var modifiers = elm._vModifiers; // injected by v-model runtime
  39889. if (isDef(modifiers)) {
  39890. if (modifiers.number) {
  39891. return toNumber(value) !== toNumber(newVal)
  39892. }
  39893. if (modifiers.trim) {
  39894. return value.trim() !== newVal.trim()
  39895. }
  39896. }
  39897. return value !== newVal
  39898. }
  39899. var domProps = {
  39900. create: updateDOMProps,
  39901. update: updateDOMProps
  39902. };
  39903. /* */
  39904. var parseStyleText = cached(function (cssText) {
  39905. var res = {};
  39906. var listDelimiter = /;(?![^(]*\))/g;
  39907. var propertyDelimiter = /:(.+)/;
  39908. cssText.split(listDelimiter).forEach(function (item) {
  39909. if (item) {
  39910. var tmp = item.split(propertyDelimiter);
  39911. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  39912. }
  39913. });
  39914. return res
  39915. });
  39916. // merge static and dynamic style data on the same vnode
  39917. function normalizeStyleData (data) {
  39918. var style = normalizeStyleBinding(data.style);
  39919. // static style is pre-processed into an object during compilation
  39920. // and is always a fresh object, so it's safe to merge into it
  39921. return data.staticStyle
  39922. ? extend(data.staticStyle, style)
  39923. : style
  39924. }
  39925. // normalize possible array / string values into Object
  39926. function normalizeStyleBinding (bindingStyle) {
  39927. if (Array.isArray(bindingStyle)) {
  39928. return toObject(bindingStyle)
  39929. }
  39930. if (typeof bindingStyle === 'string') {
  39931. return parseStyleText(bindingStyle)
  39932. }
  39933. return bindingStyle
  39934. }
  39935. /**
  39936. * parent component style should be after child's
  39937. * so that parent component's style could override it
  39938. */
  39939. function getStyle (vnode, checkChild) {
  39940. var res = {};
  39941. var styleData;
  39942. if (checkChild) {
  39943. var childNode = vnode;
  39944. while (childNode.componentInstance) {
  39945. childNode = childNode.componentInstance._vnode;
  39946. if (
  39947. childNode && childNode.data &&
  39948. (styleData = normalizeStyleData(childNode.data))
  39949. ) {
  39950. extend(res, styleData);
  39951. }
  39952. }
  39953. }
  39954. if ((styleData = normalizeStyleData(vnode.data))) {
  39955. extend(res, styleData);
  39956. }
  39957. var parentNode = vnode;
  39958. while ((parentNode = parentNode.parent)) {
  39959. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  39960. extend(res, styleData);
  39961. }
  39962. }
  39963. return res
  39964. }
  39965. /* */
  39966. var cssVarRE = /^--/;
  39967. var importantRE = /\s*!important$/;
  39968. var setProp = function (el, name, val) {
  39969. /* istanbul ignore if */
  39970. if (cssVarRE.test(name)) {
  39971. el.style.setProperty(name, val);
  39972. } else if (importantRE.test(val)) {
  39973. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  39974. } else {
  39975. var normalizedName = normalize(name);
  39976. if (Array.isArray(val)) {
  39977. // Support values array created by autoprefixer, e.g.
  39978. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  39979. // Set them one by one, and the browser will only set those it can recognize
  39980. for (var i = 0, len = val.length; i < len; i++) {
  39981. el.style[normalizedName] = val[i];
  39982. }
  39983. } else {
  39984. el.style[normalizedName] = val;
  39985. }
  39986. }
  39987. };
  39988. var vendorNames = ['Webkit', 'Moz', 'ms'];
  39989. var emptyStyle;
  39990. var normalize = cached(function (prop) {
  39991. emptyStyle = emptyStyle || document.createElement('div').style;
  39992. prop = camelize(prop);
  39993. if (prop !== 'filter' && (prop in emptyStyle)) {
  39994. return prop
  39995. }
  39996. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  39997. for (var i = 0; i < vendorNames.length; i++) {
  39998. var name = vendorNames[i] + capName;
  39999. if (name in emptyStyle) {
  40000. return name
  40001. }
  40002. }
  40003. });
  40004. function updateStyle (oldVnode, vnode) {
  40005. var data = vnode.data;
  40006. var oldData = oldVnode.data;
  40007. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  40008. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  40009. ) {
  40010. return
  40011. }
  40012. var cur, name;
  40013. var el = vnode.elm;
  40014. var oldStaticStyle = oldData.staticStyle;
  40015. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  40016. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  40017. var oldStyle = oldStaticStyle || oldStyleBinding;
  40018. var style = normalizeStyleBinding(vnode.data.style) || {};
  40019. // store normalized style under a different key for next diff
  40020. // make sure to clone it if it's reactive, since the user likely wants
  40021. // to mutate it.
  40022. vnode.data.normalizedStyle = isDef(style.__ob__)
  40023. ? extend({}, style)
  40024. : style;
  40025. var newStyle = getStyle(vnode, true);
  40026. for (name in oldStyle) {
  40027. if (isUndef(newStyle[name])) {
  40028. setProp(el, name, '');
  40029. }
  40030. }
  40031. for (name in newStyle) {
  40032. cur = newStyle[name];
  40033. if (cur !== oldStyle[name]) {
  40034. // ie9 setting to null has no effect, must use empty string
  40035. setProp(el, name, cur == null ? '' : cur);
  40036. }
  40037. }
  40038. }
  40039. var style = {
  40040. create: updateStyle,
  40041. update: updateStyle
  40042. };
  40043. /* */
  40044. var whitespaceRE = /\s+/;
  40045. /**
  40046. * Add class with compatibility for SVG since classList is not supported on
  40047. * SVG elements in IE
  40048. */
  40049. function addClass (el, cls) {
  40050. /* istanbul ignore if */
  40051. if (!cls || !(cls = cls.trim())) {
  40052. return
  40053. }
  40054. /* istanbul ignore else */
  40055. if (el.classList) {
  40056. if (cls.indexOf(' ') > -1) {
  40057. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  40058. } else {
  40059. el.classList.add(cls);
  40060. }
  40061. } else {
  40062. var cur = " " + (el.getAttribute('class') || '') + " ";
  40063. if (cur.indexOf(' ' + cls + ' ') < 0) {
  40064. el.setAttribute('class', (cur + cls).trim());
  40065. }
  40066. }
  40067. }
  40068. /**
  40069. * Remove class with compatibility for SVG since classList is not supported on
  40070. * SVG elements in IE
  40071. */
  40072. function removeClass (el, cls) {
  40073. /* istanbul ignore if */
  40074. if (!cls || !(cls = cls.trim())) {
  40075. return
  40076. }
  40077. /* istanbul ignore else */
  40078. if (el.classList) {
  40079. if (cls.indexOf(' ') > -1) {
  40080. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  40081. } else {
  40082. el.classList.remove(cls);
  40083. }
  40084. if (!el.classList.length) {
  40085. el.removeAttribute('class');
  40086. }
  40087. } else {
  40088. var cur = " " + (el.getAttribute('class') || '') + " ";
  40089. var tar = ' ' + cls + ' ';
  40090. while (cur.indexOf(tar) >= 0) {
  40091. cur = cur.replace(tar, ' ');
  40092. }
  40093. cur = cur.trim();
  40094. if (cur) {
  40095. el.setAttribute('class', cur);
  40096. } else {
  40097. el.removeAttribute('class');
  40098. }
  40099. }
  40100. }
  40101. /* */
  40102. function resolveTransition (def$$1) {
  40103. if (!def$$1) {
  40104. return
  40105. }
  40106. /* istanbul ignore else */
  40107. if (typeof def$$1 === 'object') {
  40108. var res = {};
  40109. if (def$$1.css !== false) {
  40110. extend(res, autoCssTransition(def$$1.name || 'v'));
  40111. }
  40112. extend(res, def$$1);
  40113. return res
  40114. } else if (typeof def$$1 === 'string') {
  40115. return autoCssTransition(def$$1)
  40116. }
  40117. }
  40118. var autoCssTransition = cached(function (name) {
  40119. return {
  40120. enterClass: (name + "-enter"),
  40121. enterToClass: (name + "-enter-to"),
  40122. enterActiveClass: (name + "-enter-active"),
  40123. leaveClass: (name + "-leave"),
  40124. leaveToClass: (name + "-leave-to"),
  40125. leaveActiveClass: (name + "-leave-active")
  40126. }
  40127. });
  40128. var hasTransition = inBrowser && !isIE9;
  40129. var TRANSITION = 'transition';
  40130. var ANIMATION = 'animation';
  40131. // Transition property/event sniffing
  40132. var transitionProp = 'transition';
  40133. var transitionEndEvent = 'transitionend';
  40134. var animationProp = 'animation';
  40135. var animationEndEvent = 'animationend';
  40136. if (hasTransition) {
  40137. /* istanbul ignore if */
  40138. if (window.ontransitionend === undefined &&
  40139. window.onwebkittransitionend !== undefined
  40140. ) {
  40141. transitionProp = 'WebkitTransition';
  40142. transitionEndEvent = 'webkitTransitionEnd';
  40143. }
  40144. if (window.onanimationend === undefined &&
  40145. window.onwebkitanimationend !== undefined
  40146. ) {
  40147. animationProp = 'WebkitAnimation';
  40148. animationEndEvent = 'webkitAnimationEnd';
  40149. }
  40150. }
  40151. // binding to window is necessary to make hot reload work in IE in strict mode
  40152. var raf = inBrowser
  40153. ? window.requestAnimationFrame
  40154. ? window.requestAnimationFrame.bind(window)
  40155. : setTimeout
  40156. : /* istanbul ignore next */ function (fn) { return fn(); };
  40157. function nextFrame (fn) {
  40158. raf(function () {
  40159. raf(fn);
  40160. });
  40161. }
  40162. function addTransitionClass (el, cls) {
  40163. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  40164. if (transitionClasses.indexOf(cls) < 0) {
  40165. transitionClasses.push(cls);
  40166. addClass(el, cls);
  40167. }
  40168. }
  40169. function removeTransitionClass (el, cls) {
  40170. if (el._transitionClasses) {
  40171. remove(el._transitionClasses, cls);
  40172. }
  40173. removeClass(el, cls);
  40174. }
  40175. function whenTransitionEnds (
  40176. el,
  40177. expectedType,
  40178. cb
  40179. ) {
  40180. var ref = getTransitionInfo(el, expectedType);
  40181. var type = ref.type;
  40182. var timeout = ref.timeout;
  40183. var propCount = ref.propCount;
  40184. if (!type) { return cb() }
  40185. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  40186. var ended = 0;
  40187. var end = function () {
  40188. el.removeEventListener(event, onEnd);
  40189. cb();
  40190. };
  40191. var onEnd = function (e) {
  40192. if (e.target === el) {
  40193. if (++ended >= propCount) {
  40194. end();
  40195. }
  40196. }
  40197. };
  40198. setTimeout(function () {
  40199. if (ended < propCount) {
  40200. end();
  40201. }
  40202. }, timeout + 1);
  40203. el.addEventListener(event, onEnd);
  40204. }
  40205. var transformRE = /\b(transform|all)(,|$)/;
  40206. function getTransitionInfo (el, expectedType) {
  40207. var styles = window.getComputedStyle(el);
  40208. // JSDOM may return undefined for transition properties
  40209. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  40210. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  40211. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  40212. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  40213. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  40214. var animationTimeout = getTimeout(animationDelays, animationDurations);
  40215. var type;
  40216. var timeout = 0;
  40217. var propCount = 0;
  40218. /* istanbul ignore if */
  40219. if (expectedType === TRANSITION) {
  40220. if (transitionTimeout > 0) {
  40221. type = TRANSITION;
  40222. timeout = transitionTimeout;
  40223. propCount = transitionDurations.length;
  40224. }
  40225. } else if (expectedType === ANIMATION) {
  40226. if (animationTimeout > 0) {
  40227. type = ANIMATION;
  40228. timeout = animationTimeout;
  40229. propCount = animationDurations.length;
  40230. }
  40231. } else {
  40232. timeout = Math.max(transitionTimeout, animationTimeout);
  40233. type = timeout > 0
  40234. ? transitionTimeout > animationTimeout
  40235. ? TRANSITION
  40236. : ANIMATION
  40237. : null;
  40238. propCount = type
  40239. ? type === TRANSITION
  40240. ? transitionDurations.length
  40241. : animationDurations.length
  40242. : 0;
  40243. }
  40244. var hasTransform =
  40245. type === TRANSITION &&
  40246. transformRE.test(styles[transitionProp + 'Property']);
  40247. return {
  40248. type: type,
  40249. timeout: timeout,
  40250. propCount: propCount,
  40251. hasTransform: hasTransform
  40252. }
  40253. }
  40254. function getTimeout (delays, durations) {
  40255. /* istanbul ignore next */
  40256. while (delays.length < durations.length) {
  40257. delays = delays.concat(delays);
  40258. }
  40259. return Math.max.apply(null, durations.map(function (d, i) {
  40260. return toMs(d) + toMs(delays[i])
  40261. }))
  40262. }
  40263. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  40264. // in a locale-dependent way, using a comma instead of a dot.
  40265. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  40266. // as a floor function) causing unexpected behaviors
  40267. function toMs (s) {
  40268. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  40269. }
  40270. /* */
  40271. function enter (vnode, toggleDisplay) {
  40272. var el = vnode.elm;
  40273. // call leave callback now
  40274. if (isDef(el._leaveCb)) {
  40275. el._leaveCb.cancelled = true;
  40276. el._leaveCb();
  40277. }
  40278. var data = resolveTransition(vnode.data.transition);
  40279. if (isUndef(data)) {
  40280. return
  40281. }
  40282. /* istanbul ignore if */
  40283. if (isDef(el._enterCb) || el.nodeType !== 1) {
  40284. return
  40285. }
  40286. var css = data.css;
  40287. var type = data.type;
  40288. var enterClass = data.enterClass;
  40289. var enterToClass = data.enterToClass;
  40290. var enterActiveClass = data.enterActiveClass;
  40291. var appearClass = data.appearClass;
  40292. var appearToClass = data.appearToClass;
  40293. var appearActiveClass = data.appearActiveClass;
  40294. var beforeEnter = data.beforeEnter;
  40295. var enter = data.enter;
  40296. var afterEnter = data.afterEnter;
  40297. var enterCancelled = data.enterCancelled;
  40298. var beforeAppear = data.beforeAppear;
  40299. var appear = data.appear;
  40300. var afterAppear = data.afterAppear;
  40301. var appearCancelled = data.appearCancelled;
  40302. var duration = data.duration;
  40303. // activeInstance will always be the <transition> component managing this
  40304. // transition. One edge case to check is when the <transition> is placed
  40305. // as the root node of a child component. In that case we need to check
  40306. // <transition>'s parent for appear check.
  40307. var context = activeInstance;
  40308. var transitionNode = activeInstance.$vnode;
  40309. while (transitionNode && transitionNode.parent) {
  40310. context = transitionNode.context;
  40311. transitionNode = transitionNode.parent;
  40312. }
  40313. var isAppear = !context._isMounted || !vnode.isRootInsert;
  40314. if (isAppear && !appear && appear !== '') {
  40315. return
  40316. }
  40317. var startClass = isAppear && appearClass
  40318. ? appearClass
  40319. : enterClass;
  40320. var activeClass = isAppear && appearActiveClass
  40321. ? appearActiveClass
  40322. : enterActiveClass;
  40323. var toClass = isAppear && appearToClass
  40324. ? appearToClass
  40325. : enterToClass;
  40326. var beforeEnterHook = isAppear
  40327. ? (beforeAppear || beforeEnter)
  40328. : beforeEnter;
  40329. var enterHook = isAppear
  40330. ? (typeof appear === 'function' ? appear : enter)
  40331. : enter;
  40332. var afterEnterHook = isAppear
  40333. ? (afterAppear || afterEnter)
  40334. : afterEnter;
  40335. var enterCancelledHook = isAppear
  40336. ? (appearCancelled || enterCancelled)
  40337. : enterCancelled;
  40338. var explicitEnterDuration = toNumber(
  40339. isObject(duration)
  40340. ? duration.enter
  40341. : duration
  40342. );
  40343. if (explicitEnterDuration != null) {
  40344. checkDuration(explicitEnterDuration, 'enter', vnode);
  40345. }
  40346. var expectsCSS = css !== false && !isIE9;
  40347. var userWantsControl = getHookArgumentsLength(enterHook);
  40348. var cb = el._enterCb = once(function () {
  40349. if (expectsCSS) {
  40350. removeTransitionClass(el, toClass);
  40351. removeTransitionClass(el, activeClass);
  40352. }
  40353. if (cb.cancelled) {
  40354. if (expectsCSS) {
  40355. removeTransitionClass(el, startClass);
  40356. }
  40357. enterCancelledHook && enterCancelledHook(el);
  40358. } else {
  40359. afterEnterHook && afterEnterHook(el);
  40360. }
  40361. el._enterCb = null;
  40362. });
  40363. if (!vnode.data.show) {
  40364. // remove pending leave element on enter by injecting an insert hook
  40365. mergeVNodeHook(vnode, 'insert', function () {
  40366. var parent = el.parentNode;
  40367. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  40368. if (pendingNode &&
  40369. pendingNode.tag === vnode.tag &&
  40370. pendingNode.elm._leaveCb
  40371. ) {
  40372. pendingNode.elm._leaveCb();
  40373. }
  40374. enterHook && enterHook(el, cb);
  40375. });
  40376. }
  40377. // start enter transition
  40378. beforeEnterHook && beforeEnterHook(el);
  40379. if (expectsCSS) {
  40380. addTransitionClass(el, startClass);
  40381. addTransitionClass(el, activeClass);
  40382. nextFrame(function () {
  40383. removeTransitionClass(el, startClass);
  40384. if (!cb.cancelled) {
  40385. addTransitionClass(el, toClass);
  40386. if (!userWantsControl) {
  40387. if (isValidDuration(explicitEnterDuration)) {
  40388. setTimeout(cb, explicitEnterDuration);
  40389. } else {
  40390. whenTransitionEnds(el, type, cb);
  40391. }
  40392. }
  40393. }
  40394. });
  40395. }
  40396. if (vnode.data.show) {
  40397. toggleDisplay && toggleDisplay();
  40398. enterHook && enterHook(el, cb);
  40399. }
  40400. if (!expectsCSS && !userWantsControl) {
  40401. cb();
  40402. }
  40403. }
  40404. function leave (vnode, rm) {
  40405. var el = vnode.elm;
  40406. // call enter callback now
  40407. if (isDef(el._enterCb)) {
  40408. el._enterCb.cancelled = true;
  40409. el._enterCb();
  40410. }
  40411. var data = resolveTransition(vnode.data.transition);
  40412. if (isUndef(data) || el.nodeType !== 1) {
  40413. return rm()
  40414. }
  40415. /* istanbul ignore if */
  40416. if (isDef(el._leaveCb)) {
  40417. return
  40418. }
  40419. var css = data.css;
  40420. var type = data.type;
  40421. var leaveClass = data.leaveClass;
  40422. var leaveToClass = data.leaveToClass;
  40423. var leaveActiveClass = data.leaveActiveClass;
  40424. var beforeLeave = data.beforeLeave;
  40425. var leave = data.leave;
  40426. var afterLeave = data.afterLeave;
  40427. var leaveCancelled = data.leaveCancelled;
  40428. var delayLeave = data.delayLeave;
  40429. var duration = data.duration;
  40430. var expectsCSS = css !== false && !isIE9;
  40431. var userWantsControl = getHookArgumentsLength(leave);
  40432. var explicitLeaveDuration = toNumber(
  40433. isObject(duration)
  40434. ? duration.leave
  40435. : duration
  40436. );
  40437. if (isDef(explicitLeaveDuration)) {
  40438. checkDuration(explicitLeaveDuration, 'leave', vnode);
  40439. }
  40440. var cb = el._leaveCb = once(function () {
  40441. if (el.parentNode && el.parentNode._pending) {
  40442. el.parentNode._pending[vnode.key] = null;
  40443. }
  40444. if (expectsCSS) {
  40445. removeTransitionClass(el, leaveToClass);
  40446. removeTransitionClass(el, leaveActiveClass);
  40447. }
  40448. if (cb.cancelled) {
  40449. if (expectsCSS) {
  40450. removeTransitionClass(el, leaveClass);
  40451. }
  40452. leaveCancelled && leaveCancelled(el);
  40453. } else {
  40454. rm();
  40455. afterLeave && afterLeave(el);
  40456. }
  40457. el._leaveCb = null;
  40458. });
  40459. if (delayLeave) {
  40460. delayLeave(performLeave);
  40461. } else {
  40462. performLeave();
  40463. }
  40464. function performLeave () {
  40465. // the delayed leave may have already been cancelled
  40466. if (cb.cancelled) {
  40467. return
  40468. }
  40469. // record leaving element
  40470. if (!vnode.data.show && el.parentNode) {
  40471. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  40472. }
  40473. beforeLeave && beforeLeave(el);
  40474. if (expectsCSS) {
  40475. addTransitionClass(el, leaveClass);
  40476. addTransitionClass(el, leaveActiveClass);
  40477. nextFrame(function () {
  40478. removeTransitionClass(el, leaveClass);
  40479. if (!cb.cancelled) {
  40480. addTransitionClass(el, leaveToClass);
  40481. if (!userWantsControl) {
  40482. if (isValidDuration(explicitLeaveDuration)) {
  40483. setTimeout(cb, explicitLeaveDuration);
  40484. } else {
  40485. whenTransitionEnds(el, type, cb);
  40486. }
  40487. }
  40488. }
  40489. });
  40490. }
  40491. leave && leave(el, cb);
  40492. if (!expectsCSS && !userWantsControl) {
  40493. cb();
  40494. }
  40495. }
  40496. }
  40497. // only used in dev mode
  40498. function checkDuration (val, name, vnode) {
  40499. if (typeof val !== 'number') {
  40500. warn(
  40501. "<transition> explicit " + name + " duration is not a valid number - " +
  40502. "got " + (JSON.stringify(val)) + ".",
  40503. vnode.context
  40504. );
  40505. } else if (isNaN(val)) {
  40506. warn(
  40507. "<transition> explicit " + name + " duration is NaN - " +
  40508. 'the duration expression might be incorrect.',
  40509. vnode.context
  40510. );
  40511. }
  40512. }
  40513. function isValidDuration (val) {
  40514. return typeof val === 'number' && !isNaN(val)
  40515. }
  40516. /**
  40517. * Normalize a transition hook's argument length. The hook may be:
  40518. * - a merged hook (invoker) with the original in .fns
  40519. * - a wrapped component method (check ._length)
  40520. * - a plain function (.length)
  40521. */
  40522. function getHookArgumentsLength (fn) {
  40523. if (isUndef(fn)) {
  40524. return false
  40525. }
  40526. var invokerFns = fn.fns;
  40527. if (isDef(invokerFns)) {
  40528. // invoker
  40529. return getHookArgumentsLength(
  40530. Array.isArray(invokerFns)
  40531. ? invokerFns[0]
  40532. : invokerFns
  40533. )
  40534. } else {
  40535. return (fn._length || fn.length) > 1
  40536. }
  40537. }
  40538. function _enter (_, vnode) {
  40539. if (vnode.data.show !== true) {
  40540. enter(vnode);
  40541. }
  40542. }
  40543. var transition = inBrowser ? {
  40544. create: _enter,
  40545. activate: _enter,
  40546. remove: function remove$$1 (vnode, rm) {
  40547. /* istanbul ignore else */
  40548. if (vnode.data.show !== true) {
  40549. leave(vnode, rm);
  40550. } else {
  40551. rm();
  40552. }
  40553. }
  40554. } : {};
  40555. var platformModules = [
  40556. attrs,
  40557. klass,
  40558. events,
  40559. domProps,
  40560. style,
  40561. transition
  40562. ];
  40563. /* */
  40564. // the directive module should be applied last, after all
  40565. // built-in modules have been applied.
  40566. var modules = platformModules.concat(baseModules);
  40567. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  40568. /**
  40569. * Not type checking this file because flow doesn't like attaching
  40570. * properties to Elements.
  40571. */
  40572. /* istanbul ignore if */
  40573. if (isIE9) {
  40574. // http://www.matts411.com/post/internet-explorer-9-oninput/
  40575. document.addEventListener('selectionchange', function () {
  40576. var el = document.activeElement;
  40577. if (el && el.vmodel) {
  40578. trigger(el, 'input');
  40579. }
  40580. });
  40581. }
  40582. var directive = {
  40583. inserted: function inserted (el, binding, vnode, oldVnode) {
  40584. if (vnode.tag === 'select') {
  40585. // #6903
  40586. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  40587. mergeVNodeHook(vnode, 'postpatch', function () {
  40588. directive.componentUpdated(el, binding, vnode);
  40589. });
  40590. } else {
  40591. setSelected(el, binding, vnode.context);
  40592. }
  40593. el._vOptions = [].map.call(el.options, getValue);
  40594. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  40595. el._vModifiers = binding.modifiers;
  40596. if (!binding.modifiers.lazy) {
  40597. el.addEventListener('compositionstart', onCompositionStart);
  40598. el.addEventListener('compositionend', onCompositionEnd);
  40599. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  40600. // switching focus before confirming composition choice
  40601. // this also fixes the issue where some browsers e.g. iOS Chrome
  40602. // fires "change" instead of "input" on autocomplete.
  40603. el.addEventListener('change', onCompositionEnd);
  40604. /* istanbul ignore if */
  40605. if (isIE9) {
  40606. el.vmodel = true;
  40607. }
  40608. }
  40609. }
  40610. },
  40611. componentUpdated: function componentUpdated (el, binding, vnode) {
  40612. if (vnode.tag === 'select') {
  40613. setSelected(el, binding, vnode.context);
  40614. // in case the options rendered by v-for have changed,
  40615. // it's possible that the value is out-of-sync with the rendered options.
  40616. // detect such cases and filter out values that no longer has a matching
  40617. // option in the DOM.
  40618. var prevOptions = el._vOptions;
  40619. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  40620. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  40621. // trigger change event if
  40622. // no matching option found for at least one value
  40623. var needReset = el.multiple
  40624. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  40625. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  40626. if (needReset) {
  40627. trigger(el, 'change');
  40628. }
  40629. }
  40630. }
  40631. }
  40632. };
  40633. function setSelected (el, binding, vm) {
  40634. actuallySetSelected(el, binding, vm);
  40635. /* istanbul ignore if */
  40636. if (isIE || isEdge) {
  40637. setTimeout(function () {
  40638. actuallySetSelected(el, binding, vm);
  40639. }, 0);
  40640. }
  40641. }
  40642. function actuallySetSelected (el, binding, vm) {
  40643. var value = binding.value;
  40644. var isMultiple = el.multiple;
  40645. if (isMultiple && !Array.isArray(value)) {
  40646. warn(
  40647. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  40648. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  40649. vm
  40650. );
  40651. return
  40652. }
  40653. var selected, option;
  40654. for (var i = 0, l = el.options.length; i < l; i++) {
  40655. option = el.options[i];
  40656. if (isMultiple) {
  40657. selected = looseIndexOf(value, getValue(option)) > -1;
  40658. if (option.selected !== selected) {
  40659. option.selected = selected;
  40660. }
  40661. } else {
  40662. if (looseEqual(getValue(option), value)) {
  40663. if (el.selectedIndex !== i) {
  40664. el.selectedIndex = i;
  40665. }
  40666. return
  40667. }
  40668. }
  40669. }
  40670. if (!isMultiple) {
  40671. el.selectedIndex = -1;
  40672. }
  40673. }
  40674. function hasNoMatchingOption (value, options) {
  40675. return options.every(function (o) { return !looseEqual(o, value); })
  40676. }
  40677. function getValue (option) {
  40678. return '_value' in option
  40679. ? option._value
  40680. : option.value
  40681. }
  40682. function onCompositionStart (e) {
  40683. e.target.composing = true;
  40684. }
  40685. function onCompositionEnd (e) {
  40686. // prevent triggering an input event for no reason
  40687. if (!e.target.composing) { return }
  40688. e.target.composing = false;
  40689. trigger(e.target, 'input');
  40690. }
  40691. function trigger (el, type) {
  40692. var e = document.createEvent('HTMLEvents');
  40693. e.initEvent(type, true, true);
  40694. el.dispatchEvent(e);
  40695. }
  40696. /* */
  40697. // recursively search for possible transition defined inside the component root
  40698. function locateNode (vnode) {
  40699. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  40700. ? locateNode(vnode.componentInstance._vnode)
  40701. : vnode
  40702. }
  40703. var show = {
  40704. bind: function bind (el, ref, vnode) {
  40705. var value = ref.value;
  40706. vnode = locateNode(vnode);
  40707. var transition$$1 = vnode.data && vnode.data.transition;
  40708. var originalDisplay = el.__vOriginalDisplay =
  40709. el.style.display === 'none' ? '' : el.style.display;
  40710. if (value && transition$$1) {
  40711. vnode.data.show = true;
  40712. enter(vnode, function () {
  40713. el.style.display = originalDisplay;
  40714. });
  40715. } else {
  40716. el.style.display = value ? originalDisplay : 'none';
  40717. }
  40718. },
  40719. update: function update (el, ref, vnode) {
  40720. var value = ref.value;
  40721. var oldValue = ref.oldValue;
  40722. /* istanbul ignore if */
  40723. if (!value === !oldValue) { return }
  40724. vnode = locateNode(vnode);
  40725. var transition$$1 = vnode.data && vnode.data.transition;
  40726. if (transition$$1) {
  40727. vnode.data.show = true;
  40728. if (value) {
  40729. enter(vnode, function () {
  40730. el.style.display = el.__vOriginalDisplay;
  40731. });
  40732. } else {
  40733. leave(vnode, function () {
  40734. el.style.display = 'none';
  40735. });
  40736. }
  40737. } else {
  40738. el.style.display = value ? el.__vOriginalDisplay : 'none';
  40739. }
  40740. },
  40741. unbind: function unbind (
  40742. el,
  40743. binding,
  40744. vnode,
  40745. oldVnode,
  40746. isDestroy
  40747. ) {
  40748. if (!isDestroy) {
  40749. el.style.display = el.__vOriginalDisplay;
  40750. }
  40751. }
  40752. };
  40753. var platformDirectives = {
  40754. model: directive,
  40755. show: show
  40756. };
  40757. /* */
  40758. var transitionProps = {
  40759. name: String,
  40760. appear: Boolean,
  40761. css: Boolean,
  40762. mode: String,
  40763. type: String,
  40764. enterClass: String,
  40765. leaveClass: String,
  40766. enterToClass: String,
  40767. leaveToClass: String,
  40768. enterActiveClass: String,
  40769. leaveActiveClass: String,
  40770. appearClass: String,
  40771. appearActiveClass: String,
  40772. appearToClass: String,
  40773. duration: [Number, String, Object]
  40774. };
  40775. // in case the child is also an abstract component, e.g. <keep-alive>
  40776. // we want to recursively retrieve the real component to be rendered
  40777. function getRealChild (vnode) {
  40778. var compOptions = vnode && vnode.componentOptions;
  40779. if (compOptions && compOptions.Ctor.options.abstract) {
  40780. return getRealChild(getFirstComponentChild(compOptions.children))
  40781. } else {
  40782. return vnode
  40783. }
  40784. }
  40785. function extractTransitionData (comp) {
  40786. var data = {};
  40787. var options = comp.$options;
  40788. // props
  40789. for (var key in options.propsData) {
  40790. data[key] = comp[key];
  40791. }
  40792. // events.
  40793. // extract listeners and pass them directly to the transition methods
  40794. var listeners = options._parentListeners;
  40795. for (var key$1 in listeners) {
  40796. data[camelize(key$1)] = listeners[key$1];
  40797. }
  40798. return data
  40799. }
  40800. function placeholder (h, rawChild) {
  40801. if (/\d-keep-alive$/.test(rawChild.tag)) {
  40802. return h('keep-alive', {
  40803. props: rawChild.componentOptions.propsData
  40804. })
  40805. }
  40806. }
  40807. function hasParentTransition (vnode) {
  40808. while ((vnode = vnode.parent)) {
  40809. if (vnode.data.transition) {
  40810. return true
  40811. }
  40812. }
  40813. }
  40814. function isSameChild (child, oldChild) {
  40815. return oldChild.key === child.key && oldChild.tag === child.tag
  40816. }
  40817. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  40818. var isVShowDirective = function (d) { return d.name === 'show'; };
  40819. var Transition = {
  40820. name: 'transition',
  40821. props: transitionProps,
  40822. abstract: true,
  40823. render: function render (h) {
  40824. var this$1 = this;
  40825. var children = this.$slots.default;
  40826. if (!children) {
  40827. return
  40828. }
  40829. // filter out text nodes (possible whitespaces)
  40830. children = children.filter(isNotTextNode);
  40831. /* istanbul ignore if */
  40832. if (!children.length) {
  40833. return
  40834. }
  40835. // warn multiple elements
  40836. if (children.length > 1) {
  40837. warn(
  40838. '<transition> can only be used on a single element. Use ' +
  40839. '<transition-group> for lists.',
  40840. this.$parent
  40841. );
  40842. }
  40843. var mode = this.mode;
  40844. // warn invalid mode
  40845. if (mode && mode !== 'in-out' && mode !== 'out-in'
  40846. ) {
  40847. warn(
  40848. 'invalid <transition> mode: ' + mode,
  40849. this.$parent
  40850. );
  40851. }
  40852. var rawChild = children[0];
  40853. // if this is a component root node and the component's
  40854. // parent container node also has transition, skip.
  40855. if (hasParentTransition(this.$vnode)) {
  40856. return rawChild
  40857. }
  40858. // apply transition data to child
  40859. // use getRealChild() to ignore abstract components e.g. keep-alive
  40860. var child = getRealChild(rawChild);
  40861. /* istanbul ignore if */
  40862. if (!child) {
  40863. return rawChild
  40864. }
  40865. if (this._leaving) {
  40866. return placeholder(h, rawChild)
  40867. }
  40868. // ensure a key that is unique to the vnode type and to this transition
  40869. // component instance. This key will be used to remove pending leaving nodes
  40870. // during entering.
  40871. var id = "__transition-" + (this._uid) + "-";
  40872. child.key = child.key == null
  40873. ? child.isComment
  40874. ? id + 'comment'
  40875. : id + child.tag
  40876. : isPrimitive(child.key)
  40877. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  40878. : child.key;
  40879. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  40880. var oldRawChild = this._vnode;
  40881. var oldChild = getRealChild(oldRawChild);
  40882. // mark v-show
  40883. // so that the transition module can hand over the control to the directive
  40884. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  40885. child.data.show = true;
  40886. }
  40887. if (
  40888. oldChild &&
  40889. oldChild.data &&
  40890. !isSameChild(child, oldChild) &&
  40891. !isAsyncPlaceholder(oldChild) &&
  40892. // #6687 component root is a comment node
  40893. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  40894. ) {
  40895. // replace old child transition data with fresh one
  40896. // important for dynamic transitions!
  40897. var oldData = oldChild.data.transition = extend({}, data);
  40898. // handle transition mode
  40899. if (mode === 'out-in') {
  40900. // return placeholder node and queue update when leave finishes
  40901. this._leaving = true;
  40902. mergeVNodeHook(oldData, 'afterLeave', function () {
  40903. this$1._leaving = false;
  40904. this$1.$forceUpdate();
  40905. });
  40906. return placeholder(h, rawChild)
  40907. } else if (mode === 'in-out') {
  40908. if (isAsyncPlaceholder(child)) {
  40909. return oldRawChild
  40910. }
  40911. var delayedLeave;
  40912. var performLeave = function () { delayedLeave(); };
  40913. mergeVNodeHook(data, 'afterEnter', performLeave);
  40914. mergeVNodeHook(data, 'enterCancelled', performLeave);
  40915. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  40916. }
  40917. }
  40918. return rawChild
  40919. }
  40920. };
  40921. /* */
  40922. var props = extend({
  40923. tag: String,
  40924. moveClass: String
  40925. }, transitionProps);
  40926. delete props.mode;
  40927. var TransitionGroup = {
  40928. props: props,
  40929. beforeMount: function beforeMount () {
  40930. var this$1 = this;
  40931. var update = this._update;
  40932. this._update = function (vnode, hydrating) {
  40933. var restoreActiveInstance = setActiveInstance(this$1);
  40934. // force removing pass
  40935. this$1.__patch__(
  40936. this$1._vnode,
  40937. this$1.kept,
  40938. false, // hydrating
  40939. true // removeOnly (!important, avoids unnecessary moves)
  40940. );
  40941. this$1._vnode = this$1.kept;
  40942. restoreActiveInstance();
  40943. update.call(this$1, vnode, hydrating);
  40944. };
  40945. },
  40946. render: function render (h) {
  40947. var tag = this.tag || this.$vnode.data.tag || 'span';
  40948. var map = Object.create(null);
  40949. var prevChildren = this.prevChildren = this.children;
  40950. var rawChildren = this.$slots.default || [];
  40951. var children = this.children = [];
  40952. var transitionData = extractTransitionData(this);
  40953. for (var i = 0; i < rawChildren.length; i++) {
  40954. var c = rawChildren[i];
  40955. if (c.tag) {
  40956. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  40957. children.push(c);
  40958. map[c.key] = c
  40959. ;(c.data || (c.data = {})).transition = transitionData;
  40960. } else {
  40961. var opts = c.componentOptions;
  40962. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  40963. warn(("<transition-group> children must be keyed: <" + name + ">"));
  40964. }
  40965. }
  40966. }
  40967. if (prevChildren) {
  40968. var kept = [];
  40969. var removed = [];
  40970. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  40971. var c$1 = prevChildren[i$1];
  40972. c$1.data.transition = transitionData;
  40973. c$1.data.pos = c$1.elm.getBoundingClientRect();
  40974. if (map[c$1.key]) {
  40975. kept.push(c$1);
  40976. } else {
  40977. removed.push(c$1);
  40978. }
  40979. }
  40980. this.kept = h(tag, null, kept);
  40981. this.removed = removed;
  40982. }
  40983. return h(tag, null, children)
  40984. },
  40985. updated: function updated () {
  40986. var children = this.prevChildren;
  40987. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  40988. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  40989. return
  40990. }
  40991. // we divide the work into three loops to avoid mixing DOM reads and writes
  40992. // in each iteration - which helps prevent layout thrashing.
  40993. children.forEach(callPendingCbs);
  40994. children.forEach(recordPosition);
  40995. children.forEach(applyTranslation);
  40996. // force reflow to put everything in position
  40997. // assign to this to avoid being removed in tree-shaking
  40998. // $flow-disable-line
  40999. this._reflow = document.body.offsetHeight;
  41000. children.forEach(function (c) {
  41001. if (c.data.moved) {
  41002. var el = c.elm;
  41003. var s = el.style;
  41004. addTransitionClass(el, moveClass);
  41005. s.transform = s.WebkitTransform = s.transitionDuration = '';
  41006. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  41007. if (e && e.target !== el) {
  41008. return
  41009. }
  41010. if (!e || /transform$/.test(e.propertyName)) {
  41011. el.removeEventListener(transitionEndEvent, cb);
  41012. el._moveCb = null;
  41013. removeTransitionClass(el, moveClass);
  41014. }
  41015. });
  41016. }
  41017. });
  41018. },
  41019. methods: {
  41020. hasMove: function hasMove (el, moveClass) {
  41021. /* istanbul ignore if */
  41022. if (!hasTransition) {
  41023. return false
  41024. }
  41025. /* istanbul ignore if */
  41026. if (this._hasMove) {
  41027. return this._hasMove
  41028. }
  41029. // Detect whether an element with the move class applied has
  41030. // CSS transitions. Since the element may be inside an entering
  41031. // transition at this very moment, we make a clone of it and remove
  41032. // all other transition classes applied to ensure only the move class
  41033. // is applied.
  41034. var clone = el.cloneNode();
  41035. if (el._transitionClasses) {
  41036. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  41037. }
  41038. addClass(clone, moveClass);
  41039. clone.style.display = 'none';
  41040. this.$el.appendChild(clone);
  41041. var info = getTransitionInfo(clone);
  41042. this.$el.removeChild(clone);
  41043. return (this._hasMove = info.hasTransform)
  41044. }
  41045. }
  41046. };
  41047. function callPendingCbs (c) {
  41048. /* istanbul ignore if */
  41049. if (c.elm._moveCb) {
  41050. c.elm._moveCb();
  41051. }
  41052. /* istanbul ignore if */
  41053. if (c.elm._enterCb) {
  41054. c.elm._enterCb();
  41055. }
  41056. }
  41057. function recordPosition (c) {
  41058. c.data.newPos = c.elm.getBoundingClientRect();
  41059. }
  41060. function applyTranslation (c) {
  41061. var oldPos = c.data.pos;
  41062. var newPos = c.data.newPos;
  41063. var dx = oldPos.left - newPos.left;
  41064. var dy = oldPos.top - newPos.top;
  41065. if (dx || dy) {
  41066. c.data.moved = true;
  41067. var s = c.elm.style;
  41068. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  41069. s.transitionDuration = '0s';
  41070. }
  41071. }
  41072. var platformComponents = {
  41073. Transition: Transition,
  41074. TransitionGroup: TransitionGroup
  41075. };
  41076. /* */
  41077. // install platform specific utils
  41078. Vue.config.mustUseProp = mustUseProp;
  41079. Vue.config.isReservedTag = isReservedTag;
  41080. Vue.config.isReservedAttr = isReservedAttr;
  41081. Vue.config.getTagNamespace = getTagNamespace;
  41082. Vue.config.isUnknownElement = isUnknownElement;
  41083. // install platform runtime directives & components
  41084. extend(Vue.options.directives, platformDirectives);
  41085. extend(Vue.options.components, platformComponents);
  41086. // install platform patch function
  41087. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  41088. // public mount method
  41089. Vue.prototype.$mount = function (
  41090. el,
  41091. hydrating
  41092. ) {
  41093. el = el && inBrowser ? query(el) : undefined;
  41094. return mountComponent(this, el, hydrating)
  41095. };
  41096. // devtools global hook
  41097. /* istanbul ignore next */
  41098. if (inBrowser) {
  41099. setTimeout(function () {
  41100. if (config.devtools) {
  41101. if (devtools) {
  41102. devtools.emit('init', Vue);
  41103. } else {
  41104. console[console.info ? 'info' : 'log'](
  41105. 'Download the Vue Devtools extension for a better development experience:\n' +
  41106. 'https://github.com/vuejs/vue-devtools'
  41107. );
  41108. }
  41109. }
  41110. if (config.productionTip !== false &&
  41111. typeof console !== 'undefined'
  41112. ) {
  41113. console[console.info ? 'info' : 'log'](
  41114. "You are running Vue in development mode.\n" +
  41115. "Make sure to turn on production mode when deploying for production.\n" +
  41116. "See more tips at https://vuejs.org/guide/deployment.html"
  41117. );
  41118. }
  41119. }, 0);
  41120. }
  41121. /* */
  41122. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  41123. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  41124. var buildRegex = cached(function (delimiters) {
  41125. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  41126. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  41127. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  41128. });
  41129. function parseText (
  41130. text,
  41131. delimiters
  41132. ) {
  41133. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  41134. if (!tagRE.test(text)) {
  41135. return
  41136. }
  41137. var tokens = [];
  41138. var rawTokens = [];
  41139. var lastIndex = tagRE.lastIndex = 0;
  41140. var match, index, tokenValue;
  41141. while ((match = tagRE.exec(text))) {
  41142. index = match.index;
  41143. // push text token
  41144. if (index > lastIndex) {
  41145. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  41146. tokens.push(JSON.stringify(tokenValue));
  41147. }
  41148. // tag token
  41149. var exp = parseFilters(match[1].trim());
  41150. tokens.push(("_s(" + exp + ")"));
  41151. rawTokens.push({ '@binding': exp });
  41152. lastIndex = index + match[0].length;
  41153. }
  41154. if (lastIndex < text.length) {
  41155. rawTokens.push(tokenValue = text.slice(lastIndex));
  41156. tokens.push(JSON.stringify(tokenValue));
  41157. }
  41158. return {
  41159. expression: tokens.join('+'),
  41160. tokens: rawTokens
  41161. }
  41162. }
  41163. /* */
  41164. function transformNode (el, options) {
  41165. var warn = options.warn || baseWarn;
  41166. var staticClass = getAndRemoveAttr(el, 'class');
  41167. if (staticClass) {
  41168. var res = parseText(staticClass, options.delimiters);
  41169. if (res) {
  41170. warn(
  41171. "class=\"" + staticClass + "\": " +
  41172. 'Interpolation inside attributes has been removed. ' +
  41173. 'Use v-bind or the colon shorthand instead. For example, ' +
  41174. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  41175. el.rawAttrsMap['class']
  41176. );
  41177. }
  41178. }
  41179. if (staticClass) {
  41180. el.staticClass = JSON.stringify(staticClass);
  41181. }
  41182. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  41183. if (classBinding) {
  41184. el.classBinding = classBinding;
  41185. }
  41186. }
  41187. function genData (el) {
  41188. var data = '';
  41189. if (el.staticClass) {
  41190. data += "staticClass:" + (el.staticClass) + ",";
  41191. }
  41192. if (el.classBinding) {
  41193. data += "class:" + (el.classBinding) + ",";
  41194. }
  41195. return data
  41196. }
  41197. var klass$1 = {
  41198. staticKeys: ['staticClass'],
  41199. transformNode: transformNode,
  41200. genData: genData
  41201. };
  41202. /* */
  41203. function transformNode$1 (el, options) {
  41204. var warn = options.warn || baseWarn;
  41205. var staticStyle = getAndRemoveAttr(el, 'style');
  41206. if (staticStyle) {
  41207. /* istanbul ignore if */
  41208. {
  41209. var res = parseText(staticStyle, options.delimiters);
  41210. if (res) {
  41211. warn(
  41212. "style=\"" + staticStyle + "\": " +
  41213. 'Interpolation inside attributes has been removed. ' +
  41214. 'Use v-bind or the colon shorthand instead. For example, ' +
  41215. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  41216. el.rawAttrsMap['style']
  41217. );
  41218. }
  41219. }
  41220. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  41221. }
  41222. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  41223. if (styleBinding) {
  41224. el.styleBinding = styleBinding;
  41225. }
  41226. }
  41227. function genData$1 (el) {
  41228. var data = '';
  41229. if (el.staticStyle) {
  41230. data += "staticStyle:" + (el.staticStyle) + ",";
  41231. }
  41232. if (el.styleBinding) {
  41233. data += "style:(" + (el.styleBinding) + "),";
  41234. }
  41235. return data
  41236. }
  41237. var style$1 = {
  41238. staticKeys: ['staticStyle'],
  41239. transformNode: transformNode$1,
  41240. genData: genData$1
  41241. };
  41242. /* */
  41243. var decoder;
  41244. var he = {
  41245. decode: function decode (html) {
  41246. decoder = decoder || document.createElement('div');
  41247. decoder.innerHTML = html;
  41248. return decoder.textContent
  41249. }
  41250. };
  41251. /* */
  41252. var isUnaryTag = makeMap(
  41253. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  41254. 'link,meta,param,source,track,wbr'
  41255. );
  41256. // Elements that you can, intentionally, leave open
  41257. // (and which close themselves)
  41258. var canBeLeftOpenTag = makeMap(
  41259. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  41260. );
  41261. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  41262. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  41263. var isNonPhrasingTag = makeMap(
  41264. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  41265. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  41266. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  41267. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  41268. 'title,tr,track'
  41269. );
  41270. /**
  41271. * Not type-checking this file because it's mostly vendor code.
  41272. */
  41273. // Regular Expressions for parsing tags and attributes
  41274. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41275. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41276. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  41277. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  41278. var startTagOpen = new RegExp(("^<" + qnameCapture));
  41279. var startTagClose = /^\s*(\/?)>/;
  41280. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  41281. var doctype = /^<!DOCTYPE [^>]+>/i;
  41282. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  41283. var comment = /^<!\--/;
  41284. var conditionalComment = /^<!\[/;
  41285. // Special Elements (can contain anything)
  41286. var isPlainTextElement = makeMap('script,style,textarea', true);
  41287. var reCache = {};
  41288. var decodingMap = {
  41289. '&lt;': '<',
  41290. '&gt;': '>',
  41291. '&quot;': '"',
  41292. '&amp;': '&',
  41293. '&#10;': '\n',
  41294. '&#9;': '\t',
  41295. '&#39;': "'"
  41296. };
  41297. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  41298. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  41299. // #5992
  41300. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  41301. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  41302. function decodeAttr (value, shouldDecodeNewlines) {
  41303. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  41304. return value.replace(re, function (match) { return decodingMap[match]; })
  41305. }
  41306. function parseHTML (html, options) {
  41307. var stack = [];
  41308. var expectHTML = options.expectHTML;
  41309. var isUnaryTag$$1 = options.isUnaryTag || no;
  41310. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  41311. var index = 0;
  41312. var last, lastTag;
  41313. while (html) {
  41314. last = html;
  41315. // Make sure we're not in a plaintext content element like script/style
  41316. if (!lastTag || !isPlainTextElement(lastTag)) {
  41317. var textEnd = html.indexOf('<');
  41318. if (textEnd === 0) {
  41319. // Comment:
  41320. if (comment.test(html)) {
  41321. var commentEnd = html.indexOf('-->');
  41322. if (commentEnd >= 0) {
  41323. if (options.shouldKeepComment) {
  41324. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  41325. }
  41326. advance(commentEnd + 3);
  41327. continue
  41328. }
  41329. }
  41330. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  41331. if (conditionalComment.test(html)) {
  41332. var conditionalEnd = html.indexOf(']>');
  41333. if (conditionalEnd >= 0) {
  41334. advance(conditionalEnd + 2);
  41335. continue
  41336. }
  41337. }
  41338. // Doctype:
  41339. var doctypeMatch = html.match(doctype);
  41340. if (doctypeMatch) {
  41341. advance(doctypeMatch[0].length);
  41342. continue
  41343. }
  41344. // End tag:
  41345. var endTagMatch = html.match(endTag);
  41346. if (endTagMatch) {
  41347. var curIndex = index;
  41348. advance(endTagMatch[0].length);
  41349. parseEndTag(endTagMatch[1], curIndex, index);
  41350. continue
  41351. }
  41352. // Start tag:
  41353. var startTagMatch = parseStartTag();
  41354. if (startTagMatch) {
  41355. handleStartTag(startTagMatch);
  41356. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  41357. advance(1);
  41358. }
  41359. continue
  41360. }
  41361. }
  41362. var text = (void 0), rest = (void 0), next = (void 0);
  41363. if (textEnd >= 0) {
  41364. rest = html.slice(textEnd);
  41365. while (
  41366. !endTag.test(rest) &&
  41367. !startTagOpen.test(rest) &&
  41368. !comment.test(rest) &&
  41369. !conditionalComment.test(rest)
  41370. ) {
  41371. // < in plain text, be forgiving and treat it as text
  41372. next = rest.indexOf('<', 1);
  41373. if (next < 0) { break }
  41374. textEnd += next;
  41375. rest = html.slice(textEnd);
  41376. }
  41377. text = html.substring(0, textEnd);
  41378. }
  41379. if (textEnd < 0) {
  41380. text = html;
  41381. }
  41382. if (text) {
  41383. advance(text.length);
  41384. }
  41385. if (options.chars && text) {
  41386. options.chars(text, index - text.length, index);
  41387. }
  41388. } else {
  41389. var endTagLength = 0;
  41390. var stackedTag = lastTag.toLowerCase();
  41391. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  41392. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  41393. endTagLength = endTag.length;
  41394. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  41395. text = text
  41396. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  41397. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  41398. }
  41399. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  41400. text = text.slice(1);
  41401. }
  41402. if (options.chars) {
  41403. options.chars(text);
  41404. }
  41405. return ''
  41406. });
  41407. index += html.length - rest$1.length;
  41408. html = rest$1;
  41409. parseEndTag(stackedTag, index - endTagLength, index);
  41410. }
  41411. if (html === last) {
  41412. options.chars && options.chars(html);
  41413. if (!stack.length && options.warn) {
  41414. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  41415. }
  41416. break
  41417. }
  41418. }
  41419. // Clean up any remaining tags
  41420. parseEndTag();
  41421. function advance (n) {
  41422. index += n;
  41423. html = html.substring(n);
  41424. }
  41425. function parseStartTag () {
  41426. var start = html.match(startTagOpen);
  41427. if (start) {
  41428. var match = {
  41429. tagName: start[1],
  41430. attrs: [],
  41431. start: index
  41432. };
  41433. advance(start[0].length);
  41434. var end, attr;
  41435. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  41436. attr.start = index;
  41437. advance(attr[0].length);
  41438. attr.end = index;
  41439. match.attrs.push(attr);
  41440. }
  41441. if (end) {
  41442. match.unarySlash = end[1];
  41443. advance(end[0].length);
  41444. match.end = index;
  41445. return match
  41446. }
  41447. }
  41448. }
  41449. function handleStartTag (match) {
  41450. var tagName = match.tagName;
  41451. var unarySlash = match.unarySlash;
  41452. if (expectHTML) {
  41453. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  41454. parseEndTag(lastTag);
  41455. }
  41456. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  41457. parseEndTag(tagName);
  41458. }
  41459. }
  41460. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  41461. var l = match.attrs.length;
  41462. var attrs = new Array(l);
  41463. for (var i = 0; i < l; i++) {
  41464. var args = match.attrs[i];
  41465. var value = args[3] || args[4] || args[5] || '';
  41466. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  41467. ? options.shouldDecodeNewlinesForHref
  41468. : options.shouldDecodeNewlines;
  41469. attrs[i] = {
  41470. name: args[1],
  41471. value: decodeAttr(value, shouldDecodeNewlines)
  41472. };
  41473. if (options.outputSourceRange) {
  41474. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  41475. attrs[i].end = args.end;
  41476. }
  41477. }
  41478. if (!unary) {
  41479. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  41480. lastTag = tagName;
  41481. }
  41482. if (options.start) {
  41483. options.start(tagName, attrs, unary, match.start, match.end);
  41484. }
  41485. }
  41486. function parseEndTag (tagName, start, end) {
  41487. var pos, lowerCasedTagName;
  41488. if (start == null) { start = index; }
  41489. if (end == null) { end = index; }
  41490. // Find the closest opened tag of the same type
  41491. if (tagName) {
  41492. lowerCasedTagName = tagName.toLowerCase();
  41493. for (pos = stack.length - 1; pos >= 0; pos--) {
  41494. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  41495. break
  41496. }
  41497. }
  41498. } else {
  41499. // If no tag name is provided, clean shop
  41500. pos = 0;
  41501. }
  41502. if (pos >= 0) {
  41503. // Close all the open elements, up the stack
  41504. for (var i = stack.length - 1; i >= pos; i--) {
  41505. if (i > pos || !tagName &&
  41506. options.warn
  41507. ) {
  41508. options.warn(
  41509. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  41510. { start: stack[i].start, end: stack[i].end }
  41511. );
  41512. }
  41513. if (options.end) {
  41514. options.end(stack[i].tag, start, end);
  41515. }
  41516. }
  41517. // Remove the open elements from the stack
  41518. stack.length = pos;
  41519. lastTag = pos && stack[pos - 1].tag;
  41520. } else if (lowerCasedTagName === 'br') {
  41521. if (options.start) {
  41522. options.start(tagName, [], true, start, end);
  41523. }
  41524. } else if (lowerCasedTagName === 'p') {
  41525. if (options.start) {
  41526. options.start(tagName, [], false, start, end);
  41527. }
  41528. if (options.end) {
  41529. options.end(tagName, start, end);
  41530. }
  41531. }
  41532. }
  41533. }
  41534. /* */
  41535. var onRE = /^@|^v-on:/;
  41536. var dirRE = /^v-|^@|^:|^#/;
  41537. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  41538. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  41539. var stripParensRE = /^\(|\)$/g;
  41540. var dynamicArgRE = /^\[.*\]$/;
  41541. var argRE = /:(.*)$/;
  41542. var bindRE = /^:|^\.|^v-bind:/;
  41543. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  41544. var slotRE = /^v-slot(:|$)|^#/;
  41545. var lineBreakRE = /[\r\n]/;
  41546. var whitespaceRE$1 = /\s+/g;
  41547. var invalidAttributeRE = /[\s"'<>\/=]/;
  41548. var decodeHTMLCached = cached(he.decode);
  41549. var emptySlotScopeToken = "_empty_";
  41550. // configurable state
  41551. var warn$2;
  41552. var delimiters;
  41553. var transforms;
  41554. var preTransforms;
  41555. var postTransforms;
  41556. var platformIsPreTag;
  41557. var platformMustUseProp;
  41558. var platformGetTagNamespace;
  41559. var maybeComponent;
  41560. function createASTElement (
  41561. tag,
  41562. attrs,
  41563. parent
  41564. ) {
  41565. return {
  41566. type: 1,
  41567. tag: tag,
  41568. attrsList: attrs,
  41569. attrsMap: makeAttrsMap(attrs),
  41570. rawAttrsMap: {},
  41571. parent: parent,
  41572. children: []
  41573. }
  41574. }
  41575. /**
  41576. * Convert HTML string to AST.
  41577. */
  41578. function parse (
  41579. template,
  41580. options
  41581. ) {
  41582. warn$2 = options.warn || baseWarn;
  41583. platformIsPreTag = options.isPreTag || no;
  41584. platformMustUseProp = options.mustUseProp || no;
  41585. platformGetTagNamespace = options.getTagNamespace || no;
  41586. var isReservedTag = options.isReservedTag || no;
  41587. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  41588. transforms = pluckModuleFunction(options.modules, 'transformNode');
  41589. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  41590. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  41591. delimiters = options.delimiters;
  41592. var stack = [];
  41593. var preserveWhitespace = options.preserveWhitespace !== false;
  41594. var whitespaceOption = options.whitespace;
  41595. var root;
  41596. var currentParent;
  41597. var inVPre = false;
  41598. var inPre = false;
  41599. var warned = false;
  41600. function warnOnce (msg, range) {
  41601. if (!warned) {
  41602. warned = true;
  41603. warn$2(msg, range);
  41604. }
  41605. }
  41606. function closeElement (element) {
  41607. trimEndingWhitespace(element);
  41608. if (!inVPre && !element.processed) {
  41609. element = processElement(element, options);
  41610. }
  41611. // tree management
  41612. if (!stack.length && element !== root) {
  41613. // allow root elements with v-if, v-else-if and v-else
  41614. if (root.if && (element.elseif || element.else)) {
  41615. {
  41616. checkRootConstraints(element);
  41617. }
  41618. addIfCondition(root, {
  41619. exp: element.elseif,
  41620. block: element
  41621. });
  41622. } else {
  41623. warnOnce(
  41624. "Component template should contain exactly one root element. " +
  41625. "If you are using v-if on multiple elements, " +
  41626. "use v-else-if to chain them instead.",
  41627. { start: element.start }
  41628. );
  41629. }
  41630. }
  41631. if (currentParent && !element.forbidden) {
  41632. if (element.elseif || element.else) {
  41633. processIfConditions(element, currentParent);
  41634. } else {
  41635. if (element.slotScope) {
  41636. // scoped slot
  41637. // keep it in the children list so that v-else(-if) conditions can
  41638. // find it as the prev node.
  41639. var name = element.slotTarget || '"default"'
  41640. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  41641. }
  41642. currentParent.children.push(element);
  41643. element.parent = currentParent;
  41644. }
  41645. }
  41646. // final children cleanup
  41647. // filter out scoped slots
  41648. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  41649. // remove trailing whitespace node again
  41650. trimEndingWhitespace(element);
  41651. // check pre state
  41652. if (element.pre) {
  41653. inVPre = false;
  41654. }
  41655. if (platformIsPreTag(element.tag)) {
  41656. inPre = false;
  41657. }
  41658. // apply post-transforms
  41659. for (var i = 0; i < postTransforms.length; i++) {
  41660. postTransforms[i](element, options);
  41661. }
  41662. }
  41663. function trimEndingWhitespace (el) {
  41664. // remove trailing whitespace node
  41665. if (!inPre) {
  41666. var lastNode;
  41667. while (
  41668. (lastNode = el.children[el.children.length - 1]) &&
  41669. lastNode.type === 3 &&
  41670. lastNode.text === ' '
  41671. ) {
  41672. el.children.pop();
  41673. }
  41674. }
  41675. }
  41676. function checkRootConstraints (el) {
  41677. if (el.tag === 'slot' || el.tag === 'template') {
  41678. warnOnce(
  41679. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  41680. 'contain multiple nodes.',
  41681. { start: el.start }
  41682. );
  41683. }
  41684. if (el.attrsMap.hasOwnProperty('v-for')) {
  41685. warnOnce(
  41686. 'Cannot use v-for on stateful component root element because ' +
  41687. 'it renders multiple elements.',
  41688. el.rawAttrsMap['v-for']
  41689. );
  41690. }
  41691. }
  41692. parseHTML(template, {
  41693. warn: warn$2,
  41694. expectHTML: options.expectHTML,
  41695. isUnaryTag: options.isUnaryTag,
  41696. canBeLeftOpenTag: options.canBeLeftOpenTag,
  41697. shouldDecodeNewlines: options.shouldDecodeNewlines,
  41698. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  41699. shouldKeepComment: options.comments,
  41700. outputSourceRange: options.outputSourceRange,
  41701. start: function start (tag, attrs, unary, start$1, end) {
  41702. // check namespace.
  41703. // inherit parent ns if there is one
  41704. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  41705. // handle IE svg bug
  41706. /* istanbul ignore if */
  41707. if (isIE && ns === 'svg') {
  41708. attrs = guardIESVGBug(attrs);
  41709. }
  41710. var element = createASTElement(tag, attrs, currentParent);
  41711. if (ns) {
  41712. element.ns = ns;
  41713. }
  41714. {
  41715. if (options.outputSourceRange) {
  41716. element.start = start$1;
  41717. element.end = end;
  41718. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  41719. cumulated[attr.name] = attr;
  41720. return cumulated
  41721. }, {});
  41722. }
  41723. attrs.forEach(function (attr) {
  41724. if (invalidAttributeRE.test(attr.name)) {
  41725. warn$2(
  41726. "Invalid dynamic argument expression: attribute names cannot contain " +
  41727. "spaces, quotes, <, >, / or =.",
  41728. {
  41729. start: attr.start + attr.name.indexOf("["),
  41730. end: attr.start + attr.name.length
  41731. }
  41732. );
  41733. }
  41734. });
  41735. }
  41736. if (isForbiddenTag(element) && !isServerRendering()) {
  41737. element.forbidden = true;
  41738. warn$2(
  41739. 'Templates should only be responsible for mapping the state to the ' +
  41740. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  41741. "<" + tag + ">" + ', as they will not be parsed.',
  41742. { start: element.start }
  41743. );
  41744. }
  41745. // apply pre-transforms
  41746. for (var i = 0; i < preTransforms.length; i++) {
  41747. element = preTransforms[i](element, options) || element;
  41748. }
  41749. if (!inVPre) {
  41750. processPre(element);
  41751. if (element.pre) {
  41752. inVPre = true;
  41753. }
  41754. }
  41755. if (platformIsPreTag(element.tag)) {
  41756. inPre = true;
  41757. }
  41758. if (inVPre) {
  41759. processRawAttrs(element);
  41760. } else if (!element.processed) {
  41761. // structural directives
  41762. processFor(element);
  41763. processIf(element);
  41764. processOnce(element);
  41765. }
  41766. if (!root) {
  41767. root = element;
  41768. {
  41769. checkRootConstraints(root);
  41770. }
  41771. }
  41772. if (!unary) {
  41773. currentParent = element;
  41774. stack.push(element);
  41775. } else {
  41776. closeElement(element);
  41777. }
  41778. },
  41779. end: function end (tag, start, end$1) {
  41780. var element = stack[stack.length - 1];
  41781. // pop stack
  41782. stack.length -= 1;
  41783. currentParent = stack[stack.length - 1];
  41784. if (options.outputSourceRange) {
  41785. element.end = end$1;
  41786. }
  41787. closeElement(element);
  41788. },
  41789. chars: function chars (text, start, end) {
  41790. if (!currentParent) {
  41791. {
  41792. if (text === template) {
  41793. warnOnce(
  41794. 'Component template requires a root element, rather than just text.',
  41795. { start: start }
  41796. );
  41797. } else if ((text = text.trim())) {
  41798. warnOnce(
  41799. ("text \"" + text + "\" outside root element will be ignored."),
  41800. { start: start }
  41801. );
  41802. }
  41803. }
  41804. return
  41805. }
  41806. // IE textarea placeholder bug
  41807. /* istanbul ignore if */
  41808. if (isIE &&
  41809. currentParent.tag === 'textarea' &&
  41810. currentParent.attrsMap.placeholder === text
  41811. ) {
  41812. return
  41813. }
  41814. var children = currentParent.children;
  41815. if (inPre || text.trim()) {
  41816. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  41817. } else if (!children.length) {
  41818. // remove the whitespace-only node right after an opening tag
  41819. text = '';
  41820. } else if (whitespaceOption) {
  41821. if (whitespaceOption === 'condense') {
  41822. // in condense mode, remove the whitespace node if it contains
  41823. // line break, otherwise condense to a single space
  41824. text = lineBreakRE.test(text) ? '' : ' ';
  41825. } else {
  41826. text = ' ';
  41827. }
  41828. } else {
  41829. text = preserveWhitespace ? ' ' : '';
  41830. }
  41831. if (text) {
  41832. if (!inPre && whitespaceOption === 'condense') {
  41833. // condense consecutive whitespaces into single space
  41834. text = text.replace(whitespaceRE$1, ' ');
  41835. }
  41836. var res;
  41837. var child;
  41838. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  41839. child = {
  41840. type: 2,
  41841. expression: res.expression,
  41842. tokens: res.tokens,
  41843. text: text
  41844. };
  41845. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  41846. child = {
  41847. type: 3,
  41848. text: text
  41849. };
  41850. }
  41851. if (child) {
  41852. if (options.outputSourceRange) {
  41853. child.start = start;
  41854. child.end = end;
  41855. }
  41856. children.push(child);
  41857. }
  41858. }
  41859. },
  41860. comment: function comment (text, start, end) {
  41861. // adding anything as a sibling to the root node is forbidden
  41862. // comments should still be allowed, but ignored
  41863. if (currentParent) {
  41864. var child = {
  41865. type: 3,
  41866. text: text,
  41867. isComment: true
  41868. };
  41869. if (options.outputSourceRange) {
  41870. child.start = start;
  41871. child.end = end;
  41872. }
  41873. currentParent.children.push(child);
  41874. }
  41875. }
  41876. });
  41877. return root
  41878. }
  41879. function processPre (el) {
  41880. if (getAndRemoveAttr(el, 'v-pre') != null) {
  41881. el.pre = true;
  41882. }
  41883. }
  41884. function processRawAttrs (el) {
  41885. var list = el.attrsList;
  41886. var len = list.length;
  41887. if (len) {
  41888. var attrs = el.attrs = new Array(len);
  41889. for (var i = 0; i < len; i++) {
  41890. attrs[i] = {
  41891. name: list[i].name,
  41892. value: JSON.stringify(list[i].value)
  41893. };
  41894. if (list[i].start != null) {
  41895. attrs[i].start = list[i].start;
  41896. attrs[i].end = list[i].end;
  41897. }
  41898. }
  41899. } else if (!el.pre) {
  41900. // non root node in pre blocks with no attributes
  41901. el.plain = true;
  41902. }
  41903. }
  41904. function processElement (
  41905. element,
  41906. options
  41907. ) {
  41908. processKey(element);
  41909. // determine whether this is a plain element after
  41910. // removing structural attributes
  41911. element.plain = (
  41912. !element.key &&
  41913. !element.scopedSlots &&
  41914. !element.attrsList.length
  41915. );
  41916. processRef(element);
  41917. processSlotContent(element);
  41918. processSlotOutlet(element);
  41919. processComponent(element);
  41920. for (var i = 0; i < transforms.length; i++) {
  41921. element = transforms[i](element, options) || element;
  41922. }
  41923. processAttrs(element);
  41924. return element
  41925. }
  41926. function processKey (el) {
  41927. var exp = getBindingAttr(el, 'key');
  41928. if (exp) {
  41929. {
  41930. if (el.tag === 'template') {
  41931. warn$2(
  41932. "<template> cannot be keyed. Place the key on real elements instead.",
  41933. getRawBindingAttr(el, 'key')
  41934. );
  41935. }
  41936. if (el.for) {
  41937. var iterator = el.iterator2 || el.iterator1;
  41938. var parent = el.parent;
  41939. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  41940. warn$2(
  41941. "Do not use v-for index as key on <transition-group> children, " +
  41942. "this is the same as not using keys.",
  41943. getRawBindingAttr(el, 'key'),
  41944. true /* tip */
  41945. );
  41946. }
  41947. }
  41948. }
  41949. el.key = exp;
  41950. }
  41951. }
  41952. function processRef (el) {
  41953. var ref = getBindingAttr(el, 'ref');
  41954. if (ref) {
  41955. el.ref = ref;
  41956. el.refInFor = checkInFor(el);
  41957. }
  41958. }
  41959. function processFor (el) {
  41960. var exp;
  41961. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  41962. var res = parseFor(exp);
  41963. if (res) {
  41964. extend(el, res);
  41965. } else {
  41966. warn$2(
  41967. ("Invalid v-for expression: " + exp),
  41968. el.rawAttrsMap['v-for']
  41969. );
  41970. }
  41971. }
  41972. }
  41973. function parseFor (exp) {
  41974. var inMatch = exp.match(forAliasRE);
  41975. if (!inMatch) { return }
  41976. var res = {};
  41977. res.for = inMatch[2].trim();
  41978. var alias = inMatch[1].trim().replace(stripParensRE, '');
  41979. var iteratorMatch = alias.match(forIteratorRE);
  41980. if (iteratorMatch) {
  41981. res.alias = alias.replace(forIteratorRE, '').trim();
  41982. res.iterator1 = iteratorMatch[1].trim();
  41983. if (iteratorMatch[2]) {
  41984. res.iterator2 = iteratorMatch[2].trim();
  41985. }
  41986. } else {
  41987. res.alias = alias;
  41988. }
  41989. return res
  41990. }
  41991. function processIf (el) {
  41992. var exp = getAndRemoveAttr(el, 'v-if');
  41993. if (exp) {
  41994. el.if = exp;
  41995. addIfCondition(el, {
  41996. exp: exp,
  41997. block: el
  41998. });
  41999. } else {
  42000. if (getAndRemoveAttr(el, 'v-else') != null) {
  42001. el.else = true;
  42002. }
  42003. var elseif = getAndRemoveAttr(el, 'v-else-if');
  42004. if (elseif) {
  42005. el.elseif = elseif;
  42006. }
  42007. }
  42008. }
  42009. function processIfConditions (el, parent) {
  42010. var prev = findPrevElement(parent.children);
  42011. if (prev && prev.if) {
  42012. addIfCondition(prev, {
  42013. exp: el.elseif,
  42014. block: el
  42015. });
  42016. } else {
  42017. warn$2(
  42018. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  42019. "used on element <" + (el.tag) + "> without corresponding v-if.",
  42020. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  42021. );
  42022. }
  42023. }
  42024. function findPrevElement (children) {
  42025. var i = children.length;
  42026. while (i--) {
  42027. if (children[i].type === 1) {
  42028. return children[i]
  42029. } else {
  42030. if (children[i].text !== ' ') {
  42031. warn$2(
  42032. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  42033. "will be ignored.",
  42034. children[i]
  42035. );
  42036. }
  42037. children.pop();
  42038. }
  42039. }
  42040. }
  42041. function addIfCondition (el, condition) {
  42042. if (!el.ifConditions) {
  42043. el.ifConditions = [];
  42044. }
  42045. el.ifConditions.push(condition);
  42046. }
  42047. function processOnce (el) {
  42048. var once$$1 = getAndRemoveAttr(el, 'v-once');
  42049. if (once$$1 != null) {
  42050. el.once = true;
  42051. }
  42052. }
  42053. // handle content being passed to a component as slot,
  42054. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  42055. function processSlotContent (el) {
  42056. var slotScope;
  42057. if (el.tag === 'template') {
  42058. slotScope = getAndRemoveAttr(el, 'scope');
  42059. /* istanbul ignore if */
  42060. if (slotScope) {
  42061. warn$2(
  42062. "the \"scope\" attribute for scoped slots have been deprecated and " +
  42063. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  42064. "can also be used on plain elements in addition to <template> to " +
  42065. "denote scoped slots.",
  42066. el.rawAttrsMap['scope'],
  42067. true
  42068. );
  42069. }
  42070. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  42071. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  42072. /* istanbul ignore if */
  42073. if (el.attrsMap['v-for']) {
  42074. warn$2(
  42075. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  42076. "(v-for takes higher priority). Use a wrapper <template> for the " +
  42077. "scoped slot to make it clearer.",
  42078. el.rawAttrsMap['slot-scope'],
  42079. true
  42080. );
  42081. }
  42082. el.slotScope = slotScope;
  42083. }
  42084. // slot="xxx"
  42085. var slotTarget = getBindingAttr(el, 'slot');
  42086. if (slotTarget) {
  42087. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  42088. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  42089. // preserve slot as an attribute for native shadow DOM compat
  42090. // only for non-scoped slots.
  42091. if (el.tag !== 'template' && !el.slotScope) {
  42092. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  42093. }
  42094. }
  42095. // 2.6 v-slot syntax
  42096. {
  42097. if (el.tag === 'template') {
  42098. // v-slot on <template>
  42099. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  42100. if (slotBinding) {
  42101. {
  42102. if (el.slotTarget || el.slotScope) {
  42103. warn$2(
  42104. "Unexpected mixed usage of different slot syntaxes.",
  42105. el
  42106. );
  42107. }
  42108. if (el.parent && !maybeComponent(el.parent)) {
  42109. warn$2(
  42110. "<template v-slot> can only appear at the root level inside " +
  42111. "the receiving component",
  42112. el
  42113. );
  42114. }
  42115. }
  42116. var ref = getSlotName(slotBinding);
  42117. var name = ref.name;
  42118. var dynamic = ref.dynamic;
  42119. el.slotTarget = name;
  42120. el.slotTargetDynamic = dynamic;
  42121. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  42122. }
  42123. } else {
  42124. // v-slot on component, denotes default slot
  42125. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  42126. if (slotBinding$1) {
  42127. {
  42128. if (!maybeComponent(el)) {
  42129. warn$2(
  42130. "v-slot can only be used on components or <template>.",
  42131. slotBinding$1
  42132. );
  42133. }
  42134. if (el.slotScope || el.slotTarget) {
  42135. warn$2(
  42136. "Unexpected mixed usage of different slot syntaxes.",
  42137. el
  42138. );
  42139. }
  42140. if (el.scopedSlots) {
  42141. warn$2(
  42142. "To avoid scope ambiguity, the default slot should also use " +
  42143. "<template> syntax when there are other named slots.",
  42144. slotBinding$1
  42145. );
  42146. }
  42147. }
  42148. // add the component's children to its default slot
  42149. var slots = el.scopedSlots || (el.scopedSlots = {});
  42150. var ref$1 = getSlotName(slotBinding$1);
  42151. var name$1 = ref$1.name;
  42152. var dynamic$1 = ref$1.dynamic;
  42153. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  42154. slotContainer.slotTarget = name$1;
  42155. slotContainer.slotTargetDynamic = dynamic$1;
  42156. slotContainer.children = el.children.filter(function (c) {
  42157. if (!c.slotScope) {
  42158. c.parent = slotContainer;
  42159. return true
  42160. }
  42161. });
  42162. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  42163. // remove children as they are returned from scopedSlots now
  42164. el.children = [];
  42165. // mark el non-plain so data gets generated
  42166. el.plain = false;
  42167. }
  42168. }
  42169. }
  42170. }
  42171. function getSlotName (binding) {
  42172. var name = binding.name.replace(slotRE, '');
  42173. if (!name) {
  42174. if (binding.name[0] !== '#') {
  42175. name = 'default';
  42176. } else {
  42177. warn$2(
  42178. "v-slot shorthand syntax requires a slot name.",
  42179. binding
  42180. );
  42181. }
  42182. }
  42183. return dynamicArgRE.test(name)
  42184. // dynamic [name]
  42185. ? { name: name.slice(1, -1), dynamic: true }
  42186. // static name
  42187. : { name: ("\"" + name + "\""), dynamic: false }
  42188. }
  42189. // handle <slot/> outlets
  42190. function processSlotOutlet (el) {
  42191. if (el.tag === 'slot') {
  42192. el.slotName = getBindingAttr(el, 'name');
  42193. if (el.key) {
  42194. warn$2(
  42195. "`key` does not work on <slot> because slots are abstract outlets " +
  42196. "and can possibly expand into multiple elements. " +
  42197. "Use the key on a wrapping element instead.",
  42198. getRawBindingAttr(el, 'key')
  42199. );
  42200. }
  42201. }
  42202. }
  42203. function processComponent (el) {
  42204. var binding;
  42205. if ((binding = getBindingAttr(el, 'is'))) {
  42206. el.component = binding;
  42207. }
  42208. if (getAndRemoveAttr(el, 'inline-template') != null) {
  42209. el.inlineTemplate = true;
  42210. }
  42211. }
  42212. function processAttrs (el) {
  42213. var list = el.attrsList;
  42214. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  42215. for (i = 0, l = list.length; i < l; i++) {
  42216. name = rawName = list[i].name;
  42217. value = list[i].value;
  42218. if (dirRE.test(name)) {
  42219. // mark element as dynamic
  42220. el.hasBindings = true;
  42221. // modifiers
  42222. modifiers = parseModifiers(name.replace(dirRE, ''));
  42223. // support .foo shorthand syntax for the .prop modifier
  42224. if (modifiers) {
  42225. name = name.replace(modifierRE, '');
  42226. }
  42227. if (bindRE.test(name)) { // v-bind
  42228. name = name.replace(bindRE, '');
  42229. value = parseFilters(value);
  42230. isDynamic = dynamicArgRE.test(name);
  42231. if (isDynamic) {
  42232. name = name.slice(1, -1);
  42233. }
  42234. if (
  42235. value.trim().length === 0
  42236. ) {
  42237. warn$2(
  42238. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  42239. );
  42240. }
  42241. if (modifiers) {
  42242. if (modifiers.prop && !isDynamic) {
  42243. name = camelize(name);
  42244. if (name === 'innerHtml') { name = 'innerHTML'; }
  42245. }
  42246. if (modifiers.camel && !isDynamic) {
  42247. name = camelize(name);
  42248. }
  42249. if (modifiers.sync) {
  42250. syncGen = genAssignmentCode(value, "$event");
  42251. if (!isDynamic) {
  42252. addHandler(
  42253. el,
  42254. ("update:" + (camelize(name))),
  42255. syncGen,
  42256. null,
  42257. false,
  42258. warn$2,
  42259. list[i]
  42260. );
  42261. if (hyphenate(name) !== camelize(name)) {
  42262. addHandler(
  42263. el,
  42264. ("update:" + (hyphenate(name))),
  42265. syncGen,
  42266. null,
  42267. false,
  42268. warn$2,
  42269. list[i]
  42270. );
  42271. }
  42272. } else {
  42273. // handler w/ dynamic event name
  42274. addHandler(
  42275. el,
  42276. ("\"update:\"+(" + name + ")"),
  42277. syncGen,
  42278. null,
  42279. false,
  42280. warn$2,
  42281. list[i],
  42282. true // dynamic
  42283. );
  42284. }
  42285. }
  42286. }
  42287. if ((modifiers && modifiers.prop) || (
  42288. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  42289. )) {
  42290. addProp(el, name, value, list[i], isDynamic);
  42291. } else {
  42292. addAttr(el, name, value, list[i], isDynamic);
  42293. }
  42294. } else if (onRE.test(name)) { // v-on
  42295. name = name.replace(onRE, '');
  42296. isDynamic = dynamicArgRE.test(name);
  42297. if (isDynamic) {
  42298. name = name.slice(1, -1);
  42299. }
  42300. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  42301. } else { // normal directives
  42302. name = name.replace(dirRE, '');
  42303. // parse arg
  42304. var argMatch = name.match(argRE);
  42305. var arg = argMatch && argMatch[1];
  42306. isDynamic = false;
  42307. if (arg) {
  42308. name = name.slice(0, -(arg.length + 1));
  42309. if (dynamicArgRE.test(arg)) {
  42310. arg = arg.slice(1, -1);
  42311. isDynamic = true;
  42312. }
  42313. }
  42314. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  42315. if (name === 'model') {
  42316. checkForAliasModel(el, value);
  42317. }
  42318. }
  42319. } else {
  42320. // literal attribute
  42321. {
  42322. var res = parseText(value, delimiters);
  42323. if (res) {
  42324. warn$2(
  42325. name + "=\"" + value + "\": " +
  42326. 'Interpolation inside attributes has been removed. ' +
  42327. 'Use v-bind or the colon shorthand instead. For example, ' +
  42328. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  42329. list[i]
  42330. );
  42331. }
  42332. }
  42333. addAttr(el, name, JSON.stringify(value), list[i]);
  42334. // #6887 firefox doesn't update muted state if set via attribute
  42335. // even immediately after element creation
  42336. if (!el.component &&
  42337. name === 'muted' &&
  42338. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  42339. addProp(el, name, 'true', list[i]);
  42340. }
  42341. }
  42342. }
  42343. }
  42344. function checkInFor (el) {
  42345. var parent = el;
  42346. while (parent) {
  42347. if (parent.for !== undefined) {
  42348. return true
  42349. }
  42350. parent = parent.parent;
  42351. }
  42352. return false
  42353. }
  42354. function parseModifiers (name) {
  42355. var match = name.match(modifierRE);
  42356. if (match) {
  42357. var ret = {};
  42358. match.forEach(function (m) { ret[m.slice(1)] = true; });
  42359. return ret
  42360. }
  42361. }
  42362. function makeAttrsMap (attrs) {
  42363. var map = {};
  42364. for (var i = 0, l = attrs.length; i < l; i++) {
  42365. if (
  42366. map[attrs[i].name] && !isIE && !isEdge
  42367. ) {
  42368. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  42369. }
  42370. map[attrs[i].name] = attrs[i].value;
  42371. }
  42372. return map
  42373. }
  42374. // for script (e.g. type="x/template") or style, do not decode content
  42375. function isTextTag (el) {
  42376. return el.tag === 'script' || el.tag === 'style'
  42377. }
  42378. function isForbiddenTag (el) {
  42379. return (
  42380. el.tag === 'style' ||
  42381. (el.tag === 'script' && (
  42382. !el.attrsMap.type ||
  42383. el.attrsMap.type === 'text/javascript'
  42384. ))
  42385. )
  42386. }
  42387. var ieNSBug = /^xmlns:NS\d+/;
  42388. var ieNSPrefix = /^NS\d+:/;
  42389. /* istanbul ignore next */
  42390. function guardIESVGBug (attrs) {
  42391. var res = [];
  42392. for (var i = 0; i < attrs.length; i++) {
  42393. var attr = attrs[i];
  42394. if (!ieNSBug.test(attr.name)) {
  42395. attr.name = attr.name.replace(ieNSPrefix, '');
  42396. res.push(attr);
  42397. }
  42398. }
  42399. return res
  42400. }
  42401. function checkForAliasModel (el, value) {
  42402. var _el = el;
  42403. while (_el) {
  42404. if (_el.for && _el.alias === value) {
  42405. warn$2(
  42406. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  42407. "You are binding v-model directly to a v-for iteration alias. " +
  42408. "This will not be able to modify the v-for source array because " +
  42409. "writing to the alias is like modifying a function local variable. " +
  42410. "Consider using an array of objects and use v-model on an object property instead.",
  42411. el.rawAttrsMap['v-model']
  42412. );
  42413. }
  42414. _el = _el.parent;
  42415. }
  42416. }
  42417. /* */
  42418. function preTransformNode (el, options) {
  42419. if (el.tag === 'input') {
  42420. var map = el.attrsMap;
  42421. if (!map['v-model']) {
  42422. return
  42423. }
  42424. var typeBinding;
  42425. if (map[':type'] || map['v-bind:type']) {
  42426. typeBinding = getBindingAttr(el, 'type');
  42427. }
  42428. if (!map.type && !typeBinding && map['v-bind']) {
  42429. typeBinding = "(" + (map['v-bind']) + ").type";
  42430. }
  42431. if (typeBinding) {
  42432. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  42433. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  42434. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  42435. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  42436. // 1. checkbox
  42437. var branch0 = cloneASTElement(el);
  42438. // process for on the main node
  42439. processFor(branch0);
  42440. addRawAttr(branch0, 'type', 'checkbox');
  42441. processElement(branch0, options);
  42442. branch0.processed = true; // prevent it from double-processed
  42443. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  42444. addIfCondition(branch0, {
  42445. exp: branch0.if,
  42446. block: branch0
  42447. });
  42448. // 2. add radio else-if condition
  42449. var branch1 = cloneASTElement(el);
  42450. getAndRemoveAttr(branch1, 'v-for', true);
  42451. addRawAttr(branch1, 'type', 'radio');
  42452. processElement(branch1, options);
  42453. addIfCondition(branch0, {
  42454. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  42455. block: branch1
  42456. });
  42457. // 3. other
  42458. var branch2 = cloneASTElement(el);
  42459. getAndRemoveAttr(branch2, 'v-for', true);
  42460. addRawAttr(branch2, ':type', typeBinding);
  42461. processElement(branch2, options);
  42462. addIfCondition(branch0, {
  42463. exp: ifCondition,
  42464. block: branch2
  42465. });
  42466. if (hasElse) {
  42467. branch0.else = true;
  42468. } else if (elseIfCondition) {
  42469. branch0.elseif = elseIfCondition;
  42470. }
  42471. return branch0
  42472. }
  42473. }
  42474. }
  42475. function cloneASTElement (el) {
  42476. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  42477. }
  42478. var model$1 = {
  42479. preTransformNode: preTransformNode
  42480. };
  42481. var modules$1 = [
  42482. klass$1,
  42483. style$1,
  42484. model$1
  42485. ];
  42486. /* */
  42487. function text (el, dir) {
  42488. if (dir.value) {
  42489. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  42490. }
  42491. }
  42492. /* */
  42493. function html (el, dir) {
  42494. if (dir.value) {
  42495. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  42496. }
  42497. }
  42498. var directives$1 = {
  42499. model: model,
  42500. text: text,
  42501. html: html
  42502. };
  42503. /* */
  42504. var baseOptions = {
  42505. expectHTML: true,
  42506. modules: modules$1,
  42507. directives: directives$1,
  42508. isPreTag: isPreTag,
  42509. isUnaryTag: isUnaryTag,
  42510. mustUseProp: mustUseProp,
  42511. canBeLeftOpenTag: canBeLeftOpenTag,
  42512. isReservedTag: isReservedTag,
  42513. getTagNamespace: getTagNamespace,
  42514. staticKeys: genStaticKeys(modules$1)
  42515. };
  42516. /* */
  42517. var isStaticKey;
  42518. var isPlatformReservedTag;
  42519. var genStaticKeysCached = cached(genStaticKeys$1);
  42520. /**
  42521. * Goal of the optimizer: walk the generated template AST tree
  42522. * and detect sub-trees that are purely static, i.e. parts of
  42523. * the DOM that never needs to change.
  42524. *
  42525. * Once we detect these sub-trees, we can:
  42526. *
  42527. * 1. Hoist them into constants, so that we no longer need to
  42528. * create fresh nodes for them on each re-render;
  42529. * 2. Completely skip them in the patching process.
  42530. */
  42531. function optimize (root, options) {
  42532. if (!root) { return }
  42533. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  42534. isPlatformReservedTag = options.isReservedTag || no;
  42535. // first pass: mark all non-static nodes.
  42536. markStatic$1(root);
  42537. // second pass: mark static roots.
  42538. markStaticRoots(root, false);
  42539. }
  42540. function genStaticKeys$1 (keys) {
  42541. return makeMap(
  42542. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  42543. (keys ? ',' + keys : '')
  42544. )
  42545. }
  42546. function markStatic$1 (node) {
  42547. node.static = isStatic(node);
  42548. if (node.type === 1) {
  42549. // do not make component slot content static. this avoids
  42550. // 1. components not able to mutate slot nodes
  42551. // 2. static slot content fails for hot-reloading
  42552. if (
  42553. !isPlatformReservedTag(node.tag) &&
  42554. node.tag !== 'slot' &&
  42555. node.attrsMap['inline-template'] == null
  42556. ) {
  42557. return
  42558. }
  42559. for (var i = 0, l = node.children.length; i < l; i++) {
  42560. var child = node.children[i];
  42561. markStatic$1(child);
  42562. if (!child.static) {
  42563. node.static = false;
  42564. }
  42565. }
  42566. if (node.ifConditions) {
  42567. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42568. var block = node.ifConditions[i$1].block;
  42569. markStatic$1(block);
  42570. if (!block.static) {
  42571. node.static = false;
  42572. }
  42573. }
  42574. }
  42575. }
  42576. }
  42577. function markStaticRoots (node, isInFor) {
  42578. if (node.type === 1) {
  42579. if (node.static || node.once) {
  42580. node.staticInFor = isInFor;
  42581. }
  42582. // For a node to qualify as a static root, it should have children that
  42583. // are not just static text. Otherwise the cost of hoisting out will
  42584. // outweigh the benefits and it's better off to just always render it fresh.
  42585. if (node.static && node.children.length && !(
  42586. node.children.length === 1 &&
  42587. node.children[0].type === 3
  42588. )) {
  42589. node.staticRoot = true;
  42590. return
  42591. } else {
  42592. node.staticRoot = false;
  42593. }
  42594. if (node.children) {
  42595. for (var i = 0, l = node.children.length; i < l; i++) {
  42596. markStaticRoots(node.children[i], isInFor || !!node.for);
  42597. }
  42598. }
  42599. if (node.ifConditions) {
  42600. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42601. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  42602. }
  42603. }
  42604. }
  42605. }
  42606. function isStatic (node) {
  42607. if (node.type === 2) { // expression
  42608. return false
  42609. }
  42610. if (node.type === 3) { // text
  42611. return true
  42612. }
  42613. return !!(node.pre || (
  42614. !node.hasBindings && // no dynamic bindings
  42615. !node.if && !node.for && // not v-if or v-for or v-else
  42616. !isBuiltInTag(node.tag) && // not a built-in
  42617. isPlatformReservedTag(node.tag) && // not a component
  42618. !isDirectChildOfTemplateFor(node) &&
  42619. Object.keys(node).every(isStaticKey)
  42620. ))
  42621. }
  42622. function isDirectChildOfTemplateFor (node) {
  42623. while (node.parent) {
  42624. node = node.parent;
  42625. if (node.tag !== 'template') {
  42626. return false
  42627. }
  42628. if (node.for) {
  42629. return true
  42630. }
  42631. }
  42632. return false
  42633. }
  42634. /* */
  42635. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  42636. var fnInvokeRE = /\([^)]*?\);*$/;
  42637. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  42638. // KeyboardEvent.keyCode aliases
  42639. var keyCodes = {
  42640. esc: 27,
  42641. tab: 9,
  42642. enter: 13,
  42643. space: 32,
  42644. up: 38,
  42645. left: 37,
  42646. right: 39,
  42647. down: 40,
  42648. 'delete': [8, 46]
  42649. };
  42650. // KeyboardEvent.key aliases
  42651. var keyNames = {
  42652. // #7880: IE11 and Edge use `Esc` for Escape key name.
  42653. esc: ['Esc', 'Escape'],
  42654. tab: 'Tab',
  42655. enter: 'Enter',
  42656. // #9112: IE11 uses `Spacebar` for Space key name.
  42657. space: [' ', 'Spacebar'],
  42658. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  42659. up: ['Up', 'ArrowUp'],
  42660. left: ['Left', 'ArrowLeft'],
  42661. right: ['Right', 'ArrowRight'],
  42662. down: ['Down', 'ArrowDown'],
  42663. // #9112: IE11 uses `Del` for Delete key name.
  42664. 'delete': ['Backspace', 'Delete', 'Del']
  42665. };
  42666. // #4868: modifiers that prevent the execution of the listener
  42667. // need to explicitly return null so that we can determine whether to remove
  42668. // the listener for .once
  42669. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  42670. var modifierCode = {
  42671. stop: '$event.stopPropagation();',
  42672. prevent: '$event.preventDefault();',
  42673. self: genGuard("$event.target !== $event.currentTarget"),
  42674. ctrl: genGuard("!$event.ctrlKey"),
  42675. shift: genGuard("!$event.shiftKey"),
  42676. alt: genGuard("!$event.altKey"),
  42677. meta: genGuard("!$event.metaKey"),
  42678. left: genGuard("'button' in $event && $event.button !== 0"),
  42679. middle: genGuard("'button' in $event && $event.button !== 1"),
  42680. right: genGuard("'button' in $event && $event.button !== 2")
  42681. };
  42682. function genHandlers (
  42683. events,
  42684. isNative
  42685. ) {
  42686. var prefix = isNative ? 'nativeOn:' : 'on:';
  42687. var staticHandlers = "";
  42688. var dynamicHandlers = "";
  42689. for (var name in events) {
  42690. var handlerCode = genHandler(events[name]);
  42691. if (events[name] && events[name].dynamic) {
  42692. dynamicHandlers += name + "," + handlerCode + ",";
  42693. } else {
  42694. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  42695. }
  42696. }
  42697. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  42698. if (dynamicHandlers) {
  42699. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  42700. } else {
  42701. return prefix + staticHandlers
  42702. }
  42703. }
  42704. function genHandler (handler) {
  42705. if (!handler) {
  42706. return 'function(){}'
  42707. }
  42708. if (Array.isArray(handler)) {
  42709. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  42710. }
  42711. var isMethodPath = simplePathRE.test(handler.value);
  42712. var isFunctionExpression = fnExpRE.test(handler.value);
  42713. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  42714. if (!handler.modifiers) {
  42715. if (isMethodPath || isFunctionExpression) {
  42716. return handler.value
  42717. }
  42718. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  42719. } else {
  42720. var code = '';
  42721. var genModifierCode = '';
  42722. var keys = [];
  42723. for (var key in handler.modifiers) {
  42724. if (modifierCode[key]) {
  42725. genModifierCode += modifierCode[key];
  42726. // left/right
  42727. if (keyCodes[key]) {
  42728. keys.push(key);
  42729. }
  42730. } else if (key === 'exact') {
  42731. var modifiers = (handler.modifiers);
  42732. genModifierCode += genGuard(
  42733. ['ctrl', 'shift', 'alt', 'meta']
  42734. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  42735. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  42736. .join('||')
  42737. );
  42738. } else {
  42739. keys.push(key);
  42740. }
  42741. }
  42742. if (keys.length) {
  42743. code += genKeyFilter(keys);
  42744. }
  42745. // Make sure modifiers like prevent and stop get executed after key filtering
  42746. if (genModifierCode) {
  42747. code += genModifierCode;
  42748. }
  42749. var handlerCode = isMethodPath
  42750. ? ("return " + (handler.value) + "($event)")
  42751. : isFunctionExpression
  42752. ? ("return (" + (handler.value) + ")($event)")
  42753. : isFunctionInvocation
  42754. ? ("return " + (handler.value))
  42755. : handler.value;
  42756. return ("function($event){" + code + handlerCode + "}")
  42757. }
  42758. }
  42759. function genKeyFilter (keys) {
  42760. return (
  42761. // make sure the key filters only apply to KeyboardEvents
  42762. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  42763. // key events that do not have keyCode property...
  42764. "if(!$event.type.indexOf('key')&&" +
  42765. (keys.map(genFilterCode).join('&&')) + ")return null;"
  42766. )
  42767. }
  42768. function genFilterCode (key) {
  42769. var keyVal = parseInt(key, 10);
  42770. if (keyVal) {
  42771. return ("$event.keyCode!==" + keyVal)
  42772. }
  42773. var keyCode = keyCodes[key];
  42774. var keyName = keyNames[key];
  42775. return (
  42776. "_k($event.keyCode," +
  42777. (JSON.stringify(key)) + "," +
  42778. (JSON.stringify(keyCode)) + "," +
  42779. "$event.key," +
  42780. "" + (JSON.stringify(keyName)) +
  42781. ")"
  42782. )
  42783. }
  42784. /* */
  42785. function on (el, dir) {
  42786. if (dir.modifiers) {
  42787. warn("v-on without argument does not support modifiers.");
  42788. }
  42789. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  42790. }
  42791. /* */
  42792. function bind$1 (el, dir) {
  42793. el.wrapData = function (code) {
  42794. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  42795. };
  42796. }
  42797. /* */
  42798. var baseDirectives = {
  42799. on: on,
  42800. bind: bind$1,
  42801. cloak: noop
  42802. };
  42803. /* */
  42804. var CodegenState = function CodegenState (options) {
  42805. this.options = options;
  42806. this.warn = options.warn || baseWarn;
  42807. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  42808. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  42809. this.directives = extend(extend({}, baseDirectives), options.directives);
  42810. var isReservedTag = options.isReservedTag || no;
  42811. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  42812. this.onceId = 0;
  42813. this.staticRenderFns = [];
  42814. this.pre = false;
  42815. };
  42816. function generate (
  42817. ast,
  42818. options
  42819. ) {
  42820. var state = new CodegenState(options);
  42821. var code = ast ? genElement(ast, state) : '_c("div")';
  42822. return {
  42823. render: ("with(this){return " + code + "}"),
  42824. staticRenderFns: state.staticRenderFns
  42825. }
  42826. }
  42827. function genElement (el, state) {
  42828. if (el.parent) {
  42829. el.pre = el.pre || el.parent.pre;
  42830. }
  42831. if (el.staticRoot && !el.staticProcessed) {
  42832. return genStatic(el, state)
  42833. } else if (el.once && !el.onceProcessed) {
  42834. return genOnce(el, state)
  42835. } else if (el.for && !el.forProcessed) {
  42836. return genFor(el, state)
  42837. } else if (el.if && !el.ifProcessed) {
  42838. return genIf(el, state)
  42839. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  42840. return genChildren(el, state) || 'void 0'
  42841. } else if (el.tag === 'slot') {
  42842. return genSlot(el, state)
  42843. } else {
  42844. // component or element
  42845. var code;
  42846. if (el.component) {
  42847. code = genComponent(el.component, el, state);
  42848. } else {
  42849. var data;
  42850. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  42851. data = genData$2(el, state);
  42852. }
  42853. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42854. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  42855. }
  42856. // module transforms
  42857. for (var i = 0; i < state.transforms.length; i++) {
  42858. code = state.transforms[i](el, code);
  42859. }
  42860. return code
  42861. }
  42862. }
  42863. // hoist static sub-trees out
  42864. function genStatic (el, state) {
  42865. el.staticProcessed = true;
  42866. // Some elements (templates) need to behave differently inside of a v-pre
  42867. // node. All pre nodes are static roots, so we can use this as a location to
  42868. // wrap a state change and reset it upon exiting the pre node.
  42869. var originalPreState = state.pre;
  42870. if (el.pre) {
  42871. state.pre = el.pre;
  42872. }
  42873. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  42874. state.pre = originalPreState;
  42875. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  42876. }
  42877. // v-once
  42878. function genOnce (el, state) {
  42879. el.onceProcessed = true;
  42880. if (el.if && !el.ifProcessed) {
  42881. return genIf(el, state)
  42882. } else if (el.staticInFor) {
  42883. var key = '';
  42884. var parent = el.parent;
  42885. while (parent) {
  42886. if (parent.for) {
  42887. key = parent.key;
  42888. break
  42889. }
  42890. parent = parent.parent;
  42891. }
  42892. if (!key) {
  42893. state.warn(
  42894. "v-once can only be used inside v-for that is keyed. ",
  42895. el.rawAttrsMap['v-once']
  42896. );
  42897. return genElement(el, state)
  42898. }
  42899. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  42900. } else {
  42901. return genStatic(el, state)
  42902. }
  42903. }
  42904. function genIf (
  42905. el,
  42906. state,
  42907. altGen,
  42908. altEmpty
  42909. ) {
  42910. el.ifProcessed = true; // avoid recursion
  42911. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  42912. }
  42913. function genIfConditions (
  42914. conditions,
  42915. state,
  42916. altGen,
  42917. altEmpty
  42918. ) {
  42919. if (!conditions.length) {
  42920. return altEmpty || '_e()'
  42921. }
  42922. var condition = conditions.shift();
  42923. if (condition.exp) {
  42924. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  42925. } else {
  42926. return ("" + (genTernaryExp(condition.block)))
  42927. }
  42928. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  42929. function genTernaryExp (el) {
  42930. return altGen
  42931. ? altGen(el, state)
  42932. : el.once
  42933. ? genOnce(el, state)
  42934. : genElement(el, state)
  42935. }
  42936. }
  42937. function genFor (
  42938. el,
  42939. state,
  42940. altGen,
  42941. altHelper
  42942. ) {
  42943. var exp = el.for;
  42944. var alias = el.alias;
  42945. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  42946. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  42947. if (state.maybeComponent(el) &&
  42948. el.tag !== 'slot' &&
  42949. el.tag !== 'template' &&
  42950. !el.key
  42951. ) {
  42952. state.warn(
  42953. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  42954. "v-for should have explicit keys. " +
  42955. "See https://vuejs.org/guide/list.html#key for more info.",
  42956. el.rawAttrsMap['v-for'],
  42957. true /* tip */
  42958. );
  42959. }
  42960. el.forProcessed = true; // avoid recursion
  42961. return (altHelper || '_l') + "((" + exp + ")," +
  42962. "function(" + alias + iterator1 + iterator2 + "){" +
  42963. "return " + ((altGen || genElement)(el, state)) +
  42964. '})'
  42965. }
  42966. function genData$2 (el, state) {
  42967. var data = '{';
  42968. // directives first.
  42969. // directives may mutate the el's other properties before they are generated.
  42970. var dirs = genDirectives(el, state);
  42971. if (dirs) { data += dirs + ','; }
  42972. // key
  42973. if (el.key) {
  42974. data += "key:" + (el.key) + ",";
  42975. }
  42976. // ref
  42977. if (el.ref) {
  42978. data += "ref:" + (el.ref) + ",";
  42979. }
  42980. if (el.refInFor) {
  42981. data += "refInFor:true,";
  42982. }
  42983. // pre
  42984. if (el.pre) {
  42985. data += "pre:true,";
  42986. }
  42987. // record original tag name for components using "is" attribute
  42988. if (el.component) {
  42989. data += "tag:\"" + (el.tag) + "\",";
  42990. }
  42991. // module data generation functions
  42992. for (var i = 0; i < state.dataGenFns.length; i++) {
  42993. data += state.dataGenFns[i](el);
  42994. }
  42995. // attributes
  42996. if (el.attrs) {
  42997. data += "attrs:" + (genProps(el.attrs)) + ",";
  42998. }
  42999. // DOM props
  43000. if (el.props) {
  43001. data += "domProps:" + (genProps(el.props)) + ",";
  43002. }
  43003. // event handlers
  43004. if (el.events) {
  43005. data += (genHandlers(el.events, false)) + ",";
  43006. }
  43007. if (el.nativeEvents) {
  43008. data += (genHandlers(el.nativeEvents, true)) + ",";
  43009. }
  43010. // slot target
  43011. // only for non-scoped slots
  43012. if (el.slotTarget && !el.slotScope) {
  43013. data += "slot:" + (el.slotTarget) + ",";
  43014. }
  43015. // scoped slots
  43016. if (el.scopedSlots) {
  43017. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  43018. }
  43019. // component v-model
  43020. if (el.model) {
  43021. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  43022. }
  43023. // inline-template
  43024. if (el.inlineTemplate) {
  43025. var inlineTemplate = genInlineTemplate(el, state);
  43026. if (inlineTemplate) {
  43027. data += inlineTemplate + ",";
  43028. }
  43029. }
  43030. data = data.replace(/,$/, '') + '}';
  43031. // v-bind dynamic argument wrap
  43032. // v-bind with dynamic arguments must be applied using the same v-bind object
  43033. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  43034. if (el.dynamicAttrs) {
  43035. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  43036. }
  43037. // v-bind data wrap
  43038. if (el.wrapData) {
  43039. data = el.wrapData(data);
  43040. }
  43041. // v-on data wrap
  43042. if (el.wrapListeners) {
  43043. data = el.wrapListeners(data);
  43044. }
  43045. return data
  43046. }
  43047. function genDirectives (el, state) {
  43048. var dirs = el.directives;
  43049. if (!dirs) { return }
  43050. var res = 'directives:[';
  43051. var hasRuntime = false;
  43052. var i, l, dir, needRuntime;
  43053. for (i = 0, l = dirs.length; i < l; i++) {
  43054. dir = dirs[i];
  43055. needRuntime = true;
  43056. var gen = state.directives[dir.name];
  43057. if (gen) {
  43058. // compile-time directive that manipulates AST.
  43059. // returns true if it also needs a runtime counterpart.
  43060. needRuntime = !!gen(el, dir, state.warn);
  43061. }
  43062. if (needRuntime) {
  43063. hasRuntime = true;
  43064. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  43065. }
  43066. }
  43067. if (hasRuntime) {
  43068. return res.slice(0, -1) + ']'
  43069. }
  43070. }
  43071. function genInlineTemplate (el, state) {
  43072. var ast = el.children[0];
  43073. if (el.children.length !== 1 || ast.type !== 1) {
  43074. state.warn(
  43075. 'Inline-template components must have exactly one child element.',
  43076. { start: el.start }
  43077. );
  43078. }
  43079. if (ast && ast.type === 1) {
  43080. var inlineRenderFns = generate(ast, state.options);
  43081. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  43082. }
  43083. }
  43084. function genScopedSlots (
  43085. el,
  43086. slots,
  43087. state
  43088. ) {
  43089. // by default scoped slots are considered "stable", this allows child
  43090. // components with only scoped slots to skip forced updates from parent.
  43091. // but in some cases we have to bail-out of this optimization
  43092. // for example if the slot contains dynamic names, has v-if or v-for on them...
  43093. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  43094. var slot = slots[key];
  43095. return (
  43096. slot.slotTargetDynamic ||
  43097. slot.if ||
  43098. slot.for ||
  43099. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  43100. )
  43101. });
  43102. // #9534: if a component with scoped slots is inside a conditional branch,
  43103. // it's possible for the same component to be reused but with different
  43104. // compiled slot content. To avoid that, we generate a unique key based on
  43105. // the generated code of all the slot contents.
  43106. var needsKey = !!el.if;
  43107. // OR when it is inside another scoped slot or v-for (the reactivity may be
  43108. // disconnected due to the intermediate scope variable)
  43109. // #9438, #9506
  43110. // TODO: this can be further optimized by properly analyzing in-scope bindings
  43111. // and skip force updating ones that do not actually use scope variables.
  43112. if (!needsForceUpdate) {
  43113. var parent = el.parent;
  43114. while (parent) {
  43115. if (
  43116. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  43117. parent.for
  43118. ) {
  43119. needsForceUpdate = true;
  43120. break
  43121. }
  43122. if (parent.if) {
  43123. needsKey = true;
  43124. }
  43125. parent = parent.parent;
  43126. }
  43127. }
  43128. var generatedSlots = Object.keys(slots)
  43129. .map(function (key) { return genScopedSlot(slots[key], state); })
  43130. .join(',');
  43131. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  43132. }
  43133. function hash(str) {
  43134. var hash = 5381;
  43135. var i = str.length;
  43136. while(i) {
  43137. hash = (hash * 33) ^ str.charCodeAt(--i);
  43138. }
  43139. return hash >>> 0
  43140. }
  43141. function containsSlotChild (el) {
  43142. if (el.type === 1) {
  43143. if (el.tag === 'slot') {
  43144. return true
  43145. }
  43146. return el.children.some(containsSlotChild)
  43147. }
  43148. return false
  43149. }
  43150. function genScopedSlot (
  43151. el,
  43152. state
  43153. ) {
  43154. var isLegacySyntax = el.attrsMap['slot-scope'];
  43155. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  43156. return genIf(el, state, genScopedSlot, "null")
  43157. }
  43158. if (el.for && !el.forProcessed) {
  43159. return genFor(el, state, genScopedSlot)
  43160. }
  43161. var slotScope = el.slotScope === emptySlotScopeToken
  43162. ? ""
  43163. : String(el.slotScope);
  43164. var fn = "function(" + slotScope + "){" +
  43165. "return " + (el.tag === 'template'
  43166. ? el.if && isLegacySyntax
  43167. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  43168. : genChildren(el, state) || 'undefined'
  43169. : genElement(el, state)) + "}";
  43170. // reverse proxy v-slot without scope on this.$slots
  43171. var reverseProxy = slotScope ? "" : ",proxy:true";
  43172. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  43173. }
  43174. function genChildren (
  43175. el,
  43176. state,
  43177. checkSkip,
  43178. altGenElement,
  43179. altGenNode
  43180. ) {
  43181. var children = el.children;
  43182. if (children.length) {
  43183. var el$1 = children[0];
  43184. // optimize single v-for
  43185. if (children.length === 1 &&
  43186. el$1.for &&
  43187. el$1.tag !== 'template' &&
  43188. el$1.tag !== 'slot'
  43189. ) {
  43190. var normalizationType = checkSkip
  43191. ? state.maybeComponent(el$1) ? ",1" : ",0"
  43192. : "";
  43193. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  43194. }
  43195. var normalizationType$1 = checkSkip
  43196. ? getNormalizationType(children, state.maybeComponent)
  43197. : 0;
  43198. var gen = altGenNode || genNode;
  43199. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  43200. }
  43201. }
  43202. // determine the normalization needed for the children array.
  43203. // 0: no normalization needed
  43204. // 1: simple normalization needed (possible 1-level deep nested array)
  43205. // 2: full normalization needed
  43206. function getNormalizationType (
  43207. children,
  43208. maybeComponent
  43209. ) {
  43210. var res = 0;
  43211. for (var i = 0; i < children.length; i++) {
  43212. var el = children[i];
  43213. if (el.type !== 1) {
  43214. continue
  43215. }
  43216. if (needsNormalization(el) ||
  43217. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  43218. res = 2;
  43219. break
  43220. }
  43221. if (maybeComponent(el) ||
  43222. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  43223. res = 1;
  43224. }
  43225. }
  43226. return res
  43227. }
  43228. function needsNormalization (el) {
  43229. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  43230. }
  43231. function genNode (node, state) {
  43232. if (node.type === 1) {
  43233. return genElement(node, state)
  43234. } else if (node.type === 3 && node.isComment) {
  43235. return genComment(node)
  43236. } else {
  43237. return genText(node)
  43238. }
  43239. }
  43240. function genText (text) {
  43241. return ("_v(" + (text.type === 2
  43242. ? text.expression // no need for () because already wrapped in _s()
  43243. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  43244. }
  43245. function genComment (comment) {
  43246. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  43247. }
  43248. function genSlot (el, state) {
  43249. var slotName = el.slotName || '"default"';
  43250. var children = genChildren(el, state);
  43251. var res = "_t(" + slotName + (children ? ("," + children) : '');
  43252. var attrs = el.attrs || el.dynamicAttrs
  43253. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  43254. // slot props are camelized
  43255. name: camelize(attr.name),
  43256. value: attr.value,
  43257. dynamic: attr.dynamic
  43258. }); }))
  43259. : null;
  43260. var bind$$1 = el.attrsMap['v-bind'];
  43261. if ((attrs || bind$$1) && !children) {
  43262. res += ",null";
  43263. }
  43264. if (attrs) {
  43265. res += "," + attrs;
  43266. }
  43267. if (bind$$1) {
  43268. res += (attrs ? '' : ',null') + "," + bind$$1;
  43269. }
  43270. return res + ')'
  43271. }
  43272. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  43273. function genComponent (
  43274. componentName,
  43275. el,
  43276. state
  43277. ) {
  43278. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  43279. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  43280. }
  43281. function genProps (props) {
  43282. var staticProps = "";
  43283. var dynamicProps = "";
  43284. for (var i = 0; i < props.length; i++) {
  43285. var prop = props[i];
  43286. var value = transformSpecialNewlines(prop.value);
  43287. if (prop.dynamic) {
  43288. dynamicProps += (prop.name) + "," + value + ",";
  43289. } else {
  43290. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  43291. }
  43292. }
  43293. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  43294. if (dynamicProps) {
  43295. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  43296. } else {
  43297. return staticProps
  43298. }
  43299. }
  43300. // #3895, #4268
  43301. function transformSpecialNewlines (text) {
  43302. return text
  43303. .replace(/\u2028/g, '\\u2028')
  43304. .replace(/\u2029/g, '\\u2029')
  43305. }
  43306. /* */
  43307. // these keywords should not appear inside expressions, but operators like
  43308. // typeof, instanceof and in are allowed
  43309. var prohibitedKeywordRE = new RegExp('\\b' + (
  43310. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  43311. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  43312. 'extends,finally,continue,debugger,function,arguments'
  43313. ).split(',').join('\\b|\\b') + '\\b');
  43314. // these unary operators should not be used as property/method names
  43315. var unaryOperatorsRE = new RegExp('\\b' + (
  43316. 'delete,typeof,void'
  43317. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  43318. // strip strings in expressions
  43319. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  43320. // detect problematic expressions in a template
  43321. function detectErrors (ast, warn) {
  43322. if (ast) {
  43323. checkNode(ast, warn);
  43324. }
  43325. }
  43326. function checkNode (node, warn) {
  43327. if (node.type === 1) {
  43328. for (var name in node.attrsMap) {
  43329. if (dirRE.test(name)) {
  43330. var value = node.attrsMap[name];
  43331. if (value) {
  43332. var range = node.rawAttrsMap[name];
  43333. if (name === 'v-for') {
  43334. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  43335. } else if (name === 'v-slot' || name[0] === '#') {
  43336. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  43337. } else if (onRE.test(name)) {
  43338. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  43339. } else {
  43340. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  43341. }
  43342. }
  43343. }
  43344. }
  43345. if (node.children) {
  43346. for (var i = 0; i < node.children.length; i++) {
  43347. checkNode(node.children[i], warn);
  43348. }
  43349. }
  43350. } else if (node.type === 2) {
  43351. checkExpression(node.expression, node.text, warn, node);
  43352. }
  43353. }
  43354. function checkEvent (exp, text, warn, range) {
  43355. var stripped = exp.replace(stripStringRE, '');
  43356. var keywordMatch = stripped.match(unaryOperatorsRE);
  43357. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  43358. warn(
  43359. "avoid using JavaScript unary operator as property name: " +
  43360. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  43361. range
  43362. );
  43363. }
  43364. checkExpression(exp, text, warn, range);
  43365. }
  43366. function checkFor (node, text, warn, range) {
  43367. checkExpression(node.for || '', text, warn, range);
  43368. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  43369. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  43370. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  43371. }
  43372. function checkIdentifier (
  43373. ident,
  43374. type,
  43375. text,
  43376. warn,
  43377. range
  43378. ) {
  43379. if (typeof ident === 'string') {
  43380. try {
  43381. new Function(("var " + ident + "=_"));
  43382. } catch (e) {
  43383. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  43384. }
  43385. }
  43386. }
  43387. function checkExpression (exp, text, warn, range) {
  43388. try {
  43389. new Function(("return " + exp));
  43390. } catch (e) {
  43391. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  43392. if (keywordMatch) {
  43393. warn(
  43394. "avoid using JavaScript keyword as property name: " +
  43395. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  43396. range
  43397. );
  43398. } else {
  43399. warn(
  43400. "invalid expression: " + (e.message) + " in\n\n" +
  43401. " " + exp + "\n\n" +
  43402. " Raw expression: " + (text.trim()) + "\n",
  43403. range
  43404. );
  43405. }
  43406. }
  43407. }
  43408. function checkFunctionParameterExpression (exp, text, warn, range) {
  43409. try {
  43410. new Function(exp, '');
  43411. } catch (e) {
  43412. warn(
  43413. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  43414. " " + exp + "\n\n" +
  43415. " Raw expression: " + (text.trim()) + "\n",
  43416. range
  43417. );
  43418. }
  43419. }
  43420. /* */
  43421. var range = 2;
  43422. function generateCodeFrame (
  43423. source,
  43424. start,
  43425. end
  43426. ) {
  43427. if ( start === void 0 ) start = 0;
  43428. if ( end === void 0 ) end = source.length;
  43429. var lines = source.split(/\r?\n/);
  43430. var count = 0;
  43431. var res = [];
  43432. for (var i = 0; i < lines.length; i++) {
  43433. count += lines[i].length + 1;
  43434. if (count >= start) {
  43435. for (var j = i - range; j <= i + range || end > count; j++) {
  43436. if (j < 0 || j >= lines.length) { continue }
  43437. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  43438. var lineLength = lines[j].length;
  43439. if (j === i) {
  43440. // push underline
  43441. var pad = start - (count - lineLength) + 1;
  43442. var length = end > count ? lineLength - pad : end - start;
  43443. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  43444. } else if (j > i) {
  43445. if (end > count) {
  43446. var length$1 = Math.min(end - count, lineLength);
  43447. res.push(" | " + repeat$1("^", length$1));
  43448. }
  43449. count += lineLength + 1;
  43450. }
  43451. }
  43452. break
  43453. }
  43454. }
  43455. return res.join('\n')
  43456. }
  43457. function repeat$1 (str, n) {
  43458. var result = '';
  43459. if (n > 0) {
  43460. while (true) { // eslint-disable-line
  43461. if (n & 1) { result += str; }
  43462. n >>>= 1;
  43463. if (n <= 0) { break }
  43464. str += str;
  43465. }
  43466. }
  43467. return result
  43468. }
  43469. /* */
  43470. function createFunction (code, errors) {
  43471. try {
  43472. return new Function(code)
  43473. } catch (err) {
  43474. errors.push({ err: err, code: code });
  43475. return noop
  43476. }
  43477. }
  43478. function createCompileToFunctionFn (compile) {
  43479. var cache = Object.create(null);
  43480. return function compileToFunctions (
  43481. template,
  43482. options,
  43483. vm
  43484. ) {
  43485. options = extend({}, options);
  43486. var warn$$1 = options.warn || warn;
  43487. delete options.warn;
  43488. /* istanbul ignore if */
  43489. {
  43490. // detect possible CSP restriction
  43491. try {
  43492. new Function('return 1');
  43493. } catch (e) {
  43494. if (e.toString().match(/unsafe-eval|CSP/)) {
  43495. warn$$1(
  43496. 'It seems you are using the standalone build of Vue.js in an ' +
  43497. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  43498. 'The template compiler cannot work in this environment. Consider ' +
  43499. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  43500. 'templates into render functions.'
  43501. );
  43502. }
  43503. }
  43504. }
  43505. // check cache
  43506. var key = options.delimiters
  43507. ? String(options.delimiters) + template
  43508. : template;
  43509. if (cache[key]) {
  43510. return cache[key]
  43511. }
  43512. // compile
  43513. var compiled = compile(template, options);
  43514. // check compilation errors/tips
  43515. {
  43516. if (compiled.errors && compiled.errors.length) {
  43517. if (options.outputSourceRange) {
  43518. compiled.errors.forEach(function (e) {
  43519. warn$$1(
  43520. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  43521. generateCodeFrame(template, e.start, e.end),
  43522. vm
  43523. );
  43524. });
  43525. } else {
  43526. warn$$1(
  43527. "Error compiling template:\n\n" + template + "\n\n" +
  43528. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  43529. vm
  43530. );
  43531. }
  43532. }
  43533. if (compiled.tips && compiled.tips.length) {
  43534. if (options.outputSourceRange) {
  43535. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  43536. } else {
  43537. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  43538. }
  43539. }
  43540. }
  43541. // turn code into functions
  43542. var res = {};
  43543. var fnGenErrors = [];
  43544. res.render = createFunction(compiled.render, fnGenErrors);
  43545. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  43546. return createFunction(code, fnGenErrors)
  43547. });
  43548. // check function generation errors.
  43549. // this should only happen if there is a bug in the compiler itself.
  43550. // mostly for codegen development use
  43551. /* istanbul ignore if */
  43552. {
  43553. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  43554. warn$$1(
  43555. "Failed to generate render function:\n\n" +
  43556. fnGenErrors.map(function (ref) {
  43557. var err = ref.err;
  43558. var code = ref.code;
  43559. return ((err.toString()) + " in\n\n" + code + "\n");
  43560. }).join('\n'),
  43561. vm
  43562. );
  43563. }
  43564. }
  43565. return (cache[key] = res)
  43566. }
  43567. }
  43568. /* */
  43569. function createCompilerCreator (baseCompile) {
  43570. return function createCompiler (baseOptions) {
  43571. function compile (
  43572. template,
  43573. options
  43574. ) {
  43575. var finalOptions = Object.create(baseOptions);
  43576. var errors = [];
  43577. var tips = [];
  43578. var warn = function (msg, range, tip) {
  43579. (tip ? tips : errors).push(msg);
  43580. };
  43581. if (options) {
  43582. if (options.outputSourceRange) {
  43583. // $flow-disable-line
  43584. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  43585. warn = function (msg, range, tip) {
  43586. var data = { msg: msg };
  43587. if (range) {
  43588. if (range.start != null) {
  43589. data.start = range.start + leadingSpaceLength;
  43590. }
  43591. if (range.end != null) {
  43592. data.end = range.end + leadingSpaceLength;
  43593. }
  43594. }
  43595. (tip ? tips : errors).push(data);
  43596. };
  43597. }
  43598. // merge custom modules
  43599. if (options.modules) {
  43600. finalOptions.modules =
  43601. (baseOptions.modules || []).concat(options.modules);
  43602. }
  43603. // merge custom directives
  43604. if (options.directives) {
  43605. finalOptions.directives = extend(
  43606. Object.create(baseOptions.directives || null),
  43607. options.directives
  43608. );
  43609. }
  43610. // copy other options
  43611. for (var key in options) {
  43612. if (key !== 'modules' && key !== 'directives') {
  43613. finalOptions[key] = options[key];
  43614. }
  43615. }
  43616. }
  43617. finalOptions.warn = warn;
  43618. var compiled = baseCompile(template.trim(), finalOptions);
  43619. {
  43620. detectErrors(compiled.ast, warn);
  43621. }
  43622. compiled.errors = errors;
  43623. compiled.tips = tips;
  43624. return compiled
  43625. }
  43626. return {
  43627. compile: compile,
  43628. compileToFunctions: createCompileToFunctionFn(compile)
  43629. }
  43630. }
  43631. }
  43632. /* */
  43633. // `createCompilerCreator` allows creating compilers that use alternative
  43634. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  43635. // Here we just export a default compiler using the default parts.
  43636. var createCompiler = createCompilerCreator(function baseCompile (
  43637. template,
  43638. options
  43639. ) {
  43640. var ast = parse(template.trim(), options);
  43641. if (options.optimize !== false) {
  43642. optimize(ast, options);
  43643. }
  43644. var code = generate(ast, options);
  43645. return {
  43646. ast: ast,
  43647. render: code.render,
  43648. staticRenderFns: code.staticRenderFns
  43649. }
  43650. });
  43651. /* */
  43652. var ref$1 = createCompiler(baseOptions);
  43653. var compile = ref$1.compile;
  43654. var compileToFunctions = ref$1.compileToFunctions;
  43655. /* */
  43656. // check whether current browser encodes a char inside attribute values
  43657. var div;
  43658. function getShouldDecode (href) {
  43659. div = div || document.createElement('div');
  43660. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  43661. return div.innerHTML.indexOf('&#10;') > 0
  43662. }
  43663. // #3663: IE encodes newlines inside attribute values while other browsers don't
  43664. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  43665. // #6828: chrome encodes content in a[href]
  43666. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  43667. /* */
  43668. var idToTemplate = cached(function (id) {
  43669. var el = query(id);
  43670. return el && el.innerHTML
  43671. });
  43672. var mount = Vue.prototype.$mount;
  43673. Vue.prototype.$mount = function (
  43674. el,
  43675. hydrating
  43676. ) {
  43677. el = el && query(el);
  43678. /* istanbul ignore if */
  43679. if (el === document.body || el === document.documentElement) {
  43680. warn(
  43681. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  43682. );
  43683. return this
  43684. }
  43685. var options = this.$options;
  43686. // resolve template/el and convert to render function
  43687. if (!options.render) {
  43688. var template = options.template;
  43689. if (template) {
  43690. if (typeof template === 'string') {
  43691. if (template.charAt(0) === '#') {
  43692. template = idToTemplate(template);
  43693. /* istanbul ignore if */
  43694. if (!template) {
  43695. warn(
  43696. ("Template element not found or is empty: " + (options.template)),
  43697. this
  43698. );
  43699. }
  43700. }
  43701. } else if (template.nodeType) {
  43702. template = template.innerHTML;
  43703. } else {
  43704. {
  43705. warn('invalid template option:' + template, this);
  43706. }
  43707. return this
  43708. }
  43709. } else if (el) {
  43710. template = getOuterHTML(el);
  43711. }
  43712. if (template) {
  43713. /* istanbul ignore if */
  43714. if (config.performance && mark) {
  43715. mark('compile');
  43716. }
  43717. var ref = compileToFunctions(template, {
  43718. outputSourceRange: "development" !== 'production',
  43719. shouldDecodeNewlines: shouldDecodeNewlines,
  43720. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  43721. delimiters: options.delimiters,
  43722. comments: options.comments
  43723. }, this);
  43724. var render = ref.render;
  43725. var staticRenderFns = ref.staticRenderFns;
  43726. options.render = render;
  43727. options.staticRenderFns = staticRenderFns;
  43728. /* istanbul ignore if */
  43729. if (config.performance && mark) {
  43730. mark('compile end');
  43731. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  43732. }
  43733. }
  43734. }
  43735. return mount.call(this, el, hydrating)
  43736. };
  43737. /**
  43738. * Get outerHTML of elements, taking care
  43739. * of SVG elements in IE as well.
  43740. */
  43741. function getOuterHTML (el) {
  43742. if (el.outerHTML) {
  43743. return el.outerHTML
  43744. } else {
  43745. var container = document.createElement('div');
  43746. container.appendChild(el.cloneNode(true));
  43747. return container.innerHTML
  43748. }
  43749. }
  43750. Vue.compile = compileToFunctions;
  43751. module.exports = Vue;
  43752. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate))
  43753. /***/ }),
  43754. /***/ "./node_modules/vue/dist/vue.common.js":
  43755. /*!*********************************************!*\
  43756. !*** ./node_modules/vue/dist/vue.common.js ***!
  43757. \*********************************************/
  43758. /*! no static exports found */
  43759. /***/ (function(module, exports, __webpack_require__) {
  43760. if (false) {} else {
  43761. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  43762. }
  43763. /***/ }),
  43764. /***/ "./node_modules/webpack/buildin/global.js":
  43765. /*!***********************************!*\
  43766. !*** (webpack)/buildin/global.js ***!
  43767. \***********************************/
  43768. /*! no static exports found */
  43769. /***/ (function(module, exports) {
  43770. var g;
  43771. // This works in non-strict mode
  43772. g = (function() {
  43773. return this;
  43774. })();
  43775. try {
  43776. // This works if eval is allowed (see CSP)
  43777. g = g || new Function("return this")();
  43778. } catch (e) {
  43779. // This works if the window reference is available
  43780. if (typeof window === "object") g = window;
  43781. }
  43782. // g can still be undefined, but nothing to do about it...
  43783. // We return undefined, instead of nothing here, so it's
  43784. // easier to handle this case. if(!global) { ...}
  43785. module.exports = g;
  43786. /***/ }),
  43787. /***/ "./node_modules/webpack/buildin/module.js":
  43788. /*!***********************************!*\
  43789. !*** (webpack)/buildin/module.js ***!
  43790. \***********************************/
  43791. /*! no static exports found */
  43792. /***/ (function(module, exports) {
  43793. module.exports = function(module) {
  43794. if (!module.webpackPolyfill) {
  43795. module.deprecate = function() {};
  43796. module.paths = [];
  43797. // module.parent = undefined by default
  43798. if (!module.children) module.children = [];
  43799. Object.defineProperty(module, "loaded", {
  43800. enumerable: true,
  43801. get: function() {
  43802. return module.l;
  43803. }
  43804. });
  43805. Object.defineProperty(module, "id", {
  43806. enumerable: true,
  43807. get: function() {
  43808. return module.i;
  43809. }
  43810. });
  43811. module.webpackPolyfill = 1;
  43812. }
  43813. return module;
  43814. };
  43815. /***/ }),
  43816. /***/ "./resources/js/app.js":
  43817. /*!*****************************!*\
  43818. !*** ./resources/js/app.js ***!
  43819. \*****************************/
  43820. /*! no static exports found */
  43821. /***/ (function(module, exports, __webpack_require__) {
  43822. /**
  43823. * First we will load all of this project's JavaScript dependencies which
  43824. * includes Vue and other libraries. It is a great starting point when
  43825. * building robust, powerful web applications using Vue and Laravel.
  43826. */
  43827. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  43828. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  43829. /**
  43830. * The following block of code may be used to automatically register your
  43831. * Vue components. It will recursively scan this directory for the Vue
  43832. * components and automatically register them with their "basename".
  43833. *
  43834. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  43835. */
  43836. // const files = require.context('./', true, /\.vue$/i)
  43837. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  43838. Vue.component('follow-button', __webpack_require__(/*! ./components/FollowButton.vue */ "./resources/js/components/FollowButton.vue")["default"]);
  43839. /**
  43840. * Next, we will create a fresh Vue application instance and attach it to
  43841. * the page. Then, you may begin adding components to this application
  43842. * or customize the JavaScript scaffolding to fit your unique needs.
  43843. */
  43844. var app = new Vue({
  43845. el: '#app'
  43846. });
  43847. /***/ }),
  43848. /***/ "./resources/js/bootstrap.js":
  43849. /*!***********************************!*\
  43850. !*** ./resources/js/bootstrap.js ***!
  43851. \***********************************/
  43852. /*! no static exports found */
  43853. /***/ (function(module, exports, __webpack_require__) {
  43854. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  43855. /**
  43856. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  43857. * for JavaScript based Bootstrap features such as modals and tabs. This
  43858. * code may be modified to fit the specific needs of your application.
  43859. */
  43860. try {
  43861. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  43862. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  43863. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  43864. } catch (e) {}
  43865. /**
  43866. * We'll load the axios HTTP library which allows us to easily issue requests
  43867. * to our Laravel back-end. This library automatically handles sending the
  43868. * CSRF token as a header based on the value of the "XSRF" token cookie.
  43869. */
  43870. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  43871. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  43872. /**
  43873. * Echo exposes an expressive API for subscribing to channels and listening
  43874. * for events that are broadcast by Laravel. Echo and event broadcasting
  43875. * allows your team to easily build robust real-time web applications.
  43876. */
  43877. // import Echo from 'laravel-echo';
  43878. // window.Pusher = require('pusher-js');
  43879. // window.Echo = new Echo({
  43880. // broadcaster: 'pusher',
  43881. // key: process.env.MIX_PUSHER_APP_KEY,
  43882. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  43883. // forceTLS: true
  43884. // });
  43885. /***/ }),
  43886. /***/ "./resources/js/components/FollowButton.vue":
  43887. /*!**************************************************!*\
  43888. !*** ./resources/js/components/FollowButton.vue ***!
  43889. \**************************************************/
  43890. /*! exports provided: default */
  43891. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43892. "use strict";
  43893. __webpack_require__.r(__webpack_exports__);
  43894. /* harmony import */ var _FollowButton_vue_vue_type_template_id_426ba0ae___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FollowButton.vue?vue&type=template&id=426ba0ae& */ "./resources/js/components/FollowButton.vue?vue&type=template&id=426ba0ae&");
  43895. /* harmony import */ var _FollowButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FollowButton.vue?vue&type=script&lang=js& */ "./resources/js/components/FollowButton.vue?vue&type=script&lang=js&");
  43896. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  43897. /* normalize component */
  43898. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  43899. _FollowButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  43900. _FollowButton_vue_vue_type_template_id_426ba0ae___WEBPACK_IMPORTED_MODULE_0__["render"],
  43901. _FollowButton_vue_vue_type_template_id_426ba0ae___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  43902. false,
  43903. null,
  43904. null,
  43905. null
  43906. )
  43907. /* hot reload */
  43908. if (false) { var api; }
  43909. component.options.__file = "resources/js/components/FollowButton.vue"
  43910. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  43911. /***/ }),
  43912. /***/ "./resources/js/components/FollowButton.vue?vue&type=script&lang=js&":
  43913. /*!***************************************************************************!*\
  43914. !*** ./resources/js/components/FollowButton.vue?vue&type=script&lang=js& ***!
  43915. \***************************************************************************/
  43916. /*! exports provided: default */
  43917. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43918. "use strict";
  43919. __webpack_require__.r(__webpack_exports__);
  43920. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_FollowButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./FollowButton.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/FollowButton.vue?vue&type=script&lang=js&");
  43921. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_FollowButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  43922. /***/ }),
  43923. /***/ "./resources/js/components/FollowButton.vue?vue&type=template&id=426ba0ae&":
  43924. /*!*********************************************************************************!*\
  43925. !*** ./resources/js/components/FollowButton.vue?vue&type=template&id=426ba0ae& ***!
  43926. \*********************************************************************************/
  43927. /*! exports provided: render, staticRenderFns */
  43928. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43929. "use strict";
  43930. __webpack_require__.r(__webpack_exports__);
  43931. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_FollowButton_vue_vue_type_template_id_426ba0ae___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./FollowButton.vue?vue&type=template&id=426ba0ae& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/FollowButton.vue?vue&type=template&id=426ba0ae&");
  43932. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_FollowButton_vue_vue_type_template_id_426ba0ae___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  43933. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_FollowButton_vue_vue_type_template_id_426ba0ae___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  43934. /***/ }),
  43935. /***/ "./resources/sass/app.scss":
  43936. /*!*********************************!*\
  43937. !*** ./resources/sass/app.scss ***!
  43938. \*********************************/
  43939. /*! no static exports found */
  43940. /***/ (function(module, exports) {
  43941. // removed by extract-text-webpack-plugin
  43942. /***/ }),
  43943. /***/ 0:
  43944. /*!*************************************************************!*\
  43945. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  43946. \*************************************************************/
  43947. /*! no static exports found */
  43948. /***/ (function(module, exports, __webpack_require__) {
  43949. __webpack_require__(/*! /home/annngals/pictureBlog/resources/js/app.js */"./resources/js/app.js");
  43950. module.exports = __webpack_require__(/*! /home/annngals/pictureBlog/resources/sass/app.scss */"./resources/sass/app.scss");
  43951. /***/ })
  43952. /******/ });