app.js 1.4 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887
  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/ExampleComponent.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/ExampleComponent.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. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1604. /*!*****************************************************!*\
  1605. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1606. \*****************************************************/
  1607. /*! no static exports found */
  1608. /***/ (function(module, exports, __webpack_require__) {
  1609. /*!
  1610. * Bootstrap v4.5.2 (https://getbootstrap.com/)
  1611. * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1612. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1613. */
  1614. (function (global, factory) {
  1615. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1616. undefined;
  1617. }(this, (function (exports, $, Popper) { 'use strict';
  1618. $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
  1619. Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
  1620. function _defineProperties(target, props) {
  1621. for (var i = 0; i < props.length; i++) {
  1622. var descriptor = props[i];
  1623. descriptor.enumerable = descriptor.enumerable || false;
  1624. descriptor.configurable = true;
  1625. if ("value" in descriptor) descriptor.writable = true;
  1626. Object.defineProperty(target, descriptor.key, descriptor);
  1627. }
  1628. }
  1629. function _createClass(Constructor, protoProps, staticProps) {
  1630. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1631. if (staticProps) _defineProperties(Constructor, staticProps);
  1632. return Constructor;
  1633. }
  1634. function _extends() {
  1635. _extends = Object.assign || function (target) {
  1636. for (var i = 1; i < arguments.length; i++) {
  1637. var source = arguments[i];
  1638. for (var key in source) {
  1639. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1640. target[key] = source[key];
  1641. }
  1642. }
  1643. }
  1644. return target;
  1645. };
  1646. return _extends.apply(this, arguments);
  1647. }
  1648. function _inheritsLoose(subClass, superClass) {
  1649. subClass.prototype = Object.create(superClass.prototype);
  1650. subClass.prototype.constructor = subClass;
  1651. subClass.__proto__ = superClass;
  1652. }
  1653. /**
  1654. * --------------------------------------------------------------------------
  1655. * Bootstrap (v4.5.2): util.js
  1656. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1657. * --------------------------------------------------------------------------
  1658. */
  1659. /**
  1660. * ------------------------------------------------------------------------
  1661. * Private TransitionEnd Helpers
  1662. * ------------------------------------------------------------------------
  1663. */
  1664. var TRANSITION_END = 'transitionend';
  1665. var MAX_UID = 1000000;
  1666. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1667. function toType(obj) {
  1668. if (obj === null || typeof obj === 'undefined') {
  1669. return "" + obj;
  1670. }
  1671. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1672. }
  1673. function getSpecialTransitionEndEvent() {
  1674. return {
  1675. bindType: TRANSITION_END,
  1676. delegateType: TRANSITION_END,
  1677. handle: function handle(event) {
  1678. if ($(event.target).is(this)) {
  1679. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1680. }
  1681. return undefined;
  1682. }
  1683. };
  1684. }
  1685. function transitionEndEmulator(duration) {
  1686. var _this = this;
  1687. var called = false;
  1688. $(this).one(Util.TRANSITION_END, function () {
  1689. called = true;
  1690. });
  1691. setTimeout(function () {
  1692. if (!called) {
  1693. Util.triggerTransitionEnd(_this);
  1694. }
  1695. }, duration);
  1696. return this;
  1697. }
  1698. function setTransitionEndSupport() {
  1699. $.fn.emulateTransitionEnd = transitionEndEmulator;
  1700. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1701. }
  1702. /**
  1703. * --------------------------------------------------------------------------
  1704. * Public Util Api
  1705. * --------------------------------------------------------------------------
  1706. */
  1707. var Util = {
  1708. TRANSITION_END: 'bsTransitionEnd',
  1709. getUID: function getUID(prefix) {
  1710. do {
  1711. // eslint-disable-next-line no-bitwise
  1712. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1713. } while (document.getElementById(prefix));
  1714. return prefix;
  1715. },
  1716. getSelectorFromElement: function getSelectorFromElement(element) {
  1717. var selector = element.getAttribute('data-target');
  1718. if (!selector || selector === '#') {
  1719. var hrefAttr = element.getAttribute('href');
  1720. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  1721. }
  1722. try {
  1723. return document.querySelector(selector) ? selector : null;
  1724. } catch (err) {
  1725. return null;
  1726. }
  1727. },
  1728. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  1729. if (!element) {
  1730. return 0;
  1731. } // Get transition-duration of the element
  1732. var transitionDuration = $(element).css('transition-duration');
  1733. var transitionDelay = $(element).css('transition-delay');
  1734. var floatTransitionDuration = parseFloat(transitionDuration);
  1735. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  1736. if (!floatTransitionDuration && !floatTransitionDelay) {
  1737. return 0;
  1738. } // If multiple durations are defined, take the first
  1739. transitionDuration = transitionDuration.split(',')[0];
  1740. transitionDelay = transitionDelay.split(',')[0];
  1741. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  1742. },
  1743. reflow: function reflow(element) {
  1744. return element.offsetHeight;
  1745. },
  1746. triggerTransitionEnd: function triggerTransitionEnd(element) {
  1747. $(element).trigger(TRANSITION_END);
  1748. },
  1749. // TODO: Remove in v5
  1750. supportsTransitionEnd: function supportsTransitionEnd() {
  1751. return Boolean(TRANSITION_END);
  1752. },
  1753. isElement: function isElement(obj) {
  1754. return (obj[0] || obj).nodeType;
  1755. },
  1756. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  1757. for (var property in configTypes) {
  1758. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  1759. var expectedTypes = configTypes[property];
  1760. var value = config[property];
  1761. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  1762. if (!new RegExp(expectedTypes).test(valueType)) {
  1763. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  1764. }
  1765. }
  1766. }
  1767. },
  1768. findShadowRoot: function findShadowRoot(element) {
  1769. if (!document.documentElement.attachShadow) {
  1770. return null;
  1771. } // Can find the shadow root otherwise it'll return the document
  1772. if (typeof element.getRootNode === 'function') {
  1773. var root = element.getRootNode();
  1774. return root instanceof ShadowRoot ? root : null;
  1775. }
  1776. if (element instanceof ShadowRoot) {
  1777. return element;
  1778. } // when we don't find a shadow root
  1779. if (!element.parentNode) {
  1780. return null;
  1781. }
  1782. return Util.findShadowRoot(element.parentNode);
  1783. },
  1784. jQueryDetection: function jQueryDetection() {
  1785. if (typeof $ === 'undefined') {
  1786. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  1787. }
  1788. var version = $.fn.jquery.split(' ')[0].split('.');
  1789. var minMajor = 1;
  1790. var ltMajor = 2;
  1791. var minMinor = 9;
  1792. var minPatch = 1;
  1793. var maxMajor = 4;
  1794. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  1795. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  1796. }
  1797. }
  1798. };
  1799. Util.jQueryDetection();
  1800. setTransitionEndSupport();
  1801. /**
  1802. * ------------------------------------------------------------------------
  1803. * Constants
  1804. * ------------------------------------------------------------------------
  1805. */
  1806. var NAME = 'alert';
  1807. var VERSION = '4.5.2';
  1808. var DATA_KEY = 'bs.alert';
  1809. var EVENT_KEY = "." + DATA_KEY;
  1810. var DATA_API_KEY = '.data-api';
  1811. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1812. var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  1813. var EVENT_CLOSE = "close" + EVENT_KEY;
  1814. var EVENT_CLOSED = "closed" + EVENT_KEY;
  1815. var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  1816. var CLASS_NAME_ALERT = 'alert';
  1817. var CLASS_NAME_FADE = 'fade';
  1818. var CLASS_NAME_SHOW = 'show';
  1819. /**
  1820. * ------------------------------------------------------------------------
  1821. * Class Definition
  1822. * ------------------------------------------------------------------------
  1823. */
  1824. var Alert = /*#__PURE__*/function () {
  1825. function Alert(element) {
  1826. this._element = element;
  1827. } // Getters
  1828. var _proto = Alert.prototype;
  1829. // Public
  1830. _proto.close = function close(element) {
  1831. var rootElement = this._element;
  1832. if (element) {
  1833. rootElement = this._getRootElement(element);
  1834. }
  1835. var customEvent = this._triggerCloseEvent(rootElement);
  1836. if (customEvent.isDefaultPrevented()) {
  1837. return;
  1838. }
  1839. this._removeElement(rootElement);
  1840. };
  1841. _proto.dispose = function dispose() {
  1842. $.removeData(this._element, DATA_KEY);
  1843. this._element = null;
  1844. } // Private
  1845. ;
  1846. _proto._getRootElement = function _getRootElement(element) {
  1847. var selector = Util.getSelectorFromElement(element);
  1848. var parent = false;
  1849. if (selector) {
  1850. parent = document.querySelector(selector);
  1851. }
  1852. if (!parent) {
  1853. parent = $(element).closest("." + CLASS_NAME_ALERT)[0];
  1854. }
  1855. return parent;
  1856. };
  1857. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  1858. var closeEvent = $.Event(EVENT_CLOSE);
  1859. $(element).trigger(closeEvent);
  1860. return closeEvent;
  1861. };
  1862. _proto._removeElement = function _removeElement(element) {
  1863. var _this = this;
  1864. $(element).removeClass(CLASS_NAME_SHOW);
  1865. if (!$(element).hasClass(CLASS_NAME_FADE)) {
  1866. this._destroyElement(element);
  1867. return;
  1868. }
  1869. var transitionDuration = Util.getTransitionDurationFromElement(element);
  1870. $(element).one(Util.TRANSITION_END, function (event) {
  1871. return _this._destroyElement(element, event);
  1872. }).emulateTransitionEnd(transitionDuration);
  1873. };
  1874. _proto._destroyElement = function _destroyElement(element) {
  1875. $(element).detach().trigger(EVENT_CLOSED).remove();
  1876. } // Static
  1877. ;
  1878. Alert._jQueryInterface = function _jQueryInterface(config) {
  1879. return this.each(function () {
  1880. var $element = $(this);
  1881. var data = $element.data(DATA_KEY);
  1882. if (!data) {
  1883. data = new Alert(this);
  1884. $element.data(DATA_KEY, data);
  1885. }
  1886. if (config === 'close') {
  1887. data[config](this);
  1888. }
  1889. });
  1890. };
  1891. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  1892. return function (event) {
  1893. if (event) {
  1894. event.preventDefault();
  1895. }
  1896. alertInstance.close(this);
  1897. };
  1898. };
  1899. _createClass(Alert, null, [{
  1900. key: "VERSION",
  1901. get: function get() {
  1902. return VERSION;
  1903. }
  1904. }]);
  1905. return Alert;
  1906. }();
  1907. /**
  1908. * ------------------------------------------------------------------------
  1909. * Data Api implementation
  1910. * ------------------------------------------------------------------------
  1911. */
  1912. $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
  1913. /**
  1914. * ------------------------------------------------------------------------
  1915. * jQuery
  1916. * ------------------------------------------------------------------------
  1917. */
  1918. $.fn[NAME] = Alert._jQueryInterface;
  1919. $.fn[NAME].Constructor = Alert;
  1920. $.fn[NAME].noConflict = function () {
  1921. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1922. return Alert._jQueryInterface;
  1923. };
  1924. /**
  1925. * ------------------------------------------------------------------------
  1926. * Constants
  1927. * ------------------------------------------------------------------------
  1928. */
  1929. var NAME$1 = 'button';
  1930. var VERSION$1 = '4.5.2';
  1931. var DATA_KEY$1 = 'bs.button';
  1932. var EVENT_KEY$1 = "." + DATA_KEY$1;
  1933. var DATA_API_KEY$1 = '.data-api';
  1934. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  1935. var CLASS_NAME_ACTIVE = 'active';
  1936. var CLASS_NAME_BUTTON = 'btn';
  1937. var CLASS_NAME_FOCUS = 'focus';
  1938. var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
  1939. var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
  1940. var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
  1941. var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
  1942. var SELECTOR_INPUT = 'input:not([type="hidden"])';
  1943. var SELECTOR_ACTIVE = '.active';
  1944. var SELECTOR_BUTTON = '.btn';
  1945. var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
  1946. var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
  1947. var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
  1948. /**
  1949. * ------------------------------------------------------------------------
  1950. * Class Definition
  1951. * ------------------------------------------------------------------------
  1952. */
  1953. var Button = /*#__PURE__*/function () {
  1954. function Button(element) {
  1955. this._element = element;
  1956. } // Getters
  1957. var _proto = Button.prototype;
  1958. // Public
  1959. _proto.toggle = function toggle() {
  1960. var triggerChangeEvent = true;
  1961. var addAriaPressed = true;
  1962. var rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0];
  1963. if (rootElement) {
  1964. var input = this._element.querySelector(SELECTOR_INPUT);
  1965. if (input) {
  1966. if (input.type === 'radio') {
  1967. if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  1968. triggerChangeEvent = false;
  1969. } else {
  1970. var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
  1971. if (activeElement) {
  1972. $(activeElement).removeClass(CLASS_NAME_ACTIVE);
  1973. }
  1974. }
  1975. }
  1976. if (triggerChangeEvent) {
  1977. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  1978. if (input.type === 'checkbox' || input.type === 'radio') {
  1979. input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
  1980. }
  1981. $(input).trigger('change');
  1982. }
  1983. input.focus();
  1984. addAriaPressed = false;
  1985. }
  1986. }
  1987. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  1988. if (addAriaPressed) {
  1989. this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
  1990. }
  1991. if (triggerChangeEvent) {
  1992. $(this._element).toggleClass(CLASS_NAME_ACTIVE);
  1993. }
  1994. }
  1995. };
  1996. _proto.dispose = function dispose() {
  1997. $.removeData(this._element, DATA_KEY$1);
  1998. this._element = null;
  1999. } // Static
  2000. ;
  2001. Button._jQueryInterface = function _jQueryInterface(config) {
  2002. return this.each(function () {
  2003. var data = $(this).data(DATA_KEY$1);
  2004. if (!data) {
  2005. data = new Button(this);
  2006. $(this).data(DATA_KEY$1, data);
  2007. }
  2008. if (config === 'toggle') {
  2009. data[config]();
  2010. }
  2011. });
  2012. };
  2013. _createClass(Button, null, [{
  2014. key: "VERSION",
  2015. get: function get() {
  2016. return VERSION$1;
  2017. }
  2018. }]);
  2019. return Button;
  2020. }();
  2021. /**
  2022. * ------------------------------------------------------------------------
  2023. * Data Api implementation
  2024. * ------------------------------------------------------------------------
  2025. */
  2026. $(document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2027. var button = event.target;
  2028. var initialButton = button;
  2029. if (!$(button).hasClass(CLASS_NAME_BUTTON)) {
  2030. button = $(button).closest(SELECTOR_BUTTON)[0];
  2031. }
  2032. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2033. event.preventDefault(); // work around Firefox bug #1540995
  2034. } else {
  2035. var inputBtn = button.querySelector(SELECTOR_INPUT);
  2036. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2037. event.preventDefault(); // work around Firefox bug #1540995
  2038. return;
  2039. }
  2040. if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') {
  2041. Button._jQueryInterface.call($(button), 'toggle');
  2042. }
  2043. }
  2044. }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2045. var button = $(event.target).closest(SELECTOR_BUTTON)[0];
  2046. $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
  2047. });
  2048. $(window).on(EVENT_LOAD_DATA_API, function () {
  2049. // ensure correct active class is set to match the controls' actual values/states
  2050. // find all checkboxes/readio buttons inside data-toggle groups
  2051. var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
  2052. for (var i = 0, len = buttons.length; i < len; i++) {
  2053. var button = buttons[i];
  2054. var input = button.querySelector(SELECTOR_INPUT);
  2055. if (input.checked || input.hasAttribute('checked')) {
  2056. button.classList.add(CLASS_NAME_ACTIVE);
  2057. } else {
  2058. button.classList.remove(CLASS_NAME_ACTIVE);
  2059. }
  2060. } // find all button toggles
  2061. buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
  2062. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2063. var _button = buttons[_i];
  2064. if (_button.getAttribute('aria-pressed') === 'true') {
  2065. _button.classList.add(CLASS_NAME_ACTIVE);
  2066. } else {
  2067. _button.classList.remove(CLASS_NAME_ACTIVE);
  2068. }
  2069. }
  2070. });
  2071. /**
  2072. * ------------------------------------------------------------------------
  2073. * jQuery
  2074. * ------------------------------------------------------------------------
  2075. */
  2076. $.fn[NAME$1] = Button._jQueryInterface;
  2077. $.fn[NAME$1].Constructor = Button;
  2078. $.fn[NAME$1].noConflict = function () {
  2079. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2080. return Button._jQueryInterface;
  2081. };
  2082. /**
  2083. * ------------------------------------------------------------------------
  2084. * Constants
  2085. * ------------------------------------------------------------------------
  2086. */
  2087. var NAME$2 = 'carousel';
  2088. var VERSION$2 = '4.5.2';
  2089. var DATA_KEY$2 = 'bs.carousel';
  2090. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2091. var DATA_API_KEY$2 = '.data-api';
  2092. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2093. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2094. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2095. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2096. var SWIPE_THRESHOLD = 40;
  2097. var Default = {
  2098. interval: 5000,
  2099. keyboard: true,
  2100. slide: false,
  2101. pause: 'hover',
  2102. wrap: true,
  2103. touch: true
  2104. };
  2105. var DefaultType = {
  2106. interval: '(number|boolean)',
  2107. keyboard: 'boolean',
  2108. slide: '(boolean|string)',
  2109. pause: '(string|boolean)',
  2110. wrap: 'boolean',
  2111. touch: 'boolean'
  2112. };
  2113. var DIRECTION_NEXT = 'next';
  2114. var DIRECTION_PREV = 'prev';
  2115. var DIRECTION_LEFT = 'left';
  2116. var DIRECTION_RIGHT = 'right';
  2117. var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  2118. var EVENT_SLID = "slid" + EVENT_KEY$2;
  2119. var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  2120. var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  2121. var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  2122. var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  2123. var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  2124. var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  2125. var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  2126. var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  2127. var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  2128. var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  2129. var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  2130. var CLASS_NAME_CAROUSEL = 'carousel';
  2131. var CLASS_NAME_ACTIVE$1 = 'active';
  2132. var CLASS_NAME_SLIDE = 'slide';
  2133. var CLASS_NAME_RIGHT = 'carousel-item-right';
  2134. var CLASS_NAME_LEFT = 'carousel-item-left';
  2135. var CLASS_NAME_NEXT = 'carousel-item-next';
  2136. var CLASS_NAME_PREV = 'carousel-item-prev';
  2137. var CLASS_NAME_POINTER_EVENT = 'pointer-event';
  2138. var SELECTOR_ACTIVE$1 = '.active';
  2139. var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  2140. var SELECTOR_ITEM = '.carousel-item';
  2141. var SELECTOR_ITEM_IMG = '.carousel-item img';
  2142. var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  2143. var SELECTOR_INDICATORS = '.carousel-indicators';
  2144. var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
  2145. var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
  2146. var PointerType = {
  2147. TOUCH: 'touch',
  2148. PEN: 'pen'
  2149. };
  2150. /**
  2151. * ------------------------------------------------------------------------
  2152. * Class Definition
  2153. * ------------------------------------------------------------------------
  2154. */
  2155. var Carousel = /*#__PURE__*/function () {
  2156. function Carousel(element, config) {
  2157. this._items = null;
  2158. this._interval = null;
  2159. this._activeElement = null;
  2160. this._isPaused = false;
  2161. this._isSliding = false;
  2162. this.touchTimeout = null;
  2163. this.touchStartX = 0;
  2164. this.touchDeltaX = 0;
  2165. this._config = this._getConfig(config);
  2166. this._element = element;
  2167. this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
  2168. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2169. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2170. this._addEventListeners();
  2171. } // Getters
  2172. var _proto = Carousel.prototype;
  2173. // Public
  2174. _proto.next = function next() {
  2175. if (!this._isSliding) {
  2176. this._slide(DIRECTION_NEXT);
  2177. }
  2178. };
  2179. _proto.nextWhenVisible = function nextWhenVisible() {
  2180. // Don't call next when the page isn't visible
  2181. // or the carousel or its parent isn't visible
  2182. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2183. this.next();
  2184. }
  2185. };
  2186. _proto.prev = function prev() {
  2187. if (!this._isSliding) {
  2188. this._slide(DIRECTION_PREV);
  2189. }
  2190. };
  2191. _proto.pause = function pause(event) {
  2192. if (!event) {
  2193. this._isPaused = true;
  2194. }
  2195. if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
  2196. Util.triggerTransitionEnd(this._element);
  2197. this.cycle(true);
  2198. }
  2199. clearInterval(this._interval);
  2200. this._interval = null;
  2201. };
  2202. _proto.cycle = function cycle(event) {
  2203. if (!event) {
  2204. this._isPaused = false;
  2205. }
  2206. if (this._interval) {
  2207. clearInterval(this._interval);
  2208. this._interval = null;
  2209. }
  2210. if (this._config.interval && !this._isPaused) {
  2211. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2212. }
  2213. };
  2214. _proto.to = function to(index) {
  2215. var _this = this;
  2216. this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2217. var activeIndex = this._getItemIndex(this._activeElement);
  2218. if (index > this._items.length - 1 || index < 0) {
  2219. return;
  2220. }
  2221. if (this._isSliding) {
  2222. $(this._element).one(EVENT_SLID, function () {
  2223. return _this.to(index);
  2224. });
  2225. return;
  2226. }
  2227. if (activeIndex === index) {
  2228. this.pause();
  2229. this.cycle();
  2230. return;
  2231. }
  2232. var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
  2233. this._slide(direction, this._items[index]);
  2234. };
  2235. _proto.dispose = function dispose() {
  2236. $(this._element).off(EVENT_KEY$2);
  2237. $.removeData(this._element, DATA_KEY$2);
  2238. this._items = null;
  2239. this._config = null;
  2240. this._element = null;
  2241. this._interval = null;
  2242. this._isPaused = null;
  2243. this._isSliding = null;
  2244. this._activeElement = null;
  2245. this._indicatorsElement = null;
  2246. } // Private
  2247. ;
  2248. _proto._getConfig = function _getConfig(config) {
  2249. config = _extends({}, Default, config);
  2250. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2251. return config;
  2252. };
  2253. _proto._handleSwipe = function _handleSwipe() {
  2254. var absDeltax = Math.abs(this.touchDeltaX);
  2255. if (absDeltax <= SWIPE_THRESHOLD) {
  2256. return;
  2257. }
  2258. var direction = absDeltax / this.touchDeltaX;
  2259. this.touchDeltaX = 0; // swipe left
  2260. if (direction > 0) {
  2261. this.prev();
  2262. } // swipe right
  2263. if (direction < 0) {
  2264. this.next();
  2265. }
  2266. };
  2267. _proto._addEventListeners = function _addEventListeners() {
  2268. var _this2 = this;
  2269. if (this._config.keyboard) {
  2270. $(this._element).on(EVENT_KEYDOWN, function (event) {
  2271. return _this2._keydown(event);
  2272. });
  2273. }
  2274. if (this._config.pause === 'hover') {
  2275. $(this._element).on(EVENT_MOUSEENTER, function (event) {
  2276. return _this2.pause(event);
  2277. }).on(EVENT_MOUSELEAVE, function (event) {
  2278. return _this2.cycle(event);
  2279. });
  2280. }
  2281. if (this._config.touch) {
  2282. this._addTouchEventListeners();
  2283. }
  2284. };
  2285. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2286. var _this3 = this;
  2287. if (!this._touchSupported) {
  2288. return;
  2289. }
  2290. var start = function start(event) {
  2291. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2292. _this3.touchStartX = event.originalEvent.clientX;
  2293. } else if (!_this3._pointerEvent) {
  2294. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2295. }
  2296. };
  2297. var move = function move(event) {
  2298. // ensure swiping with one touch and not pinching
  2299. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2300. _this3.touchDeltaX = 0;
  2301. } else {
  2302. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2303. }
  2304. };
  2305. var end = function end(event) {
  2306. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2307. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2308. }
  2309. _this3._handleSwipe();
  2310. if (_this3._config.pause === 'hover') {
  2311. // If it's a touch-enabled device, mouseenter/leave are fired as
  2312. // part of the mouse compatibility events on first tap - the carousel
  2313. // would stop cycling until user tapped out of it;
  2314. // here, we listen for touchend, explicitly pause the carousel
  2315. // (as if it's the second time we tap on it, mouseenter compat event
  2316. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2317. // events to fire) we explicitly restart cycling
  2318. _this3.pause();
  2319. if (_this3.touchTimeout) {
  2320. clearTimeout(_this3.touchTimeout);
  2321. }
  2322. _this3.touchTimeout = setTimeout(function (event) {
  2323. return _this3.cycle(event);
  2324. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2325. }
  2326. };
  2327. $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
  2328. return e.preventDefault();
  2329. });
  2330. if (this._pointerEvent) {
  2331. $(this._element).on(EVENT_POINTERDOWN, function (event) {
  2332. return start(event);
  2333. });
  2334. $(this._element).on(EVENT_POINTERUP, function (event) {
  2335. return end(event);
  2336. });
  2337. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  2338. } else {
  2339. $(this._element).on(EVENT_TOUCHSTART, function (event) {
  2340. return start(event);
  2341. });
  2342. $(this._element).on(EVENT_TOUCHMOVE, function (event) {
  2343. return move(event);
  2344. });
  2345. $(this._element).on(EVENT_TOUCHEND, function (event) {
  2346. return end(event);
  2347. });
  2348. }
  2349. };
  2350. _proto._keydown = function _keydown(event) {
  2351. if (/input|textarea/i.test(event.target.tagName)) {
  2352. return;
  2353. }
  2354. switch (event.which) {
  2355. case ARROW_LEFT_KEYCODE:
  2356. event.preventDefault();
  2357. this.prev();
  2358. break;
  2359. case ARROW_RIGHT_KEYCODE:
  2360. event.preventDefault();
  2361. this.next();
  2362. break;
  2363. }
  2364. };
  2365. _proto._getItemIndex = function _getItemIndex(element) {
  2366. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
  2367. return this._items.indexOf(element);
  2368. };
  2369. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2370. var isNextDirection = direction === DIRECTION_NEXT;
  2371. var isPrevDirection = direction === DIRECTION_PREV;
  2372. var activeIndex = this._getItemIndex(activeElement);
  2373. var lastItemIndex = this._items.length - 1;
  2374. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2375. if (isGoingToWrap && !this._config.wrap) {
  2376. return activeElement;
  2377. }
  2378. var delta = direction === DIRECTION_PREV ? -1 : 1;
  2379. var itemIndex = (activeIndex + delta) % this._items.length;
  2380. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2381. };
  2382. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2383. var targetIndex = this._getItemIndex(relatedTarget);
  2384. var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
  2385. var slideEvent = $.Event(EVENT_SLIDE, {
  2386. relatedTarget: relatedTarget,
  2387. direction: eventDirectionName,
  2388. from: fromIndex,
  2389. to: targetIndex
  2390. });
  2391. $(this._element).trigger(slideEvent);
  2392. return slideEvent;
  2393. };
  2394. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2395. if (this._indicatorsElement) {
  2396. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
  2397. $(indicators).removeClass(CLASS_NAME_ACTIVE$1);
  2398. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2399. if (nextIndicator) {
  2400. $(nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
  2401. }
  2402. }
  2403. };
  2404. _proto._slide = function _slide(direction, element) {
  2405. var _this4 = this;
  2406. var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2407. var activeElementIndex = this._getItemIndex(activeElement);
  2408. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2409. var nextElementIndex = this._getItemIndex(nextElement);
  2410. var isCycling = Boolean(this._interval);
  2411. var directionalClassName;
  2412. var orderClassName;
  2413. var eventDirectionName;
  2414. if (direction === DIRECTION_NEXT) {
  2415. directionalClassName = CLASS_NAME_LEFT;
  2416. orderClassName = CLASS_NAME_NEXT;
  2417. eventDirectionName = DIRECTION_LEFT;
  2418. } else {
  2419. directionalClassName = CLASS_NAME_RIGHT;
  2420. orderClassName = CLASS_NAME_PREV;
  2421. eventDirectionName = DIRECTION_RIGHT;
  2422. }
  2423. if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
  2424. this._isSliding = false;
  2425. return;
  2426. }
  2427. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2428. if (slideEvent.isDefaultPrevented()) {
  2429. return;
  2430. }
  2431. if (!activeElement || !nextElement) {
  2432. // Some weirdness is happening, so we bail
  2433. return;
  2434. }
  2435. this._isSliding = true;
  2436. if (isCycling) {
  2437. this.pause();
  2438. }
  2439. this._setActiveIndicatorElement(nextElement);
  2440. var slidEvent = $.Event(EVENT_SLID, {
  2441. relatedTarget: nextElement,
  2442. direction: eventDirectionName,
  2443. from: activeElementIndex,
  2444. to: nextElementIndex
  2445. });
  2446. if ($(this._element).hasClass(CLASS_NAME_SLIDE)) {
  2447. $(nextElement).addClass(orderClassName);
  2448. Util.reflow(nextElement);
  2449. $(activeElement).addClass(directionalClassName);
  2450. $(nextElement).addClass(directionalClassName);
  2451. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2452. if (nextElementInterval) {
  2453. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2454. this._config.interval = nextElementInterval;
  2455. } else {
  2456. this._config.interval = this._config.defaultInterval || this._config.interval;
  2457. }
  2458. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2459. $(activeElement).one(Util.TRANSITION_END, function () {
  2460. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
  2461. $(activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
  2462. _this4._isSliding = false;
  2463. setTimeout(function () {
  2464. return $(_this4._element).trigger(slidEvent);
  2465. }, 0);
  2466. }).emulateTransitionEnd(transitionDuration);
  2467. } else {
  2468. $(activeElement).removeClass(CLASS_NAME_ACTIVE$1);
  2469. $(nextElement).addClass(CLASS_NAME_ACTIVE$1);
  2470. this._isSliding = false;
  2471. $(this._element).trigger(slidEvent);
  2472. }
  2473. if (isCycling) {
  2474. this.cycle();
  2475. }
  2476. } // Static
  2477. ;
  2478. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2479. return this.each(function () {
  2480. var data = $(this).data(DATA_KEY$2);
  2481. var _config = _extends({}, Default, $(this).data());
  2482. if (typeof config === 'object') {
  2483. _config = _extends({}, _config, config);
  2484. }
  2485. var action = typeof config === 'string' ? config : _config.slide;
  2486. if (!data) {
  2487. data = new Carousel(this, _config);
  2488. $(this).data(DATA_KEY$2, data);
  2489. }
  2490. if (typeof config === 'number') {
  2491. data.to(config);
  2492. } else if (typeof action === 'string') {
  2493. if (typeof data[action] === 'undefined') {
  2494. throw new TypeError("No method named \"" + action + "\"");
  2495. }
  2496. data[action]();
  2497. } else if (_config.interval && _config.ride) {
  2498. data.pause();
  2499. data.cycle();
  2500. }
  2501. });
  2502. };
  2503. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2504. var selector = Util.getSelectorFromElement(this);
  2505. if (!selector) {
  2506. return;
  2507. }
  2508. var target = $(selector)[0];
  2509. if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) {
  2510. return;
  2511. }
  2512. var config = _extends({}, $(target).data(), $(this).data());
  2513. var slideIndex = this.getAttribute('data-slide-to');
  2514. if (slideIndex) {
  2515. config.interval = false;
  2516. }
  2517. Carousel._jQueryInterface.call($(target), config);
  2518. if (slideIndex) {
  2519. $(target).data(DATA_KEY$2).to(slideIndex);
  2520. }
  2521. event.preventDefault();
  2522. };
  2523. _createClass(Carousel, null, [{
  2524. key: "VERSION",
  2525. get: function get() {
  2526. return VERSION$2;
  2527. }
  2528. }, {
  2529. key: "Default",
  2530. get: function get() {
  2531. return Default;
  2532. }
  2533. }]);
  2534. return Carousel;
  2535. }();
  2536. /**
  2537. * ------------------------------------------------------------------------
  2538. * Data Api implementation
  2539. * ------------------------------------------------------------------------
  2540. */
  2541. $(document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
  2542. $(window).on(EVENT_LOAD_DATA_API$1, function () {
  2543. var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
  2544. for (var i = 0, len = carousels.length; i < len; i++) {
  2545. var $carousel = $(carousels[i]);
  2546. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2547. }
  2548. });
  2549. /**
  2550. * ------------------------------------------------------------------------
  2551. * jQuery
  2552. * ------------------------------------------------------------------------
  2553. */
  2554. $.fn[NAME$2] = Carousel._jQueryInterface;
  2555. $.fn[NAME$2].Constructor = Carousel;
  2556. $.fn[NAME$2].noConflict = function () {
  2557. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2558. return Carousel._jQueryInterface;
  2559. };
  2560. /**
  2561. * ------------------------------------------------------------------------
  2562. * Constants
  2563. * ------------------------------------------------------------------------
  2564. */
  2565. var NAME$3 = 'collapse';
  2566. var VERSION$3 = '4.5.2';
  2567. var DATA_KEY$3 = 'bs.collapse';
  2568. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2569. var DATA_API_KEY$3 = '.data-api';
  2570. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2571. var Default$1 = {
  2572. toggle: true,
  2573. parent: ''
  2574. };
  2575. var DefaultType$1 = {
  2576. toggle: 'boolean',
  2577. parent: '(string|element)'
  2578. };
  2579. var EVENT_SHOW = "show" + EVENT_KEY$3;
  2580. var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  2581. var EVENT_HIDE = "hide" + EVENT_KEY$3;
  2582. var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  2583. var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  2584. var CLASS_NAME_SHOW$1 = 'show';
  2585. var CLASS_NAME_COLLAPSE = 'collapse';
  2586. var CLASS_NAME_COLLAPSING = 'collapsing';
  2587. var CLASS_NAME_COLLAPSED = 'collapsed';
  2588. var DIMENSION_WIDTH = 'width';
  2589. var DIMENSION_HEIGHT = 'height';
  2590. var SELECTOR_ACTIVES = '.show, .collapsing';
  2591. var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
  2592. /**
  2593. * ------------------------------------------------------------------------
  2594. * Class Definition
  2595. * ------------------------------------------------------------------------
  2596. */
  2597. var Collapse = /*#__PURE__*/function () {
  2598. function Collapse(element, config) {
  2599. this._isTransitioning = false;
  2600. this._element = element;
  2601. this._config = this._getConfig(config);
  2602. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2603. var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
  2604. for (var i = 0, len = toggleList.length; i < len; i++) {
  2605. var elem = toggleList[i];
  2606. var selector = Util.getSelectorFromElement(elem);
  2607. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  2608. return foundElem === element;
  2609. });
  2610. if (selector !== null && filterElement.length > 0) {
  2611. this._selector = selector;
  2612. this._triggerArray.push(elem);
  2613. }
  2614. }
  2615. this._parent = this._config.parent ? this._getParent() : null;
  2616. if (!this._config.parent) {
  2617. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  2618. }
  2619. if (this._config.toggle) {
  2620. this.toggle();
  2621. }
  2622. } // Getters
  2623. var _proto = Collapse.prototype;
  2624. // Public
  2625. _proto.toggle = function toggle() {
  2626. if ($(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2627. this.hide();
  2628. } else {
  2629. this.show();
  2630. }
  2631. };
  2632. _proto.show = function show() {
  2633. var _this = this;
  2634. if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2635. return;
  2636. }
  2637. var actives;
  2638. var activesData;
  2639. if (this._parent) {
  2640. actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
  2641. if (typeof _this._config.parent === 'string') {
  2642. return elem.getAttribute('data-parent') === _this._config.parent;
  2643. }
  2644. return elem.classList.contains(CLASS_NAME_COLLAPSE);
  2645. });
  2646. if (actives.length === 0) {
  2647. actives = null;
  2648. }
  2649. }
  2650. if (actives) {
  2651. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  2652. if (activesData && activesData._isTransitioning) {
  2653. return;
  2654. }
  2655. }
  2656. var startEvent = $.Event(EVENT_SHOW);
  2657. $(this._element).trigger(startEvent);
  2658. if (startEvent.isDefaultPrevented()) {
  2659. return;
  2660. }
  2661. if (actives) {
  2662. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  2663. if (!activesData) {
  2664. $(actives).data(DATA_KEY$3, null);
  2665. }
  2666. }
  2667. var dimension = this._getDimension();
  2668. $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
  2669. this._element.style[dimension] = 0;
  2670. if (this._triggerArray.length) {
  2671. $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
  2672. }
  2673. this.setTransitioning(true);
  2674. var complete = function complete() {
  2675. $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  2676. _this._element.style[dimension] = '';
  2677. _this.setTransitioning(false);
  2678. $(_this._element).trigger(EVENT_SHOWN);
  2679. };
  2680. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  2681. var scrollSize = "scroll" + capitalizedDimension;
  2682. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2683. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2684. this._element.style[dimension] = this._element[scrollSize] + "px";
  2685. };
  2686. _proto.hide = function hide() {
  2687. var _this2 = this;
  2688. if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2689. return;
  2690. }
  2691. var startEvent = $.Event(EVENT_HIDE);
  2692. $(this._element).trigger(startEvent);
  2693. if (startEvent.isDefaultPrevented()) {
  2694. return;
  2695. }
  2696. var dimension = this._getDimension();
  2697. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  2698. Util.reflow(this._element);
  2699. $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  2700. var triggerArrayLength = this._triggerArray.length;
  2701. if (triggerArrayLength > 0) {
  2702. for (var i = 0; i < triggerArrayLength; i++) {
  2703. var trigger = this._triggerArray[i];
  2704. var selector = Util.getSelectorFromElement(trigger);
  2705. if (selector !== null) {
  2706. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  2707. if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
  2708. $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
  2709. }
  2710. }
  2711. }
  2712. }
  2713. this.setTransitioning(true);
  2714. var complete = function complete() {
  2715. _this2.setTransitioning(false);
  2716. $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
  2717. };
  2718. this._element.style[dimension] = '';
  2719. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2720. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2721. };
  2722. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  2723. this._isTransitioning = isTransitioning;
  2724. };
  2725. _proto.dispose = function dispose() {
  2726. $.removeData(this._element, DATA_KEY$3);
  2727. this._config = null;
  2728. this._parent = null;
  2729. this._element = null;
  2730. this._triggerArray = null;
  2731. this._isTransitioning = null;
  2732. } // Private
  2733. ;
  2734. _proto._getConfig = function _getConfig(config) {
  2735. config = _extends({}, Default$1, config);
  2736. config.toggle = Boolean(config.toggle); // Coerce string values
  2737. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  2738. return config;
  2739. };
  2740. _proto._getDimension = function _getDimension() {
  2741. var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH);
  2742. return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
  2743. };
  2744. _proto._getParent = function _getParent() {
  2745. var _this3 = this;
  2746. var parent;
  2747. if (Util.isElement(this._config.parent)) {
  2748. parent = this._config.parent; // It's a jQuery object
  2749. if (typeof this._config.parent.jquery !== 'undefined') {
  2750. parent = this._config.parent[0];
  2751. }
  2752. } else {
  2753. parent = document.querySelector(this._config.parent);
  2754. }
  2755. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  2756. var children = [].slice.call(parent.querySelectorAll(selector));
  2757. $(children).each(function (i, element) {
  2758. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  2759. });
  2760. return parent;
  2761. };
  2762. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  2763. var isOpen = $(element).hasClass(CLASS_NAME_SHOW$1);
  2764. if (triggerArray.length) {
  2765. $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  2766. }
  2767. } // Static
  2768. ;
  2769. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  2770. var selector = Util.getSelectorFromElement(element);
  2771. return selector ? document.querySelector(selector) : null;
  2772. };
  2773. Collapse._jQueryInterface = function _jQueryInterface(config) {
  2774. return this.each(function () {
  2775. var $this = $(this);
  2776. var data = $this.data(DATA_KEY$3);
  2777. var _config = _extends({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  2778. if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
  2779. _config.toggle = false;
  2780. }
  2781. if (!data) {
  2782. data = new Collapse(this, _config);
  2783. $this.data(DATA_KEY$3, data);
  2784. }
  2785. if (typeof config === 'string') {
  2786. if (typeof data[config] === 'undefined') {
  2787. throw new TypeError("No method named \"" + config + "\"");
  2788. }
  2789. data[config]();
  2790. }
  2791. });
  2792. };
  2793. _createClass(Collapse, null, [{
  2794. key: "VERSION",
  2795. get: function get() {
  2796. return VERSION$3;
  2797. }
  2798. }, {
  2799. key: "Default",
  2800. get: function get() {
  2801. return Default$1;
  2802. }
  2803. }]);
  2804. return Collapse;
  2805. }();
  2806. /**
  2807. * ------------------------------------------------------------------------
  2808. * Data Api implementation
  2809. * ------------------------------------------------------------------------
  2810. */
  2811. $(document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
  2812. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  2813. if (event.currentTarget.tagName === 'A') {
  2814. event.preventDefault();
  2815. }
  2816. var $trigger = $(this);
  2817. var selector = Util.getSelectorFromElement(this);
  2818. var selectors = [].slice.call(document.querySelectorAll(selector));
  2819. $(selectors).each(function () {
  2820. var $target = $(this);
  2821. var data = $target.data(DATA_KEY$3);
  2822. var config = data ? 'toggle' : $trigger.data();
  2823. Collapse._jQueryInterface.call($target, config);
  2824. });
  2825. });
  2826. /**
  2827. * ------------------------------------------------------------------------
  2828. * jQuery
  2829. * ------------------------------------------------------------------------
  2830. */
  2831. $.fn[NAME$3] = Collapse._jQueryInterface;
  2832. $.fn[NAME$3].Constructor = Collapse;
  2833. $.fn[NAME$3].noConflict = function () {
  2834. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  2835. return Collapse._jQueryInterface;
  2836. };
  2837. /**
  2838. * ------------------------------------------------------------------------
  2839. * Constants
  2840. * ------------------------------------------------------------------------
  2841. */
  2842. var NAME$4 = 'dropdown';
  2843. var VERSION$4 = '4.5.2';
  2844. var DATA_KEY$4 = 'bs.dropdown';
  2845. var EVENT_KEY$4 = "." + DATA_KEY$4;
  2846. var DATA_API_KEY$4 = '.data-api';
  2847. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  2848. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  2849. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  2850. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  2851. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  2852. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  2853. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  2854. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  2855. var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
  2856. var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  2857. var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  2858. var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  2859. var EVENT_CLICK = "click" + EVENT_KEY$4;
  2860. var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  2861. var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  2862. var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
  2863. var CLASS_NAME_DISABLED = 'disabled';
  2864. var CLASS_NAME_SHOW$2 = 'show';
  2865. var CLASS_NAME_DROPUP = 'dropup';
  2866. var CLASS_NAME_DROPRIGHT = 'dropright';
  2867. var CLASS_NAME_DROPLEFT = 'dropleft';
  2868. var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  2869. var CLASS_NAME_POSITION_STATIC = 'position-static';
  2870. var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
  2871. var SELECTOR_FORM_CHILD = '.dropdown form';
  2872. var SELECTOR_MENU = '.dropdown-menu';
  2873. var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  2874. var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  2875. var PLACEMENT_TOP = 'top-start';
  2876. var PLACEMENT_TOPEND = 'top-end';
  2877. var PLACEMENT_BOTTOM = 'bottom-start';
  2878. var PLACEMENT_BOTTOMEND = 'bottom-end';
  2879. var PLACEMENT_RIGHT = 'right-start';
  2880. var PLACEMENT_LEFT = 'left-start';
  2881. var Default$2 = {
  2882. offset: 0,
  2883. flip: true,
  2884. boundary: 'scrollParent',
  2885. reference: 'toggle',
  2886. display: 'dynamic',
  2887. popperConfig: null
  2888. };
  2889. var DefaultType$2 = {
  2890. offset: '(number|string|function)',
  2891. flip: 'boolean',
  2892. boundary: '(string|element)',
  2893. reference: '(string|element)',
  2894. display: 'string',
  2895. popperConfig: '(null|object)'
  2896. };
  2897. /**
  2898. * ------------------------------------------------------------------------
  2899. * Class Definition
  2900. * ------------------------------------------------------------------------
  2901. */
  2902. var Dropdown = /*#__PURE__*/function () {
  2903. function Dropdown(element, config) {
  2904. this._element = element;
  2905. this._popper = null;
  2906. this._config = this._getConfig(config);
  2907. this._menu = this._getMenuElement();
  2908. this._inNavbar = this._detectNavbar();
  2909. this._addEventListeners();
  2910. } // Getters
  2911. var _proto = Dropdown.prototype;
  2912. // Public
  2913. _proto.toggle = function toggle() {
  2914. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED)) {
  2915. return;
  2916. }
  2917. var isActive = $(this._menu).hasClass(CLASS_NAME_SHOW$2);
  2918. Dropdown._clearMenus();
  2919. if (isActive) {
  2920. return;
  2921. }
  2922. this.show(true);
  2923. };
  2924. _proto.show = function show(usePopper) {
  2925. if (usePopper === void 0) {
  2926. usePopper = false;
  2927. }
  2928. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || $(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  2929. return;
  2930. }
  2931. var relatedTarget = {
  2932. relatedTarget: this._element
  2933. };
  2934. var showEvent = $.Event(EVENT_SHOW$1, relatedTarget);
  2935. var parent = Dropdown._getParentFromElement(this._element);
  2936. $(parent).trigger(showEvent);
  2937. if (showEvent.isDefaultPrevented()) {
  2938. return;
  2939. } // Disable totally Popper.js for Dropdown in Navbar
  2940. if (!this._inNavbar && usePopper) {
  2941. /**
  2942. * Check for Popper dependency
  2943. * Popper - https://popper.js.org
  2944. */
  2945. if (typeof Popper === 'undefined') {
  2946. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  2947. }
  2948. var referenceElement = this._element;
  2949. if (this._config.reference === 'parent') {
  2950. referenceElement = parent;
  2951. } else if (Util.isElement(this._config.reference)) {
  2952. referenceElement = this._config.reference; // Check if it's jQuery element
  2953. if (typeof this._config.reference.jquery !== 'undefined') {
  2954. referenceElement = this._config.reference[0];
  2955. }
  2956. } // If boundary is not `scrollParent`, then set position to `static`
  2957. // to allow the menu to "escape" the scroll parent's boundaries
  2958. // https://github.com/twbs/bootstrap/issues/24251
  2959. if (this._config.boundary !== 'scrollParent') {
  2960. $(parent).addClass(CLASS_NAME_POSITION_STATIC);
  2961. }
  2962. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  2963. } // If this is a touch-enabled device we add extra
  2964. // empty mouseover listeners to the body's immediate children;
  2965. // only needed because of broken event delegation on iOS
  2966. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2967. if ('ontouchstart' in document.documentElement && $(parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
  2968. $(document.body).children().on('mouseover', null, $.noop);
  2969. }
  2970. this._element.focus();
  2971. this._element.setAttribute('aria-expanded', true);
  2972. $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
  2973. $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_SHOWN$1, relatedTarget));
  2974. };
  2975. _proto.hide = function hide() {
  2976. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || !$(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  2977. return;
  2978. }
  2979. var relatedTarget = {
  2980. relatedTarget: this._element
  2981. };
  2982. var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
  2983. var parent = Dropdown._getParentFromElement(this._element);
  2984. $(parent).trigger(hideEvent);
  2985. if (hideEvent.isDefaultPrevented()) {
  2986. return;
  2987. }
  2988. if (this._popper) {
  2989. this._popper.destroy();
  2990. }
  2991. $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
  2992. $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
  2993. };
  2994. _proto.dispose = function dispose() {
  2995. $.removeData(this._element, DATA_KEY$4);
  2996. $(this._element).off(EVENT_KEY$4);
  2997. this._element = null;
  2998. this._menu = null;
  2999. if (this._popper !== null) {
  3000. this._popper.destroy();
  3001. this._popper = null;
  3002. }
  3003. };
  3004. _proto.update = function update() {
  3005. this._inNavbar = this._detectNavbar();
  3006. if (this._popper !== null) {
  3007. this._popper.scheduleUpdate();
  3008. }
  3009. } // Private
  3010. ;
  3011. _proto._addEventListeners = function _addEventListeners() {
  3012. var _this = this;
  3013. $(this._element).on(EVENT_CLICK, function (event) {
  3014. event.preventDefault();
  3015. event.stopPropagation();
  3016. _this.toggle();
  3017. });
  3018. };
  3019. _proto._getConfig = function _getConfig(config) {
  3020. config = _extends({}, this.constructor.Default, $(this._element).data(), config);
  3021. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3022. return config;
  3023. };
  3024. _proto._getMenuElement = function _getMenuElement() {
  3025. if (!this._menu) {
  3026. var parent = Dropdown._getParentFromElement(this._element);
  3027. if (parent) {
  3028. this._menu = parent.querySelector(SELECTOR_MENU);
  3029. }
  3030. }
  3031. return this._menu;
  3032. };
  3033. _proto._getPlacement = function _getPlacement() {
  3034. var $parentDropdown = $(this._element.parentNode);
  3035. var placement = PLACEMENT_BOTTOM; // Handle dropup
  3036. if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
  3037. placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  3038. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
  3039. placement = PLACEMENT_RIGHT;
  3040. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
  3041. placement = PLACEMENT_LEFT;
  3042. } else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
  3043. placement = PLACEMENT_BOTTOMEND;
  3044. }
  3045. return placement;
  3046. };
  3047. _proto._detectNavbar = function _detectNavbar() {
  3048. return $(this._element).closest('.navbar').length > 0;
  3049. };
  3050. _proto._getOffset = function _getOffset() {
  3051. var _this2 = this;
  3052. var offset = {};
  3053. if (typeof this._config.offset === 'function') {
  3054. offset.fn = function (data) {
  3055. data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  3056. return data;
  3057. };
  3058. } else {
  3059. offset.offset = this._config.offset;
  3060. }
  3061. return offset;
  3062. };
  3063. _proto._getPopperConfig = function _getPopperConfig() {
  3064. var popperConfig = {
  3065. placement: this._getPlacement(),
  3066. modifiers: {
  3067. offset: this._getOffset(),
  3068. flip: {
  3069. enabled: this._config.flip
  3070. },
  3071. preventOverflow: {
  3072. boundariesElement: this._config.boundary
  3073. }
  3074. }
  3075. }; // Disable Popper.js if we have a static display
  3076. if (this._config.display === 'static') {
  3077. popperConfig.modifiers.applyStyle = {
  3078. enabled: false
  3079. };
  3080. }
  3081. return _extends({}, popperConfig, this._config.popperConfig);
  3082. } // Static
  3083. ;
  3084. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3085. return this.each(function () {
  3086. var data = $(this).data(DATA_KEY$4);
  3087. var _config = typeof config === 'object' ? config : null;
  3088. if (!data) {
  3089. data = new Dropdown(this, _config);
  3090. $(this).data(DATA_KEY$4, data);
  3091. }
  3092. if (typeof config === 'string') {
  3093. if (typeof data[config] === 'undefined') {
  3094. throw new TypeError("No method named \"" + config + "\"");
  3095. }
  3096. data[config]();
  3097. }
  3098. });
  3099. };
  3100. Dropdown._clearMenus = function _clearMenus(event) {
  3101. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3102. return;
  3103. }
  3104. var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
  3105. for (var i = 0, len = toggles.length; i < len; i++) {
  3106. var parent = Dropdown._getParentFromElement(toggles[i]);
  3107. var context = $(toggles[i]).data(DATA_KEY$4);
  3108. var relatedTarget = {
  3109. relatedTarget: toggles[i]
  3110. };
  3111. if (event && event.type === 'click') {
  3112. relatedTarget.clickEvent = event;
  3113. }
  3114. if (!context) {
  3115. continue;
  3116. }
  3117. var dropdownMenu = context._menu;
  3118. if (!$(parent).hasClass(CLASS_NAME_SHOW$2)) {
  3119. continue;
  3120. }
  3121. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3122. continue;
  3123. }
  3124. var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
  3125. $(parent).trigger(hideEvent);
  3126. if (hideEvent.isDefaultPrevented()) {
  3127. continue;
  3128. } // If this is a touch-enabled device we remove the extra
  3129. // empty mouseover listeners we added for iOS support
  3130. if ('ontouchstart' in document.documentElement) {
  3131. $(document.body).children().off('mouseover', null, $.noop);
  3132. }
  3133. toggles[i].setAttribute('aria-expanded', 'false');
  3134. if (context._popper) {
  3135. context._popper.destroy();
  3136. }
  3137. $(dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
  3138. $(parent).removeClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
  3139. }
  3140. };
  3141. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3142. var parent;
  3143. var selector = Util.getSelectorFromElement(element);
  3144. if (selector) {
  3145. parent = document.querySelector(selector);
  3146. }
  3147. return parent || element.parentNode;
  3148. } // eslint-disable-next-line complexity
  3149. ;
  3150. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3151. // If not input/textarea:
  3152. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3153. // If input/textarea:
  3154. // - If space key => not a dropdown command
  3155. // - If key is other than escape
  3156. // - If key is not up or down => not a dropdown command
  3157. // - If trigger inside the menu => not a dropdown command
  3158. 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 || $(event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3159. return;
  3160. }
  3161. if (this.disabled || $(this).hasClass(CLASS_NAME_DISABLED)) {
  3162. return;
  3163. }
  3164. var parent = Dropdown._getParentFromElement(this);
  3165. var isActive = $(parent).hasClass(CLASS_NAME_SHOW$2);
  3166. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3167. return;
  3168. }
  3169. event.preventDefault();
  3170. event.stopPropagation();
  3171. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3172. if (event.which === ESCAPE_KEYCODE) {
  3173. $(parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
  3174. }
  3175. $(this).trigger('click');
  3176. return;
  3177. }
  3178. var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
  3179. return $(item).is(':visible');
  3180. });
  3181. if (items.length === 0) {
  3182. return;
  3183. }
  3184. var index = items.indexOf(event.target);
  3185. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3186. // Up
  3187. index--;
  3188. }
  3189. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3190. // Down
  3191. index++;
  3192. }
  3193. if (index < 0) {
  3194. index = 0;
  3195. }
  3196. items[index].focus();
  3197. };
  3198. _createClass(Dropdown, null, [{
  3199. key: "VERSION",
  3200. get: function get() {
  3201. return VERSION$4;
  3202. }
  3203. }, {
  3204. key: "Default",
  3205. get: function get() {
  3206. return Default$2;
  3207. }
  3208. }, {
  3209. key: "DefaultType",
  3210. get: function get() {
  3211. return DefaultType$2;
  3212. }
  3213. }]);
  3214. return Dropdown;
  3215. }();
  3216. /**
  3217. * ------------------------------------------------------------------------
  3218. * Data Api implementation
  3219. * ------------------------------------------------------------------------
  3220. */
  3221. $(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) {
  3222. event.preventDefault();
  3223. event.stopPropagation();
  3224. Dropdown._jQueryInterface.call($(this), 'toggle');
  3225. }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
  3226. e.stopPropagation();
  3227. });
  3228. /**
  3229. * ------------------------------------------------------------------------
  3230. * jQuery
  3231. * ------------------------------------------------------------------------
  3232. */
  3233. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3234. $.fn[NAME$4].Constructor = Dropdown;
  3235. $.fn[NAME$4].noConflict = function () {
  3236. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3237. return Dropdown._jQueryInterface;
  3238. };
  3239. /**
  3240. * ------------------------------------------------------------------------
  3241. * Constants
  3242. * ------------------------------------------------------------------------
  3243. */
  3244. var NAME$5 = 'modal';
  3245. var VERSION$5 = '4.5.2';
  3246. var DATA_KEY$5 = 'bs.modal';
  3247. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3248. var DATA_API_KEY$5 = '.data-api';
  3249. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3250. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3251. var Default$3 = {
  3252. backdrop: true,
  3253. keyboard: true,
  3254. focus: true,
  3255. show: true
  3256. };
  3257. var DefaultType$3 = {
  3258. backdrop: '(boolean|string)',
  3259. keyboard: 'boolean',
  3260. focus: 'boolean',
  3261. show: 'boolean'
  3262. };
  3263. var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  3264. var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  3265. var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  3266. var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  3267. var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  3268. var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  3269. var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  3270. var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  3271. var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  3272. var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  3273. var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  3274. var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  3275. var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
  3276. var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  3277. var CLASS_NAME_BACKDROP = 'modal-backdrop';
  3278. var CLASS_NAME_OPEN = 'modal-open';
  3279. var CLASS_NAME_FADE$1 = 'fade';
  3280. var CLASS_NAME_SHOW$3 = 'show';
  3281. var CLASS_NAME_STATIC = 'modal-static';
  3282. var SELECTOR_DIALOG = '.modal-dialog';
  3283. var SELECTOR_MODAL_BODY = '.modal-body';
  3284. var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
  3285. var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
  3286. var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  3287. var SELECTOR_STICKY_CONTENT = '.sticky-top';
  3288. /**
  3289. * ------------------------------------------------------------------------
  3290. * Class Definition
  3291. * ------------------------------------------------------------------------
  3292. */
  3293. var Modal = /*#__PURE__*/function () {
  3294. function Modal(element, config) {
  3295. this._config = this._getConfig(config);
  3296. this._element = element;
  3297. this._dialog = element.querySelector(SELECTOR_DIALOG);
  3298. this._backdrop = null;
  3299. this._isShown = false;
  3300. this._isBodyOverflowing = false;
  3301. this._ignoreBackdropClick = false;
  3302. this._isTransitioning = false;
  3303. this._scrollbarWidth = 0;
  3304. } // Getters
  3305. var _proto = Modal.prototype;
  3306. // Public
  3307. _proto.toggle = function toggle(relatedTarget) {
  3308. return this._isShown ? this.hide() : this.show(relatedTarget);
  3309. };
  3310. _proto.show = function show(relatedTarget) {
  3311. var _this = this;
  3312. if (this._isShown || this._isTransitioning) {
  3313. return;
  3314. }
  3315. if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
  3316. this._isTransitioning = true;
  3317. }
  3318. var showEvent = $.Event(EVENT_SHOW$2, {
  3319. relatedTarget: relatedTarget
  3320. });
  3321. $(this._element).trigger(showEvent);
  3322. if (this._isShown || showEvent.isDefaultPrevented()) {
  3323. return;
  3324. }
  3325. this._isShown = true;
  3326. this._checkScrollbar();
  3327. this._setScrollbar();
  3328. this._adjustDialog();
  3329. this._setEscapeEvent();
  3330. this._setResizeEvent();
  3331. $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
  3332. return _this.hide(event);
  3333. });
  3334. $(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
  3335. $(_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
  3336. if ($(event.target).is(_this._element)) {
  3337. _this._ignoreBackdropClick = true;
  3338. }
  3339. });
  3340. });
  3341. this._showBackdrop(function () {
  3342. return _this._showElement(relatedTarget);
  3343. });
  3344. };
  3345. _proto.hide = function hide(event) {
  3346. var _this2 = this;
  3347. if (event) {
  3348. event.preventDefault();
  3349. }
  3350. if (!this._isShown || this._isTransitioning) {
  3351. return;
  3352. }
  3353. var hideEvent = $.Event(EVENT_HIDE$2);
  3354. $(this._element).trigger(hideEvent);
  3355. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3356. return;
  3357. }
  3358. this._isShown = false;
  3359. var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
  3360. if (transition) {
  3361. this._isTransitioning = true;
  3362. }
  3363. this._setEscapeEvent();
  3364. this._setResizeEvent();
  3365. $(document).off(EVENT_FOCUSIN);
  3366. $(this._element).removeClass(CLASS_NAME_SHOW$3);
  3367. $(this._element).off(EVENT_CLICK_DISMISS);
  3368. $(this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
  3369. if (transition) {
  3370. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3371. $(this._element).one(Util.TRANSITION_END, function (event) {
  3372. return _this2._hideModal(event);
  3373. }).emulateTransitionEnd(transitionDuration);
  3374. } else {
  3375. this._hideModal();
  3376. }
  3377. };
  3378. _proto.dispose = function dispose() {
  3379. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3380. return $(htmlElement).off(EVENT_KEY$5);
  3381. });
  3382. /**
  3383. * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
  3384. * Do not move `document` in `htmlElements` array
  3385. * It will remove `EVENT_CLICK_DATA_API` event that should remain
  3386. */
  3387. $(document).off(EVENT_FOCUSIN);
  3388. $.removeData(this._element, DATA_KEY$5);
  3389. this._config = null;
  3390. this._element = null;
  3391. this._dialog = null;
  3392. this._backdrop = null;
  3393. this._isShown = null;
  3394. this._isBodyOverflowing = null;
  3395. this._ignoreBackdropClick = null;
  3396. this._isTransitioning = null;
  3397. this._scrollbarWidth = null;
  3398. };
  3399. _proto.handleUpdate = function handleUpdate() {
  3400. this._adjustDialog();
  3401. } // Private
  3402. ;
  3403. _proto._getConfig = function _getConfig(config) {
  3404. config = _extends({}, Default$3, config);
  3405. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3406. return config;
  3407. };
  3408. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3409. var _this3 = this;
  3410. if (this._config.backdrop === 'static') {
  3411. var hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED);
  3412. $(this._element).trigger(hideEventPrevented);
  3413. if (hideEventPrevented.defaultPrevented) {
  3414. return;
  3415. }
  3416. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3417. if (!isModalOverflowing) {
  3418. this._element.style.overflowY = 'hidden';
  3419. }
  3420. this._element.classList.add(CLASS_NAME_STATIC);
  3421. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3422. $(this._element).off(Util.TRANSITION_END);
  3423. $(this._element).one(Util.TRANSITION_END, function () {
  3424. _this3._element.classList.remove(CLASS_NAME_STATIC);
  3425. if (!isModalOverflowing) {
  3426. $(_this3._element).one(Util.TRANSITION_END, function () {
  3427. _this3._element.style.overflowY = '';
  3428. }).emulateTransitionEnd(_this3._element, modalTransitionDuration);
  3429. }
  3430. }).emulateTransitionEnd(modalTransitionDuration);
  3431. this._element.focus();
  3432. } else {
  3433. this.hide();
  3434. }
  3435. };
  3436. _proto._showElement = function _showElement(relatedTarget) {
  3437. var _this4 = this;
  3438. var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
  3439. var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
  3440. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3441. // Don't move modal's DOM position
  3442. document.body.appendChild(this._element);
  3443. }
  3444. this._element.style.display = 'block';
  3445. this._element.removeAttribute('aria-hidden');
  3446. this._element.setAttribute('aria-modal', true);
  3447. this._element.setAttribute('role', 'dialog');
  3448. if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
  3449. modalBody.scrollTop = 0;
  3450. } else {
  3451. this._element.scrollTop = 0;
  3452. }
  3453. if (transition) {
  3454. Util.reflow(this._element);
  3455. }
  3456. $(this._element).addClass(CLASS_NAME_SHOW$3);
  3457. if (this._config.focus) {
  3458. this._enforceFocus();
  3459. }
  3460. var shownEvent = $.Event(EVENT_SHOWN$2, {
  3461. relatedTarget: relatedTarget
  3462. });
  3463. var transitionComplete = function transitionComplete() {
  3464. if (_this4._config.focus) {
  3465. _this4._element.focus();
  3466. }
  3467. _this4._isTransitioning = false;
  3468. $(_this4._element).trigger(shownEvent);
  3469. };
  3470. if (transition) {
  3471. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3472. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3473. } else {
  3474. transitionComplete();
  3475. }
  3476. };
  3477. _proto._enforceFocus = function _enforceFocus() {
  3478. var _this5 = this;
  3479. $(document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
  3480. .on(EVENT_FOCUSIN, function (event) {
  3481. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3482. _this5._element.focus();
  3483. }
  3484. });
  3485. };
  3486. _proto._setEscapeEvent = function _setEscapeEvent() {
  3487. var _this6 = this;
  3488. if (this._isShown) {
  3489. $(this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
  3490. if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3491. event.preventDefault();
  3492. _this6.hide();
  3493. } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3494. _this6._triggerBackdropTransition();
  3495. }
  3496. });
  3497. } else if (!this._isShown) {
  3498. $(this._element).off(EVENT_KEYDOWN_DISMISS);
  3499. }
  3500. };
  3501. _proto._setResizeEvent = function _setResizeEvent() {
  3502. var _this7 = this;
  3503. if (this._isShown) {
  3504. $(window).on(EVENT_RESIZE, function (event) {
  3505. return _this7.handleUpdate(event);
  3506. });
  3507. } else {
  3508. $(window).off(EVENT_RESIZE);
  3509. }
  3510. };
  3511. _proto._hideModal = function _hideModal() {
  3512. var _this8 = this;
  3513. this._element.style.display = 'none';
  3514. this._element.setAttribute('aria-hidden', true);
  3515. this._element.removeAttribute('aria-modal');
  3516. this._element.removeAttribute('role');
  3517. this._isTransitioning = false;
  3518. this._showBackdrop(function () {
  3519. $(document.body).removeClass(CLASS_NAME_OPEN);
  3520. _this8._resetAdjustments();
  3521. _this8._resetScrollbar();
  3522. $(_this8._element).trigger(EVENT_HIDDEN$2);
  3523. });
  3524. };
  3525. _proto._removeBackdrop = function _removeBackdrop() {
  3526. if (this._backdrop) {
  3527. $(this._backdrop).remove();
  3528. this._backdrop = null;
  3529. }
  3530. };
  3531. _proto._showBackdrop = function _showBackdrop(callback) {
  3532. var _this9 = this;
  3533. var animate = $(this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
  3534. if (this._isShown && this._config.backdrop) {
  3535. this._backdrop = document.createElement('div');
  3536. this._backdrop.className = CLASS_NAME_BACKDROP;
  3537. if (animate) {
  3538. this._backdrop.classList.add(animate);
  3539. }
  3540. $(this._backdrop).appendTo(document.body);
  3541. $(this._element).on(EVENT_CLICK_DISMISS, function (event) {
  3542. if (_this9._ignoreBackdropClick) {
  3543. _this9._ignoreBackdropClick = false;
  3544. return;
  3545. }
  3546. if (event.target !== event.currentTarget) {
  3547. return;
  3548. }
  3549. _this9._triggerBackdropTransition();
  3550. });
  3551. if (animate) {
  3552. Util.reflow(this._backdrop);
  3553. }
  3554. $(this._backdrop).addClass(CLASS_NAME_SHOW$3);
  3555. if (!callback) {
  3556. return;
  3557. }
  3558. if (!animate) {
  3559. callback();
  3560. return;
  3561. }
  3562. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3563. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3564. } else if (!this._isShown && this._backdrop) {
  3565. $(this._backdrop).removeClass(CLASS_NAME_SHOW$3);
  3566. var callbackRemove = function callbackRemove() {
  3567. _this9._removeBackdrop();
  3568. if (callback) {
  3569. callback();
  3570. }
  3571. };
  3572. if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
  3573. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3574. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3575. } else {
  3576. callbackRemove();
  3577. }
  3578. } else if (callback) {
  3579. callback();
  3580. }
  3581. } // ----------------------------------------------------------------------
  3582. // the following methods are used to handle overflowing modals
  3583. // todo (fat): these should probably be refactored out of modal.js
  3584. // ----------------------------------------------------------------------
  3585. ;
  3586. _proto._adjustDialog = function _adjustDialog() {
  3587. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3588. if (!this._isBodyOverflowing && isModalOverflowing) {
  3589. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3590. }
  3591. if (this._isBodyOverflowing && !isModalOverflowing) {
  3592. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3593. }
  3594. };
  3595. _proto._resetAdjustments = function _resetAdjustments() {
  3596. this._element.style.paddingLeft = '';
  3597. this._element.style.paddingRight = '';
  3598. };
  3599. _proto._checkScrollbar = function _checkScrollbar() {
  3600. var rect = document.body.getBoundingClientRect();
  3601. this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
  3602. this._scrollbarWidth = this._getScrollbarWidth();
  3603. };
  3604. _proto._setScrollbar = function _setScrollbar() {
  3605. var _this10 = this;
  3606. if (this._isBodyOverflowing) {
  3607. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3608. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3609. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  3610. var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
  3611. $(fixedContent).each(function (index, element) {
  3612. var actualPadding = element.style.paddingRight;
  3613. var calculatedPadding = $(element).css('padding-right');
  3614. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  3615. }); // Adjust sticky content margin
  3616. $(stickyContent).each(function (index, element) {
  3617. var actualMargin = element.style.marginRight;
  3618. var calculatedMargin = $(element).css('margin-right');
  3619. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  3620. }); // Adjust body padding
  3621. var actualPadding = document.body.style.paddingRight;
  3622. var calculatedPadding = $(document.body).css('padding-right');
  3623. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3624. }
  3625. $(document.body).addClass(CLASS_NAME_OPEN);
  3626. };
  3627. _proto._resetScrollbar = function _resetScrollbar() {
  3628. // Restore fixed content padding
  3629. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  3630. $(fixedContent).each(function (index, element) {
  3631. var padding = $(element).data('padding-right');
  3632. $(element).removeData('padding-right');
  3633. element.style.paddingRight = padding ? padding : '';
  3634. }); // Restore sticky content
  3635. var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
  3636. $(elements).each(function (index, element) {
  3637. var margin = $(element).data('margin-right');
  3638. if (typeof margin !== 'undefined') {
  3639. $(element).css('margin-right', margin).removeData('margin-right');
  3640. }
  3641. }); // Restore body padding
  3642. var padding = $(document.body).data('padding-right');
  3643. $(document.body).removeData('padding-right');
  3644. document.body.style.paddingRight = padding ? padding : '';
  3645. };
  3646. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3647. // thx d.walsh
  3648. var scrollDiv = document.createElement('div');
  3649. scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
  3650. document.body.appendChild(scrollDiv);
  3651. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3652. document.body.removeChild(scrollDiv);
  3653. return scrollbarWidth;
  3654. } // Static
  3655. ;
  3656. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3657. return this.each(function () {
  3658. var data = $(this).data(DATA_KEY$5);
  3659. var _config = _extends({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  3660. if (!data) {
  3661. data = new Modal(this, _config);
  3662. $(this).data(DATA_KEY$5, data);
  3663. }
  3664. if (typeof config === 'string') {
  3665. if (typeof data[config] === 'undefined') {
  3666. throw new TypeError("No method named \"" + config + "\"");
  3667. }
  3668. data[config](relatedTarget);
  3669. } else if (_config.show) {
  3670. data.show(relatedTarget);
  3671. }
  3672. });
  3673. };
  3674. _createClass(Modal, null, [{
  3675. key: "VERSION",
  3676. get: function get() {
  3677. return VERSION$5;
  3678. }
  3679. }, {
  3680. key: "Default",
  3681. get: function get() {
  3682. return Default$3;
  3683. }
  3684. }]);
  3685. return Modal;
  3686. }();
  3687. /**
  3688. * ------------------------------------------------------------------------
  3689. * Data Api implementation
  3690. * ------------------------------------------------------------------------
  3691. */
  3692. $(document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
  3693. var _this11 = this;
  3694. var target;
  3695. var selector = Util.getSelectorFromElement(this);
  3696. if (selector) {
  3697. target = document.querySelector(selector);
  3698. }
  3699. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $(target).data(), $(this).data());
  3700. if (this.tagName === 'A' || this.tagName === 'AREA') {
  3701. event.preventDefault();
  3702. }
  3703. var $target = $(target).one(EVENT_SHOW$2, function (showEvent) {
  3704. if (showEvent.isDefaultPrevented()) {
  3705. // Only register focus restorer if modal will actually get shown
  3706. return;
  3707. }
  3708. $target.one(EVENT_HIDDEN$2, function () {
  3709. if ($(_this11).is(':visible')) {
  3710. _this11.focus();
  3711. }
  3712. });
  3713. });
  3714. Modal._jQueryInterface.call($(target), config, this);
  3715. });
  3716. /**
  3717. * ------------------------------------------------------------------------
  3718. * jQuery
  3719. * ------------------------------------------------------------------------
  3720. */
  3721. $.fn[NAME$5] = Modal._jQueryInterface;
  3722. $.fn[NAME$5].Constructor = Modal;
  3723. $.fn[NAME$5].noConflict = function () {
  3724. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  3725. return Modal._jQueryInterface;
  3726. };
  3727. /**
  3728. * --------------------------------------------------------------------------
  3729. * Bootstrap (v4.5.2): tools/sanitizer.js
  3730. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3731. * --------------------------------------------------------------------------
  3732. */
  3733. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  3734. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  3735. var DefaultWhitelist = {
  3736. // Global attributes allowed on any supplied element below.
  3737. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  3738. a: ['target', 'href', 'title', 'rel'],
  3739. area: [],
  3740. b: [],
  3741. br: [],
  3742. col: [],
  3743. code: [],
  3744. div: [],
  3745. em: [],
  3746. hr: [],
  3747. h1: [],
  3748. h2: [],
  3749. h3: [],
  3750. h4: [],
  3751. h5: [],
  3752. h6: [],
  3753. i: [],
  3754. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  3755. li: [],
  3756. ol: [],
  3757. p: [],
  3758. pre: [],
  3759. s: [],
  3760. small: [],
  3761. span: [],
  3762. sub: [],
  3763. sup: [],
  3764. strong: [],
  3765. u: [],
  3766. ul: []
  3767. };
  3768. /**
  3769. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  3770. *
  3771. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3772. */
  3773. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
  3774. /**
  3775. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  3776. *
  3777. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3778. */
  3779. 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;
  3780. function allowedAttribute(attr, allowedAttributeList) {
  3781. var attrName = attr.nodeName.toLowerCase();
  3782. if (allowedAttributeList.indexOf(attrName) !== -1) {
  3783. if (uriAttrs.indexOf(attrName) !== -1) {
  3784. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  3785. }
  3786. return true;
  3787. }
  3788. var regExp = allowedAttributeList.filter(function (attrRegex) {
  3789. return attrRegex instanceof RegExp;
  3790. }); // Check if a regular expression validates the attribute.
  3791. for (var i = 0, len = regExp.length; i < len; i++) {
  3792. if (attrName.match(regExp[i])) {
  3793. return true;
  3794. }
  3795. }
  3796. return false;
  3797. }
  3798. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  3799. if (unsafeHtml.length === 0) {
  3800. return unsafeHtml;
  3801. }
  3802. if (sanitizeFn && typeof sanitizeFn === 'function') {
  3803. return sanitizeFn(unsafeHtml);
  3804. }
  3805. var domParser = new window.DOMParser();
  3806. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  3807. var whitelistKeys = Object.keys(whiteList);
  3808. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  3809. var _loop = function _loop(i, len) {
  3810. var el = elements[i];
  3811. var elName = el.nodeName.toLowerCase();
  3812. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  3813. el.parentNode.removeChild(el);
  3814. return "continue";
  3815. }
  3816. var attributeList = [].slice.call(el.attributes);
  3817. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  3818. attributeList.forEach(function (attr) {
  3819. if (!allowedAttribute(attr, whitelistedAttributes)) {
  3820. el.removeAttribute(attr.nodeName);
  3821. }
  3822. });
  3823. };
  3824. for (var i = 0, len = elements.length; i < len; i++) {
  3825. var _ret = _loop(i);
  3826. if (_ret === "continue") continue;
  3827. }
  3828. return createdDocument.body.innerHTML;
  3829. }
  3830. /**
  3831. * ------------------------------------------------------------------------
  3832. * Constants
  3833. * ------------------------------------------------------------------------
  3834. */
  3835. var NAME$6 = 'tooltip';
  3836. var VERSION$6 = '4.5.2';
  3837. var DATA_KEY$6 = 'bs.tooltip';
  3838. var EVENT_KEY$6 = "." + DATA_KEY$6;
  3839. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  3840. var CLASS_PREFIX = 'bs-tooltip';
  3841. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  3842. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  3843. var DefaultType$4 = {
  3844. animation: 'boolean',
  3845. template: 'string',
  3846. title: '(string|element|function)',
  3847. trigger: 'string',
  3848. delay: '(number|object)',
  3849. html: 'boolean',
  3850. selector: '(string|boolean)',
  3851. placement: '(string|function)',
  3852. offset: '(number|string|function)',
  3853. container: '(string|element|boolean)',
  3854. fallbackPlacement: '(string|array)',
  3855. boundary: '(string|element)',
  3856. sanitize: 'boolean',
  3857. sanitizeFn: '(null|function)',
  3858. whiteList: 'object',
  3859. popperConfig: '(null|object)'
  3860. };
  3861. var AttachmentMap = {
  3862. AUTO: 'auto',
  3863. TOP: 'top',
  3864. RIGHT: 'right',
  3865. BOTTOM: 'bottom',
  3866. LEFT: 'left'
  3867. };
  3868. var Default$4 = {
  3869. animation: true,
  3870. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  3871. trigger: 'hover focus',
  3872. title: '',
  3873. delay: 0,
  3874. html: false,
  3875. selector: false,
  3876. placement: 'top',
  3877. offset: 0,
  3878. container: false,
  3879. fallbackPlacement: 'flip',
  3880. boundary: 'scrollParent',
  3881. sanitize: true,
  3882. sanitizeFn: null,
  3883. whiteList: DefaultWhitelist,
  3884. popperConfig: null
  3885. };
  3886. var HOVER_STATE_SHOW = 'show';
  3887. var HOVER_STATE_OUT = 'out';
  3888. var Event = {
  3889. HIDE: "hide" + EVENT_KEY$6,
  3890. HIDDEN: "hidden" + EVENT_KEY$6,
  3891. SHOW: "show" + EVENT_KEY$6,
  3892. SHOWN: "shown" + EVENT_KEY$6,
  3893. INSERTED: "inserted" + EVENT_KEY$6,
  3894. CLICK: "click" + EVENT_KEY$6,
  3895. FOCUSIN: "focusin" + EVENT_KEY$6,
  3896. FOCUSOUT: "focusout" + EVENT_KEY$6,
  3897. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  3898. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  3899. };
  3900. var CLASS_NAME_FADE$2 = 'fade';
  3901. var CLASS_NAME_SHOW$4 = 'show';
  3902. var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  3903. var SELECTOR_ARROW = '.arrow';
  3904. var TRIGGER_HOVER = 'hover';
  3905. var TRIGGER_FOCUS = 'focus';
  3906. var TRIGGER_CLICK = 'click';
  3907. var TRIGGER_MANUAL = 'manual';
  3908. /**
  3909. * ------------------------------------------------------------------------
  3910. * Class Definition
  3911. * ------------------------------------------------------------------------
  3912. */
  3913. var Tooltip = /*#__PURE__*/function () {
  3914. function Tooltip(element, config) {
  3915. if (typeof Popper === 'undefined') {
  3916. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  3917. } // private
  3918. this._isEnabled = true;
  3919. this._timeout = 0;
  3920. this._hoverState = '';
  3921. this._activeTrigger = {};
  3922. this._popper = null; // Protected
  3923. this.element = element;
  3924. this.config = this._getConfig(config);
  3925. this.tip = null;
  3926. this._setListeners();
  3927. } // Getters
  3928. var _proto = Tooltip.prototype;
  3929. // Public
  3930. _proto.enable = function enable() {
  3931. this._isEnabled = true;
  3932. };
  3933. _proto.disable = function disable() {
  3934. this._isEnabled = false;
  3935. };
  3936. _proto.toggleEnabled = function toggleEnabled() {
  3937. this._isEnabled = !this._isEnabled;
  3938. };
  3939. _proto.toggle = function toggle(event) {
  3940. if (!this._isEnabled) {
  3941. return;
  3942. }
  3943. if (event) {
  3944. var dataKey = this.constructor.DATA_KEY;
  3945. var context = $(event.currentTarget).data(dataKey);
  3946. if (!context) {
  3947. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3948. $(event.currentTarget).data(dataKey, context);
  3949. }
  3950. context._activeTrigger.click = !context._activeTrigger.click;
  3951. if (context._isWithActiveTrigger()) {
  3952. context._enter(null, context);
  3953. } else {
  3954. context._leave(null, context);
  3955. }
  3956. } else {
  3957. if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
  3958. this._leave(null, this);
  3959. return;
  3960. }
  3961. this._enter(null, this);
  3962. }
  3963. };
  3964. _proto.dispose = function dispose() {
  3965. clearTimeout(this._timeout);
  3966. $.removeData(this.element, this.constructor.DATA_KEY);
  3967. $(this.element).off(this.constructor.EVENT_KEY);
  3968. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  3969. if (this.tip) {
  3970. $(this.tip).remove();
  3971. }
  3972. this._isEnabled = null;
  3973. this._timeout = null;
  3974. this._hoverState = null;
  3975. this._activeTrigger = null;
  3976. if (this._popper) {
  3977. this._popper.destroy();
  3978. }
  3979. this._popper = null;
  3980. this.element = null;
  3981. this.config = null;
  3982. this.tip = null;
  3983. };
  3984. _proto.show = function show() {
  3985. var _this = this;
  3986. if ($(this.element).css('display') === 'none') {
  3987. throw new Error('Please use show on visible elements');
  3988. }
  3989. var showEvent = $.Event(this.constructor.Event.SHOW);
  3990. if (this.isWithContent() && this._isEnabled) {
  3991. $(this.element).trigger(showEvent);
  3992. var shadowRoot = Util.findShadowRoot(this.element);
  3993. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  3994. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  3995. return;
  3996. }
  3997. var tip = this.getTipElement();
  3998. var tipId = Util.getUID(this.constructor.NAME);
  3999. tip.setAttribute('id', tipId);
  4000. this.element.setAttribute('aria-describedby', tipId);
  4001. this.setContent();
  4002. if (this.config.animation) {
  4003. $(tip).addClass(CLASS_NAME_FADE$2);
  4004. }
  4005. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4006. var attachment = this._getAttachment(placement);
  4007. this.addAttachmentClass(attachment);
  4008. var container = this._getContainer();
  4009. $(tip).data(this.constructor.DATA_KEY, this);
  4010. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4011. $(tip).appendTo(container);
  4012. }
  4013. $(this.element).trigger(this.constructor.Event.INSERTED);
  4014. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4015. $(tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra
  4016. // empty mouseover listeners to the body's immediate children;
  4017. // only needed because of broken event delegation on iOS
  4018. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4019. if ('ontouchstart' in document.documentElement) {
  4020. $(document.body).children().on('mouseover', null, $.noop);
  4021. }
  4022. var complete = function complete() {
  4023. if (_this.config.animation) {
  4024. _this._fixTransition();
  4025. }
  4026. var prevHoverState = _this._hoverState;
  4027. _this._hoverState = null;
  4028. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4029. if (prevHoverState === HOVER_STATE_OUT) {
  4030. _this._leave(null, _this);
  4031. }
  4032. };
  4033. if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4034. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4035. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4036. } else {
  4037. complete();
  4038. }
  4039. }
  4040. };
  4041. _proto.hide = function hide(callback) {
  4042. var _this2 = this;
  4043. var tip = this.getTipElement();
  4044. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4045. var complete = function complete() {
  4046. if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
  4047. tip.parentNode.removeChild(tip);
  4048. }
  4049. _this2._cleanTipClass();
  4050. _this2.element.removeAttribute('aria-describedby');
  4051. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4052. if (_this2._popper !== null) {
  4053. _this2._popper.destroy();
  4054. }
  4055. if (callback) {
  4056. callback();
  4057. }
  4058. };
  4059. $(this.element).trigger(hideEvent);
  4060. if (hideEvent.isDefaultPrevented()) {
  4061. return;
  4062. }
  4063. $(tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
  4064. // empty mouseover listeners we added for iOS support
  4065. if ('ontouchstart' in document.documentElement) {
  4066. $(document.body).children().off('mouseover', null, $.noop);
  4067. }
  4068. this._activeTrigger[TRIGGER_CLICK] = false;
  4069. this._activeTrigger[TRIGGER_FOCUS] = false;
  4070. this._activeTrigger[TRIGGER_HOVER] = false;
  4071. if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4072. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4073. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4074. } else {
  4075. complete();
  4076. }
  4077. this._hoverState = '';
  4078. };
  4079. _proto.update = function update() {
  4080. if (this._popper !== null) {
  4081. this._popper.scheduleUpdate();
  4082. }
  4083. } // Protected
  4084. ;
  4085. _proto.isWithContent = function isWithContent() {
  4086. return Boolean(this.getTitle());
  4087. };
  4088. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4089. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4090. };
  4091. _proto.getTipElement = function getTipElement() {
  4092. this.tip = this.tip || $(this.config.template)[0];
  4093. return this.tip;
  4094. };
  4095. _proto.setContent = function setContent() {
  4096. var tip = this.getTipElement();
  4097. this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
  4098. $(tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
  4099. };
  4100. _proto.setElementContent = function setElementContent($element, content) {
  4101. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4102. // Content is a DOM node or a jQuery
  4103. if (this.config.html) {
  4104. if (!$(content).parent().is($element)) {
  4105. $element.empty().append(content);
  4106. }
  4107. } else {
  4108. $element.text($(content).text());
  4109. }
  4110. return;
  4111. }
  4112. if (this.config.html) {
  4113. if (this.config.sanitize) {
  4114. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4115. }
  4116. $element.html(content);
  4117. } else {
  4118. $element.text(content);
  4119. }
  4120. };
  4121. _proto.getTitle = function getTitle() {
  4122. var title = this.element.getAttribute('data-original-title');
  4123. if (!title) {
  4124. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4125. }
  4126. return title;
  4127. } // Private
  4128. ;
  4129. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4130. var _this3 = this;
  4131. var defaultBsConfig = {
  4132. placement: attachment,
  4133. modifiers: {
  4134. offset: this._getOffset(),
  4135. flip: {
  4136. behavior: this.config.fallbackPlacement
  4137. },
  4138. arrow: {
  4139. element: SELECTOR_ARROW
  4140. },
  4141. preventOverflow: {
  4142. boundariesElement: this.config.boundary
  4143. }
  4144. },
  4145. onCreate: function onCreate(data) {
  4146. if (data.originalPlacement !== data.placement) {
  4147. _this3._handlePopperPlacementChange(data);
  4148. }
  4149. },
  4150. onUpdate: function onUpdate(data) {
  4151. return _this3._handlePopperPlacementChange(data);
  4152. }
  4153. };
  4154. return _extends({}, defaultBsConfig, this.config.popperConfig);
  4155. };
  4156. _proto._getOffset = function _getOffset() {
  4157. var _this4 = this;
  4158. var offset = {};
  4159. if (typeof this.config.offset === 'function') {
  4160. offset.fn = function (data) {
  4161. data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
  4162. return data;
  4163. };
  4164. } else {
  4165. offset.offset = this.config.offset;
  4166. }
  4167. return offset;
  4168. };
  4169. _proto._getContainer = function _getContainer() {
  4170. if (this.config.container === false) {
  4171. return document.body;
  4172. }
  4173. if (Util.isElement(this.config.container)) {
  4174. return $(this.config.container);
  4175. }
  4176. return $(document).find(this.config.container);
  4177. };
  4178. _proto._getAttachment = function _getAttachment(placement) {
  4179. return AttachmentMap[placement.toUpperCase()];
  4180. };
  4181. _proto._setListeners = function _setListeners() {
  4182. var _this5 = this;
  4183. var triggers = this.config.trigger.split(' ');
  4184. triggers.forEach(function (trigger) {
  4185. if (trigger === 'click') {
  4186. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4187. return _this5.toggle(event);
  4188. });
  4189. } else if (trigger !== TRIGGER_MANUAL) {
  4190. var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4191. var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4192. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4193. return _this5._enter(event);
  4194. }).on(eventOut, _this5.config.selector, function (event) {
  4195. return _this5._leave(event);
  4196. });
  4197. }
  4198. });
  4199. this._hideModalHandler = function () {
  4200. if (_this5.element) {
  4201. _this5.hide();
  4202. }
  4203. };
  4204. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4205. if (this.config.selector) {
  4206. this.config = _extends({}, this.config, {
  4207. trigger: 'manual',
  4208. selector: ''
  4209. });
  4210. } else {
  4211. this._fixTitle();
  4212. }
  4213. };
  4214. _proto._fixTitle = function _fixTitle() {
  4215. var titleType = typeof this.element.getAttribute('data-original-title');
  4216. if (this.element.getAttribute('title') || titleType !== 'string') {
  4217. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4218. this.element.setAttribute('title', '');
  4219. }
  4220. };
  4221. _proto._enter = function _enter(event, context) {
  4222. var dataKey = this.constructor.DATA_KEY;
  4223. context = context || $(event.currentTarget).data(dataKey);
  4224. if (!context) {
  4225. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4226. $(event.currentTarget).data(dataKey, context);
  4227. }
  4228. if (event) {
  4229. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  4230. }
  4231. if ($(context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
  4232. context._hoverState = HOVER_STATE_SHOW;
  4233. return;
  4234. }
  4235. clearTimeout(context._timeout);
  4236. context._hoverState = HOVER_STATE_SHOW;
  4237. if (!context.config.delay || !context.config.delay.show) {
  4238. context.show();
  4239. return;
  4240. }
  4241. context._timeout = setTimeout(function () {
  4242. if (context._hoverState === HOVER_STATE_SHOW) {
  4243. context.show();
  4244. }
  4245. }, context.config.delay.show);
  4246. };
  4247. _proto._leave = function _leave(event, context) {
  4248. var dataKey = this.constructor.DATA_KEY;
  4249. context = context || $(event.currentTarget).data(dataKey);
  4250. if (!context) {
  4251. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4252. $(event.currentTarget).data(dataKey, context);
  4253. }
  4254. if (event) {
  4255. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
  4256. }
  4257. if (context._isWithActiveTrigger()) {
  4258. return;
  4259. }
  4260. clearTimeout(context._timeout);
  4261. context._hoverState = HOVER_STATE_OUT;
  4262. if (!context.config.delay || !context.config.delay.hide) {
  4263. context.hide();
  4264. return;
  4265. }
  4266. context._timeout = setTimeout(function () {
  4267. if (context._hoverState === HOVER_STATE_OUT) {
  4268. context.hide();
  4269. }
  4270. }, context.config.delay.hide);
  4271. };
  4272. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4273. for (var trigger in this._activeTrigger) {
  4274. if (this._activeTrigger[trigger]) {
  4275. return true;
  4276. }
  4277. }
  4278. return false;
  4279. };
  4280. _proto._getConfig = function _getConfig(config) {
  4281. var dataAttributes = $(this.element).data();
  4282. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4283. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4284. delete dataAttributes[dataAttr];
  4285. }
  4286. });
  4287. config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  4288. if (typeof config.delay === 'number') {
  4289. config.delay = {
  4290. show: config.delay,
  4291. hide: config.delay
  4292. };
  4293. }
  4294. if (typeof config.title === 'number') {
  4295. config.title = config.title.toString();
  4296. }
  4297. if (typeof config.content === 'number') {
  4298. config.content = config.content.toString();
  4299. }
  4300. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4301. if (config.sanitize) {
  4302. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4303. }
  4304. return config;
  4305. };
  4306. _proto._getDelegateConfig = function _getDelegateConfig() {
  4307. var config = {};
  4308. if (this.config) {
  4309. for (var key in this.config) {
  4310. if (this.constructor.Default[key] !== this.config[key]) {
  4311. config[key] = this.config[key];
  4312. }
  4313. }
  4314. }
  4315. return config;
  4316. };
  4317. _proto._cleanTipClass = function _cleanTipClass() {
  4318. var $tip = $(this.getTipElement());
  4319. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4320. if (tabClass !== null && tabClass.length) {
  4321. $tip.removeClass(tabClass.join(''));
  4322. }
  4323. };
  4324. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4325. this.tip = popperData.instance.popper;
  4326. this._cleanTipClass();
  4327. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4328. };
  4329. _proto._fixTransition = function _fixTransition() {
  4330. var tip = this.getTipElement();
  4331. var initConfigAnimation = this.config.animation;
  4332. if (tip.getAttribute('x-placement') !== null) {
  4333. return;
  4334. }
  4335. $(tip).removeClass(CLASS_NAME_FADE$2);
  4336. this.config.animation = false;
  4337. this.hide();
  4338. this.show();
  4339. this.config.animation = initConfigAnimation;
  4340. } // Static
  4341. ;
  4342. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4343. return this.each(function () {
  4344. var data = $(this).data(DATA_KEY$6);
  4345. var _config = typeof config === 'object' && config;
  4346. if (!data && /dispose|hide/.test(config)) {
  4347. return;
  4348. }
  4349. if (!data) {
  4350. data = new Tooltip(this, _config);
  4351. $(this).data(DATA_KEY$6, data);
  4352. }
  4353. if (typeof config === 'string') {
  4354. if (typeof data[config] === 'undefined') {
  4355. throw new TypeError("No method named \"" + config + "\"");
  4356. }
  4357. data[config]();
  4358. }
  4359. });
  4360. };
  4361. _createClass(Tooltip, null, [{
  4362. key: "VERSION",
  4363. get: function get() {
  4364. return VERSION$6;
  4365. }
  4366. }, {
  4367. key: "Default",
  4368. get: function get() {
  4369. return Default$4;
  4370. }
  4371. }, {
  4372. key: "NAME",
  4373. get: function get() {
  4374. return NAME$6;
  4375. }
  4376. }, {
  4377. key: "DATA_KEY",
  4378. get: function get() {
  4379. return DATA_KEY$6;
  4380. }
  4381. }, {
  4382. key: "Event",
  4383. get: function get() {
  4384. return Event;
  4385. }
  4386. }, {
  4387. key: "EVENT_KEY",
  4388. get: function get() {
  4389. return EVENT_KEY$6;
  4390. }
  4391. }, {
  4392. key: "DefaultType",
  4393. get: function get() {
  4394. return DefaultType$4;
  4395. }
  4396. }]);
  4397. return Tooltip;
  4398. }();
  4399. /**
  4400. * ------------------------------------------------------------------------
  4401. * jQuery
  4402. * ------------------------------------------------------------------------
  4403. */
  4404. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4405. $.fn[NAME$6].Constructor = Tooltip;
  4406. $.fn[NAME$6].noConflict = function () {
  4407. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4408. return Tooltip._jQueryInterface;
  4409. };
  4410. /**
  4411. * ------------------------------------------------------------------------
  4412. * Constants
  4413. * ------------------------------------------------------------------------
  4414. */
  4415. var NAME$7 = 'popover';
  4416. var VERSION$7 = '4.5.2';
  4417. var DATA_KEY$7 = 'bs.popover';
  4418. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4419. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4420. var CLASS_PREFIX$1 = 'bs-popover';
  4421. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4422. var Default$5 = _extends({}, Tooltip.Default, {
  4423. placement: 'right',
  4424. trigger: 'click',
  4425. content: '',
  4426. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4427. });
  4428. var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
  4429. content: '(string|element|function)'
  4430. });
  4431. var CLASS_NAME_FADE$3 = 'fade';
  4432. var CLASS_NAME_SHOW$5 = 'show';
  4433. var SELECTOR_TITLE = '.popover-header';
  4434. var SELECTOR_CONTENT = '.popover-body';
  4435. var Event$1 = {
  4436. HIDE: "hide" + EVENT_KEY$7,
  4437. HIDDEN: "hidden" + EVENT_KEY$7,
  4438. SHOW: "show" + EVENT_KEY$7,
  4439. SHOWN: "shown" + EVENT_KEY$7,
  4440. INSERTED: "inserted" + EVENT_KEY$7,
  4441. CLICK: "click" + EVENT_KEY$7,
  4442. FOCUSIN: "focusin" + EVENT_KEY$7,
  4443. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4444. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4445. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4446. };
  4447. /**
  4448. * ------------------------------------------------------------------------
  4449. * Class Definition
  4450. * ------------------------------------------------------------------------
  4451. */
  4452. var Popover = /*#__PURE__*/function (_Tooltip) {
  4453. _inheritsLoose(Popover, _Tooltip);
  4454. function Popover() {
  4455. return _Tooltip.apply(this, arguments) || this;
  4456. }
  4457. var _proto = Popover.prototype;
  4458. // Overrides
  4459. _proto.isWithContent = function isWithContent() {
  4460. return this.getTitle() || this._getContent();
  4461. };
  4462. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4463. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4464. };
  4465. _proto.getTipElement = function getTipElement() {
  4466. this.tip = this.tip || $(this.config.template)[0];
  4467. return this.tip;
  4468. };
  4469. _proto.setContent = function setContent() {
  4470. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4471. this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
  4472. var content = this._getContent();
  4473. if (typeof content === 'function') {
  4474. content = content.call(this.element);
  4475. }
  4476. this.setElementContent($tip.find(SELECTOR_CONTENT), content);
  4477. $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
  4478. } // Private
  4479. ;
  4480. _proto._getContent = function _getContent() {
  4481. return this.element.getAttribute('data-content') || this.config.content;
  4482. };
  4483. _proto._cleanTipClass = function _cleanTipClass() {
  4484. var $tip = $(this.getTipElement());
  4485. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4486. if (tabClass !== null && tabClass.length > 0) {
  4487. $tip.removeClass(tabClass.join(''));
  4488. }
  4489. } // Static
  4490. ;
  4491. Popover._jQueryInterface = function _jQueryInterface(config) {
  4492. return this.each(function () {
  4493. var data = $(this).data(DATA_KEY$7);
  4494. var _config = typeof config === 'object' ? config : null;
  4495. if (!data && /dispose|hide/.test(config)) {
  4496. return;
  4497. }
  4498. if (!data) {
  4499. data = new Popover(this, _config);
  4500. $(this).data(DATA_KEY$7, data);
  4501. }
  4502. if (typeof config === 'string') {
  4503. if (typeof data[config] === 'undefined') {
  4504. throw new TypeError("No method named \"" + config + "\"");
  4505. }
  4506. data[config]();
  4507. }
  4508. });
  4509. };
  4510. _createClass(Popover, null, [{
  4511. key: "VERSION",
  4512. // Getters
  4513. get: function get() {
  4514. return VERSION$7;
  4515. }
  4516. }, {
  4517. key: "Default",
  4518. get: function get() {
  4519. return Default$5;
  4520. }
  4521. }, {
  4522. key: "NAME",
  4523. get: function get() {
  4524. return NAME$7;
  4525. }
  4526. }, {
  4527. key: "DATA_KEY",
  4528. get: function get() {
  4529. return DATA_KEY$7;
  4530. }
  4531. }, {
  4532. key: "Event",
  4533. get: function get() {
  4534. return Event$1;
  4535. }
  4536. }, {
  4537. key: "EVENT_KEY",
  4538. get: function get() {
  4539. return EVENT_KEY$7;
  4540. }
  4541. }, {
  4542. key: "DefaultType",
  4543. get: function get() {
  4544. return DefaultType$5;
  4545. }
  4546. }]);
  4547. return Popover;
  4548. }(Tooltip);
  4549. /**
  4550. * ------------------------------------------------------------------------
  4551. * jQuery
  4552. * ------------------------------------------------------------------------
  4553. */
  4554. $.fn[NAME$7] = Popover._jQueryInterface;
  4555. $.fn[NAME$7].Constructor = Popover;
  4556. $.fn[NAME$7].noConflict = function () {
  4557. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4558. return Popover._jQueryInterface;
  4559. };
  4560. /**
  4561. * ------------------------------------------------------------------------
  4562. * Constants
  4563. * ------------------------------------------------------------------------
  4564. */
  4565. var NAME$8 = 'scrollspy';
  4566. var VERSION$8 = '4.5.2';
  4567. var DATA_KEY$8 = 'bs.scrollspy';
  4568. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4569. var DATA_API_KEY$6 = '.data-api';
  4570. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4571. var Default$6 = {
  4572. offset: 10,
  4573. method: 'auto',
  4574. target: ''
  4575. };
  4576. var DefaultType$6 = {
  4577. offset: 'number',
  4578. method: 'string',
  4579. target: '(string|element)'
  4580. };
  4581. var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  4582. var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  4583. var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  4584. var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  4585. var CLASS_NAME_ACTIVE$2 = 'active';
  4586. var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
  4587. var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  4588. var SELECTOR_NAV_LINKS = '.nav-link';
  4589. var SELECTOR_NAV_ITEMS = '.nav-item';
  4590. var SELECTOR_LIST_ITEMS = '.list-group-item';
  4591. var SELECTOR_DROPDOWN = '.dropdown';
  4592. var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
  4593. var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  4594. var METHOD_OFFSET = 'offset';
  4595. var METHOD_POSITION = 'position';
  4596. /**
  4597. * ------------------------------------------------------------------------
  4598. * Class Definition
  4599. * ------------------------------------------------------------------------
  4600. */
  4601. var ScrollSpy = /*#__PURE__*/function () {
  4602. function ScrollSpy(element, config) {
  4603. var _this = this;
  4604. this._element = element;
  4605. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4606. this._config = this._getConfig(config);
  4607. this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
  4608. this._offsets = [];
  4609. this._targets = [];
  4610. this._activeTarget = null;
  4611. this._scrollHeight = 0;
  4612. $(this._scrollElement).on(EVENT_SCROLL, function (event) {
  4613. return _this._process(event);
  4614. });
  4615. this.refresh();
  4616. this._process();
  4617. } // Getters
  4618. var _proto = ScrollSpy.prototype;
  4619. // Public
  4620. _proto.refresh = function refresh() {
  4621. var _this2 = this;
  4622. var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  4623. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4624. var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  4625. this._offsets = [];
  4626. this._targets = [];
  4627. this._scrollHeight = this._getScrollHeight();
  4628. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4629. targets.map(function (element) {
  4630. var target;
  4631. var targetSelector = Util.getSelectorFromElement(element);
  4632. if (targetSelector) {
  4633. target = document.querySelector(targetSelector);
  4634. }
  4635. if (target) {
  4636. var targetBCR = target.getBoundingClientRect();
  4637. if (targetBCR.width || targetBCR.height) {
  4638. // TODO (fat): remove sketch reliance on jQuery position/offset
  4639. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  4640. }
  4641. }
  4642. return null;
  4643. }).filter(function (item) {
  4644. return item;
  4645. }).sort(function (a, b) {
  4646. return a[0] - b[0];
  4647. }).forEach(function (item) {
  4648. _this2._offsets.push(item[0]);
  4649. _this2._targets.push(item[1]);
  4650. });
  4651. };
  4652. _proto.dispose = function dispose() {
  4653. $.removeData(this._element, DATA_KEY$8);
  4654. $(this._scrollElement).off(EVENT_KEY$8);
  4655. this._element = null;
  4656. this._scrollElement = null;
  4657. this._config = null;
  4658. this._selector = null;
  4659. this._offsets = null;
  4660. this._targets = null;
  4661. this._activeTarget = null;
  4662. this._scrollHeight = null;
  4663. } // Private
  4664. ;
  4665. _proto._getConfig = function _getConfig(config) {
  4666. config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
  4667. if (typeof config.target !== 'string' && Util.isElement(config.target)) {
  4668. var id = $(config.target).attr('id');
  4669. if (!id) {
  4670. id = Util.getUID(NAME$8);
  4671. $(config.target).attr('id', id);
  4672. }
  4673. config.target = "#" + id;
  4674. }
  4675. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  4676. return config;
  4677. };
  4678. _proto._getScrollTop = function _getScrollTop() {
  4679. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4680. };
  4681. _proto._getScrollHeight = function _getScrollHeight() {
  4682. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4683. };
  4684. _proto._getOffsetHeight = function _getOffsetHeight() {
  4685. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4686. };
  4687. _proto._process = function _process() {
  4688. var scrollTop = this._getScrollTop() + this._config.offset;
  4689. var scrollHeight = this._getScrollHeight();
  4690. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  4691. if (this._scrollHeight !== scrollHeight) {
  4692. this.refresh();
  4693. }
  4694. if (scrollTop >= maxScroll) {
  4695. var target = this._targets[this._targets.length - 1];
  4696. if (this._activeTarget !== target) {
  4697. this._activate(target);
  4698. }
  4699. return;
  4700. }
  4701. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  4702. this._activeTarget = null;
  4703. this._clear();
  4704. return;
  4705. }
  4706. for (var i = this._offsets.length; i--;) {
  4707. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  4708. if (isActiveTarget) {
  4709. this._activate(this._targets[i]);
  4710. }
  4711. }
  4712. };
  4713. _proto._activate = function _activate(target) {
  4714. this._activeTarget = target;
  4715. this._clear();
  4716. var queries = this._selector.split(',').map(function (selector) {
  4717. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  4718. });
  4719. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  4720. if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
  4721. $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
  4722. $link.addClass(CLASS_NAME_ACTIVE$2);
  4723. } else {
  4724. // Set triggered link as active
  4725. $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
  4726. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  4727. $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
  4728. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
  4729. }
  4730. $(this._scrollElement).trigger(EVENT_ACTIVATE, {
  4731. relatedTarget: target
  4732. });
  4733. };
  4734. _proto._clear = function _clear() {
  4735. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  4736. return node.classList.contains(CLASS_NAME_ACTIVE$2);
  4737. }).forEach(function (node) {
  4738. return node.classList.remove(CLASS_NAME_ACTIVE$2);
  4739. });
  4740. } // Static
  4741. ;
  4742. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  4743. return this.each(function () {
  4744. var data = $(this).data(DATA_KEY$8);
  4745. var _config = typeof config === 'object' && config;
  4746. if (!data) {
  4747. data = new ScrollSpy(this, _config);
  4748. $(this).data(DATA_KEY$8, data);
  4749. }
  4750. if (typeof config === 'string') {
  4751. if (typeof data[config] === 'undefined') {
  4752. throw new TypeError("No method named \"" + config + "\"");
  4753. }
  4754. data[config]();
  4755. }
  4756. });
  4757. };
  4758. _createClass(ScrollSpy, null, [{
  4759. key: "VERSION",
  4760. get: function get() {
  4761. return VERSION$8;
  4762. }
  4763. }, {
  4764. key: "Default",
  4765. get: function get() {
  4766. return Default$6;
  4767. }
  4768. }]);
  4769. return ScrollSpy;
  4770. }();
  4771. /**
  4772. * ------------------------------------------------------------------------
  4773. * Data Api implementation
  4774. * ------------------------------------------------------------------------
  4775. */
  4776. $(window).on(EVENT_LOAD_DATA_API$2, function () {
  4777. var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
  4778. var scrollSpysLength = scrollSpys.length;
  4779. for (var i = scrollSpysLength; i--;) {
  4780. var $spy = $(scrollSpys[i]);
  4781. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  4782. }
  4783. });
  4784. /**
  4785. * ------------------------------------------------------------------------
  4786. * jQuery
  4787. * ------------------------------------------------------------------------
  4788. */
  4789. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  4790. $.fn[NAME$8].Constructor = ScrollSpy;
  4791. $.fn[NAME$8].noConflict = function () {
  4792. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  4793. return ScrollSpy._jQueryInterface;
  4794. };
  4795. /**
  4796. * ------------------------------------------------------------------------
  4797. * Constants
  4798. * ------------------------------------------------------------------------
  4799. */
  4800. var NAME$9 = 'tab';
  4801. var VERSION$9 = '4.5.2';
  4802. var DATA_KEY$9 = 'bs.tab';
  4803. var EVENT_KEY$9 = "." + DATA_KEY$9;
  4804. var DATA_API_KEY$7 = '.data-api';
  4805. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  4806. var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  4807. var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  4808. var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  4809. var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  4810. var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  4811. var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  4812. var CLASS_NAME_ACTIVE$3 = 'active';
  4813. var CLASS_NAME_DISABLED$1 = 'disabled';
  4814. var CLASS_NAME_FADE$4 = 'fade';
  4815. var CLASS_NAME_SHOW$6 = 'show';
  4816. var SELECTOR_DROPDOWN$1 = '.dropdown';
  4817. var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  4818. var SELECTOR_ACTIVE$2 = '.active';
  4819. var SELECTOR_ACTIVE_UL = '> li > .active';
  4820. var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
  4821. var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  4822. var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
  4823. /**
  4824. * ------------------------------------------------------------------------
  4825. * Class Definition
  4826. * ------------------------------------------------------------------------
  4827. */
  4828. var Tab = /*#__PURE__*/function () {
  4829. function Tab(element) {
  4830. this._element = element;
  4831. } // Getters
  4832. var _proto = Tab.prototype;
  4833. // Public
  4834. _proto.show = function show() {
  4835. var _this = this;
  4836. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(CLASS_NAME_ACTIVE$3) || $(this._element).hasClass(CLASS_NAME_DISABLED$1)) {
  4837. return;
  4838. }
  4839. var target;
  4840. var previous;
  4841. var listElement = $(this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
  4842. var selector = Util.getSelectorFromElement(this._element);
  4843. if (listElement) {
  4844. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
  4845. previous = $.makeArray($(listElement).find(itemSelector));
  4846. previous = previous[previous.length - 1];
  4847. }
  4848. var hideEvent = $.Event(EVENT_HIDE$3, {
  4849. relatedTarget: this._element
  4850. });
  4851. var showEvent = $.Event(EVENT_SHOW$3, {
  4852. relatedTarget: previous
  4853. });
  4854. if (previous) {
  4855. $(previous).trigger(hideEvent);
  4856. }
  4857. $(this._element).trigger(showEvent);
  4858. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  4859. return;
  4860. }
  4861. if (selector) {
  4862. target = document.querySelector(selector);
  4863. }
  4864. this._activate(this._element, listElement);
  4865. var complete = function complete() {
  4866. var hiddenEvent = $.Event(EVENT_HIDDEN$3, {
  4867. relatedTarget: _this._element
  4868. });
  4869. var shownEvent = $.Event(EVENT_SHOWN$3, {
  4870. relatedTarget: previous
  4871. });
  4872. $(previous).trigger(hiddenEvent);
  4873. $(_this._element).trigger(shownEvent);
  4874. };
  4875. if (target) {
  4876. this._activate(target, target.parentNode, complete);
  4877. } else {
  4878. complete();
  4879. }
  4880. };
  4881. _proto.dispose = function dispose() {
  4882. $.removeData(this._element, DATA_KEY$9);
  4883. this._element = null;
  4884. } // Private
  4885. ;
  4886. _proto._activate = function _activate(element, container, callback) {
  4887. var _this2 = this;
  4888. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(SELECTOR_ACTIVE_UL) : $(container).children(SELECTOR_ACTIVE$2);
  4889. var active = activeElements[0];
  4890. var isTransitioning = callback && active && $(active).hasClass(CLASS_NAME_FADE$4);
  4891. var complete = function complete() {
  4892. return _this2._transitionComplete(element, active, callback);
  4893. };
  4894. if (active && isTransitioning) {
  4895. var transitionDuration = Util.getTransitionDurationFromElement(active);
  4896. $(active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4897. } else {
  4898. complete();
  4899. }
  4900. };
  4901. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  4902. if (active) {
  4903. $(active).removeClass(CLASS_NAME_ACTIVE$3);
  4904. var dropdownChild = $(active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
  4905. if (dropdownChild) {
  4906. $(dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
  4907. }
  4908. if (active.getAttribute('role') === 'tab') {
  4909. active.setAttribute('aria-selected', false);
  4910. }
  4911. }
  4912. $(element).addClass(CLASS_NAME_ACTIVE$3);
  4913. if (element.getAttribute('role') === 'tab') {
  4914. element.setAttribute('aria-selected', true);
  4915. }
  4916. Util.reflow(element);
  4917. if (element.classList.contains(CLASS_NAME_FADE$4)) {
  4918. element.classList.add(CLASS_NAME_SHOW$6);
  4919. }
  4920. if (element.parentNode && $(element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
  4921. var dropdownElement = $(element).closest(SELECTOR_DROPDOWN$1)[0];
  4922. if (dropdownElement) {
  4923. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
  4924. $(dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
  4925. }
  4926. element.setAttribute('aria-expanded', true);
  4927. }
  4928. if (callback) {
  4929. callback();
  4930. }
  4931. } // Static
  4932. ;
  4933. Tab._jQueryInterface = function _jQueryInterface(config) {
  4934. return this.each(function () {
  4935. var $this = $(this);
  4936. var data = $this.data(DATA_KEY$9);
  4937. if (!data) {
  4938. data = new Tab(this);
  4939. $this.data(DATA_KEY$9, data);
  4940. }
  4941. if (typeof config === 'string') {
  4942. if (typeof data[config] === 'undefined') {
  4943. throw new TypeError("No method named \"" + config + "\"");
  4944. }
  4945. data[config]();
  4946. }
  4947. });
  4948. };
  4949. _createClass(Tab, null, [{
  4950. key: "VERSION",
  4951. get: function get() {
  4952. return VERSION$9;
  4953. }
  4954. }]);
  4955. return Tab;
  4956. }();
  4957. /**
  4958. * ------------------------------------------------------------------------
  4959. * Data Api implementation
  4960. * ------------------------------------------------------------------------
  4961. */
  4962. $(document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
  4963. event.preventDefault();
  4964. Tab._jQueryInterface.call($(this), 'show');
  4965. });
  4966. /**
  4967. * ------------------------------------------------------------------------
  4968. * jQuery
  4969. * ------------------------------------------------------------------------
  4970. */
  4971. $.fn[NAME$9] = Tab._jQueryInterface;
  4972. $.fn[NAME$9].Constructor = Tab;
  4973. $.fn[NAME$9].noConflict = function () {
  4974. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  4975. return Tab._jQueryInterface;
  4976. };
  4977. /**
  4978. * ------------------------------------------------------------------------
  4979. * Constants
  4980. * ------------------------------------------------------------------------
  4981. */
  4982. var NAME$a = 'toast';
  4983. var VERSION$a = '4.5.2';
  4984. var DATA_KEY$a = 'bs.toast';
  4985. var EVENT_KEY$a = "." + DATA_KEY$a;
  4986. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  4987. var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  4988. var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  4989. var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  4990. var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  4991. var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  4992. var CLASS_NAME_FADE$5 = 'fade';
  4993. var CLASS_NAME_HIDE = 'hide';
  4994. var CLASS_NAME_SHOW$7 = 'show';
  4995. var CLASS_NAME_SHOWING = 'showing';
  4996. var DefaultType$7 = {
  4997. animation: 'boolean',
  4998. autohide: 'boolean',
  4999. delay: 'number'
  5000. };
  5001. var Default$7 = {
  5002. animation: true,
  5003. autohide: true,
  5004. delay: 500
  5005. };
  5006. var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
  5007. /**
  5008. * ------------------------------------------------------------------------
  5009. * Class Definition
  5010. * ------------------------------------------------------------------------
  5011. */
  5012. var Toast = /*#__PURE__*/function () {
  5013. function Toast(element, config) {
  5014. this._element = element;
  5015. this._config = this._getConfig(config);
  5016. this._timeout = null;
  5017. this._setListeners();
  5018. } // Getters
  5019. var _proto = Toast.prototype;
  5020. // Public
  5021. _proto.show = function show() {
  5022. var _this = this;
  5023. var showEvent = $.Event(EVENT_SHOW$4);
  5024. $(this._element).trigger(showEvent);
  5025. if (showEvent.isDefaultPrevented()) {
  5026. return;
  5027. }
  5028. this._clearTimeout();
  5029. if (this._config.animation) {
  5030. this._element.classList.add(CLASS_NAME_FADE$5);
  5031. }
  5032. var complete = function complete() {
  5033. _this._element.classList.remove(CLASS_NAME_SHOWING);
  5034. _this._element.classList.add(CLASS_NAME_SHOW$7);
  5035. $(_this._element).trigger(EVENT_SHOWN$4);
  5036. if (_this._config.autohide) {
  5037. _this._timeout = setTimeout(function () {
  5038. _this.hide();
  5039. }, _this._config.delay);
  5040. }
  5041. };
  5042. this._element.classList.remove(CLASS_NAME_HIDE);
  5043. Util.reflow(this._element);
  5044. this._element.classList.add(CLASS_NAME_SHOWING);
  5045. if (this._config.animation) {
  5046. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5047. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5048. } else {
  5049. complete();
  5050. }
  5051. };
  5052. _proto.hide = function hide() {
  5053. if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5054. return;
  5055. }
  5056. var hideEvent = $.Event(EVENT_HIDE$4);
  5057. $(this._element).trigger(hideEvent);
  5058. if (hideEvent.isDefaultPrevented()) {
  5059. return;
  5060. }
  5061. this._close();
  5062. };
  5063. _proto.dispose = function dispose() {
  5064. this._clearTimeout();
  5065. if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5066. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5067. }
  5068. $(this._element).off(EVENT_CLICK_DISMISS$1);
  5069. $.removeData(this._element, DATA_KEY$a);
  5070. this._element = null;
  5071. this._config = null;
  5072. } // Private
  5073. ;
  5074. _proto._getConfig = function _getConfig(config) {
  5075. config = _extends({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  5076. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5077. return config;
  5078. };
  5079. _proto._setListeners = function _setListeners() {
  5080. var _this2 = this;
  5081. $(this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
  5082. return _this2.hide();
  5083. });
  5084. };
  5085. _proto._close = function _close() {
  5086. var _this3 = this;
  5087. var complete = function complete() {
  5088. _this3._element.classList.add(CLASS_NAME_HIDE);
  5089. $(_this3._element).trigger(EVENT_HIDDEN$4);
  5090. };
  5091. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5092. if (this._config.animation) {
  5093. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5094. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5095. } else {
  5096. complete();
  5097. }
  5098. };
  5099. _proto._clearTimeout = function _clearTimeout() {
  5100. clearTimeout(this._timeout);
  5101. this._timeout = null;
  5102. } // Static
  5103. ;
  5104. Toast._jQueryInterface = function _jQueryInterface(config) {
  5105. return this.each(function () {
  5106. var $element = $(this);
  5107. var data = $element.data(DATA_KEY$a);
  5108. var _config = typeof config === 'object' && config;
  5109. if (!data) {
  5110. data = new Toast(this, _config);
  5111. $element.data(DATA_KEY$a, data);
  5112. }
  5113. if (typeof config === 'string') {
  5114. if (typeof data[config] === 'undefined') {
  5115. throw new TypeError("No method named \"" + config + "\"");
  5116. }
  5117. data[config](this);
  5118. }
  5119. });
  5120. };
  5121. _createClass(Toast, null, [{
  5122. key: "VERSION",
  5123. get: function get() {
  5124. return VERSION$a;
  5125. }
  5126. }, {
  5127. key: "DefaultType",
  5128. get: function get() {
  5129. return DefaultType$7;
  5130. }
  5131. }, {
  5132. key: "Default",
  5133. get: function get() {
  5134. return Default$7;
  5135. }
  5136. }]);
  5137. return Toast;
  5138. }();
  5139. /**
  5140. * ------------------------------------------------------------------------
  5141. * jQuery
  5142. * ------------------------------------------------------------------------
  5143. */
  5144. $.fn[NAME$a] = Toast._jQueryInterface;
  5145. $.fn[NAME$a].Constructor = Toast;
  5146. $.fn[NAME$a].noConflict = function () {
  5147. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5148. return Toast._jQueryInterface;
  5149. };
  5150. exports.Alert = Alert;
  5151. exports.Button = Button;
  5152. exports.Carousel = Carousel;
  5153. exports.Collapse = Collapse;
  5154. exports.Dropdown = Dropdown;
  5155. exports.Modal = Modal;
  5156. exports.Popover = Popover;
  5157. exports.Scrollspy = ScrollSpy;
  5158. exports.Tab = Tab;
  5159. exports.Toast = Toast;
  5160. exports.Tooltip = Tooltip;
  5161. exports.Util = Util;
  5162. Object.defineProperty(exports, '__esModule', { value: true });
  5163. })));
  5164. //# sourceMappingURL=bootstrap.js.map
  5165. /***/ }),
  5166. /***/ "./node_modules/jquery/dist/jquery.js":
  5167. /*!********************************************!*\
  5168. !*** ./node_modules/jquery/dist/jquery.js ***!
  5169. \********************************************/
  5170. /*! no static exports found */
  5171. /***/ (function(module, exports, __webpack_require__) {
  5172. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  5173. * jQuery JavaScript Library v3.5.1
  5174. * https://jquery.com/
  5175. *
  5176. * Includes Sizzle.js
  5177. * https://sizzlejs.com/
  5178. *
  5179. * Copyright JS Foundation and other contributors
  5180. * Released under the MIT license
  5181. * https://jquery.org/license
  5182. *
  5183. * Date: 2020-05-04T22:49Z
  5184. */
  5185. ( function( global, factory ) {
  5186. "use strict";
  5187. if ( true && typeof module.exports === "object" ) {
  5188. // For CommonJS and CommonJS-like environments where a proper `window`
  5189. // is present, execute the factory and get jQuery.
  5190. // For environments that do not have a `window` with a `document`
  5191. // (such as Node.js), expose a factory as module.exports.
  5192. // This accentuates the need for the creation of a real `window`.
  5193. // e.g. var jQuery = require("jquery")(window);
  5194. // See ticket #14549 for more info.
  5195. module.exports = global.document ?
  5196. factory( global, true ) :
  5197. function( w ) {
  5198. if ( !w.document ) {
  5199. throw new Error( "jQuery requires a window with a document" );
  5200. }
  5201. return factory( w );
  5202. };
  5203. } else {
  5204. factory( global );
  5205. }
  5206. // Pass this if window is not defined yet
  5207. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  5208. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  5209. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  5210. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  5211. // enough that all such attempts are guarded in a try block.
  5212. "use strict";
  5213. var arr = [];
  5214. var getProto = Object.getPrototypeOf;
  5215. var slice = arr.slice;
  5216. var flat = arr.flat ? function( array ) {
  5217. return arr.flat.call( array );
  5218. } : function( array ) {
  5219. return arr.concat.apply( [], array );
  5220. };
  5221. var push = arr.push;
  5222. var indexOf = arr.indexOf;
  5223. var class2type = {};
  5224. var toString = class2type.toString;
  5225. var hasOwn = class2type.hasOwnProperty;
  5226. var fnToString = hasOwn.toString;
  5227. var ObjectFunctionString = fnToString.call( Object );
  5228. var support = {};
  5229. var isFunction = function isFunction( obj ) {
  5230. // Support: Chrome <=57, Firefox <=52
  5231. // In some browsers, typeof returns "function" for HTML <object> elements
  5232. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  5233. // We don't want to classify *any* DOM node as a function.
  5234. return typeof obj === "function" && typeof obj.nodeType !== "number";
  5235. };
  5236. var isWindow = function isWindow( obj ) {
  5237. return obj != null && obj === obj.window;
  5238. };
  5239. var document = window.document;
  5240. var preservedScriptAttributes = {
  5241. type: true,
  5242. src: true,
  5243. nonce: true,
  5244. noModule: true
  5245. };
  5246. function DOMEval( code, node, doc ) {
  5247. doc = doc || document;
  5248. var i, val,
  5249. script = doc.createElement( "script" );
  5250. script.text = code;
  5251. if ( node ) {
  5252. for ( i in preservedScriptAttributes ) {
  5253. // Support: Firefox 64+, Edge 18+
  5254. // Some browsers don't support the "nonce" property on scripts.
  5255. // On the other hand, just using `getAttribute` is not enough as
  5256. // the `nonce` attribute is reset to an empty string whenever it
  5257. // becomes browsing-context connected.
  5258. // See https://github.com/whatwg/html/issues/2369
  5259. // See https://html.spec.whatwg.org/#nonce-attributes
  5260. // The `node.getAttribute` check was added for the sake of
  5261. // `jQuery.globalEval` so that it can fake a nonce-containing node
  5262. // via an object.
  5263. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  5264. if ( val ) {
  5265. script.setAttribute( i, val );
  5266. }
  5267. }
  5268. }
  5269. doc.head.appendChild( script ).parentNode.removeChild( script );
  5270. }
  5271. function toType( obj ) {
  5272. if ( obj == null ) {
  5273. return obj + "";
  5274. }
  5275. // Support: Android <=2.3 only (functionish RegExp)
  5276. return typeof obj === "object" || typeof obj === "function" ?
  5277. class2type[ toString.call( obj ) ] || "object" :
  5278. typeof obj;
  5279. }
  5280. /* global Symbol */
  5281. // Defining this global in .eslintrc.json would create a danger of using the global
  5282. // unguarded in another place, it seems safer to define global only for this module
  5283. var
  5284. version = "3.5.1",
  5285. // Define a local copy of jQuery
  5286. jQuery = function( selector, context ) {
  5287. // The jQuery object is actually just the init constructor 'enhanced'
  5288. // Need init if jQuery is called (just allow error to be thrown if not included)
  5289. return new jQuery.fn.init( selector, context );
  5290. };
  5291. jQuery.fn = jQuery.prototype = {
  5292. // The current version of jQuery being used
  5293. jquery: version,
  5294. constructor: jQuery,
  5295. // The default length of a jQuery object is 0
  5296. length: 0,
  5297. toArray: function() {
  5298. return slice.call( this );
  5299. },
  5300. // Get the Nth element in the matched element set OR
  5301. // Get the whole matched element set as a clean array
  5302. get: function( num ) {
  5303. // Return all the elements in a clean array
  5304. if ( num == null ) {
  5305. return slice.call( this );
  5306. }
  5307. // Return just the one element from the set
  5308. return num < 0 ? this[ num + this.length ] : this[ num ];
  5309. },
  5310. // Take an array of elements and push it onto the stack
  5311. // (returning the new matched element set)
  5312. pushStack: function( elems ) {
  5313. // Build a new jQuery matched element set
  5314. var ret = jQuery.merge( this.constructor(), elems );
  5315. // Add the old object onto the stack (as a reference)
  5316. ret.prevObject = this;
  5317. // Return the newly-formed element set
  5318. return ret;
  5319. },
  5320. // Execute a callback for every element in the matched set.
  5321. each: function( callback ) {
  5322. return jQuery.each( this, callback );
  5323. },
  5324. map: function( callback ) {
  5325. return this.pushStack( jQuery.map( this, function( elem, i ) {
  5326. return callback.call( elem, i, elem );
  5327. } ) );
  5328. },
  5329. slice: function() {
  5330. return this.pushStack( slice.apply( this, arguments ) );
  5331. },
  5332. first: function() {
  5333. return this.eq( 0 );
  5334. },
  5335. last: function() {
  5336. return this.eq( -1 );
  5337. },
  5338. even: function() {
  5339. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  5340. return ( i + 1 ) % 2;
  5341. } ) );
  5342. },
  5343. odd: function() {
  5344. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  5345. return i % 2;
  5346. } ) );
  5347. },
  5348. eq: function( i ) {
  5349. var len = this.length,
  5350. j = +i + ( i < 0 ? len : 0 );
  5351. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  5352. },
  5353. end: function() {
  5354. return this.prevObject || this.constructor();
  5355. },
  5356. // For internal use only.
  5357. // Behaves like an Array's method, not like a jQuery method.
  5358. push: push,
  5359. sort: arr.sort,
  5360. splice: arr.splice
  5361. };
  5362. jQuery.extend = jQuery.fn.extend = function() {
  5363. var options, name, src, copy, copyIsArray, clone,
  5364. target = arguments[ 0 ] || {},
  5365. i = 1,
  5366. length = arguments.length,
  5367. deep = false;
  5368. // Handle a deep copy situation
  5369. if ( typeof target === "boolean" ) {
  5370. deep = target;
  5371. // Skip the boolean and the target
  5372. target = arguments[ i ] || {};
  5373. i++;
  5374. }
  5375. // Handle case when target is a string or something (possible in deep copy)
  5376. if ( typeof target !== "object" && !isFunction( target ) ) {
  5377. target = {};
  5378. }
  5379. // Extend jQuery itself if only one argument is passed
  5380. if ( i === length ) {
  5381. target = this;
  5382. i--;
  5383. }
  5384. for ( ; i < length; i++ ) {
  5385. // Only deal with non-null/undefined values
  5386. if ( ( options = arguments[ i ] ) != null ) {
  5387. // Extend the base object
  5388. for ( name in options ) {
  5389. copy = options[ name ];
  5390. // Prevent Object.prototype pollution
  5391. // Prevent never-ending loop
  5392. if ( name === "__proto__" || target === copy ) {
  5393. continue;
  5394. }
  5395. // Recurse if we're merging plain objects or arrays
  5396. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  5397. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  5398. src = target[ name ];
  5399. // Ensure proper type for the source value
  5400. if ( copyIsArray && !Array.isArray( src ) ) {
  5401. clone = [];
  5402. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  5403. clone = {};
  5404. } else {
  5405. clone = src;
  5406. }
  5407. copyIsArray = false;
  5408. // Never move original objects, clone them
  5409. target[ name ] = jQuery.extend( deep, clone, copy );
  5410. // Don't bring in undefined values
  5411. } else if ( copy !== undefined ) {
  5412. target[ name ] = copy;
  5413. }
  5414. }
  5415. }
  5416. }
  5417. // Return the modified object
  5418. return target;
  5419. };
  5420. jQuery.extend( {
  5421. // Unique for each copy of jQuery on the page
  5422. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  5423. // Assume jQuery is ready without the ready module
  5424. isReady: true,
  5425. error: function( msg ) {
  5426. throw new Error( msg );
  5427. },
  5428. noop: function() {},
  5429. isPlainObject: function( obj ) {
  5430. var proto, Ctor;
  5431. // Detect obvious negatives
  5432. // Use toString instead of jQuery.type to catch host objects
  5433. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  5434. return false;
  5435. }
  5436. proto = getProto( obj );
  5437. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  5438. if ( !proto ) {
  5439. return true;
  5440. }
  5441. // Objects with prototype are plain iff they were constructed by a global Object function
  5442. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  5443. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  5444. },
  5445. isEmptyObject: function( obj ) {
  5446. var name;
  5447. for ( name in obj ) {
  5448. return false;
  5449. }
  5450. return true;
  5451. },
  5452. // Evaluates a script in a provided context; falls back to the global one
  5453. // if not specified.
  5454. globalEval: function( code, options, doc ) {
  5455. DOMEval( code, { nonce: options && options.nonce }, doc );
  5456. },
  5457. each: function( obj, callback ) {
  5458. var length, i = 0;
  5459. if ( isArrayLike( obj ) ) {
  5460. length = obj.length;
  5461. for ( ; i < length; i++ ) {
  5462. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5463. break;
  5464. }
  5465. }
  5466. } else {
  5467. for ( i in obj ) {
  5468. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5469. break;
  5470. }
  5471. }
  5472. }
  5473. return obj;
  5474. },
  5475. // results is for internal usage only
  5476. makeArray: function( arr, results ) {
  5477. var ret = results || [];
  5478. if ( arr != null ) {
  5479. if ( isArrayLike( Object( arr ) ) ) {
  5480. jQuery.merge( ret,
  5481. typeof arr === "string" ?
  5482. [ arr ] : arr
  5483. );
  5484. } else {
  5485. push.call( ret, arr );
  5486. }
  5487. }
  5488. return ret;
  5489. },
  5490. inArray: function( elem, arr, i ) {
  5491. return arr == null ? -1 : indexOf.call( arr, elem, i );
  5492. },
  5493. // Support: Android <=4.0 only, PhantomJS 1 only
  5494. // push.apply(_, arraylike) throws on ancient WebKit
  5495. merge: function( first, second ) {
  5496. var len = +second.length,
  5497. j = 0,
  5498. i = first.length;
  5499. for ( ; j < len; j++ ) {
  5500. first[ i++ ] = second[ j ];
  5501. }
  5502. first.length = i;
  5503. return first;
  5504. },
  5505. grep: function( elems, callback, invert ) {
  5506. var callbackInverse,
  5507. matches = [],
  5508. i = 0,
  5509. length = elems.length,
  5510. callbackExpect = !invert;
  5511. // Go through the array, only saving the items
  5512. // that pass the validator function
  5513. for ( ; i < length; i++ ) {
  5514. callbackInverse = !callback( elems[ i ], i );
  5515. if ( callbackInverse !== callbackExpect ) {
  5516. matches.push( elems[ i ] );
  5517. }
  5518. }
  5519. return matches;
  5520. },
  5521. // arg is for internal usage only
  5522. map: function( elems, callback, arg ) {
  5523. var length, value,
  5524. i = 0,
  5525. ret = [];
  5526. // Go through the array, translating each of the items to their new values
  5527. if ( isArrayLike( elems ) ) {
  5528. length = elems.length;
  5529. for ( ; i < length; i++ ) {
  5530. value = callback( elems[ i ], i, arg );
  5531. if ( value != null ) {
  5532. ret.push( value );
  5533. }
  5534. }
  5535. // Go through every key on the object,
  5536. } else {
  5537. for ( i in elems ) {
  5538. value = callback( elems[ i ], i, arg );
  5539. if ( value != null ) {
  5540. ret.push( value );
  5541. }
  5542. }
  5543. }
  5544. // Flatten any nested arrays
  5545. return flat( ret );
  5546. },
  5547. // A global GUID counter for objects
  5548. guid: 1,
  5549. // jQuery.support is not used in Core but other projects attach their
  5550. // properties to it so it needs to exist.
  5551. support: support
  5552. } );
  5553. if ( typeof Symbol === "function" ) {
  5554. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  5555. }
  5556. // Populate the class2type map
  5557. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5558. function( _i, name ) {
  5559. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5560. } );
  5561. function isArrayLike( obj ) {
  5562. // Support: real iOS 8.2 only (not reproducible in simulator)
  5563. // `in` check used to prevent JIT error (gh-2145)
  5564. // hasOwn isn't used here due to false negatives
  5565. // regarding Nodelist length in IE
  5566. var length = !!obj && "length" in obj && obj.length,
  5567. type = toType( obj );
  5568. if ( isFunction( obj ) || isWindow( obj ) ) {
  5569. return false;
  5570. }
  5571. return type === "array" || length === 0 ||
  5572. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  5573. }
  5574. var Sizzle =
  5575. /*!
  5576. * Sizzle CSS Selector Engine v2.3.5
  5577. * https://sizzlejs.com/
  5578. *
  5579. * Copyright JS Foundation and other contributors
  5580. * Released under the MIT license
  5581. * https://js.foundation/
  5582. *
  5583. * Date: 2020-03-14
  5584. */
  5585. ( function( window ) {
  5586. var i,
  5587. support,
  5588. Expr,
  5589. getText,
  5590. isXML,
  5591. tokenize,
  5592. compile,
  5593. select,
  5594. outermostContext,
  5595. sortInput,
  5596. hasDuplicate,
  5597. // Local document vars
  5598. setDocument,
  5599. document,
  5600. docElem,
  5601. documentIsHTML,
  5602. rbuggyQSA,
  5603. rbuggyMatches,
  5604. matches,
  5605. contains,
  5606. // Instance-specific data
  5607. expando = "sizzle" + 1 * new Date(),
  5608. preferredDoc = window.document,
  5609. dirruns = 0,
  5610. done = 0,
  5611. classCache = createCache(),
  5612. tokenCache = createCache(),
  5613. compilerCache = createCache(),
  5614. nonnativeSelectorCache = createCache(),
  5615. sortOrder = function( a, b ) {
  5616. if ( a === b ) {
  5617. hasDuplicate = true;
  5618. }
  5619. return 0;
  5620. },
  5621. // Instance methods
  5622. hasOwn = ( {} ).hasOwnProperty,
  5623. arr = [],
  5624. pop = arr.pop,
  5625. pushNative = arr.push,
  5626. push = arr.push,
  5627. slice = arr.slice,
  5628. // Use a stripped-down indexOf as it's faster than native
  5629. // https://jsperf.com/thor-indexof-vs-for/5
  5630. indexOf = function( list, elem ) {
  5631. var i = 0,
  5632. len = list.length;
  5633. for ( ; i < len; i++ ) {
  5634. if ( list[ i ] === elem ) {
  5635. return i;
  5636. }
  5637. }
  5638. return -1;
  5639. },
  5640. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
  5641. "ismap|loop|multiple|open|readonly|required|scoped",
  5642. // Regular expressions
  5643. // http://www.w3.org/TR/css3-selectors/#whitespace
  5644. whitespace = "[\\x20\\t\\r\\n\\f]",
  5645. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  5646. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  5647. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  5648. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  5649. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  5650. // Operator (capture 2)
  5651. "*([*^$|!~]?=)" + whitespace +
  5652. // "Attribute values must be CSS identifiers [capture 5]
  5653. // or strings [capture 3 or capture 4]"
  5654. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  5655. whitespace + "*\\]",
  5656. pseudos = ":(" + identifier + ")(?:\\((" +
  5657. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  5658. // 1. quoted (capture 3; capture 4 or capture 5)
  5659. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  5660. // 2. simple (capture 6)
  5661. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  5662. // 3. anything else (capture 2)
  5663. ".*" +
  5664. ")\\)|)",
  5665. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  5666. rwhitespace = new RegExp( whitespace + "+", "g" ),
  5667. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
  5668. whitespace + "+$", "g" ),
  5669. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  5670. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
  5671. "*" ),
  5672. rdescend = new RegExp( whitespace + "|>" ),
  5673. rpseudo = new RegExp( pseudos ),
  5674. ridentifier = new RegExp( "^" + identifier + "$" ),
  5675. matchExpr = {
  5676. "ID": new RegExp( "^#(" + identifier + ")" ),
  5677. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  5678. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  5679. "ATTR": new RegExp( "^" + attributes ),
  5680. "PSEUDO": new RegExp( "^" + pseudos ),
  5681. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  5682. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  5683. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  5684. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  5685. // For use in libraries implementing .is()
  5686. // We use this for POS matching in `select`
  5687. "needsContext": new RegExp( "^" + whitespace +
  5688. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  5689. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  5690. },
  5691. rhtml = /HTML$/i,
  5692. rinputs = /^(?:input|select|textarea|button)$/i,
  5693. rheader = /^h\d$/i,
  5694. rnative = /^[^{]+\{\s*\[native \w/,
  5695. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  5696. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  5697. rsibling = /[+~]/,
  5698. // CSS escapes
  5699. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  5700. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
  5701. funescape = function( escape, nonHex ) {
  5702. var high = "0x" + escape.slice( 1 ) - 0x10000;
  5703. return nonHex ?
  5704. // Strip the backslash prefix from a non-hex escape sequence
  5705. nonHex :
  5706. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  5707. // Support: IE <=11+
  5708. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  5709. // surrogate pair
  5710. high < 0 ?
  5711. String.fromCharCode( high + 0x10000 ) :
  5712. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  5713. },
  5714. // CSS string/identifier serialization
  5715. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  5716. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  5717. fcssescape = function( ch, asCodePoint ) {
  5718. if ( asCodePoint ) {
  5719. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  5720. if ( ch === "\0" ) {
  5721. return "\uFFFD";
  5722. }
  5723. // Control characters and (dependent upon position) numbers get escaped as code points
  5724. return ch.slice( 0, -1 ) + "\\" +
  5725. ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  5726. }
  5727. // Other potentially-special ASCII characters get backslash-escaped
  5728. return "\\" + ch;
  5729. },
  5730. // Used for iframes
  5731. // See setDocument()
  5732. // Removing the function wrapper causes a "Permission Denied"
  5733. // error in IE
  5734. unloadHandler = function() {
  5735. setDocument();
  5736. },
  5737. inDisabledFieldset = addCombinator(
  5738. function( elem ) {
  5739. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  5740. },
  5741. { dir: "parentNode", next: "legend" }
  5742. );
  5743. // Optimize for push.apply( _, NodeList )
  5744. try {
  5745. push.apply(
  5746. ( arr = slice.call( preferredDoc.childNodes ) ),
  5747. preferredDoc.childNodes
  5748. );
  5749. // Support: Android<4.0
  5750. // Detect silently failing push.apply
  5751. // eslint-disable-next-line no-unused-expressions
  5752. arr[ preferredDoc.childNodes.length ].nodeType;
  5753. } catch ( e ) {
  5754. push = { apply: arr.length ?
  5755. // Leverage slice if possible
  5756. function( target, els ) {
  5757. pushNative.apply( target, slice.call( els ) );
  5758. } :
  5759. // Support: IE<9
  5760. // Otherwise append directly
  5761. function( target, els ) {
  5762. var j = target.length,
  5763. i = 0;
  5764. // Can't trust NodeList.length
  5765. while ( ( target[ j++ ] = els[ i++ ] ) ) {}
  5766. target.length = j - 1;
  5767. }
  5768. };
  5769. }
  5770. function Sizzle( selector, context, results, seed ) {
  5771. var m, i, elem, nid, match, groups, newSelector,
  5772. newContext = context && context.ownerDocument,
  5773. // nodeType defaults to 9, since context defaults to document
  5774. nodeType = context ? context.nodeType : 9;
  5775. results = results || [];
  5776. // Return early from calls with invalid selector or context
  5777. if ( typeof selector !== "string" || !selector ||
  5778. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  5779. return results;
  5780. }
  5781. // Try to shortcut find operations (as opposed to filters) in HTML documents
  5782. if ( !seed ) {
  5783. setDocument( context );
  5784. context = context || document;
  5785. if ( documentIsHTML ) {
  5786. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  5787. // (excepting DocumentFragment context, where the methods don't exist)
  5788. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  5789. // ID selector
  5790. if ( ( m = match[ 1 ] ) ) {
  5791. // Document context
  5792. if ( nodeType === 9 ) {
  5793. if ( ( elem = context.getElementById( m ) ) ) {
  5794. // Support: IE, Opera, Webkit
  5795. // TODO: identify versions
  5796. // getElementById can match elements by name instead of ID
  5797. if ( elem.id === m ) {
  5798. results.push( elem );
  5799. return results;
  5800. }
  5801. } else {
  5802. return results;
  5803. }
  5804. // Element context
  5805. } else {
  5806. // Support: IE, Opera, Webkit
  5807. // TODO: identify versions
  5808. // getElementById can match elements by name instead of ID
  5809. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  5810. contains( context, elem ) &&
  5811. elem.id === m ) {
  5812. results.push( elem );
  5813. return results;
  5814. }
  5815. }
  5816. // Type selector
  5817. } else if ( match[ 2 ] ) {
  5818. push.apply( results, context.getElementsByTagName( selector ) );
  5819. return results;
  5820. // Class selector
  5821. } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
  5822. context.getElementsByClassName ) {
  5823. push.apply( results, context.getElementsByClassName( m ) );
  5824. return results;
  5825. }
  5826. }
  5827. // Take advantage of querySelectorAll
  5828. if ( support.qsa &&
  5829. !nonnativeSelectorCache[ selector + " " ] &&
  5830. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
  5831. // Support: IE 8 only
  5832. // Exclude object elements
  5833. ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
  5834. newSelector = selector;
  5835. newContext = context;
  5836. // qSA considers elements outside a scoping root when evaluating child or
  5837. // descendant combinators, which is not what we want.
  5838. // In such cases, we work around the behavior by prefixing every selector in the
  5839. // list with an ID selector referencing the scope context.
  5840. // The technique has to be used as well when a leading combinator is used
  5841. // as such selectors are not recognized by querySelectorAll.
  5842. // Thanks to Andrew Dupont for this technique.
  5843. if ( nodeType === 1 &&
  5844. ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
  5845. // Expand context for sibling selectors
  5846. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  5847. context;
  5848. // We can use :scope instead of the ID hack if the browser
  5849. // supports it & if we're not changing the context.
  5850. if ( newContext !== context || !support.scope ) {
  5851. // Capture the context ID, setting it first if necessary
  5852. if ( ( nid = context.getAttribute( "id" ) ) ) {
  5853. nid = nid.replace( rcssescape, fcssescape );
  5854. } else {
  5855. context.setAttribute( "id", ( nid = expando ) );
  5856. }
  5857. }
  5858. // Prefix every selector in the list
  5859. groups = tokenize( selector );
  5860. i = groups.length;
  5861. while ( i-- ) {
  5862. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  5863. toSelector( groups[ i ] );
  5864. }
  5865. newSelector = groups.join( "," );
  5866. }
  5867. try {
  5868. push.apply( results,
  5869. newContext.querySelectorAll( newSelector )
  5870. );
  5871. return results;
  5872. } catch ( qsaError ) {
  5873. nonnativeSelectorCache( selector, true );
  5874. } finally {
  5875. if ( nid === expando ) {
  5876. context.removeAttribute( "id" );
  5877. }
  5878. }
  5879. }
  5880. }
  5881. }
  5882. // All others
  5883. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  5884. }
  5885. /**
  5886. * Create key-value caches of limited size
  5887. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  5888. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  5889. * deleting the oldest entry
  5890. */
  5891. function createCache() {
  5892. var keys = [];
  5893. function cache( key, value ) {
  5894. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  5895. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  5896. // Only keep the most recent entries
  5897. delete cache[ keys.shift() ];
  5898. }
  5899. return ( cache[ key + " " ] = value );
  5900. }
  5901. return cache;
  5902. }
  5903. /**
  5904. * Mark a function for special use by Sizzle
  5905. * @param {Function} fn The function to mark
  5906. */
  5907. function markFunction( fn ) {
  5908. fn[ expando ] = true;
  5909. return fn;
  5910. }
  5911. /**
  5912. * Support testing using an element
  5913. * @param {Function} fn Passed the created element and returns a boolean result
  5914. */
  5915. function assert( fn ) {
  5916. var el = document.createElement( "fieldset" );
  5917. try {
  5918. return !!fn( el );
  5919. } catch ( e ) {
  5920. return false;
  5921. } finally {
  5922. // Remove from its parent by default
  5923. if ( el.parentNode ) {
  5924. el.parentNode.removeChild( el );
  5925. }
  5926. // release memory in IE
  5927. el = null;
  5928. }
  5929. }
  5930. /**
  5931. * Adds the same handler for all of the specified attrs
  5932. * @param {String} attrs Pipe-separated list of attributes
  5933. * @param {Function} handler The method that will be applied
  5934. */
  5935. function addHandle( attrs, handler ) {
  5936. var arr = attrs.split( "|" ),
  5937. i = arr.length;
  5938. while ( i-- ) {
  5939. Expr.attrHandle[ arr[ i ] ] = handler;
  5940. }
  5941. }
  5942. /**
  5943. * Checks document order of two siblings
  5944. * @param {Element} a
  5945. * @param {Element} b
  5946. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  5947. */
  5948. function siblingCheck( a, b ) {
  5949. var cur = b && a,
  5950. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  5951. a.sourceIndex - b.sourceIndex;
  5952. // Use IE sourceIndex if available on both nodes
  5953. if ( diff ) {
  5954. return diff;
  5955. }
  5956. // Check if b follows a
  5957. if ( cur ) {
  5958. while ( ( cur = cur.nextSibling ) ) {
  5959. if ( cur === b ) {
  5960. return -1;
  5961. }
  5962. }
  5963. }
  5964. return a ? 1 : -1;
  5965. }
  5966. /**
  5967. * Returns a function to use in pseudos for input types
  5968. * @param {String} type
  5969. */
  5970. function createInputPseudo( type ) {
  5971. return function( elem ) {
  5972. var name = elem.nodeName.toLowerCase();
  5973. return name === "input" && elem.type === type;
  5974. };
  5975. }
  5976. /**
  5977. * Returns a function to use in pseudos for buttons
  5978. * @param {String} type
  5979. */
  5980. function createButtonPseudo( type ) {
  5981. return function( elem ) {
  5982. var name = elem.nodeName.toLowerCase();
  5983. return ( name === "input" || name === "button" ) && elem.type === type;
  5984. };
  5985. }
  5986. /**
  5987. * Returns a function to use in pseudos for :enabled/:disabled
  5988. * @param {Boolean} disabled true for :disabled; false for :enabled
  5989. */
  5990. function createDisabledPseudo( disabled ) {
  5991. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  5992. return function( elem ) {
  5993. // Only certain elements can match :enabled or :disabled
  5994. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  5995. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  5996. if ( "form" in elem ) {
  5997. // Check for inherited disabledness on relevant non-disabled elements:
  5998. // * listed form-associated elements in a disabled fieldset
  5999. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  6000. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  6001. // * option elements in a disabled optgroup
  6002. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  6003. // All such elements have a "form" property.
  6004. if ( elem.parentNode && elem.disabled === false ) {
  6005. // Option elements defer to a parent optgroup if present
  6006. if ( "label" in elem ) {
  6007. if ( "label" in elem.parentNode ) {
  6008. return elem.parentNode.disabled === disabled;
  6009. } else {
  6010. return elem.disabled === disabled;
  6011. }
  6012. }
  6013. // Support: IE 6 - 11
  6014. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  6015. return elem.isDisabled === disabled ||
  6016. // Where there is no isDisabled, check manually
  6017. /* jshint -W018 */
  6018. elem.isDisabled !== !disabled &&
  6019. inDisabledFieldset( elem ) === disabled;
  6020. }
  6021. return elem.disabled === disabled;
  6022. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  6023. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  6024. // even exist on them, let alone have a boolean value.
  6025. } else if ( "label" in elem ) {
  6026. return elem.disabled === disabled;
  6027. }
  6028. // Remaining elements are neither :enabled nor :disabled
  6029. return false;
  6030. };
  6031. }
  6032. /**
  6033. * Returns a function to use in pseudos for positionals
  6034. * @param {Function} fn
  6035. */
  6036. function createPositionalPseudo( fn ) {
  6037. return markFunction( function( argument ) {
  6038. argument = +argument;
  6039. return markFunction( function( seed, matches ) {
  6040. var j,
  6041. matchIndexes = fn( [], seed.length, argument ),
  6042. i = matchIndexes.length;
  6043. // Match elements found at the specified indexes
  6044. while ( i-- ) {
  6045. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  6046. seed[ j ] = !( matches[ j ] = seed[ j ] );
  6047. }
  6048. }
  6049. } );
  6050. } );
  6051. }
  6052. /**
  6053. * Checks a node for validity as a Sizzle context
  6054. * @param {Element|Object=} context
  6055. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  6056. */
  6057. function testContext( context ) {
  6058. return context && typeof context.getElementsByTagName !== "undefined" && context;
  6059. }
  6060. // Expose support vars for convenience
  6061. support = Sizzle.support = {};
  6062. /**
  6063. * Detects XML nodes
  6064. * @param {Element|Object} elem An element or a document
  6065. * @returns {Boolean} True iff elem is a non-HTML XML node
  6066. */
  6067. isXML = Sizzle.isXML = function( elem ) {
  6068. var namespace = elem.namespaceURI,
  6069. docElem = ( elem.ownerDocument || elem ).documentElement;
  6070. // Support: IE <=8
  6071. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  6072. // https://bugs.jquery.com/ticket/4833
  6073. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  6074. };
  6075. /**
  6076. * Sets document-related variables once based on the current document
  6077. * @param {Element|Object} [doc] An element or document object to use to set the document
  6078. * @returns {Object} Returns the current document
  6079. */
  6080. setDocument = Sizzle.setDocument = function( node ) {
  6081. var hasCompare, subWindow,
  6082. doc = node ? node.ownerDocument || node : preferredDoc;
  6083. // Return early if doc is invalid or already selected
  6084. // Support: IE 11+, Edge 17 - 18+
  6085. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6086. // two documents; shallow comparisons work.
  6087. // eslint-disable-next-line eqeqeq
  6088. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  6089. return document;
  6090. }
  6091. // Update global variables
  6092. document = doc;
  6093. docElem = document.documentElement;
  6094. documentIsHTML = !isXML( document );
  6095. // Support: IE 9 - 11+, Edge 12 - 18+
  6096. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  6097. // Support: IE 11+, Edge 17 - 18+
  6098. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6099. // two documents; shallow comparisons work.
  6100. // eslint-disable-next-line eqeqeq
  6101. if ( preferredDoc != document &&
  6102. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  6103. // Support: IE 11, Edge
  6104. if ( subWindow.addEventListener ) {
  6105. subWindow.addEventListener( "unload", unloadHandler, false );
  6106. // Support: IE 9 - 10 only
  6107. } else if ( subWindow.attachEvent ) {
  6108. subWindow.attachEvent( "onunload", unloadHandler );
  6109. }
  6110. }
  6111. // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
  6112. // Safari 4 - 5 only, Opera <=11.6 - 12.x only
  6113. // IE/Edge & older browsers don't support the :scope pseudo-class.
  6114. // Support: Safari 6.0 only
  6115. // Safari 6.0 supports :scope but it's an alias of :root there.
  6116. support.scope = assert( function( el ) {
  6117. docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
  6118. return typeof el.querySelectorAll !== "undefined" &&
  6119. !el.querySelectorAll( ":scope fieldset div" ).length;
  6120. } );
  6121. /* Attributes
  6122. ---------------------------------------------------------------------- */
  6123. // Support: IE<8
  6124. // Verify that getAttribute really returns attributes and not properties
  6125. // (excepting IE8 booleans)
  6126. support.attributes = assert( function( el ) {
  6127. el.className = "i";
  6128. return !el.getAttribute( "className" );
  6129. } );
  6130. /* getElement(s)By*
  6131. ---------------------------------------------------------------------- */
  6132. // Check if getElementsByTagName("*") returns only elements
  6133. support.getElementsByTagName = assert( function( el ) {
  6134. el.appendChild( document.createComment( "" ) );
  6135. return !el.getElementsByTagName( "*" ).length;
  6136. } );
  6137. // Support: IE<9
  6138. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  6139. // Support: IE<10
  6140. // Check if getElementById returns elements by name
  6141. // The broken getElementById methods don't pick up programmatically-set names,
  6142. // so use a roundabout getElementsByName test
  6143. support.getById = assert( function( el ) {
  6144. docElem.appendChild( el ).id = expando;
  6145. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  6146. } );
  6147. // ID filter and find
  6148. if ( support.getById ) {
  6149. Expr.filter[ "ID" ] = function( id ) {
  6150. var attrId = id.replace( runescape, funescape );
  6151. return function( elem ) {
  6152. return elem.getAttribute( "id" ) === attrId;
  6153. };
  6154. };
  6155. Expr.find[ "ID" ] = function( id, context ) {
  6156. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6157. var elem = context.getElementById( id );
  6158. return elem ? [ elem ] : [];
  6159. }
  6160. };
  6161. } else {
  6162. Expr.filter[ "ID" ] = function( id ) {
  6163. var attrId = id.replace( runescape, funescape );
  6164. return function( elem ) {
  6165. var node = typeof elem.getAttributeNode !== "undefined" &&
  6166. elem.getAttributeNode( "id" );
  6167. return node && node.value === attrId;
  6168. };
  6169. };
  6170. // Support: IE 6 - 7 only
  6171. // getElementById is not reliable as a find shortcut
  6172. Expr.find[ "ID" ] = function( id, context ) {
  6173. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6174. var node, i, elems,
  6175. elem = context.getElementById( id );
  6176. if ( elem ) {
  6177. // Verify the id attribute
  6178. node = elem.getAttributeNode( "id" );
  6179. if ( node && node.value === id ) {
  6180. return [ elem ];
  6181. }
  6182. // Fall back on getElementsByName
  6183. elems = context.getElementsByName( id );
  6184. i = 0;
  6185. while ( ( elem = elems[ i++ ] ) ) {
  6186. node = elem.getAttributeNode( "id" );
  6187. if ( node && node.value === id ) {
  6188. return [ elem ];
  6189. }
  6190. }
  6191. }
  6192. return [];
  6193. }
  6194. };
  6195. }
  6196. // Tag
  6197. Expr.find[ "TAG" ] = support.getElementsByTagName ?
  6198. function( tag, context ) {
  6199. if ( typeof context.getElementsByTagName !== "undefined" ) {
  6200. return context.getElementsByTagName( tag );
  6201. // DocumentFragment nodes don't have gEBTN
  6202. } else if ( support.qsa ) {
  6203. return context.querySelectorAll( tag );
  6204. }
  6205. } :
  6206. function( tag, context ) {
  6207. var elem,
  6208. tmp = [],
  6209. i = 0,
  6210. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  6211. results = context.getElementsByTagName( tag );
  6212. // Filter out possible comments
  6213. if ( tag === "*" ) {
  6214. while ( ( elem = results[ i++ ] ) ) {
  6215. if ( elem.nodeType === 1 ) {
  6216. tmp.push( elem );
  6217. }
  6218. }
  6219. return tmp;
  6220. }
  6221. return results;
  6222. };
  6223. // Class
  6224. Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
  6225. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  6226. return context.getElementsByClassName( className );
  6227. }
  6228. };
  6229. /* QSA/matchesSelector
  6230. ---------------------------------------------------------------------- */
  6231. // QSA and matchesSelector support
  6232. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  6233. rbuggyMatches = [];
  6234. // qSa(:focus) reports false when true (Chrome 21)
  6235. // We allow this because of a bug in IE8/9 that throws an error
  6236. // whenever `document.activeElement` is accessed on an iframe
  6237. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  6238. // See https://bugs.jquery.com/ticket/13378
  6239. rbuggyQSA = [];
  6240. if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
  6241. // Build QSA regex
  6242. // Regex strategy adopted from Diego Perini
  6243. assert( function( el ) {
  6244. var input;
  6245. // Select is set to empty string on purpose
  6246. // This is to test IE's treatment of not explicitly
  6247. // setting a boolean content attribute,
  6248. // since its presence should be enough
  6249. // https://bugs.jquery.com/ticket/12359
  6250. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  6251. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  6252. "<option selected=''></option></select>";
  6253. // Support: IE8, Opera 11-12.16
  6254. // Nothing should be selected when empty strings follow ^= or $= or *=
  6255. // The test attribute must be unknown in Opera but "safe" for WinRT
  6256. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  6257. if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
  6258. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  6259. }
  6260. // Support: IE8
  6261. // Boolean attributes and "value" are not treated correctly
  6262. if ( !el.querySelectorAll( "[selected]" ).length ) {
  6263. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  6264. }
  6265. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  6266. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  6267. rbuggyQSA.push( "~=" );
  6268. }
  6269. // Support: IE 11+, Edge 15 - 18+
  6270. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  6271. // Adding a temporary attribute to the document before the selection works
  6272. // around the issue.
  6273. // Interestingly, IE 10 & older don't seem to have the issue.
  6274. input = document.createElement( "input" );
  6275. input.setAttribute( "name", "" );
  6276. el.appendChild( input );
  6277. if ( !el.querySelectorAll( "[name='']" ).length ) {
  6278. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  6279. whitespace + "*(?:''|\"\")" );
  6280. }
  6281. // Webkit/Opera - :checked should return selected option elements
  6282. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6283. // IE8 throws error here and will not see later tests
  6284. if ( !el.querySelectorAll( ":checked" ).length ) {
  6285. rbuggyQSA.push( ":checked" );
  6286. }
  6287. // Support: Safari 8+, iOS 8+
  6288. // https://bugs.webkit.org/show_bug.cgi?id=136851
  6289. // In-page `selector#id sibling-combinator selector` fails
  6290. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  6291. rbuggyQSA.push( ".#.+[+~]" );
  6292. }
  6293. // Support: Firefox <=3.6 - 5 only
  6294. // Old Firefox doesn't throw on a badly-escaped identifier.
  6295. el.querySelectorAll( "\\\f" );
  6296. rbuggyQSA.push( "[\\r\\n\\f]" );
  6297. } );
  6298. assert( function( el ) {
  6299. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  6300. "<select disabled='disabled'><option/></select>";
  6301. // Support: Windows 8 Native Apps
  6302. // The type and name attributes are restricted during .innerHTML assignment
  6303. var input = document.createElement( "input" );
  6304. input.setAttribute( "type", "hidden" );
  6305. el.appendChild( input ).setAttribute( "name", "D" );
  6306. // Support: IE8
  6307. // Enforce case-sensitivity of name attribute
  6308. if ( el.querySelectorAll( "[name=d]" ).length ) {
  6309. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  6310. }
  6311. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  6312. // IE8 throws error here and will not see later tests
  6313. if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
  6314. rbuggyQSA.push( ":enabled", ":disabled" );
  6315. }
  6316. // Support: IE9-11+
  6317. // IE's :disabled selector does not pick up the children of disabled fieldsets
  6318. docElem.appendChild( el ).disabled = true;
  6319. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  6320. rbuggyQSA.push( ":enabled", ":disabled" );
  6321. }
  6322. // Support: Opera 10 - 11 only
  6323. // Opera 10-11 does not throw on post-comma invalid pseudos
  6324. el.querySelectorAll( "*,:x" );
  6325. rbuggyQSA.push( ",.*:" );
  6326. } );
  6327. }
  6328. if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
  6329. docElem.webkitMatchesSelector ||
  6330. docElem.mozMatchesSelector ||
  6331. docElem.oMatchesSelector ||
  6332. docElem.msMatchesSelector ) ) ) ) {
  6333. assert( function( el ) {
  6334. // Check to see if it's possible to do matchesSelector
  6335. // on a disconnected node (IE 9)
  6336. support.disconnectedMatch = matches.call( el, "*" );
  6337. // This should fail with an exception
  6338. // Gecko does not error, returns false instead
  6339. matches.call( el, "[s!='']:x" );
  6340. rbuggyMatches.push( "!=", pseudos );
  6341. } );
  6342. }
  6343. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  6344. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
  6345. /* Contains
  6346. ---------------------------------------------------------------------- */
  6347. hasCompare = rnative.test( docElem.compareDocumentPosition );
  6348. // Element contains another
  6349. // Purposefully self-exclusive
  6350. // As in, an element does not contain itself
  6351. contains = hasCompare || rnative.test( docElem.contains ) ?
  6352. function( a, b ) {
  6353. var adown = a.nodeType === 9 ? a.documentElement : a,
  6354. bup = b && b.parentNode;
  6355. return a === bup || !!( bup && bup.nodeType === 1 && (
  6356. adown.contains ?
  6357. adown.contains( bup ) :
  6358. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  6359. ) );
  6360. } :
  6361. function( a, b ) {
  6362. if ( b ) {
  6363. while ( ( b = b.parentNode ) ) {
  6364. if ( b === a ) {
  6365. return true;
  6366. }
  6367. }
  6368. }
  6369. return false;
  6370. };
  6371. /* Sorting
  6372. ---------------------------------------------------------------------- */
  6373. // Document order sorting
  6374. sortOrder = hasCompare ?
  6375. function( a, b ) {
  6376. // Flag for duplicate removal
  6377. if ( a === b ) {
  6378. hasDuplicate = true;
  6379. return 0;
  6380. }
  6381. // Sort on method existence if only one input has compareDocumentPosition
  6382. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  6383. if ( compare ) {
  6384. return compare;
  6385. }
  6386. // Calculate position if both inputs belong to the same document
  6387. // Support: IE 11+, Edge 17 - 18+
  6388. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6389. // two documents; shallow comparisons work.
  6390. // eslint-disable-next-line eqeqeq
  6391. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  6392. a.compareDocumentPosition( b ) :
  6393. // Otherwise we know they are disconnected
  6394. 1;
  6395. // Disconnected nodes
  6396. if ( compare & 1 ||
  6397. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  6398. // Choose the first element that is related to our preferred document
  6399. // Support: IE 11+, Edge 17 - 18+
  6400. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6401. // two documents; shallow comparisons work.
  6402. // eslint-disable-next-line eqeqeq
  6403. if ( a == document || a.ownerDocument == preferredDoc &&
  6404. contains( preferredDoc, a ) ) {
  6405. return -1;
  6406. }
  6407. // Support: IE 11+, Edge 17 - 18+
  6408. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6409. // two documents; shallow comparisons work.
  6410. // eslint-disable-next-line eqeqeq
  6411. if ( b == document || b.ownerDocument == preferredDoc &&
  6412. contains( preferredDoc, b ) ) {
  6413. return 1;
  6414. }
  6415. // Maintain original order
  6416. return sortInput ?
  6417. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6418. 0;
  6419. }
  6420. return compare & 4 ? -1 : 1;
  6421. } :
  6422. function( a, b ) {
  6423. // Exit early if the nodes are identical
  6424. if ( a === b ) {
  6425. hasDuplicate = true;
  6426. return 0;
  6427. }
  6428. var cur,
  6429. i = 0,
  6430. aup = a.parentNode,
  6431. bup = b.parentNode,
  6432. ap = [ a ],
  6433. bp = [ b ];
  6434. // Parentless nodes are either documents or disconnected
  6435. if ( !aup || !bup ) {
  6436. // Support: IE 11+, Edge 17 - 18+
  6437. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6438. // two documents; shallow comparisons work.
  6439. /* eslint-disable eqeqeq */
  6440. return a == document ? -1 :
  6441. b == document ? 1 :
  6442. /* eslint-enable eqeqeq */
  6443. aup ? -1 :
  6444. bup ? 1 :
  6445. sortInput ?
  6446. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6447. 0;
  6448. // If the nodes are siblings, we can do a quick check
  6449. } else if ( aup === bup ) {
  6450. return siblingCheck( a, b );
  6451. }
  6452. // Otherwise we need full lists of their ancestors for comparison
  6453. cur = a;
  6454. while ( ( cur = cur.parentNode ) ) {
  6455. ap.unshift( cur );
  6456. }
  6457. cur = b;
  6458. while ( ( cur = cur.parentNode ) ) {
  6459. bp.unshift( cur );
  6460. }
  6461. // Walk down the tree looking for a discrepancy
  6462. while ( ap[ i ] === bp[ i ] ) {
  6463. i++;
  6464. }
  6465. return i ?
  6466. // Do a sibling check if the nodes have a common ancestor
  6467. siblingCheck( ap[ i ], bp[ i ] ) :
  6468. // Otherwise nodes in our document sort first
  6469. // Support: IE 11+, Edge 17 - 18+
  6470. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6471. // two documents; shallow comparisons work.
  6472. /* eslint-disable eqeqeq */
  6473. ap[ i ] == preferredDoc ? -1 :
  6474. bp[ i ] == preferredDoc ? 1 :
  6475. /* eslint-enable eqeqeq */
  6476. 0;
  6477. };
  6478. return document;
  6479. };
  6480. Sizzle.matches = function( expr, elements ) {
  6481. return Sizzle( expr, null, null, elements );
  6482. };
  6483. Sizzle.matchesSelector = function( elem, expr ) {
  6484. setDocument( elem );
  6485. if ( support.matchesSelector && documentIsHTML &&
  6486. !nonnativeSelectorCache[ expr + " " ] &&
  6487. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  6488. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  6489. try {
  6490. var ret = matches.call( elem, expr );
  6491. // IE 9's matchesSelector returns false on disconnected nodes
  6492. if ( ret || support.disconnectedMatch ||
  6493. // As well, disconnected nodes are said to be in a document
  6494. // fragment in IE 9
  6495. elem.document && elem.document.nodeType !== 11 ) {
  6496. return ret;
  6497. }
  6498. } catch ( e ) {
  6499. nonnativeSelectorCache( expr, true );
  6500. }
  6501. }
  6502. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  6503. };
  6504. Sizzle.contains = function( context, elem ) {
  6505. // Set document vars if needed
  6506. // Support: IE 11+, Edge 17 - 18+
  6507. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6508. // two documents; shallow comparisons work.
  6509. // eslint-disable-next-line eqeqeq
  6510. if ( ( context.ownerDocument || context ) != document ) {
  6511. setDocument( context );
  6512. }
  6513. return contains( context, elem );
  6514. };
  6515. Sizzle.attr = function( elem, name ) {
  6516. // Set document vars if needed
  6517. // Support: IE 11+, Edge 17 - 18+
  6518. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6519. // two documents; shallow comparisons work.
  6520. // eslint-disable-next-line eqeqeq
  6521. if ( ( elem.ownerDocument || elem ) != document ) {
  6522. setDocument( elem );
  6523. }
  6524. var fn = Expr.attrHandle[ name.toLowerCase() ],
  6525. // Don't get fooled by Object.prototype properties (jQuery #13807)
  6526. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  6527. fn( elem, name, !documentIsHTML ) :
  6528. undefined;
  6529. return val !== undefined ?
  6530. val :
  6531. support.attributes || !documentIsHTML ?
  6532. elem.getAttribute( name ) :
  6533. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  6534. val.value :
  6535. null;
  6536. };
  6537. Sizzle.escape = function( sel ) {
  6538. return ( sel + "" ).replace( rcssescape, fcssescape );
  6539. };
  6540. Sizzle.error = function( msg ) {
  6541. throw new Error( "Syntax error, unrecognized expression: " + msg );
  6542. };
  6543. /**
  6544. * Document sorting and removing duplicates
  6545. * @param {ArrayLike} results
  6546. */
  6547. Sizzle.uniqueSort = function( results ) {
  6548. var elem,
  6549. duplicates = [],
  6550. j = 0,
  6551. i = 0;
  6552. // Unless we *know* we can detect duplicates, assume their presence
  6553. hasDuplicate = !support.detectDuplicates;
  6554. sortInput = !support.sortStable && results.slice( 0 );
  6555. results.sort( sortOrder );
  6556. if ( hasDuplicate ) {
  6557. while ( ( elem = results[ i++ ] ) ) {
  6558. if ( elem === results[ i ] ) {
  6559. j = duplicates.push( i );
  6560. }
  6561. }
  6562. while ( j-- ) {
  6563. results.splice( duplicates[ j ], 1 );
  6564. }
  6565. }
  6566. // Clear input after sorting to release objects
  6567. // See https://github.com/jquery/sizzle/pull/225
  6568. sortInput = null;
  6569. return results;
  6570. };
  6571. /**
  6572. * Utility function for retrieving the text value of an array of DOM nodes
  6573. * @param {Array|Element} elem
  6574. */
  6575. getText = Sizzle.getText = function( elem ) {
  6576. var node,
  6577. ret = "",
  6578. i = 0,
  6579. nodeType = elem.nodeType;
  6580. if ( !nodeType ) {
  6581. // If no nodeType, this is expected to be an array
  6582. while ( ( node = elem[ i++ ] ) ) {
  6583. // Do not traverse comment nodes
  6584. ret += getText( node );
  6585. }
  6586. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  6587. // Use textContent for elements
  6588. // innerText usage removed for consistency of new lines (jQuery #11153)
  6589. if ( typeof elem.textContent === "string" ) {
  6590. return elem.textContent;
  6591. } else {
  6592. // Traverse its children
  6593. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6594. ret += getText( elem );
  6595. }
  6596. }
  6597. } else if ( nodeType === 3 || nodeType === 4 ) {
  6598. return elem.nodeValue;
  6599. }
  6600. // Do not include comment or processing instruction nodes
  6601. return ret;
  6602. };
  6603. Expr = Sizzle.selectors = {
  6604. // Can be adjusted by the user
  6605. cacheLength: 50,
  6606. createPseudo: markFunction,
  6607. match: matchExpr,
  6608. attrHandle: {},
  6609. find: {},
  6610. relative: {
  6611. ">": { dir: "parentNode", first: true },
  6612. " ": { dir: "parentNode" },
  6613. "+": { dir: "previousSibling", first: true },
  6614. "~": { dir: "previousSibling" }
  6615. },
  6616. preFilter: {
  6617. "ATTR": function( match ) {
  6618. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  6619. // Move the given value to match[3] whether quoted or unquoted
  6620. match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
  6621. match[ 5 ] || "" ).replace( runescape, funescape );
  6622. if ( match[ 2 ] === "~=" ) {
  6623. match[ 3 ] = " " + match[ 3 ] + " ";
  6624. }
  6625. return match.slice( 0, 4 );
  6626. },
  6627. "CHILD": function( match ) {
  6628. /* matches from matchExpr["CHILD"]
  6629. 1 type (only|nth|...)
  6630. 2 what (child|of-type)
  6631. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  6632. 4 xn-component of xn+y argument ([+-]?\d*n|)
  6633. 5 sign of xn-component
  6634. 6 x of xn-component
  6635. 7 sign of y-component
  6636. 8 y of y-component
  6637. */
  6638. match[ 1 ] = match[ 1 ].toLowerCase();
  6639. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  6640. // nth-* requires argument
  6641. if ( !match[ 3 ] ) {
  6642. Sizzle.error( match[ 0 ] );
  6643. }
  6644. // numeric x and y parameters for Expr.filter.CHILD
  6645. // remember that false/true cast respectively to 0/1
  6646. match[ 4 ] = +( match[ 4 ] ?
  6647. match[ 5 ] + ( match[ 6 ] || 1 ) :
  6648. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
  6649. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  6650. // other types prohibit arguments
  6651. } else if ( match[ 3 ] ) {
  6652. Sizzle.error( match[ 0 ] );
  6653. }
  6654. return match;
  6655. },
  6656. "PSEUDO": function( match ) {
  6657. var excess,
  6658. unquoted = !match[ 6 ] && match[ 2 ];
  6659. if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
  6660. return null;
  6661. }
  6662. // Accept quoted arguments as-is
  6663. if ( match[ 3 ] ) {
  6664. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  6665. // Strip excess characters from unquoted arguments
  6666. } else if ( unquoted && rpseudo.test( unquoted ) &&
  6667. // Get excess from tokenize (recursively)
  6668. ( excess = tokenize( unquoted, true ) ) &&
  6669. // advance to the next closing parenthesis
  6670. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  6671. // excess is a negative index
  6672. match[ 0 ] = match[ 0 ].slice( 0, excess );
  6673. match[ 2 ] = unquoted.slice( 0, excess );
  6674. }
  6675. // Return only captures needed by the pseudo filter method (type and argument)
  6676. return match.slice( 0, 3 );
  6677. }
  6678. },
  6679. filter: {
  6680. "TAG": function( nodeNameSelector ) {
  6681. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  6682. return nodeNameSelector === "*" ?
  6683. function() {
  6684. return true;
  6685. } :
  6686. function( elem ) {
  6687. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  6688. };
  6689. },
  6690. "CLASS": function( className ) {
  6691. var pattern = classCache[ className + " " ];
  6692. return pattern ||
  6693. ( pattern = new RegExp( "(^|" + whitespace +
  6694. ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
  6695. className, function( elem ) {
  6696. return pattern.test(
  6697. typeof elem.className === "string" && elem.className ||
  6698. typeof elem.getAttribute !== "undefined" &&
  6699. elem.getAttribute( "class" ) ||
  6700. ""
  6701. );
  6702. } );
  6703. },
  6704. "ATTR": function( name, operator, check ) {
  6705. return function( elem ) {
  6706. var result = Sizzle.attr( elem, name );
  6707. if ( result == null ) {
  6708. return operator === "!=";
  6709. }
  6710. if ( !operator ) {
  6711. return true;
  6712. }
  6713. result += "";
  6714. /* eslint-disable max-len */
  6715. return operator === "=" ? result === check :
  6716. operator === "!=" ? result !== check :
  6717. operator === "^=" ? check && result.indexOf( check ) === 0 :
  6718. operator === "*=" ? check && result.indexOf( check ) > -1 :
  6719. operator === "$=" ? check && result.slice( -check.length ) === check :
  6720. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  6721. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  6722. false;
  6723. /* eslint-enable max-len */
  6724. };
  6725. },
  6726. "CHILD": function( type, what, _argument, first, last ) {
  6727. var simple = type.slice( 0, 3 ) !== "nth",
  6728. forward = type.slice( -4 ) !== "last",
  6729. ofType = what === "of-type";
  6730. return first === 1 && last === 0 ?
  6731. // Shortcut for :nth-*(n)
  6732. function( elem ) {
  6733. return !!elem.parentNode;
  6734. } :
  6735. function( elem, _context, xml ) {
  6736. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  6737. dir = simple !== forward ? "nextSibling" : "previousSibling",
  6738. parent = elem.parentNode,
  6739. name = ofType && elem.nodeName.toLowerCase(),
  6740. useCache = !xml && !ofType,
  6741. diff = false;
  6742. if ( parent ) {
  6743. // :(first|last|only)-(child|of-type)
  6744. if ( simple ) {
  6745. while ( dir ) {
  6746. node = elem;
  6747. while ( ( node = node[ dir ] ) ) {
  6748. if ( ofType ?
  6749. node.nodeName.toLowerCase() === name :
  6750. node.nodeType === 1 ) {
  6751. return false;
  6752. }
  6753. }
  6754. // Reverse direction for :only-* (if we haven't yet done so)
  6755. start = dir = type === "only" && !start && "nextSibling";
  6756. }
  6757. return true;
  6758. }
  6759. start = [ forward ? parent.firstChild : parent.lastChild ];
  6760. // non-xml :nth-child(...) stores cache data on `parent`
  6761. if ( forward && useCache ) {
  6762. // Seek `elem` from a previously-cached index
  6763. // ...in a gzip-friendly way
  6764. node = parent;
  6765. outerCache = node[ expando ] || ( node[ expando ] = {} );
  6766. // Support: IE <9 only
  6767. // Defend against cloned attroperties (jQuery gh-1709)
  6768. uniqueCache = outerCache[ node.uniqueID ] ||
  6769. ( outerCache[ node.uniqueID ] = {} );
  6770. cache = uniqueCache[ type ] || [];
  6771. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6772. diff = nodeIndex && cache[ 2 ];
  6773. node = nodeIndex && parent.childNodes[ nodeIndex ];
  6774. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  6775. // Fallback to seeking `elem` from the start
  6776. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  6777. // When found, cache indexes on `parent` and break
  6778. if ( node.nodeType === 1 && ++diff && node === elem ) {
  6779. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  6780. break;
  6781. }
  6782. }
  6783. } else {
  6784. // Use previously-cached element index if available
  6785. if ( useCache ) {
  6786. // ...in a gzip-friendly way
  6787. node = elem;
  6788. outerCache = node[ expando ] || ( node[ expando ] = {} );
  6789. // Support: IE <9 only
  6790. // Defend against cloned attroperties (jQuery gh-1709)
  6791. uniqueCache = outerCache[ node.uniqueID ] ||
  6792. ( outerCache[ node.uniqueID ] = {} );
  6793. cache = uniqueCache[ type ] || [];
  6794. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6795. diff = nodeIndex;
  6796. }
  6797. // xml :nth-child(...)
  6798. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  6799. if ( diff === false ) {
  6800. // Use the same loop as above to seek `elem` from the start
  6801. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  6802. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  6803. if ( ( ofType ?
  6804. node.nodeName.toLowerCase() === name :
  6805. node.nodeType === 1 ) &&
  6806. ++diff ) {
  6807. // Cache the index of each encountered element
  6808. if ( useCache ) {
  6809. outerCache = node[ expando ] ||
  6810. ( node[ expando ] = {} );
  6811. // Support: IE <9 only
  6812. // Defend against cloned attroperties (jQuery gh-1709)
  6813. uniqueCache = outerCache[ node.uniqueID ] ||
  6814. ( outerCache[ node.uniqueID ] = {} );
  6815. uniqueCache[ type ] = [ dirruns, diff ];
  6816. }
  6817. if ( node === elem ) {
  6818. break;
  6819. }
  6820. }
  6821. }
  6822. }
  6823. }
  6824. // Incorporate the offset, then check against cycle size
  6825. diff -= last;
  6826. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  6827. }
  6828. };
  6829. },
  6830. "PSEUDO": function( pseudo, argument ) {
  6831. // pseudo-class names are case-insensitive
  6832. // http://www.w3.org/TR/selectors/#pseudo-classes
  6833. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  6834. // Remember that setFilters inherits from pseudos
  6835. var args,
  6836. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  6837. Sizzle.error( "unsupported pseudo: " + pseudo );
  6838. // The user may use createPseudo to indicate that
  6839. // arguments are needed to create the filter function
  6840. // just as Sizzle does
  6841. if ( fn[ expando ] ) {
  6842. return fn( argument );
  6843. }
  6844. // But maintain support for old signatures
  6845. if ( fn.length > 1 ) {
  6846. args = [ pseudo, pseudo, "", argument ];
  6847. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  6848. markFunction( function( seed, matches ) {
  6849. var idx,
  6850. matched = fn( seed, argument ),
  6851. i = matched.length;
  6852. while ( i-- ) {
  6853. idx = indexOf( seed, matched[ i ] );
  6854. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  6855. }
  6856. } ) :
  6857. function( elem ) {
  6858. return fn( elem, 0, args );
  6859. };
  6860. }
  6861. return fn;
  6862. }
  6863. },
  6864. pseudos: {
  6865. // Potentially complex pseudos
  6866. "not": markFunction( function( selector ) {
  6867. // Trim the selector passed to compile
  6868. // to avoid treating leading and trailing
  6869. // spaces as combinators
  6870. var input = [],
  6871. results = [],
  6872. matcher = compile( selector.replace( rtrim, "$1" ) );
  6873. return matcher[ expando ] ?
  6874. markFunction( function( seed, matches, _context, xml ) {
  6875. var elem,
  6876. unmatched = matcher( seed, null, xml, [] ),
  6877. i = seed.length;
  6878. // Match elements unmatched by `matcher`
  6879. while ( i-- ) {
  6880. if ( ( elem = unmatched[ i ] ) ) {
  6881. seed[ i ] = !( matches[ i ] = elem );
  6882. }
  6883. }
  6884. } ) :
  6885. function( elem, _context, xml ) {
  6886. input[ 0 ] = elem;
  6887. matcher( input, null, xml, results );
  6888. // Don't keep the element (issue #299)
  6889. input[ 0 ] = null;
  6890. return !results.pop();
  6891. };
  6892. } ),
  6893. "has": markFunction( function( selector ) {
  6894. return function( elem ) {
  6895. return Sizzle( selector, elem ).length > 0;
  6896. };
  6897. } ),
  6898. "contains": markFunction( function( text ) {
  6899. text = text.replace( runescape, funescape );
  6900. return function( elem ) {
  6901. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  6902. };
  6903. } ),
  6904. // "Whether an element is represented by a :lang() selector
  6905. // is based solely on the element's language value
  6906. // being equal to the identifier C,
  6907. // or beginning with the identifier C immediately followed by "-".
  6908. // The matching of C against the element's language value is performed case-insensitively.
  6909. // The identifier C does not have to be a valid language name."
  6910. // http://www.w3.org/TR/selectors/#lang-pseudo
  6911. "lang": markFunction( function( lang ) {
  6912. // lang value must be a valid identifier
  6913. if ( !ridentifier.test( lang || "" ) ) {
  6914. Sizzle.error( "unsupported lang: " + lang );
  6915. }
  6916. lang = lang.replace( runescape, funescape ).toLowerCase();
  6917. return function( elem ) {
  6918. var elemLang;
  6919. do {
  6920. if ( ( elemLang = documentIsHTML ?
  6921. elem.lang :
  6922. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  6923. elemLang = elemLang.toLowerCase();
  6924. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  6925. }
  6926. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  6927. return false;
  6928. };
  6929. } ),
  6930. // Miscellaneous
  6931. "target": function( elem ) {
  6932. var hash = window.location && window.location.hash;
  6933. return hash && hash.slice( 1 ) === elem.id;
  6934. },
  6935. "root": function( elem ) {
  6936. return elem === docElem;
  6937. },
  6938. "focus": function( elem ) {
  6939. return elem === document.activeElement &&
  6940. ( !document.hasFocus || document.hasFocus() ) &&
  6941. !!( elem.type || elem.href || ~elem.tabIndex );
  6942. },
  6943. // Boolean properties
  6944. "enabled": createDisabledPseudo( false ),
  6945. "disabled": createDisabledPseudo( true ),
  6946. "checked": function( elem ) {
  6947. // In CSS3, :checked should return both checked and selected elements
  6948. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6949. var nodeName = elem.nodeName.toLowerCase();
  6950. return ( nodeName === "input" && !!elem.checked ) ||
  6951. ( nodeName === "option" && !!elem.selected );
  6952. },
  6953. "selected": function( elem ) {
  6954. // Accessing this property makes selected-by-default
  6955. // options in Safari work properly
  6956. if ( elem.parentNode ) {
  6957. // eslint-disable-next-line no-unused-expressions
  6958. elem.parentNode.selectedIndex;
  6959. }
  6960. return elem.selected === true;
  6961. },
  6962. // Contents
  6963. "empty": function( elem ) {
  6964. // http://www.w3.org/TR/selectors/#empty-pseudo
  6965. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  6966. // but not by others (comment: 8; processing instruction: 7; etc.)
  6967. // nodeType < 6 works because attributes (2) do not appear as children
  6968. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6969. if ( elem.nodeType < 6 ) {
  6970. return false;
  6971. }
  6972. }
  6973. return true;
  6974. },
  6975. "parent": function( elem ) {
  6976. return !Expr.pseudos[ "empty" ]( elem );
  6977. },
  6978. // Element/input types
  6979. "header": function( elem ) {
  6980. return rheader.test( elem.nodeName );
  6981. },
  6982. "input": function( elem ) {
  6983. return rinputs.test( elem.nodeName );
  6984. },
  6985. "button": function( elem ) {
  6986. var name = elem.nodeName.toLowerCase();
  6987. return name === "input" && elem.type === "button" || name === "button";
  6988. },
  6989. "text": function( elem ) {
  6990. var attr;
  6991. return elem.nodeName.toLowerCase() === "input" &&
  6992. elem.type === "text" &&
  6993. // Support: IE<8
  6994. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  6995. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  6996. attr.toLowerCase() === "text" );
  6997. },
  6998. // Position-in-collection
  6999. "first": createPositionalPseudo( function() {
  7000. return [ 0 ];
  7001. } ),
  7002. "last": createPositionalPseudo( function( _matchIndexes, length ) {
  7003. return [ length - 1 ];
  7004. } ),
  7005. "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
  7006. return [ argument < 0 ? argument + length : argument ];
  7007. } ),
  7008. "even": createPositionalPseudo( function( matchIndexes, length ) {
  7009. var i = 0;
  7010. for ( ; i < length; i += 2 ) {
  7011. matchIndexes.push( i );
  7012. }
  7013. return matchIndexes;
  7014. } ),
  7015. "odd": createPositionalPseudo( function( matchIndexes, length ) {
  7016. var i = 1;
  7017. for ( ; i < length; i += 2 ) {
  7018. matchIndexes.push( i );
  7019. }
  7020. return matchIndexes;
  7021. } ),
  7022. "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  7023. var i = argument < 0 ?
  7024. argument + length :
  7025. argument > length ?
  7026. length :
  7027. argument;
  7028. for ( ; --i >= 0; ) {
  7029. matchIndexes.push( i );
  7030. }
  7031. return matchIndexes;
  7032. } ),
  7033. "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  7034. var i = argument < 0 ? argument + length : argument;
  7035. for ( ; ++i < length; ) {
  7036. matchIndexes.push( i );
  7037. }
  7038. return matchIndexes;
  7039. } )
  7040. }
  7041. };
  7042. Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
  7043. // Add button/input type pseudos
  7044. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  7045. Expr.pseudos[ i ] = createInputPseudo( i );
  7046. }
  7047. for ( i in { submit: true, reset: true } ) {
  7048. Expr.pseudos[ i ] = createButtonPseudo( i );
  7049. }
  7050. // Easy API for creating new setFilters
  7051. function setFilters() {}
  7052. setFilters.prototype = Expr.filters = Expr.pseudos;
  7053. Expr.setFilters = new setFilters();
  7054. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  7055. var matched, match, tokens, type,
  7056. soFar, groups, preFilters,
  7057. cached = tokenCache[ selector + " " ];
  7058. if ( cached ) {
  7059. return parseOnly ? 0 : cached.slice( 0 );
  7060. }
  7061. soFar = selector;
  7062. groups = [];
  7063. preFilters = Expr.preFilter;
  7064. while ( soFar ) {
  7065. // Comma and first run
  7066. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  7067. if ( match ) {
  7068. // Don't consume trailing commas as valid
  7069. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  7070. }
  7071. groups.push( ( tokens = [] ) );
  7072. }
  7073. matched = false;
  7074. // Combinators
  7075. if ( ( match = rcombinators.exec( soFar ) ) ) {
  7076. matched = match.shift();
  7077. tokens.push( {
  7078. value: matched,
  7079. // Cast descendant combinators to space
  7080. type: match[ 0 ].replace( rtrim, " " )
  7081. } );
  7082. soFar = soFar.slice( matched.length );
  7083. }
  7084. // Filters
  7085. for ( type in Expr.filter ) {
  7086. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  7087. ( match = preFilters[ type ]( match ) ) ) ) {
  7088. matched = match.shift();
  7089. tokens.push( {
  7090. value: matched,
  7091. type: type,
  7092. matches: match
  7093. } );
  7094. soFar = soFar.slice( matched.length );
  7095. }
  7096. }
  7097. if ( !matched ) {
  7098. break;
  7099. }
  7100. }
  7101. // Return the length of the invalid excess
  7102. // if we're just parsing
  7103. // Otherwise, throw an error or return tokens
  7104. return parseOnly ?
  7105. soFar.length :
  7106. soFar ?
  7107. Sizzle.error( selector ) :
  7108. // Cache the tokens
  7109. tokenCache( selector, groups ).slice( 0 );
  7110. };
  7111. function toSelector( tokens ) {
  7112. var i = 0,
  7113. len = tokens.length,
  7114. selector = "";
  7115. for ( ; i < len; i++ ) {
  7116. selector += tokens[ i ].value;
  7117. }
  7118. return selector;
  7119. }
  7120. function addCombinator( matcher, combinator, base ) {
  7121. var dir = combinator.dir,
  7122. skip = combinator.next,
  7123. key = skip || dir,
  7124. checkNonElements = base && key === "parentNode",
  7125. doneName = done++;
  7126. return combinator.first ?
  7127. // Check against closest ancestor/preceding element
  7128. function( elem, context, xml ) {
  7129. while ( ( elem = elem[ dir ] ) ) {
  7130. if ( elem.nodeType === 1 || checkNonElements ) {
  7131. return matcher( elem, context, xml );
  7132. }
  7133. }
  7134. return false;
  7135. } :
  7136. // Check against all ancestor/preceding elements
  7137. function( elem, context, xml ) {
  7138. var oldCache, uniqueCache, outerCache,
  7139. newCache = [ dirruns, doneName ];
  7140. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  7141. if ( xml ) {
  7142. while ( ( elem = elem[ dir ] ) ) {
  7143. if ( elem.nodeType === 1 || checkNonElements ) {
  7144. if ( matcher( elem, context, xml ) ) {
  7145. return true;
  7146. }
  7147. }
  7148. }
  7149. } else {
  7150. while ( ( elem = elem[ dir ] ) ) {
  7151. if ( elem.nodeType === 1 || checkNonElements ) {
  7152. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  7153. // Support: IE <9 only
  7154. // Defend against cloned attroperties (jQuery gh-1709)
  7155. uniqueCache = outerCache[ elem.uniqueID ] ||
  7156. ( outerCache[ elem.uniqueID ] = {} );
  7157. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  7158. elem = elem[ dir ] || elem;
  7159. } else if ( ( oldCache = uniqueCache[ key ] ) &&
  7160. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  7161. // Assign to newCache so results back-propagate to previous elements
  7162. return ( newCache[ 2 ] = oldCache[ 2 ] );
  7163. } else {
  7164. // Reuse newcache so results back-propagate to previous elements
  7165. uniqueCache[ key ] = newCache;
  7166. // A match means we're done; a fail means we have to keep checking
  7167. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  7168. return true;
  7169. }
  7170. }
  7171. }
  7172. }
  7173. }
  7174. return false;
  7175. };
  7176. }
  7177. function elementMatcher( matchers ) {
  7178. return matchers.length > 1 ?
  7179. function( elem, context, xml ) {
  7180. var i = matchers.length;
  7181. while ( i-- ) {
  7182. if ( !matchers[ i ]( elem, context, xml ) ) {
  7183. return false;
  7184. }
  7185. }
  7186. return true;
  7187. } :
  7188. matchers[ 0 ];
  7189. }
  7190. function multipleContexts( selector, contexts, results ) {
  7191. var i = 0,
  7192. len = contexts.length;
  7193. for ( ; i < len; i++ ) {
  7194. Sizzle( selector, contexts[ i ], results );
  7195. }
  7196. return results;
  7197. }
  7198. function condense( unmatched, map, filter, context, xml ) {
  7199. var elem,
  7200. newUnmatched = [],
  7201. i = 0,
  7202. len = unmatched.length,
  7203. mapped = map != null;
  7204. for ( ; i < len; i++ ) {
  7205. if ( ( elem = unmatched[ i ] ) ) {
  7206. if ( !filter || filter( elem, context, xml ) ) {
  7207. newUnmatched.push( elem );
  7208. if ( mapped ) {
  7209. map.push( i );
  7210. }
  7211. }
  7212. }
  7213. }
  7214. return newUnmatched;
  7215. }
  7216. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  7217. if ( postFilter && !postFilter[ expando ] ) {
  7218. postFilter = setMatcher( postFilter );
  7219. }
  7220. if ( postFinder && !postFinder[ expando ] ) {
  7221. postFinder = setMatcher( postFinder, postSelector );
  7222. }
  7223. return markFunction( function( seed, results, context, xml ) {
  7224. var temp, i, elem,
  7225. preMap = [],
  7226. postMap = [],
  7227. preexisting = results.length,
  7228. // Get initial elements from seed or context
  7229. elems = seed || multipleContexts(
  7230. selector || "*",
  7231. context.nodeType ? [ context ] : context,
  7232. []
  7233. ),
  7234. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  7235. matcherIn = preFilter && ( seed || !selector ) ?
  7236. condense( elems, preMap, preFilter, context, xml ) :
  7237. elems,
  7238. matcherOut = matcher ?
  7239. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  7240. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  7241. // ...intermediate processing is necessary
  7242. [] :
  7243. // ...otherwise use results directly
  7244. results :
  7245. matcherIn;
  7246. // Find primary matches
  7247. if ( matcher ) {
  7248. matcher( matcherIn, matcherOut, context, xml );
  7249. }
  7250. // Apply postFilter
  7251. if ( postFilter ) {
  7252. temp = condense( matcherOut, postMap );
  7253. postFilter( temp, [], context, xml );
  7254. // Un-match failing elements by moving them back to matcherIn
  7255. i = temp.length;
  7256. while ( i-- ) {
  7257. if ( ( elem = temp[ i ] ) ) {
  7258. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  7259. }
  7260. }
  7261. }
  7262. if ( seed ) {
  7263. if ( postFinder || preFilter ) {
  7264. if ( postFinder ) {
  7265. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  7266. temp = [];
  7267. i = matcherOut.length;
  7268. while ( i-- ) {
  7269. if ( ( elem = matcherOut[ i ] ) ) {
  7270. // Restore matcherIn since elem is not yet a final match
  7271. temp.push( ( matcherIn[ i ] = elem ) );
  7272. }
  7273. }
  7274. postFinder( null, ( matcherOut = [] ), temp, xml );
  7275. }
  7276. // Move matched elements from seed to results to keep them synchronized
  7277. i = matcherOut.length;
  7278. while ( i-- ) {
  7279. if ( ( elem = matcherOut[ i ] ) &&
  7280. ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
  7281. seed[ temp ] = !( results[ temp ] = elem );
  7282. }
  7283. }
  7284. }
  7285. // Add elements to results, through postFinder if defined
  7286. } else {
  7287. matcherOut = condense(
  7288. matcherOut === results ?
  7289. matcherOut.splice( preexisting, matcherOut.length ) :
  7290. matcherOut
  7291. );
  7292. if ( postFinder ) {
  7293. postFinder( null, results, matcherOut, xml );
  7294. } else {
  7295. push.apply( results, matcherOut );
  7296. }
  7297. }
  7298. } );
  7299. }
  7300. function matcherFromTokens( tokens ) {
  7301. var checkContext, matcher, j,
  7302. len = tokens.length,
  7303. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  7304. implicitRelative = leadingRelative || Expr.relative[ " " ],
  7305. i = leadingRelative ? 1 : 0,
  7306. // The foundational matcher ensures that elements are reachable from top-level context(s)
  7307. matchContext = addCombinator( function( elem ) {
  7308. return elem === checkContext;
  7309. }, implicitRelative, true ),
  7310. matchAnyContext = addCombinator( function( elem ) {
  7311. return indexOf( checkContext, elem ) > -1;
  7312. }, implicitRelative, true ),
  7313. matchers = [ function( elem, context, xml ) {
  7314. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  7315. ( checkContext = context ).nodeType ?
  7316. matchContext( elem, context, xml ) :
  7317. matchAnyContext( elem, context, xml ) );
  7318. // Avoid hanging onto element (issue #299)
  7319. checkContext = null;
  7320. return ret;
  7321. } ];
  7322. for ( ; i < len; i++ ) {
  7323. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  7324. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  7325. } else {
  7326. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  7327. // Return special upon seeing a positional matcher
  7328. if ( matcher[ expando ] ) {
  7329. // Find the next relative operator (if any) for proper handling
  7330. j = ++i;
  7331. for ( ; j < len; j++ ) {
  7332. if ( Expr.relative[ tokens[ j ].type ] ) {
  7333. break;
  7334. }
  7335. }
  7336. return setMatcher(
  7337. i > 1 && elementMatcher( matchers ),
  7338. i > 1 && toSelector(
  7339. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  7340. tokens
  7341. .slice( 0, i - 1 )
  7342. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  7343. ).replace( rtrim, "$1" ),
  7344. matcher,
  7345. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  7346. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  7347. j < len && toSelector( tokens )
  7348. );
  7349. }
  7350. matchers.push( matcher );
  7351. }
  7352. }
  7353. return elementMatcher( matchers );
  7354. }
  7355. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  7356. var bySet = setMatchers.length > 0,
  7357. byElement = elementMatchers.length > 0,
  7358. superMatcher = function( seed, context, xml, results, outermost ) {
  7359. var elem, j, matcher,
  7360. matchedCount = 0,
  7361. i = "0",
  7362. unmatched = seed && [],
  7363. setMatched = [],
  7364. contextBackup = outermostContext,
  7365. // We must always have either seed elements or outermost context
  7366. elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
  7367. // Use integer dirruns iff this is the outermost matcher
  7368. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  7369. len = elems.length;
  7370. if ( outermost ) {
  7371. // Support: IE 11+, Edge 17 - 18+
  7372. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  7373. // two documents; shallow comparisons work.
  7374. // eslint-disable-next-line eqeqeq
  7375. outermostContext = context == document || context || outermost;
  7376. }
  7377. // Add elements passing elementMatchers directly to results
  7378. // Support: IE<9, Safari
  7379. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  7380. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  7381. if ( byElement && elem ) {
  7382. j = 0;
  7383. // Support: IE 11+, Edge 17 - 18+
  7384. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  7385. // two documents; shallow comparisons work.
  7386. // eslint-disable-next-line eqeqeq
  7387. if ( !context && elem.ownerDocument != document ) {
  7388. setDocument( elem );
  7389. xml = !documentIsHTML;
  7390. }
  7391. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  7392. if ( matcher( elem, context || document, xml ) ) {
  7393. results.push( elem );
  7394. break;
  7395. }
  7396. }
  7397. if ( outermost ) {
  7398. dirruns = dirrunsUnique;
  7399. }
  7400. }
  7401. // Track unmatched elements for set filters
  7402. if ( bySet ) {
  7403. // They will have gone through all possible matchers
  7404. if ( ( elem = !matcher && elem ) ) {
  7405. matchedCount--;
  7406. }
  7407. // Lengthen the array for every element, matched or not
  7408. if ( seed ) {
  7409. unmatched.push( elem );
  7410. }
  7411. }
  7412. }
  7413. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  7414. // makes the latter nonnegative.
  7415. matchedCount += i;
  7416. // Apply set filters to unmatched elements
  7417. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  7418. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  7419. // no element matchers and no seed.
  7420. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  7421. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  7422. // numerically zero.
  7423. if ( bySet && i !== matchedCount ) {
  7424. j = 0;
  7425. while ( ( matcher = setMatchers[ j++ ] ) ) {
  7426. matcher( unmatched, setMatched, context, xml );
  7427. }
  7428. if ( seed ) {
  7429. // Reintegrate element matches to eliminate the need for sorting
  7430. if ( matchedCount > 0 ) {
  7431. while ( i-- ) {
  7432. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  7433. setMatched[ i ] = pop.call( results );
  7434. }
  7435. }
  7436. }
  7437. // Discard index placeholder values to get only actual matches
  7438. setMatched = condense( setMatched );
  7439. }
  7440. // Add matches to results
  7441. push.apply( results, setMatched );
  7442. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  7443. if ( outermost && !seed && setMatched.length > 0 &&
  7444. ( matchedCount + setMatchers.length ) > 1 ) {
  7445. Sizzle.uniqueSort( results );
  7446. }
  7447. }
  7448. // Override manipulation of globals by nested matchers
  7449. if ( outermost ) {
  7450. dirruns = dirrunsUnique;
  7451. outermostContext = contextBackup;
  7452. }
  7453. return unmatched;
  7454. };
  7455. return bySet ?
  7456. markFunction( superMatcher ) :
  7457. superMatcher;
  7458. }
  7459. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  7460. var i,
  7461. setMatchers = [],
  7462. elementMatchers = [],
  7463. cached = compilerCache[ selector + " " ];
  7464. if ( !cached ) {
  7465. // Generate a function of recursive functions that can be used to check each element
  7466. if ( !match ) {
  7467. match = tokenize( selector );
  7468. }
  7469. i = match.length;
  7470. while ( i-- ) {
  7471. cached = matcherFromTokens( match[ i ] );
  7472. if ( cached[ expando ] ) {
  7473. setMatchers.push( cached );
  7474. } else {
  7475. elementMatchers.push( cached );
  7476. }
  7477. }
  7478. // Cache the compiled function
  7479. cached = compilerCache(
  7480. selector,
  7481. matcherFromGroupMatchers( elementMatchers, setMatchers )
  7482. );
  7483. // Save selector and tokenization
  7484. cached.selector = selector;
  7485. }
  7486. return cached;
  7487. };
  7488. /**
  7489. * A low-level selection function that works with Sizzle's compiled
  7490. * selector functions
  7491. * @param {String|Function} selector A selector or a pre-compiled
  7492. * selector function built with Sizzle.compile
  7493. * @param {Element} context
  7494. * @param {Array} [results]
  7495. * @param {Array} [seed] A set of elements to match against
  7496. */
  7497. select = Sizzle.select = function( selector, context, results, seed ) {
  7498. var i, tokens, token, type, find,
  7499. compiled = typeof selector === "function" && selector,
  7500. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  7501. results = results || [];
  7502. // Try to minimize operations if there is only one selector in the list and no seed
  7503. // (the latter of which guarantees us context)
  7504. if ( match.length === 1 ) {
  7505. // Reduce context if the leading compound selector is an ID
  7506. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  7507. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  7508. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  7509. context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
  7510. .replace( runescape, funescape ), context ) || [] )[ 0 ];
  7511. if ( !context ) {
  7512. return results;
  7513. // Precompiled matchers will still verify ancestry, so step up a level
  7514. } else if ( compiled ) {
  7515. context = context.parentNode;
  7516. }
  7517. selector = selector.slice( tokens.shift().value.length );
  7518. }
  7519. // Fetch a seed set for right-to-left matching
  7520. i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
  7521. while ( i-- ) {
  7522. token = tokens[ i ];
  7523. // Abort if we hit a combinator
  7524. if ( Expr.relative[ ( type = token.type ) ] ) {
  7525. break;
  7526. }
  7527. if ( ( find = Expr.find[ type ] ) ) {
  7528. // Search, expanding context for leading sibling combinators
  7529. if ( ( seed = find(
  7530. token.matches[ 0 ].replace( runescape, funescape ),
  7531. rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
  7532. context
  7533. ) ) ) {
  7534. // If seed is empty or no tokens remain, we can return early
  7535. tokens.splice( i, 1 );
  7536. selector = seed.length && toSelector( tokens );
  7537. if ( !selector ) {
  7538. push.apply( results, seed );
  7539. return results;
  7540. }
  7541. break;
  7542. }
  7543. }
  7544. }
  7545. }
  7546. // Compile and execute a filtering function if one is not provided
  7547. // Provide `match` to avoid retokenization if we modified the selector above
  7548. ( compiled || compile( selector, match ) )(
  7549. seed,
  7550. context,
  7551. !documentIsHTML,
  7552. results,
  7553. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  7554. );
  7555. return results;
  7556. };
  7557. // One-time assignments
  7558. // Sort stability
  7559. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  7560. // Support: Chrome 14-35+
  7561. // Always assume duplicates if they aren't passed to the comparison function
  7562. support.detectDuplicates = !!hasDuplicate;
  7563. // Initialize against the default document
  7564. setDocument();
  7565. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  7566. // Detached nodes confoundingly follow *each other*
  7567. support.sortDetached = assert( function( el ) {
  7568. // Should return 1, but returns 4 (following)
  7569. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  7570. } );
  7571. // Support: IE<8
  7572. // Prevent attribute/property "interpolation"
  7573. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7574. if ( !assert( function( el ) {
  7575. el.innerHTML = "<a href='#'></a>";
  7576. return el.firstChild.getAttribute( "href" ) === "#";
  7577. } ) ) {
  7578. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  7579. if ( !isXML ) {
  7580. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  7581. }
  7582. } );
  7583. }
  7584. // Support: IE<9
  7585. // Use defaultValue in place of getAttribute("value")
  7586. if ( !support.attributes || !assert( function( el ) {
  7587. el.innerHTML = "<input/>";
  7588. el.firstChild.setAttribute( "value", "" );
  7589. return el.firstChild.getAttribute( "value" ) === "";
  7590. } ) ) {
  7591. addHandle( "value", function( elem, _name, isXML ) {
  7592. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  7593. return elem.defaultValue;
  7594. }
  7595. } );
  7596. }
  7597. // Support: IE<9
  7598. // Use getAttributeNode to fetch booleans when getAttribute lies
  7599. if ( !assert( function( el ) {
  7600. return el.getAttribute( "disabled" ) == null;
  7601. } ) ) {
  7602. addHandle( booleans, function( elem, name, isXML ) {
  7603. var val;
  7604. if ( !isXML ) {
  7605. return elem[ name ] === true ? name.toLowerCase() :
  7606. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  7607. val.value :
  7608. null;
  7609. }
  7610. } );
  7611. }
  7612. return Sizzle;
  7613. } )( window );
  7614. jQuery.find = Sizzle;
  7615. jQuery.expr = Sizzle.selectors;
  7616. // Deprecated
  7617. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  7618. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  7619. jQuery.text = Sizzle.getText;
  7620. jQuery.isXMLDoc = Sizzle.isXML;
  7621. jQuery.contains = Sizzle.contains;
  7622. jQuery.escapeSelector = Sizzle.escape;
  7623. var dir = function( elem, dir, until ) {
  7624. var matched = [],
  7625. truncate = until !== undefined;
  7626. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  7627. if ( elem.nodeType === 1 ) {
  7628. if ( truncate && jQuery( elem ).is( until ) ) {
  7629. break;
  7630. }
  7631. matched.push( elem );
  7632. }
  7633. }
  7634. return matched;
  7635. };
  7636. var siblings = function( n, elem ) {
  7637. var matched = [];
  7638. for ( ; n; n = n.nextSibling ) {
  7639. if ( n.nodeType === 1 && n !== elem ) {
  7640. matched.push( n );
  7641. }
  7642. }
  7643. return matched;
  7644. };
  7645. var rneedsContext = jQuery.expr.match.needsContext;
  7646. function nodeName( elem, name ) {
  7647. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  7648. };
  7649. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  7650. // Implement the identical functionality for filter and not
  7651. function winnow( elements, qualifier, not ) {
  7652. if ( isFunction( qualifier ) ) {
  7653. return jQuery.grep( elements, function( elem, i ) {
  7654. return !!qualifier.call( elem, i, elem ) !== not;
  7655. } );
  7656. }
  7657. // Single element
  7658. if ( qualifier.nodeType ) {
  7659. return jQuery.grep( elements, function( elem ) {
  7660. return ( elem === qualifier ) !== not;
  7661. } );
  7662. }
  7663. // Arraylike of elements (jQuery, arguments, Array)
  7664. if ( typeof qualifier !== "string" ) {
  7665. return jQuery.grep( elements, function( elem ) {
  7666. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  7667. } );
  7668. }
  7669. // Filtered directly for both simple and complex selectors
  7670. return jQuery.filter( qualifier, elements, not );
  7671. }
  7672. jQuery.filter = function( expr, elems, not ) {
  7673. var elem = elems[ 0 ];
  7674. if ( not ) {
  7675. expr = ":not(" + expr + ")";
  7676. }
  7677. if ( elems.length === 1 && elem.nodeType === 1 ) {
  7678. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  7679. }
  7680. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  7681. return elem.nodeType === 1;
  7682. } ) );
  7683. };
  7684. jQuery.fn.extend( {
  7685. find: function( selector ) {
  7686. var i, ret,
  7687. len = this.length,
  7688. self = this;
  7689. if ( typeof selector !== "string" ) {
  7690. return this.pushStack( jQuery( selector ).filter( function() {
  7691. for ( i = 0; i < len; i++ ) {
  7692. if ( jQuery.contains( self[ i ], this ) ) {
  7693. return true;
  7694. }
  7695. }
  7696. } ) );
  7697. }
  7698. ret = this.pushStack( [] );
  7699. for ( i = 0; i < len; i++ ) {
  7700. jQuery.find( selector, self[ i ], ret );
  7701. }
  7702. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  7703. },
  7704. filter: function( selector ) {
  7705. return this.pushStack( winnow( this, selector || [], false ) );
  7706. },
  7707. not: function( selector ) {
  7708. return this.pushStack( winnow( this, selector || [], true ) );
  7709. },
  7710. is: function( selector ) {
  7711. return !!winnow(
  7712. this,
  7713. // If this is a positional/relative selector, check membership in the returned set
  7714. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  7715. typeof selector === "string" && rneedsContext.test( selector ) ?
  7716. jQuery( selector ) :
  7717. selector || [],
  7718. false
  7719. ).length;
  7720. }
  7721. } );
  7722. // Initialize a jQuery object
  7723. // A central reference to the root jQuery(document)
  7724. var rootjQuery,
  7725. // A simple way to check for HTML strings
  7726. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  7727. // Strict HTML recognition (#11290: must start with <)
  7728. // Shortcut simple #id case for speed
  7729. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  7730. init = jQuery.fn.init = function( selector, context, root ) {
  7731. var match, elem;
  7732. // HANDLE: $(""), $(null), $(undefined), $(false)
  7733. if ( !selector ) {
  7734. return this;
  7735. }
  7736. // Method init() accepts an alternate rootjQuery
  7737. // so migrate can support jQuery.sub (gh-2101)
  7738. root = root || rootjQuery;
  7739. // Handle HTML strings
  7740. if ( typeof selector === "string" ) {
  7741. if ( selector[ 0 ] === "<" &&
  7742. selector[ selector.length - 1 ] === ">" &&
  7743. selector.length >= 3 ) {
  7744. // Assume that strings that start and end with <> are HTML and skip the regex check
  7745. match = [ null, selector, null ];
  7746. } else {
  7747. match = rquickExpr.exec( selector );
  7748. }
  7749. // Match html or make sure no context is specified for #id
  7750. if ( match && ( match[ 1 ] || !context ) ) {
  7751. // HANDLE: $(html) -> $(array)
  7752. if ( match[ 1 ] ) {
  7753. context = context instanceof jQuery ? context[ 0 ] : context;
  7754. // Option to run scripts is true for back-compat
  7755. // Intentionally let the error be thrown if parseHTML is not present
  7756. jQuery.merge( this, jQuery.parseHTML(
  7757. match[ 1 ],
  7758. context && context.nodeType ? context.ownerDocument || context : document,
  7759. true
  7760. ) );
  7761. // HANDLE: $(html, props)
  7762. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  7763. for ( match in context ) {
  7764. // Properties of context are called as methods if possible
  7765. if ( isFunction( this[ match ] ) ) {
  7766. this[ match ]( context[ match ] );
  7767. // ...and otherwise set as attributes
  7768. } else {
  7769. this.attr( match, context[ match ] );
  7770. }
  7771. }
  7772. }
  7773. return this;
  7774. // HANDLE: $(#id)
  7775. } else {
  7776. elem = document.getElementById( match[ 2 ] );
  7777. if ( elem ) {
  7778. // Inject the element directly into the jQuery object
  7779. this[ 0 ] = elem;
  7780. this.length = 1;
  7781. }
  7782. return this;
  7783. }
  7784. // HANDLE: $(expr, $(...))
  7785. } else if ( !context || context.jquery ) {
  7786. return ( context || root ).find( selector );
  7787. // HANDLE: $(expr, context)
  7788. // (which is just equivalent to: $(context).find(expr)
  7789. } else {
  7790. return this.constructor( context ).find( selector );
  7791. }
  7792. // HANDLE: $(DOMElement)
  7793. } else if ( selector.nodeType ) {
  7794. this[ 0 ] = selector;
  7795. this.length = 1;
  7796. return this;
  7797. // HANDLE: $(function)
  7798. // Shortcut for document ready
  7799. } else if ( isFunction( selector ) ) {
  7800. return root.ready !== undefined ?
  7801. root.ready( selector ) :
  7802. // Execute immediately if ready is not present
  7803. selector( jQuery );
  7804. }
  7805. return jQuery.makeArray( selector, this );
  7806. };
  7807. // Give the init function the jQuery prototype for later instantiation
  7808. init.prototype = jQuery.fn;
  7809. // Initialize central reference
  7810. rootjQuery = jQuery( document );
  7811. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  7812. // Methods guaranteed to produce a unique set when starting from a unique set
  7813. guaranteedUnique = {
  7814. children: true,
  7815. contents: true,
  7816. next: true,
  7817. prev: true
  7818. };
  7819. jQuery.fn.extend( {
  7820. has: function( target ) {
  7821. var targets = jQuery( target, this ),
  7822. l = targets.length;
  7823. return this.filter( function() {
  7824. var i = 0;
  7825. for ( ; i < l; i++ ) {
  7826. if ( jQuery.contains( this, targets[ i ] ) ) {
  7827. return true;
  7828. }
  7829. }
  7830. } );
  7831. },
  7832. closest: function( selectors, context ) {
  7833. var cur,
  7834. i = 0,
  7835. l = this.length,
  7836. matched = [],
  7837. targets = typeof selectors !== "string" && jQuery( selectors );
  7838. // Positional selectors never match, since there's no _selection_ context
  7839. if ( !rneedsContext.test( selectors ) ) {
  7840. for ( ; i < l; i++ ) {
  7841. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  7842. // Always skip document fragments
  7843. if ( cur.nodeType < 11 && ( targets ?
  7844. targets.index( cur ) > -1 :
  7845. // Don't pass non-elements to Sizzle
  7846. cur.nodeType === 1 &&
  7847. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  7848. matched.push( cur );
  7849. break;
  7850. }
  7851. }
  7852. }
  7853. }
  7854. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  7855. },
  7856. // Determine the position of an element within the set
  7857. index: function( elem ) {
  7858. // No argument, return index in parent
  7859. if ( !elem ) {
  7860. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  7861. }
  7862. // Index in selector
  7863. if ( typeof elem === "string" ) {
  7864. return indexOf.call( jQuery( elem ), this[ 0 ] );
  7865. }
  7866. // Locate the position of the desired element
  7867. return indexOf.call( this,
  7868. // If it receives a jQuery object, the first element is used
  7869. elem.jquery ? elem[ 0 ] : elem
  7870. );
  7871. },
  7872. add: function( selector, context ) {
  7873. return this.pushStack(
  7874. jQuery.uniqueSort(
  7875. jQuery.merge( this.get(), jQuery( selector, context ) )
  7876. )
  7877. );
  7878. },
  7879. addBack: function( selector ) {
  7880. return this.add( selector == null ?
  7881. this.prevObject : this.prevObject.filter( selector )
  7882. );
  7883. }
  7884. } );
  7885. function sibling( cur, dir ) {
  7886. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  7887. return cur;
  7888. }
  7889. jQuery.each( {
  7890. parent: function( elem ) {
  7891. var parent = elem.parentNode;
  7892. return parent && parent.nodeType !== 11 ? parent : null;
  7893. },
  7894. parents: function( elem ) {
  7895. return dir( elem, "parentNode" );
  7896. },
  7897. parentsUntil: function( elem, _i, until ) {
  7898. return dir( elem, "parentNode", until );
  7899. },
  7900. next: function( elem ) {
  7901. return sibling( elem, "nextSibling" );
  7902. },
  7903. prev: function( elem ) {
  7904. return sibling( elem, "previousSibling" );
  7905. },
  7906. nextAll: function( elem ) {
  7907. return dir( elem, "nextSibling" );
  7908. },
  7909. prevAll: function( elem ) {
  7910. return dir( elem, "previousSibling" );
  7911. },
  7912. nextUntil: function( elem, _i, until ) {
  7913. return dir( elem, "nextSibling", until );
  7914. },
  7915. prevUntil: function( elem, _i, until ) {
  7916. return dir( elem, "previousSibling", until );
  7917. },
  7918. siblings: function( elem ) {
  7919. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  7920. },
  7921. children: function( elem ) {
  7922. return siblings( elem.firstChild );
  7923. },
  7924. contents: function( elem ) {
  7925. if ( elem.contentDocument != null &&
  7926. // Support: IE 11+
  7927. // <object> elements with no `data` attribute has an object
  7928. // `contentDocument` with a `null` prototype.
  7929. getProto( elem.contentDocument ) ) {
  7930. return elem.contentDocument;
  7931. }
  7932. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  7933. // Treat the template element as a regular one in browsers that
  7934. // don't support it.
  7935. if ( nodeName( elem, "template" ) ) {
  7936. elem = elem.content || elem;
  7937. }
  7938. return jQuery.merge( [], elem.childNodes );
  7939. }
  7940. }, function( name, fn ) {
  7941. jQuery.fn[ name ] = function( until, selector ) {
  7942. var matched = jQuery.map( this, fn, until );
  7943. if ( name.slice( -5 ) !== "Until" ) {
  7944. selector = until;
  7945. }
  7946. if ( selector && typeof selector === "string" ) {
  7947. matched = jQuery.filter( selector, matched );
  7948. }
  7949. if ( this.length > 1 ) {
  7950. // Remove duplicates
  7951. if ( !guaranteedUnique[ name ] ) {
  7952. jQuery.uniqueSort( matched );
  7953. }
  7954. // Reverse order for parents* and prev-derivatives
  7955. if ( rparentsprev.test( name ) ) {
  7956. matched.reverse();
  7957. }
  7958. }
  7959. return this.pushStack( matched );
  7960. };
  7961. } );
  7962. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  7963. // Convert String-formatted options into Object-formatted ones
  7964. function createOptions( options ) {
  7965. var object = {};
  7966. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  7967. object[ flag ] = true;
  7968. } );
  7969. return object;
  7970. }
  7971. /*
  7972. * Create a callback list using the following parameters:
  7973. *
  7974. * options: an optional list of space-separated options that will change how
  7975. * the callback list behaves or a more traditional option object
  7976. *
  7977. * By default a callback list will act like an event callback list and can be
  7978. * "fired" multiple times.
  7979. *
  7980. * Possible options:
  7981. *
  7982. * once: will ensure the callback list can only be fired once (like a Deferred)
  7983. *
  7984. * memory: will keep track of previous values and will call any callback added
  7985. * after the list has been fired right away with the latest "memorized"
  7986. * values (like a Deferred)
  7987. *
  7988. * unique: will ensure a callback can only be added once (no duplicate in the list)
  7989. *
  7990. * stopOnFalse: interrupt callings when a callback returns false
  7991. *
  7992. */
  7993. jQuery.Callbacks = function( options ) {
  7994. // Convert options from String-formatted to Object-formatted if needed
  7995. // (we check in cache first)
  7996. options = typeof options === "string" ?
  7997. createOptions( options ) :
  7998. jQuery.extend( {}, options );
  7999. var // Flag to know if list is currently firing
  8000. firing,
  8001. // Last fire value for non-forgettable lists
  8002. memory,
  8003. // Flag to know if list was already fired
  8004. fired,
  8005. // Flag to prevent firing
  8006. locked,
  8007. // Actual callback list
  8008. list = [],
  8009. // Queue of execution data for repeatable lists
  8010. queue = [],
  8011. // Index of currently firing callback (modified by add/remove as needed)
  8012. firingIndex = -1,
  8013. // Fire callbacks
  8014. fire = function() {
  8015. // Enforce single-firing
  8016. locked = locked || options.once;
  8017. // Execute callbacks for all pending executions,
  8018. // respecting firingIndex overrides and runtime changes
  8019. fired = firing = true;
  8020. for ( ; queue.length; firingIndex = -1 ) {
  8021. memory = queue.shift();
  8022. while ( ++firingIndex < list.length ) {
  8023. // Run callback and check for early termination
  8024. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  8025. options.stopOnFalse ) {
  8026. // Jump to end and forget the data so .add doesn't re-fire
  8027. firingIndex = list.length;
  8028. memory = false;
  8029. }
  8030. }
  8031. }
  8032. // Forget the data if we're done with it
  8033. if ( !options.memory ) {
  8034. memory = false;
  8035. }
  8036. firing = false;
  8037. // Clean up if we're done firing for good
  8038. if ( locked ) {
  8039. // Keep an empty list if we have data for future add calls
  8040. if ( memory ) {
  8041. list = [];
  8042. // Otherwise, this object is spent
  8043. } else {
  8044. list = "";
  8045. }
  8046. }
  8047. },
  8048. // Actual Callbacks object
  8049. self = {
  8050. // Add a callback or a collection of callbacks to the list
  8051. add: function() {
  8052. if ( list ) {
  8053. // If we have memory from a past run, we should fire after adding
  8054. if ( memory && !firing ) {
  8055. firingIndex = list.length - 1;
  8056. queue.push( memory );
  8057. }
  8058. ( function add( args ) {
  8059. jQuery.each( args, function( _, arg ) {
  8060. if ( isFunction( arg ) ) {
  8061. if ( !options.unique || !self.has( arg ) ) {
  8062. list.push( arg );
  8063. }
  8064. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  8065. // Inspect recursively
  8066. add( arg );
  8067. }
  8068. } );
  8069. } )( arguments );
  8070. if ( memory && !firing ) {
  8071. fire();
  8072. }
  8073. }
  8074. return this;
  8075. },
  8076. // Remove a callback from the list
  8077. remove: function() {
  8078. jQuery.each( arguments, function( _, arg ) {
  8079. var index;
  8080. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  8081. list.splice( index, 1 );
  8082. // Handle firing indexes
  8083. if ( index <= firingIndex ) {
  8084. firingIndex--;
  8085. }
  8086. }
  8087. } );
  8088. return this;
  8089. },
  8090. // Check if a given callback is in the list.
  8091. // If no argument is given, return whether or not list has callbacks attached.
  8092. has: function( fn ) {
  8093. return fn ?
  8094. jQuery.inArray( fn, list ) > -1 :
  8095. list.length > 0;
  8096. },
  8097. // Remove all callbacks from the list
  8098. empty: function() {
  8099. if ( list ) {
  8100. list = [];
  8101. }
  8102. return this;
  8103. },
  8104. // Disable .fire and .add
  8105. // Abort any current/pending executions
  8106. // Clear all callbacks and values
  8107. disable: function() {
  8108. locked = queue = [];
  8109. list = memory = "";
  8110. return this;
  8111. },
  8112. disabled: function() {
  8113. return !list;
  8114. },
  8115. // Disable .fire
  8116. // Also disable .add unless we have memory (since it would have no effect)
  8117. // Abort any pending executions
  8118. lock: function() {
  8119. locked = queue = [];
  8120. if ( !memory && !firing ) {
  8121. list = memory = "";
  8122. }
  8123. return this;
  8124. },
  8125. locked: function() {
  8126. return !!locked;
  8127. },
  8128. // Call all callbacks with the given context and arguments
  8129. fireWith: function( context, args ) {
  8130. if ( !locked ) {
  8131. args = args || [];
  8132. args = [ context, args.slice ? args.slice() : args ];
  8133. queue.push( args );
  8134. if ( !firing ) {
  8135. fire();
  8136. }
  8137. }
  8138. return this;
  8139. },
  8140. // Call all the callbacks with the given arguments
  8141. fire: function() {
  8142. self.fireWith( this, arguments );
  8143. return this;
  8144. },
  8145. // To know if the callbacks have already been called at least once
  8146. fired: function() {
  8147. return !!fired;
  8148. }
  8149. };
  8150. return self;
  8151. };
  8152. function Identity( v ) {
  8153. return v;
  8154. }
  8155. function Thrower( ex ) {
  8156. throw ex;
  8157. }
  8158. function adoptValue( value, resolve, reject, noValue ) {
  8159. var method;
  8160. try {
  8161. // Check for promise aspect first to privilege synchronous behavior
  8162. if ( value && isFunction( ( method = value.promise ) ) ) {
  8163. method.call( value ).done( resolve ).fail( reject );
  8164. // Other thenables
  8165. } else if ( value && isFunction( ( method = value.then ) ) ) {
  8166. method.call( value, resolve, reject );
  8167. // Other non-thenables
  8168. } else {
  8169. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  8170. // * false: [ value ].slice( 0 ) => resolve( value )
  8171. // * true: [ value ].slice( 1 ) => resolve()
  8172. resolve.apply( undefined, [ value ].slice( noValue ) );
  8173. }
  8174. // For Promises/A+, convert exceptions into rejections
  8175. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  8176. // Deferred#then to conditionally suppress rejection.
  8177. } catch ( value ) {
  8178. // Support: Android 4.0 only
  8179. // Strict mode functions invoked without .call/.apply get global-object context
  8180. reject.apply( undefined, [ value ] );
  8181. }
  8182. }
  8183. jQuery.extend( {
  8184. Deferred: function( func ) {
  8185. var tuples = [
  8186. // action, add listener, callbacks,
  8187. // ... .then handlers, argument index, [final state]
  8188. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  8189. jQuery.Callbacks( "memory" ), 2 ],
  8190. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  8191. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  8192. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  8193. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  8194. ],
  8195. state = "pending",
  8196. promise = {
  8197. state: function() {
  8198. return state;
  8199. },
  8200. always: function() {
  8201. deferred.done( arguments ).fail( arguments );
  8202. return this;
  8203. },
  8204. "catch": function( fn ) {
  8205. return promise.then( null, fn );
  8206. },
  8207. // Keep pipe for back-compat
  8208. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  8209. var fns = arguments;
  8210. return jQuery.Deferred( function( newDefer ) {
  8211. jQuery.each( tuples, function( _i, tuple ) {
  8212. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  8213. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  8214. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  8215. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  8216. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  8217. deferred[ tuple[ 1 ] ]( function() {
  8218. var returned = fn && fn.apply( this, arguments );
  8219. if ( returned && isFunction( returned.promise ) ) {
  8220. returned.promise()
  8221. .progress( newDefer.notify )
  8222. .done( newDefer.resolve )
  8223. .fail( newDefer.reject );
  8224. } else {
  8225. newDefer[ tuple[ 0 ] + "With" ](
  8226. this,
  8227. fn ? [ returned ] : arguments
  8228. );
  8229. }
  8230. } );
  8231. } );
  8232. fns = null;
  8233. } ).promise();
  8234. },
  8235. then: function( onFulfilled, onRejected, onProgress ) {
  8236. var maxDepth = 0;
  8237. function resolve( depth, deferred, handler, special ) {
  8238. return function() {
  8239. var that = this,
  8240. args = arguments,
  8241. mightThrow = function() {
  8242. var returned, then;
  8243. // Support: Promises/A+ section 2.3.3.3.3
  8244. // https://promisesaplus.com/#point-59
  8245. // Ignore double-resolution attempts
  8246. if ( depth < maxDepth ) {
  8247. return;
  8248. }
  8249. returned = handler.apply( that, args );
  8250. // Support: Promises/A+ section 2.3.1
  8251. // https://promisesaplus.com/#point-48
  8252. if ( returned === deferred.promise() ) {
  8253. throw new TypeError( "Thenable self-resolution" );
  8254. }
  8255. // Support: Promises/A+ sections 2.3.3.1, 3.5
  8256. // https://promisesaplus.com/#point-54
  8257. // https://promisesaplus.com/#point-75
  8258. // Retrieve `then` only once
  8259. then = returned &&
  8260. // Support: Promises/A+ section 2.3.4
  8261. // https://promisesaplus.com/#point-64
  8262. // Only check objects and functions for thenability
  8263. ( typeof returned === "object" ||
  8264. typeof returned === "function" ) &&
  8265. returned.then;
  8266. // Handle a returned thenable
  8267. if ( isFunction( then ) ) {
  8268. // Special processors (notify) just wait for resolution
  8269. if ( special ) {
  8270. then.call(
  8271. returned,
  8272. resolve( maxDepth, deferred, Identity, special ),
  8273. resolve( maxDepth, deferred, Thrower, special )
  8274. );
  8275. // Normal processors (resolve) also hook into progress
  8276. } else {
  8277. // ...and disregard older resolution values
  8278. maxDepth++;
  8279. then.call(
  8280. returned,
  8281. resolve( maxDepth, deferred, Identity, special ),
  8282. resolve( maxDepth, deferred, Thrower, special ),
  8283. resolve( maxDepth, deferred, Identity,
  8284. deferred.notifyWith )
  8285. );
  8286. }
  8287. // Handle all other returned values
  8288. } else {
  8289. // Only substitute handlers pass on context
  8290. // and multiple values (non-spec behavior)
  8291. if ( handler !== Identity ) {
  8292. that = undefined;
  8293. args = [ returned ];
  8294. }
  8295. // Process the value(s)
  8296. // Default process is resolve
  8297. ( special || deferred.resolveWith )( that, args );
  8298. }
  8299. },
  8300. // Only normal processors (resolve) catch and reject exceptions
  8301. process = special ?
  8302. mightThrow :
  8303. function() {
  8304. try {
  8305. mightThrow();
  8306. } catch ( e ) {
  8307. if ( jQuery.Deferred.exceptionHook ) {
  8308. jQuery.Deferred.exceptionHook( e,
  8309. process.stackTrace );
  8310. }
  8311. // Support: Promises/A+ section 2.3.3.3.4.1
  8312. // https://promisesaplus.com/#point-61
  8313. // Ignore post-resolution exceptions
  8314. if ( depth + 1 >= maxDepth ) {
  8315. // Only substitute handlers pass on context
  8316. // and multiple values (non-spec behavior)
  8317. if ( handler !== Thrower ) {
  8318. that = undefined;
  8319. args = [ e ];
  8320. }
  8321. deferred.rejectWith( that, args );
  8322. }
  8323. }
  8324. };
  8325. // Support: Promises/A+ section 2.3.3.3.1
  8326. // https://promisesaplus.com/#point-57
  8327. // Re-resolve promises immediately to dodge false rejection from
  8328. // subsequent errors
  8329. if ( depth ) {
  8330. process();
  8331. } else {
  8332. // Call an optional hook to record the stack, in case of exception
  8333. // since it's otherwise lost when execution goes async
  8334. if ( jQuery.Deferred.getStackHook ) {
  8335. process.stackTrace = jQuery.Deferred.getStackHook();
  8336. }
  8337. window.setTimeout( process );
  8338. }
  8339. };
  8340. }
  8341. return jQuery.Deferred( function( newDefer ) {
  8342. // progress_handlers.add( ... )
  8343. tuples[ 0 ][ 3 ].add(
  8344. resolve(
  8345. 0,
  8346. newDefer,
  8347. isFunction( onProgress ) ?
  8348. onProgress :
  8349. Identity,
  8350. newDefer.notifyWith
  8351. )
  8352. );
  8353. // fulfilled_handlers.add( ... )
  8354. tuples[ 1 ][ 3 ].add(
  8355. resolve(
  8356. 0,
  8357. newDefer,
  8358. isFunction( onFulfilled ) ?
  8359. onFulfilled :
  8360. Identity
  8361. )
  8362. );
  8363. // rejected_handlers.add( ... )
  8364. tuples[ 2 ][ 3 ].add(
  8365. resolve(
  8366. 0,
  8367. newDefer,
  8368. isFunction( onRejected ) ?
  8369. onRejected :
  8370. Thrower
  8371. )
  8372. );
  8373. } ).promise();
  8374. },
  8375. // Get a promise for this deferred
  8376. // If obj is provided, the promise aspect is added to the object
  8377. promise: function( obj ) {
  8378. return obj != null ? jQuery.extend( obj, promise ) : promise;
  8379. }
  8380. },
  8381. deferred = {};
  8382. // Add list-specific methods
  8383. jQuery.each( tuples, function( i, tuple ) {
  8384. var list = tuple[ 2 ],
  8385. stateString = tuple[ 5 ];
  8386. // promise.progress = list.add
  8387. // promise.done = list.add
  8388. // promise.fail = list.add
  8389. promise[ tuple[ 1 ] ] = list.add;
  8390. // Handle state
  8391. if ( stateString ) {
  8392. list.add(
  8393. function() {
  8394. // state = "resolved" (i.e., fulfilled)
  8395. // state = "rejected"
  8396. state = stateString;
  8397. },
  8398. // rejected_callbacks.disable
  8399. // fulfilled_callbacks.disable
  8400. tuples[ 3 - i ][ 2 ].disable,
  8401. // rejected_handlers.disable
  8402. // fulfilled_handlers.disable
  8403. tuples[ 3 - i ][ 3 ].disable,
  8404. // progress_callbacks.lock
  8405. tuples[ 0 ][ 2 ].lock,
  8406. // progress_handlers.lock
  8407. tuples[ 0 ][ 3 ].lock
  8408. );
  8409. }
  8410. // progress_handlers.fire
  8411. // fulfilled_handlers.fire
  8412. // rejected_handlers.fire
  8413. list.add( tuple[ 3 ].fire );
  8414. // deferred.notify = function() { deferred.notifyWith(...) }
  8415. // deferred.resolve = function() { deferred.resolveWith(...) }
  8416. // deferred.reject = function() { deferred.rejectWith(...) }
  8417. deferred[ tuple[ 0 ] ] = function() {
  8418. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  8419. return this;
  8420. };
  8421. // deferred.notifyWith = list.fireWith
  8422. // deferred.resolveWith = list.fireWith
  8423. // deferred.rejectWith = list.fireWith
  8424. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  8425. } );
  8426. // Make the deferred a promise
  8427. promise.promise( deferred );
  8428. // Call given func if any
  8429. if ( func ) {
  8430. func.call( deferred, deferred );
  8431. }
  8432. // All done!
  8433. return deferred;
  8434. },
  8435. // Deferred helper
  8436. when: function( singleValue ) {
  8437. var
  8438. // count of uncompleted subordinates
  8439. remaining = arguments.length,
  8440. // count of unprocessed arguments
  8441. i = remaining,
  8442. // subordinate fulfillment data
  8443. resolveContexts = Array( i ),
  8444. resolveValues = slice.call( arguments ),
  8445. // the master Deferred
  8446. master = jQuery.Deferred(),
  8447. // subordinate callback factory
  8448. updateFunc = function( i ) {
  8449. return function( value ) {
  8450. resolveContexts[ i ] = this;
  8451. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  8452. if ( !( --remaining ) ) {
  8453. master.resolveWith( resolveContexts, resolveValues );
  8454. }
  8455. };
  8456. };
  8457. // Single- and empty arguments are adopted like Promise.resolve
  8458. if ( remaining <= 1 ) {
  8459. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  8460. !remaining );
  8461. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  8462. if ( master.state() === "pending" ||
  8463. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  8464. return master.then();
  8465. }
  8466. }
  8467. // Multiple arguments are aggregated like Promise.all array elements
  8468. while ( i-- ) {
  8469. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  8470. }
  8471. return master.promise();
  8472. }
  8473. } );
  8474. // These usually indicate a programmer mistake during development,
  8475. // warn about them ASAP rather than swallowing them by default.
  8476. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  8477. jQuery.Deferred.exceptionHook = function( error, stack ) {
  8478. // Support: IE 8 - 9 only
  8479. // Console exists when dev tools are open, which can happen at any time
  8480. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  8481. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  8482. }
  8483. };
  8484. jQuery.readyException = function( error ) {
  8485. window.setTimeout( function() {
  8486. throw error;
  8487. } );
  8488. };
  8489. // The deferred used on DOM ready
  8490. var readyList = jQuery.Deferred();
  8491. jQuery.fn.ready = function( fn ) {
  8492. readyList
  8493. .then( fn )
  8494. // Wrap jQuery.readyException in a function so that the lookup
  8495. // happens at the time of error handling instead of callback
  8496. // registration.
  8497. .catch( function( error ) {
  8498. jQuery.readyException( error );
  8499. } );
  8500. return this;
  8501. };
  8502. jQuery.extend( {
  8503. // Is the DOM ready to be used? Set to true once it occurs.
  8504. isReady: false,
  8505. // A counter to track how many items to wait for before
  8506. // the ready event fires. See #6781
  8507. readyWait: 1,
  8508. // Handle when the DOM is ready
  8509. ready: function( wait ) {
  8510. // Abort if there are pending holds or we're already ready
  8511. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  8512. return;
  8513. }
  8514. // Remember that the DOM is ready
  8515. jQuery.isReady = true;
  8516. // If a normal DOM Ready event fired, decrement, and wait if need be
  8517. if ( wait !== true && --jQuery.readyWait > 0 ) {
  8518. return;
  8519. }
  8520. // If there are functions bound, to execute
  8521. readyList.resolveWith( document, [ jQuery ] );
  8522. }
  8523. } );
  8524. jQuery.ready.then = readyList.then;
  8525. // The ready event handler and self cleanup method
  8526. function completed() {
  8527. document.removeEventListener( "DOMContentLoaded", completed );
  8528. window.removeEventListener( "load", completed );
  8529. jQuery.ready();
  8530. }
  8531. // Catch cases where $(document).ready() is called
  8532. // after the browser event has already occurred.
  8533. // Support: IE <=9 - 10 only
  8534. // Older IE sometimes signals "interactive" too soon
  8535. if ( document.readyState === "complete" ||
  8536. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  8537. // Handle it asynchronously to allow scripts the opportunity to delay ready
  8538. window.setTimeout( jQuery.ready );
  8539. } else {
  8540. // Use the handy event callback
  8541. document.addEventListener( "DOMContentLoaded", completed );
  8542. // A fallback to window.onload, that will always work
  8543. window.addEventListener( "load", completed );
  8544. }
  8545. // Multifunctional method to get and set values of a collection
  8546. // The value/s can optionally be executed if it's a function
  8547. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  8548. var i = 0,
  8549. len = elems.length,
  8550. bulk = key == null;
  8551. // Sets many values
  8552. if ( toType( key ) === "object" ) {
  8553. chainable = true;
  8554. for ( i in key ) {
  8555. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  8556. }
  8557. // Sets one value
  8558. } else if ( value !== undefined ) {
  8559. chainable = true;
  8560. if ( !isFunction( value ) ) {
  8561. raw = true;
  8562. }
  8563. if ( bulk ) {
  8564. // Bulk operations run against the entire set
  8565. if ( raw ) {
  8566. fn.call( elems, value );
  8567. fn = null;
  8568. // ...except when executing function values
  8569. } else {
  8570. bulk = fn;
  8571. fn = function( elem, _key, value ) {
  8572. return bulk.call( jQuery( elem ), value );
  8573. };
  8574. }
  8575. }
  8576. if ( fn ) {
  8577. for ( ; i < len; i++ ) {
  8578. fn(
  8579. elems[ i ], key, raw ?
  8580. value :
  8581. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  8582. );
  8583. }
  8584. }
  8585. }
  8586. if ( chainable ) {
  8587. return elems;
  8588. }
  8589. // Gets
  8590. if ( bulk ) {
  8591. return fn.call( elems );
  8592. }
  8593. return len ? fn( elems[ 0 ], key ) : emptyGet;
  8594. };
  8595. // Matches dashed string for camelizing
  8596. var rmsPrefix = /^-ms-/,
  8597. rdashAlpha = /-([a-z])/g;
  8598. // Used by camelCase as callback to replace()
  8599. function fcamelCase( _all, letter ) {
  8600. return letter.toUpperCase();
  8601. }
  8602. // Convert dashed to camelCase; used by the css and data modules
  8603. // Support: IE <=9 - 11, Edge 12 - 15
  8604. // Microsoft forgot to hump their vendor prefix (#9572)
  8605. function camelCase( string ) {
  8606. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  8607. }
  8608. var acceptData = function( owner ) {
  8609. // Accepts only:
  8610. // - Node
  8611. // - Node.ELEMENT_NODE
  8612. // - Node.DOCUMENT_NODE
  8613. // - Object
  8614. // - Any
  8615. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  8616. };
  8617. function Data() {
  8618. this.expando = jQuery.expando + Data.uid++;
  8619. }
  8620. Data.uid = 1;
  8621. Data.prototype = {
  8622. cache: function( owner ) {
  8623. // Check if the owner object already has a cache
  8624. var value = owner[ this.expando ];
  8625. // If not, create one
  8626. if ( !value ) {
  8627. value = {};
  8628. // We can accept data for non-element nodes in modern browsers,
  8629. // but we should not, see #8335.
  8630. // Always return an empty object.
  8631. if ( acceptData( owner ) ) {
  8632. // If it is a node unlikely to be stringify-ed or looped over
  8633. // use plain assignment
  8634. if ( owner.nodeType ) {
  8635. owner[ this.expando ] = value;
  8636. // Otherwise secure it in a non-enumerable property
  8637. // configurable must be true to allow the property to be
  8638. // deleted when data is removed
  8639. } else {
  8640. Object.defineProperty( owner, this.expando, {
  8641. value: value,
  8642. configurable: true
  8643. } );
  8644. }
  8645. }
  8646. }
  8647. return value;
  8648. },
  8649. set: function( owner, data, value ) {
  8650. var prop,
  8651. cache = this.cache( owner );
  8652. // Handle: [ owner, key, value ] args
  8653. // Always use camelCase key (gh-2257)
  8654. if ( typeof data === "string" ) {
  8655. cache[ camelCase( data ) ] = value;
  8656. // Handle: [ owner, { properties } ] args
  8657. } else {
  8658. // Copy the properties one-by-one to the cache object
  8659. for ( prop in data ) {
  8660. cache[ camelCase( prop ) ] = data[ prop ];
  8661. }
  8662. }
  8663. return cache;
  8664. },
  8665. get: function( owner, key ) {
  8666. return key === undefined ?
  8667. this.cache( owner ) :
  8668. // Always use camelCase key (gh-2257)
  8669. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  8670. },
  8671. access: function( owner, key, value ) {
  8672. // In cases where either:
  8673. //
  8674. // 1. No key was specified
  8675. // 2. A string key was specified, but no value provided
  8676. //
  8677. // Take the "read" path and allow the get method to determine
  8678. // which value to return, respectively either:
  8679. //
  8680. // 1. The entire cache object
  8681. // 2. The data stored at the key
  8682. //
  8683. if ( key === undefined ||
  8684. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  8685. return this.get( owner, key );
  8686. }
  8687. // When the key is not a string, or both a key and value
  8688. // are specified, set or extend (existing objects) with either:
  8689. //
  8690. // 1. An object of properties
  8691. // 2. A key and value
  8692. //
  8693. this.set( owner, key, value );
  8694. // Since the "set" path can have two possible entry points
  8695. // return the expected data based on which path was taken[*]
  8696. return value !== undefined ? value : key;
  8697. },
  8698. remove: function( owner, key ) {
  8699. var i,
  8700. cache = owner[ this.expando ];
  8701. if ( cache === undefined ) {
  8702. return;
  8703. }
  8704. if ( key !== undefined ) {
  8705. // Support array or space separated string of keys
  8706. if ( Array.isArray( key ) ) {
  8707. // If key is an array of keys...
  8708. // We always set camelCase keys, so remove that.
  8709. key = key.map( camelCase );
  8710. } else {
  8711. key = camelCase( key );
  8712. // If a key with the spaces exists, use it.
  8713. // Otherwise, create an array by matching non-whitespace
  8714. key = key in cache ?
  8715. [ key ] :
  8716. ( key.match( rnothtmlwhite ) || [] );
  8717. }
  8718. i = key.length;
  8719. while ( i-- ) {
  8720. delete cache[ key[ i ] ];
  8721. }
  8722. }
  8723. // Remove the expando if there's no more data
  8724. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  8725. // Support: Chrome <=35 - 45
  8726. // Webkit & Blink performance suffers when deleting properties
  8727. // from DOM nodes, so set to undefined instead
  8728. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  8729. if ( owner.nodeType ) {
  8730. owner[ this.expando ] = undefined;
  8731. } else {
  8732. delete owner[ this.expando ];
  8733. }
  8734. }
  8735. },
  8736. hasData: function( owner ) {
  8737. var cache = owner[ this.expando ];
  8738. return cache !== undefined && !jQuery.isEmptyObject( cache );
  8739. }
  8740. };
  8741. var dataPriv = new Data();
  8742. var dataUser = new Data();
  8743. // Implementation Summary
  8744. //
  8745. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  8746. // 2. Improve the module's maintainability by reducing the storage
  8747. // paths to a single mechanism.
  8748. // 3. Use the same single mechanism to support "private" and "user" data.
  8749. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  8750. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  8751. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  8752. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  8753. rmultiDash = /[A-Z]/g;
  8754. function getData( data ) {
  8755. if ( data === "true" ) {
  8756. return true;
  8757. }
  8758. if ( data === "false" ) {
  8759. return false;
  8760. }
  8761. if ( data === "null" ) {
  8762. return null;
  8763. }
  8764. // Only convert to a number if it doesn't change the string
  8765. if ( data === +data + "" ) {
  8766. return +data;
  8767. }
  8768. if ( rbrace.test( data ) ) {
  8769. return JSON.parse( data );
  8770. }
  8771. return data;
  8772. }
  8773. function dataAttr( elem, key, data ) {
  8774. var name;
  8775. // If nothing was found internally, try to fetch any
  8776. // data from the HTML5 data-* attribute
  8777. if ( data === undefined && elem.nodeType === 1 ) {
  8778. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  8779. data = elem.getAttribute( name );
  8780. if ( typeof data === "string" ) {
  8781. try {
  8782. data = getData( data );
  8783. } catch ( e ) {}
  8784. // Make sure we set the data so it isn't changed later
  8785. dataUser.set( elem, key, data );
  8786. } else {
  8787. data = undefined;
  8788. }
  8789. }
  8790. return data;
  8791. }
  8792. jQuery.extend( {
  8793. hasData: function( elem ) {
  8794. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  8795. },
  8796. data: function( elem, name, data ) {
  8797. return dataUser.access( elem, name, data );
  8798. },
  8799. removeData: function( elem, name ) {
  8800. dataUser.remove( elem, name );
  8801. },
  8802. // TODO: Now that all calls to _data and _removeData have been replaced
  8803. // with direct calls to dataPriv methods, these can be deprecated.
  8804. _data: function( elem, name, data ) {
  8805. return dataPriv.access( elem, name, data );
  8806. },
  8807. _removeData: function( elem, name ) {
  8808. dataPriv.remove( elem, name );
  8809. }
  8810. } );
  8811. jQuery.fn.extend( {
  8812. data: function( key, value ) {
  8813. var i, name, data,
  8814. elem = this[ 0 ],
  8815. attrs = elem && elem.attributes;
  8816. // Gets all values
  8817. if ( key === undefined ) {
  8818. if ( this.length ) {
  8819. data = dataUser.get( elem );
  8820. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  8821. i = attrs.length;
  8822. while ( i-- ) {
  8823. // Support: IE 11 only
  8824. // The attrs elements can be null (#14894)
  8825. if ( attrs[ i ] ) {
  8826. name = attrs[ i ].name;
  8827. if ( name.indexOf( "data-" ) === 0 ) {
  8828. name = camelCase( name.slice( 5 ) );
  8829. dataAttr( elem, name, data[ name ] );
  8830. }
  8831. }
  8832. }
  8833. dataPriv.set( elem, "hasDataAttrs", true );
  8834. }
  8835. }
  8836. return data;
  8837. }
  8838. // Sets multiple values
  8839. if ( typeof key === "object" ) {
  8840. return this.each( function() {
  8841. dataUser.set( this, key );
  8842. } );
  8843. }
  8844. return access( this, function( value ) {
  8845. var data;
  8846. // The calling jQuery object (element matches) is not empty
  8847. // (and therefore has an element appears at this[ 0 ]) and the
  8848. // `value` parameter was not undefined. An empty jQuery object
  8849. // will result in `undefined` for elem = this[ 0 ] which will
  8850. // throw an exception if an attempt to read a data cache is made.
  8851. if ( elem && value === undefined ) {
  8852. // Attempt to get data from the cache
  8853. // The key will always be camelCased in Data
  8854. data = dataUser.get( elem, key );
  8855. if ( data !== undefined ) {
  8856. return data;
  8857. }
  8858. // Attempt to "discover" the data in
  8859. // HTML5 custom data-* attrs
  8860. data = dataAttr( elem, key );
  8861. if ( data !== undefined ) {
  8862. return data;
  8863. }
  8864. // We tried really hard, but the data doesn't exist.
  8865. return;
  8866. }
  8867. // Set the data...
  8868. this.each( function() {
  8869. // We always store the camelCased key
  8870. dataUser.set( this, key, value );
  8871. } );
  8872. }, null, value, arguments.length > 1, null, true );
  8873. },
  8874. removeData: function( key ) {
  8875. return this.each( function() {
  8876. dataUser.remove( this, key );
  8877. } );
  8878. }
  8879. } );
  8880. jQuery.extend( {
  8881. queue: function( elem, type, data ) {
  8882. var queue;
  8883. if ( elem ) {
  8884. type = ( type || "fx" ) + "queue";
  8885. queue = dataPriv.get( elem, type );
  8886. // Speed up dequeue by getting out quickly if this is just a lookup
  8887. if ( data ) {
  8888. if ( !queue || Array.isArray( data ) ) {
  8889. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  8890. } else {
  8891. queue.push( data );
  8892. }
  8893. }
  8894. return queue || [];
  8895. }
  8896. },
  8897. dequeue: function( elem, type ) {
  8898. type = type || "fx";
  8899. var queue = jQuery.queue( elem, type ),
  8900. startLength = queue.length,
  8901. fn = queue.shift(),
  8902. hooks = jQuery._queueHooks( elem, type ),
  8903. next = function() {
  8904. jQuery.dequeue( elem, type );
  8905. };
  8906. // If the fx queue is dequeued, always remove the progress sentinel
  8907. if ( fn === "inprogress" ) {
  8908. fn = queue.shift();
  8909. startLength--;
  8910. }
  8911. if ( fn ) {
  8912. // Add a progress sentinel to prevent the fx queue from being
  8913. // automatically dequeued
  8914. if ( type === "fx" ) {
  8915. queue.unshift( "inprogress" );
  8916. }
  8917. // Clear up the last queue stop function
  8918. delete hooks.stop;
  8919. fn.call( elem, next, hooks );
  8920. }
  8921. if ( !startLength && hooks ) {
  8922. hooks.empty.fire();
  8923. }
  8924. },
  8925. // Not public - generate a queueHooks object, or return the current one
  8926. _queueHooks: function( elem, type ) {
  8927. var key = type + "queueHooks";
  8928. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  8929. empty: jQuery.Callbacks( "once memory" ).add( function() {
  8930. dataPriv.remove( elem, [ type + "queue", key ] );
  8931. } )
  8932. } );
  8933. }
  8934. } );
  8935. jQuery.fn.extend( {
  8936. queue: function( type, data ) {
  8937. var setter = 2;
  8938. if ( typeof type !== "string" ) {
  8939. data = type;
  8940. type = "fx";
  8941. setter--;
  8942. }
  8943. if ( arguments.length < setter ) {
  8944. return jQuery.queue( this[ 0 ], type );
  8945. }
  8946. return data === undefined ?
  8947. this :
  8948. this.each( function() {
  8949. var queue = jQuery.queue( this, type, data );
  8950. // Ensure a hooks for this queue
  8951. jQuery._queueHooks( this, type );
  8952. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  8953. jQuery.dequeue( this, type );
  8954. }
  8955. } );
  8956. },
  8957. dequeue: function( type ) {
  8958. return this.each( function() {
  8959. jQuery.dequeue( this, type );
  8960. } );
  8961. },
  8962. clearQueue: function( type ) {
  8963. return this.queue( type || "fx", [] );
  8964. },
  8965. // Get a promise resolved when queues of a certain type
  8966. // are emptied (fx is the type by default)
  8967. promise: function( type, obj ) {
  8968. var tmp,
  8969. count = 1,
  8970. defer = jQuery.Deferred(),
  8971. elements = this,
  8972. i = this.length,
  8973. resolve = function() {
  8974. if ( !( --count ) ) {
  8975. defer.resolveWith( elements, [ elements ] );
  8976. }
  8977. };
  8978. if ( typeof type !== "string" ) {
  8979. obj = type;
  8980. type = undefined;
  8981. }
  8982. type = type || "fx";
  8983. while ( i-- ) {
  8984. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  8985. if ( tmp && tmp.empty ) {
  8986. count++;
  8987. tmp.empty.add( resolve );
  8988. }
  8989. }
  8990. resolve();
  8991. return defer.promise( obj );
  8992. }
  8993. } );
  8994. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  8995. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  8996. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  8997. var documentElement = document.documentElement;
  8998. var isAttached = function( elem ) {
  8999. return jQuery.contains( elem.ownerDocument, elem );
  9000. },
  9001. composed = { composed: true };
  9002. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  9003. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  9004. // Support: iOS 10.0-10.2 only
  9005. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  9006. // leading to errors. We need to check for `getRootNode`.
  9007. if ( documentElement.getRootNode ) {
  9008. isAttached = function( elem ) {
  9009. return jQuery.contains( elem.ownerDocument, elem ) ||
  9010. elem.getRootNode( composed ) === elem.ownerDocument;
  9011. };
  9012. }
  9013. var isHiddenWithinTree = function( elem, el ) {
  9014. // isHiddenWithinTree might be called from jQuery#filter function;
  9015. // in that case, element will be second argument
  9016. elem = el || elem;
  9017. // Inline style trumps all
  9018. return elem.style.display === "none" ||
  9019. elem.style.display === "" &&
  9020. // Otherwise, check computed style
  9021. // Support: Firefox <=43 - 45
  9022. // Disconnected elements can have computed display: none, so first confirm that elem is
  9023. // in the document.
  9024. isAttached( elem ) &&
  9025. jQuery.css( elem, "display" ) === "none";
  9026. };
  9027. function adjustCSS( elem, prop, valueParts, tween ) {
  9028. var adjusted, scale,
  9029. maxIterations = 20,
  9030. currentValue = tween ?
  9031. function() {
  9032. return tween.cur();
  9033. } :
  9034. function() {
  9035. return jQuery.css( elem, prop, "" );
  9036. },
  9037. initial = currentValue(),
  9038. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  9039. // Starting value computation is required for potential unit mismatches
  9040. initialInUnit = elem.nodeType &&
  9041. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  9042. rcssNum.exec( jQuery.css( elem, prop ) );
  9043. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  9044. // Support: Firefox <=54
  9045. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  9046. initial = initial / 2;
  9047. // Trust units reported by jQuery.css
  9048. unit = unit || initialInUnit[ 3 ];
  9049. // Iteratively approximate from a nonzero starting point
  9050. initialInUnit = +initial || 1;
  9051. while ( maxIterations-- ) {
  9052. // Evaluate and update our best guess (doubling guesses that zero out).
  9053. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  9054. jQuery.style( elem, prop, initialInUnit + unit );
  9055. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  9056. maxIterations = 0;
  9057. }
  9058. initialInUnit = initialInUnit / scale;
  9059. }
  9060. initialInUnit = initialInUnit * 2;
  9061. jQuery.style( elem, prop, initialInUnit + unit );
  9062. // Make sure we update the tween properties later on
  9063. valueParts = valueParts || [];
  9064. }
  9065. if ( valueParts ) {
  9066. initialInUnit = +initialInUnit || +initial || 0;
  9067. // Apply relative offset (+=/-=) if specified
  9068. adjusted = valueParts[ 1 ] ?
  9069. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  9070. +valueParts[ 2 ];
  9071. if ( tween ) {
  9072. tween.unit = unit;
  9073. tween.start = initialInUnit;
  9074. tween.end = adjusted;
  9075. }
  9076. }
  9077. return adjusted;
  9078. }
  9079. var defaultDisplayMap = {};
  9080. function getDefaultDisplay( elem ) {
  9081. var temp,
  9082. doc = elem.ownerDocument,
  9083. nodeName = elem.nodeName,
  9084. display = defaultDisplayMap[ nodeName ];
  9085. if ( display ) {
  9086. return display;
  9087. }
  9088. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  9089. display = jQuery.css( temp, "display" );
  9090. temp.parentNode.removeChild( temp );
  9091. if ( display === "none" ) {
  9092. display = "block";
  9093. }
  9094. defaultDisplayMap[ nodeName ] = display;
  9095. return display;
  9096. }
  9097. function showHide( elements, show ) {
  9098. var display, elem,
  9099. values = [],
  9100. index = 0,
  9101. length = elements.length;
  9102. // Determine new display value for elements that need to change
  9103. for ( ; index < length; index++ ) {
  9104. elem = elements[ index ];
  9105. if ( !elem.style ) {
  9106. continue;
  9107. }
  9108. display = elem.style.display;
  9109. if ( show ) {
  9110. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  9111. // check is required in this first loop unless we have a nonempty display value (either
  9112. // inline or about-to-be-restored)
  9113. if ( display === "none" ) {
  9114. values[ index ] = dataPriv.get( elem, "display" ) || null;
  9115. if ( !values[ index ] ) {
  9116. elem.style.display = "";
  9117. }
  9118. }
  9119. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  9120. values[ index ] = getDefaultDisplay( elem );
  9121. }
  9122. } else {
  9123. if ( display !== "none" ) {
  9124. values[ index ] = "none";
  9125. // Remember what we're overwriting
  9126. dataPriv.set( elem, "display", display );
  9127. }
  9128. }
  9129. }
  9130. // Set the display of the elements in a second loop to avoid constant reflow
  9131. for ( index = 0; index < length; index++ ) {
  9132. if ( values[ index ] != null ) {
  9133. elements[ index ].style.display = values[ index ];
  9134. }
  9135. }
  9136. return elements;
  9137. }
  9138. jQuery.fn.extend( {
  9139. show: function() {
  9140. return showHide( this, true );
  9141. },
  9142. hide: function() {
  9143. return showHide( this );
  9144. },
  9145. toggle: function( state ) {
  9146. if ( typeof state === "boolean" ) {
  9147. return state ? this.show() : this.hide();
  9148. }
  9149. return this.each( function() {
  9150. if ( isHiddenWithinTree( this ) ) {
  9151. jQuery( this ).show();
  9152. } else {
  9153. jQuery( this ).hide();
  9154. }
  9155. } );
  9156. }
  9157. } );
  9158. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  9159. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  9160. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  9161. ( function() {
  9162. var fragment = document.createDocumentFragment(),
  9163. div = fragment.appendChild( document.createElement( "div" ) ),
  9164. input = document.createElement( "input" );
  9165. // Support: Android 4.0 - 4.3 only
  9166. // Check state lost if the name is set (#11217)
  9167. // Support: Windows Web Apps (WWA)
  9168. // `name` and `type` must use .setAttribute for WWA (#14901)
  9169. input.setAttribute( "type", "radio" );
  9170. input.setAttribute( "checked", "checked" );
  9171. input.setAttribute( "name", "t" );
  9172. div.appendChild( input );
  9173. // Support: Android <=4.1 only
  9174. // Older WebKit doesn't clone checked state correctly in fragments
  9175. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  9176. // Support: IE <=11 only
  9177. // Make sure textarea (and checkbox) defaultValue is properly cloned
  9178. div.innerHTML = "<textarea>x</textarea>";
  9179. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  9180. // Support: IE <=9 only
  9181. // IE <=9 replaces <option> tags with their contents when inserted outside of
  9182. // the select element.
  9183. div.innerHTML = "<option></option>";
  9184. support.option = !!div.lastChild;
  9185. } )();
  9186. // We have to close these tags to support XHTML (#13200)
  9187. var wrapMap = {
  9188. // XHTML parsers do not magically insert elements in the
  9189. // same way that tag soup parsers do. So we cannot shorten
  9190. // this by omitting <tbody> or other required elements.
  9191. thead: [ 1, "<table>", "</table>" ],
  9192. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  9193. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  9194. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  9195. _default: [ 0, "", "" ]
  9196. };
  9197. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  9198. wrapMap.th = wrapMap.td;
  9199. // Support: IE <=9 only
  9200. if ( !support.option ) {
  9201. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  9202. }
  9203. function getAll( context, tag ) {
  9204. // Support: IE <=9 - 11 only
  9205. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  9206. var ret;
  9207. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9208. ret = context.getElementsByTagName( tag || "*" );
  9209. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  9210. ret = context.querySelectorAll( tag || "*" );
  9211. } else {
  9212. ret = [];
  9213. }
  9214. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  9215. return jQuery.merge( [ context ], ret );
  9216. }
  9217. return ret;
  9218. }
  9219. // Mark scripts as having already been evaluated
  9220. function setGlobalEval( elems, refElements ) {
  9221. var i = 0,
  9222. l = elems.length;
  9223. for ( ; i < l; i++ ) {
  9224. dataPriv.set(
  9225. elems[ i ],
  9226. "globalEval",
  9227. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  9228. );
  9229. }
  9230. }
  9231. var rhtml = /<|&#?\w+;/;
  9232. function buildFragment( elems, context, scripts, selection, ignored ) {
  9233. var elem, tmp, tag, wrap, attached, j,
  9234. fragment = context.createDocumentFragment(),
  9235. nodes = [],
  9236. i = 0,
  9237. l = elems.length;
  9238. for ( ; i < l; i++ ) {
  9239. elem = elems[ i ];
  9240. if ( elem || elem === 0 ) {
  9241. // Add nodes directly
  9242. if ( toType( elem ) === "object" ) {
  9243. // Support: Android <=4.0 only, PhantomJS 1 only
  9244. // push.apply(_, arraylike) throws on ancient WebKit
  9245. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  9246. // Convert non-html into a text node
  9247. } else if ( !rhtml.test( elem ) ) {
  9248. nodes.push( context.createTextNode( elem ) );
  9249. // Convert html into DOM nodes
  9250. } else {
  9251. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  9252. // Deserialize a standard representation
  9253. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  9254. wrap = wrapMap[ tag ] || wrapMap._default;
  9255. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  9256. // Descend through wrappers to the right content
  9257. j = wrap[ 0 ];
  9258. while ( j-- ) {
  9259. tmp = tmp.lastChild;
  9260. }
  9261. // Support: Android <=4.0 only, PhantomJS 1 only
  9262. // push.apply(_, arraylike) throws on ancient WebKit
  9263. jQuery.merge( nodes, tmp.childNodes );
  9264. // Remember the top-level container
  9265. tmp = fragment.firstChild;
  9266. // Ensure the created nodes are orphaned (#12392)
  9267. tmp.textContent = "";
  9268. }
  9269. }
  9270. }
  9271. // Remove wrapper from fragment
  9272. fragment.textContent = "";
  9273. i = 0;
  9274. while ( ( elem = nodes[ i++ ] ) ) {
  9275. // Skip elements already in the context collection (trac-4087)
  9276. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  9277. if ( ignored ) {
  9278. ignored.push( elem );
  9279. }
  9280. continue;
  9281. }
  9282. attached = isAttached( elem );
  9283. // Append to fragment
  9284. tmp = getAll( fragment.appendChild( elem ), "script" );
  9285. // Preserve script evaluation history
  9286. if ( attached ) {
  9287. setGlobalEval( tmp );
  9288. }
  9289. // Capture executables
  9290. if ( scripts ) {
  9291. j = 0;
  9292. while ( ( elem = tmp[ j++ ] ) ) {
  9293. if ( rscriptType.test( elem.type || "" ) ) {
  9294. scripts.push( elem );
  9295. }
  9296. }
  9297. }
  9298. }
  9299. return fragment;
  9300. }
  9301. var
  9302. rkeyEvent = /^key/,
  9303. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  9304. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  9305. function returnTrue() {
  9306. return true;
  9307. }
  9308. function returnFalse() {
  9309. return false;
  9310. }
  9311. // Support: IE <=9 - 11+
  9312. // focus() and blur() are asynchronous, except when they are no-op.
  9313. // So expect focus to be synchronous when the element is already active,
  9314. // and blur to be synchronous when the element is not already active.
  9315. // (focus and blur are always synchronous in other supported browsers,
  9316. // this just defines when we can count on it).
  9317. function expectSync( elem, type ) {
  9318. return ( elem === safeActiveElement() ) === ( type === "focus" );
  9319. }
  9320. // Support: IE <=9 only
  9321. // Accessing document.activeElement can throw unexpectedly
  9322. // https://bugs.jquery.com/ticket/13393
  9323. function safeActiveElement() {
  9324. try {
  9325. return document.activeElement;
  9326. } catch ( err ) { }
  9327. }
  9328. function on( elem, types, selector, data, fn, one ) {
  9329. var origFn, type;
  9330. // Types can be a map of types/handlers
  9331. if ( typeof types === "object" ) {
  9332. // ( types-Object, selector, data )
  9333. if ( typeof selector !== "string" ) {
  9334. // ( types-Object, data )
  9335. data = data || selector;
  9336. selector = undefined;
  9337. }
  9338. for ( type in types ) {
  9339. on( elem, type, selector, data, types[ type ], one );
  9340. }
  9341. return elem;
  9342. }
  9343. if ( data == null && fn == null ) {
  9344. // ( types, fn )
  9345. fn = selector;
  9346. data = selector = undefined;
  9347. } else if ( fn == null ) {
  9348. if ( typeof selector === "string" ) {
  9349. // ( types, selector, fn )
  9350. fn = data;
  9351. data = undefined;
  9352. } else {
  9353. // ( types, data, fn )
  9354. fn = data;
  9355. data = selector;
  9356. selector = undefined;
  9357. }
  9358. }
  9359. if ( fn === false ) {
  9360. fn = returnFalse;
  9361. } else if ( !fn ) {
  9362. return elem;
  9363. }
  9364. if ( one === 1 ) {
  9365. origFn = fn;
  9366. fn = function( event ) {
  9367. // Can use an empty set, since event contains the info
  9368. jQuery().off( event );
  9369. return origFn.apply( this, arguments );
  9370. };
  9371. // Use same guid so caller can remove using origFn
  9372. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  9373. }
  9374. return elem.each( function() {
  9375. jQuery.event.add( this, types, fn, data, selector );
  9376. } );
  9377. }
  9378. /*
  9379. * Helper functions for managing events -- not part of the public interface.
  9380. * Props to Dean Edwards' addEvent library for many of the ideas.
  9381. */
  9382. jQuery.event = {
  9383. global: {},
  9384. add: function( elem, types, handler, data, selector ) {
  9385. var handleObjIn, eventHandle, tmp,
  9386. events, t, handleObj,
  9387. special, handlers, type, namespaces, origType,
  9388. elemData = dataPriv.get( elem );
  9389. // Only attach events to objects that accept data
  9390. if ( !acceptData( elem ) ) {
  9391. return;
  9392. }
  9393. // Caller can pass in an object of custom data in lieu of the handler
  9394. if ( handler.handler ) {
  9395. handleObjIn = handler;
  9396. handler = handleObjIn.handler;
  9397. selector = handleObjIn.selector;
  9398. }
  9399. // Ensure that invalid selectors throw exceptions at attach time
  9400. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  9401. if ( selector ) {
  9402. jQuery.find.matchesSelector( documentElement, selector );
  9403. }
  9404. // Make sure that the handler has a unique ID, used to find/remove it later
  9405. if ( !handler.guid ) {
  9406. handler.guid = jQuery.guid++;
  9407. }
  9408. // Init the element's event structure and main handler, if this is the first
  9409. if ( !( events = elemData.events ) ) {
  9410. events = elemData.events = Object.create( null );
  9411. }
  9412. if ( !( eventHandle = elemData.handle ) ) {
  9413. eventHandle = elemData.handle = function( e ) {
  9414. // Discard the second event of a jQuery.event.trigger() and
  9415. // when an event is called after a page has unloaded
  9416. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  9417. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  9418. };
  9419. }
  9420. // Handle multiple events separated by a space
  9421. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9422. t = types.length;
  9423. while ( t-- ) {
  9424. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9425. type = origType = tmp[ 1 ];
  9426. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9427. // There *must* be a type, no attaching namespace-only handlers
  9428. if ( !type ) {
  9429. continue;
  9430. }
  9431. // If event changes its type, use the special event handlers for the changed type
  9432. special = jQuery.event.special[ type ] || {};
  9433. // If selector defined, determine special event api type, otherwise given type
  9434. type = ( selector ? special.delegateType : special.bindType ) || type;
  9435. // Update special based on newly reset type
  9436. special = jQuery.event.special[ type ] || {};
  9437. // handleObj is passed to all event handlers
  9438. handleObj = jQuery.extend( {
  9439. type: type,
  9440. origType: origType,
  9441. data: data,
  9442. handler: handler,
  9443. guid: handler.guid,
  9444. selector: selector,
  9445. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  9446. namespace: namespaces.join( "." )
  9447. }, handleObjIn );
  9448. // Init the event handler queue if we're the first
  9449. if ( !( handlers = events[ type ] ) ) {
  9450. handlers = events[ type ] = [];
  9451. handlers.delegateCount = 0;
  9452. // Only use addEventListener if the special events handler returns false
  9453. if ( !special.setup ||
  9454. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  9455. if ( elem.addEventListener ) {
  9456. elem.addEventListener( type, eventHandle );
  9457. }
  9458. }
  9459. }
  9460. if ( special.add ) {
  9461. special.add.call( elem, handleObj );
  9462. if ( !handleObj.handler.guid ) {
  9463. handleObj.handler.guid = handler.guid;
  9464. }
  9465. }
  9466. // Add to the element's handler list, delegates in front
  9467. if ( selector ) {
  9468. handlers.splice( handlers.delegateCount++, 0, handleObj );
  9469. } else {
  9470. handlers.push( handleObj );
  9471. }
  9472. // Keep track of which events have ever been used, for event optimization
  9473. jQuery.event.global[ type ] = true;
  9474. }
  9475. },
  9476. // Detach an event or set of events from an element
  9477. remove: function( elem, types, handler, selector, mappedTypes ) {
  9478. var j, origCount, tmp,
  9479. events, t, handleObj,
  9480. special, handlers, type, namespaces, origType,
  9481. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  9482. if ( !elemData || !( events = elemData.events ) ) {
  9483. return;
  9484. }
  9485. // Once for each type.namespace in types; type may be omitted
  9486. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9487. t = types.length;
  9488. while ( t-- ) {
  9489. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9490. type = origType = tmp[ 1 ];
  9491. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9492. // Unbind all events (on this namespace, if provided) for the element
  9493. if ( !type ) {
  9494. for ( type in events ) {
  9495. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  9496. }
  9497. continue;
  9498. }
  9499. special = jQuery.event.special[ type ] || {};
  9500. type = ( selector ? special.delegateType : special.bindType ) || type;
  9501. handlers = events[ type ] || [];
  9502. tmp = tmp[ 2 ] &&
  9503. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  9504. // Remove matching events
  9505. origCount = j = handlers.length;
  9506. while ( j-- ) {
  9507. handleObj = handlers[ j ];
  9508. if ( ( mappedTypes || origType === handleObj.origType ) &&
  9509. ( !handler || handler.guid === handleObj.guid ) &&
  9510. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  9511. ( !selector || selector === handleObj.selector ||
  9512. selector === "**" && handleObj.selector ) ) {
  9513. handlers.splice( j, 1 );
  9514. if ( handleObj.selector ) {
  9515. handlers.delegateCount--;
  9516. }
  9517. if ( special.remove ) {
  9518. special.remove.call( elem, handleObj );
  9519. }
  9520. }
  9521. }
  9522. // Remove generic event handler if we removed something and no more handlers exist
  9523. // (avoids potential for endless recursion during removal of special event handlers)
  9524. if ( origCount && !handlers.length ) {
  9525. if ( !special.teardown ||
  9526. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  9527. jQuery.removeEvent( elem, type, elemData.handle );
  9528. }
  9529. delete events[ type ];
  9530. }
  9531. }
  9532. // Remove data and the expando if it's no longer used
  9533. if ( jQuery.isEmptyObject( events ) ) {
  9534. dataPriv.remove( elem, "handle events" );
  9535. }
  9536. },
  9537. dispatch: function( nativeEvent ) {
  9538. var i, j, ret, matched, handleObj, handlerQueue,
  9539. args = new Array( arguments.length ),
  9540. // Make a writable jQuery.Event from the native event object
  9541. event = jQuery.event.fix( nativeEvent ),
  9542. handlers = (
  9543. dataPriv.get( this, "events" ) || Object.create( null )
  9544. )[ event.type ] || [],
  9545. special = jQuery.event.special[ event.type ] || {};
  9546. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  9547. args[ 0 ] = event;
  9548. for ( i = 1; i < arguments.length; i++ ) {
  9549. args[ i ] = arguments[ i ];
  9550. }
  9551. event.delegateTarget = this;
  9552. // Call the preDispatch hook for the mapped type, and let it bail if desired
  9553. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  9554. return;
  9555. }
  9556. // Determine handlers
  9557. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  9558. // Run delegates first; they may want to stop propagation beneath us
  9559. i = 0;
  9560. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  9561. event.currentTarget = matched.elem;
  9562. j = 0;
  9563. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  9564. !event.isImmediatePropagationStopped() ) {
  9565. // If the event is namespaced, then each handler is only invoked if it is
  9566. // specially universal or its namespaces are a superset of the event's.
  9567. if ( !event.rnamespace || handleObj.namespace === false ||
  9568. event.rnamespace.test( handleObj.namespace ) ) {
  9569. event.handleObj = handleObj;
  9570. event.data = handleObj.data;
  9571. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  9572. handleObj.handler ).apply( matched.elem, args );
  9573. if ( ret !== undefined ) {
  9574. if ( ( event.result = ret ) === false ) {
  9575. event.preventDefault();
  9576. event.stopPropagation();
  9577. }
  9578. }
  9579. }
  9580. }
  9581. }
  9582. // Call the postDispatch hook for the mapped type
  9583. if ( special.postDispatch ) {
  9584. special.postDispatch.call( this, event );
  9585. }
  9586. return event.result;
  9587. },
  9588. handlers: function( event, handlers ) {
  9589. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  9590. handlerQueue = [],
  9591. delegateCount = handlers.delegateCount,
  9592. cur = event.target;
  9593. // Find delegate handlers
  9594. if ( delegateCount &&
  9595. // Support: IE <=9
  9596. // Black-hole SVG <use> instance trees (trac-13180)
  9597. cur.nodeType &&
  9598. // Support: Firefox <=42
  9599. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  9600. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  9601. // Support: IE 11 only
  9602. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  9603. !( event.type === "click" && event.button >= 1 ) ) {
  9604. for ( ; cur !== this; cur = cur.parentNode || this ) {
  9605. // Don't check non-elements (#13208)
  9606. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  9607. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  9608. matchedHandlers = [];
  9609. matchedSelectors = {};
  9610. for ( i = 0; i < delegateCount; i++ ) {
  9611. handleObj = handlers[ i ];
  9612. // Don't conflict with Object.prototype properties (#13203)
  9613. sel = handleObj.selector + " ";
  9614. if ( matchedSelectors[ sel ] === undefined ) {
  9615. matchedSelectors[ sel ] = handleObj.needsContext ?
  9616. jQuery( sel, this ).index( cur ) > -1 :
  9617. jQuery.find( sel, this, null, [ cur ] ).length;
  9618. }
  9619. if ( matchedSelectors[ sel ] ) {
  9620. matchedHandlers.push( handleObj );
  9621. }
  9622. }
  9623. if ( matchedHandlers.length ) {
  9624. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  9625. }
  9626. }
  9627. }
  9628. }
  9629. // Add the remaining (directly-bound) handlers
  9630. cur = this;
  9631. if ( delegateCount < handlers.length ) {
  9632. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  9633. }
  9634. return handlerQueue;
  9635. },
  9636. addProp: function( name, hook ) {
  9637. Object.defineProperty( jQuery.Event.prototype, name, {
  9638. enumerable: true,
  9639. configurable: true,
  9640. get: isFunction( hook ) ?
  9641. function() {
  9642. if ( this.originalEvent ) {
  9643. return hook( this.originalEvent );
  9644. }
  9645. } :
  9646. function() {
  9647. if ( this.originalEvent ) {
  9648. return this.originalEvent[ name ];
  9649. }
  9650. },
  9651. set: function( value ) {
  9652. Object.defineProperty( this, name, {
  9653. enumerable: true,
  9654. configurable: true,
  9655. writable: true,
  9656. value: value
  9657. } );
  9658. }
  9659. } );
  9660. },
  9661. fix: function( originalEvent ) {
  9662. return originalEvent[ jQuery.expando ] ?
  9663. originalEvent :
  9664. new jQuery.Event( originalEvent );
  9665. },
  9666. special: {
  9667. load: {
  9668. // Prevent triggered image.load events from bubbling to window.load
  9669. noBubble: true
  9670. },
  9671. click: {
  9672. // Utilize native event to ensure correct state for checkable inputs
  9673. setup: function( data ) {
  9674. // For mutual compressibility with _default, replace `this` access with a local var.
  9675. // `|| data` is dead code meant only to preserve the variable through minification.
  9676. var el = this || data;
  9677. // Claim the first handler
  9678. if ( rcheckableType.test( el.type ) &&
  9679. el.click && nodeName( el, "input" ) ) {
  9680. // dataPriv.set( el, "click", ... )
  9681. leverageNative( el, "click", returnTrue );
  9682. }
  9683. // Return false to allow normal processing in the caller
  9684. return false;
  9685. },
  9686. trigger: function( data ) {
  9687. // For mutual compressibility with _default, replace `this` access with a local var.
  9688. // `|| data` is dead code meant only to preserve the variable through minification.
  9689. var el = this || data;
  9690. // Force setup before triggering a click
  9691. if ( rcheckableType.test( el.type ) &&
  9692. el.click && nodeName( el, "input" ) ) {
  9693. leverageNative( el, "click" );
  9694. }
  9695. // Return non-false to allow normal event-path propagation
  9696. return true;
  9697. },
  9698. // For cross-browser consistency, suppress native .click() on links
  9699. // Also prevent it if we're currently inside a leveraged native-event stack
  9700. _default: function( event ) {
  9701. var target = event.target;
  9702. return rcheckableType.test( target.type ) &&
  9703. target.click && nodeName( target, "input" ) &&
  9704. dataPriv.get( target, "click" ) ||
  9705. nodeName( target, "a" );
  9706. }
  9707. },
  9708. beforeunload: {
  9709. postDispatch: function( event ) {
  9710. // Support: Firefox 20+
  9711. // Firefox doesn't alert if the returnValue field is not set.
  9712. if ( event.result !== undefined && event.originalEvent ) {
  9713. event.originalEvent.returnValue = event.result;
  9714. }
  9715. }
  9716. }
  9717. }
  9718. };
  9719. // Ensure the presence of an event listener that handles manually-triggered
  9720. // synthetic events by interrupting progress until reinvoked in response to
  9721. // *native* events that it fires directly, ensuring that state changes have
  9722. // already occurred before other listeners are invoked.
  9723. function leverageNative( el, type, expectSync ) {
  9724. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  9725. if ( !expectSync ) {
  9726. if ( dataPriv.get( el, type ) === undefined ) {
  9727. jQuery.event.add( el, type, returnTrue );
  9728. }
  9729. return;
  9730. }
  9731. // Register the controller.blade.php as a special universal handler for all event namespaces
  9732. dataPriv.set( el, type, false );
  9733. jQuery.event.add( el, type, {
  9734. namespace: false,
  9735. handler: function( event ) {
  9736. var notAsync, result,
  9737. saved = dataPriv.get( this, type );
  9738. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  9739. // Interrupt processing of the outer synthetic .trigger()ed event
  9740. // Saved data should be false in such cases, but might be a leftover capture object
  9741. // from an async native handler (gh-4350)
  9742. if ( !saved.length ) {
  9743. // Store arguments for use when handling the inner native event
  9744. // There will always be at least one argument (an event object), so this array
  9745. // will not be confused with a leftover capture object.
  9746. saved = slice.call( arguments );
  9747. dataPriv.set( this, type, saved );
  9748. // Trigger the native event and capture its result
  9749. // Support: IE <=9 - 11+
  9750. // focus() and blur() are asynchronous
  9751. notAsync = expectSync( this, type );
  9752. this[ type ]();
  9753. result = dataPriv.get( this, type );
  9754. if ( saved !== result || notAsync ) {
  9755. dataPriv.set( this, type, false );
  9756. } else {
  9757. result = {};
  9758. }
  9759. if ( saved !== result ) {
  9760. // Cancel the outer synthetic event
  9761. event.stopImmediatePropagation();
  9762. event.preventDefault();
  9763. return result.value;
  9764. }
  9765. // If this is an inner synthetic event for an event with a bubbling surrogate
  9766. // (focus or blur), assume that the surrogate already propagated from triggering the
  9767. // native event and prevent that from happening again here.
  9768. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  9769. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  9770. // less bad than duplication.
  9771. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  9772. event.stopPropagation();
  9773. }
  9774. // If this is a native event triggered above, everything is now in order
  9775. // Fire an inner synthetic event with the original arguments
  9776. } else if ( saved.length ) {
  9777. // ...and capture the result
  9778. dataPriv.set( this, type, {
  9779. value: jQuery.event.trigger(
  9780. // Support: IE <=9 - 11+
  9781. // Extend with the prototype to reset the above stopImmediatePropagation()
  9782. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  9783. saved.slice( 1 ),
  9784. this
  9785. )
  9786. } );
  9787. // Abort handling of the native event
  9788. event.stopImmediatePropagation();
  9789. }
  9790. }
  9791. } );
  9792. }
  9793. jQuery.removeEvent = function( elem, type, handle ) {
  9794. // This "if" is needed for plain objects
  9795. if ( elem.removeEventListener ) {
  9796. elem.removeEventListener( type, handle );
  9797. }
  9798. };
  9799. jQuery.Event = function( src, props ) {
  9800. // Allow instantiation without the 'new' keyword
  9801. if ( !( this instanceof jQuery.Event ) ) {
  9802. return new jQuery.Event( src, props );
  9803. }
  9804. // Event object
  9805. if ( src && src.type ) {
  9806. this.originalEvent = src;
  9807. this.type = src.type;
  9808. // Events bubbling up the document may have been marked as prevented
  9809. // by a handler lower down the tree; reflect the correct value.
  9810. this.isDefaultPrevented = src.defaultPrevented ||
  9811. src.defaultPrevented === undefined &&
  9812. // Support: Android <=2.3 only
  9813. src.returnValue === false ?
  9814. returnTrue :
  9815. returnFalse;
  9816. // Create target properties
  9817. // Support: Safari <=6 - 7 only
  9818. // Target should not be a text node (#504, #13143)
  9819. this.target = ( src.target && src.target.nodeType === 3 ) ?
  9820. src.target.parentNode :
  9821. src.target;
  9822. this.currentTarget = src.currentTarget;
  9823. this.relatedTarget = src.relatedTarget;
  9824. // Event type
  9825. } else {
  9826. this.type = src;
  9827. }
  9828. // Put explicitly provided properties onto the event object
  9829. if ( props ) {
  9830. jQuery.extend( this, props );
  9831. }
  9832. // Create a timestamp if incoming event doesn't have one
  9833. this.timeStamp = src && src.timeStamp || Date.now();
  9834. // Mark it as fixed
  9835. this[ jQuery.expando ] = true;
  9836. };
  9837. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  9838. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  9839. jQuery.Event.prototype = {
  9840. constructor: jQuery.Event,
  9841. isDefaultPrevented: returnFalse,
  9842. isPropagationStopped: returnFalse,
  9843. isImmediatePropagationStopped: returnFalse,
  9844. isSimulated: false,
  9845. preventDefault: function() {
  9846. var e = this.originalEvent;
  9847. this.isDefaultPrevented = returnTrue;
  9848. if ( e && !this.isSimulated ) {
  9849. e.preventDefault();
  9850. }
  9851. },
  9852. stopPropagation: function() {
  9853. var e = this.originalEvent;
  9854. this.isPropagationStopped = returnTrue;
  9855. if ( e && !this.isSimulated ) {
  9856. e.stopPropagation();
  9857. }
  9858. },
  9859. stopImmediatePropagation: function() {
  9860. var e = this.originalEvent;
  9861. this.isImmediatePropagationStopped = returnTrue;
  9862. if ( e && !this.isSimulated ) {
  9863. e.stopImmediatePropagation();
  9864. }
  9865. this.stopPropagation();
  9866. }
  9867. };
  9868. // Includes all common event props including KeyEvent and MouseEvent specific props
  9869. jQuery.each( {
  9870. altKey: true,
  9871. bubbles: true,
  9872. cancelable: true,
  9873. changedTouches: true,
  9874. ctrlKey: true,
  9875. detail: true,
  9876. eventPhase: true,
  9877. metaKey: true,
  9878. pageX: true,
  9879. pageY: true,
  9880. shiftKey: true,
  9881. view: true,
  9882. "char": true,
  9883. code: true,
  9884. charCode: true,
  9885. key: true,
  9886. keyCode: true,
  9887. button: true,
  9888. buttons: true,
  9889. clientX: true,
  9890. clientY: true,
  9891. offsetX: true,
  9892. offsetY: true,
  9893. pointerId: true,
  9894. pointerType: true,
  9895. screenX: true,
  9896. screenY: true,
  9897. targetTouches: true,
  9898. toElement: true,
  9899. touches: true,
  9900. which: function( event ) {
  9901. var button = event.button;
  9902. // Add which for key events
  9903. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  9904. return event.charCode != null ? event.charCode : event.keyCode;
  9905. }
  9906. // Add which for click: 1 === left; 2 === middle; 3 === right
  9907. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  9908. if ( button & 1 ) {
  9909. return 1;
  9910. }
  9911. if ( button & 2 ) {
  9912. return 3;
  9913. }
  9914. if ( button & 4 ) {
  9915. return 2;
  9916. }
  9917. return 0;
  9918. }
  9919. return event.which;
  9920. }
  9921. }, jQuery.event.addProp );
  9922. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  9923. jQuery.event.special[ type ] = {
  9924. // Utilize native event if possible so blur/focus sequence is correct
  9925. setup: function() {
  9926. // Claim the first handler
  9927. // dataPriv.set( this, "focus", ... )
  9928. // dataPriv.set( this, "blur", ... )
  9929. leverageNative( this, type, expectSync );
  9930. // Return false to allow normal processing in the caller
  9931. return false;
  9932. },
  9933. trigger: function() {
  9934. // Force setup before trigger
  9935. leverageNative( this, type );
  9936. // Return non-false to allow normal event-path propagation
  9937. return true;
  9938. },
  9939. delegateType: delegateType
  9940. };
  9941. } );
  9942. // Create mouseenter/leave events using mouseover/out and event-time checks
  9943. // so that event delegation works in jQuery.
  9944. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  9945. //
  9946. // Support: Safari 7 only
  9947. // Safari sends mouseenter too often; see:
  9948. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  9949. // for the description of the bug (it existed in older Chrome versions as well).
  9950. jQuery.each( {
  9951. mouseenter: "mouseover",
  9952. mouseleave: "mouseout",
  9953. pointerenter: "pointerover",
  9954. pointerleave: "pointerout"
  9955. }, function( orig, fix ) {
  9956. jQuery.event.special[ orig ] = {
  9957. delegateType: fix,
  9958. bindType: fix,
  9959. handle: function( event ) {
  9960. var ret,
  9961. target = this,
  9962. related = event.relatedTarget,
  9963. handleObj = event.handleObj;
  9964. // For mouseenter/leave call the handler if related is outside the target.
  9965. // NB: No relatedTarget if the mouse left/entered the browser window
  9966. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  9967. event.type = handleObj.origType;
  9968. ret = handleObj.handler.apply( this, arguments );
  9969. event.type = fix;
  9970. }
  9971. return ret;
  9972. }
  9973. };
  9974. } );
  9975. jQuery.fn.extend( {
  9976. on: function( types, selector, data, fn ) {
  9977. return on( this, types, selector, data, fn );
  9978. },
  9979. one: function( types, selector, data, fn ) {
  9980. return on( this, types, selector, data, fn, 1 );
  9981. },
  9982. off: function( types, selector, fn ) {
  9983. var handleObj, type;
  9984. if ( types && types.preventDefault && types.handleObj ) {
  9985. // ( event ) dispatched jQuery.Event
  9986. handleObj = types.handleObj;
  9987. jQuery( types.delegateTarget ).off(
  9988. handleObj.namespace ?
  9989. handleObj.origType + "." + handleObj.namespace :
  9990. handleObj.origType,
  9991. handleObj.selector,
  9992. handleObj.handler
  9993. );
  9994. return this;
  9995. }
  9996. if ( typeof types === "object" ) {
  9997. // ( types-object [, selector] )
  9998. for ( type in types ) {
  9999. this.off( type, selector, types[ type ] );
  10000. }
  10001. return this;
  10002. }
  10003. if ( selector === false || typeof selector === "function" ) {
  10004. // ( types [, fn] )
  10005. fn = selector;
  10006. selector = undefined;
  10007. }
  10008. if ( fn === false ) {
  10009. fn = returnFalse;
  10010. }
  10011. return this.each( function() {
  10012. jQuery.event.remove( this, types, fn, selector );
  10013. } );
  10014. }
  10015. } );
  10016. var
  10017. // Support: IE <=10 - 11, Edge 12 - 13 only
  10018. // In IE/Edge using regex groups here causes severe slowdowns.
  10019. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  10020. rnoInnerhtml = /<script|<style|<link/i,
  10021. // checked="checked" or checked
  10022. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  10023. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  10024. // Prefer a tbody over its parent table for containing new rows
  10025. function manipulationTarget( elem, content ) {
  10026. if ( nodeName( elem, "table" ) &&
  10027. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  10028. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  10029. }
  10030. return elem;
  10031. }
  10032. // Replace/restore the type attribute of script elements for safe DOM manipulation
  10033. function disableScript( elem ) {
  10034. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  10035. return elem;
  10036. }
  10037. function restoreScript( elem ) {
  10038. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  10039. elem.type = elem.type.slice( 5 );
  10040. } else {
  10041. elem.removeAttribute( "type" );
  10042. }
  10043. return elem;
  10044. }
  10045. function cloneCopyEvent( src, dest ) {
  10046. var i, l, type, pdataOld, udataOld, udataCur, events;
  10047. if ( dest.nodeType !== 1 ) {
  10048. return;
  10049. }
  10050. // 1. Copy private data: events, handlers, etc.
  10051. if ( dataPriv.hasData( src ) ) {
  10052. pdataOld = dataPriv.get( src );
  10053. events = pdataOld.events;
  10054. if ( events ) {
  10055. dataPriv.remove( dest, "handle events" );
  10056. for ( type in events ) {
  10057. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  10058. jQuery.event.add( dest, type, events[ type ][ i ] );
  10059. }
  10060. }
  10061. }
  10062. }
  10063. // 2. Copy user data
  10064. if ( dataUser.hasData( src ) ) {
  10065. udataOld = dataUser.access( src );
  10066. udataCur = jQuery.extend( {}, udataOld );
  10067. dataUser.set( dest, udataCur );
  10068. }
  10069. }
  10070. // Fix IE bugs, see support tests
  10071. function fixInput( src, dest ) {
  10072. var nodeName = dest.nodeName.toLowerCase();
  10073. // Fails to persist the checked state of a cloned checkbox or radio button.
  10074. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  10075. dest.checked = src.checked;
  10076. // Fails to return the selected option to the default selected state when cloning options
  10077. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  10078. dest.defaultValue = src.defaultValue;
  10079. }
  10080. }
  10081. function domManip( collection, args, callback, ignored ) {
  10082. // Flatten any nested arrays
  10083. args = flat( args );
  10084. var fragment, first, scripts, hasScripts, node, doc,
  10085. i = 0,
  10086. l = collection.length,
  10087. iNoClone = l - 1,
  10088. value = args[ 0 ],
  10089. valueIsFunction = isFunction( value );
  10090. // We can't cloneNode fragments that contain checked, in WebKit
  10091. if ( valueIsFunction ||
  10092. ( l > 1 && typeof value === "string" &&
  10093. !support.checkClone && rchecked.test( value ) ) ) {
  10094. return collection.each( function( index ) {
  10095. var self = collection.eq( index );
  10096. if ( valueIsFunction ) {
  10097. args[ 0 ] = value.call( this, index, self.html() );
  10098. }
  10099. domManip( self, args, callback, ignored );
  10100. } );
  10101. }
  10102. if ( l ) {
  10103. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  10104. first = fragment.firstChild;
  10105. if ( fragment.childNodes.length === 1 ) {
  10106. fragment = first;
  10107. }
  10108. // Require either new content or an interest in ignored elements to invoke the callback
  10109. if ( first || ignored ) {
  10110. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  10111. hasScripts = scripts.length;
  10112. // Use the original fragment for the last item
  10113. // instead of the first because it can end up
  10114. // being emptied incorrectly in certain situations (#8070).
  10115. for ( ; i < l; i++ ) {
  10116. node = fragment;
  10117. if ( i !== iNoClone ) {
  10118. node = jQuery.clone( node, true, true );
  10119. // Keep references to cloned scripts for later restoration
  10120. if ( hasScripts ) {
  10121. // Support: Android <=4.0 only, PhantomJS 1 only
  10122. // push.apply(_, arraylike) throws on ancient WebKit
  10123. jQuery.merge( scripts, getAll( node, "script" ) );
  10124. }
  10125. }
  10126. callback.call( collection[ i ], node, i );
  10127. }
  10128. if ( hasScripts ) {
  10129. doc = scripts[ scripts.length - 1 ].ownerDocument;
  10130. // Reenable scripts
  10131. jQuery.map( scripts, restoreScript );
  10132. // Evaluate executable scripts on first document insertion
  10133. for ( i = 0; i < hasScripts; i++ ) {
  10134. node = scripts[ i ];
  10135. if ( rscriptType.test( node.type || "" ) &&
  10136. !dataPriv.access( node, "globalEval" ) &&
  10137. jQuery.contains( doc, node ) ) {
  10138. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  10139. // Optional AJAX dependency, but won't run scripts if not present
  10140. if ( jQuery._evalUrl && !node.noModule ) {
  10141. jQuery._evalUrl( node.src, {
  10142. nonce: node.nonce || node.getAttribute( "nonce" )
  10143. }, doc );
  10144. }
  10145. } else {
  10146. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  10147. }
  10148. }
  10149. }
  10150. }
  10151. }
  10152. }
  10153. return collection;
  10154. }
  10155. function remove( elem, selector, keepData ) {
  10156. var node,
  10157. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  10158. i = 0;
  10159. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  10160. if ( !keepData && node.nodeType === 1 ) {
  10161. jQuery.cleanData( getAll( node ) );
  10162. }
  10163. if ( node.parentNode ) {
  10164. if ( keepData && isAttached( node ) ) {
  10165. setGlobalEval( getAll( node, "script" ) );
  10166. }
  10167. node.parentNode.removeChild( node );
  10168. }
  10169. }
  10170. return elem;
  10171. }
  10172. jQuery.extend( {
  10173. htmlPrefilter: function( html ) {
  10174. return html;
  10175. },
  10176. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  10177. var i, l, srcElements, destElements,
  10178. clone = elem.cloneNode( true ),
  10179. inPage = isAttached( elem );
  10180. // Fix IE cloning issues
  10181. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  10182. !jQuery.isXMLDoc( elem ) ) {
  10183. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  10184. destElements = getAll( clone );
  10185. srcElements = getAll( elem );
  10186. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10187. fixInput( srcElements[ i ], destElements[ i ] );
  10188. }
  10189. }
  10190. // Copy the events from the original to the clone
  10191. if ( dataAndEvents ) {
  10192. if ( deepDataAndEvents ) {
  10193. srcElements = srcElements || getAll( elem );
  10194. destElements = destElements || getAll( clone );
  10195. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10196. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  10197. }
  10198. } else {
  10199. cloneCopyEvent( elem, clone );
  10200. }
  10201. }
  10202. // Preserve script evaluation history
  10203. destElements = getAll( clone, "script" );
  10204. if ( destElements.length > 0 ) {
  10205. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  10206. }
  10207. // Return the cloned set
  10208. return clone;
  10209. },
  10210. cleanData: function( elems ) {
  10211. var data, elem, type,
  10212. special = jQuery.event.special,
  10213. i = 0;
  10214. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  10215. if ( acceptData( elem ) ) {
  10216. if ( ( data = elem[ dataPriv.expando ] ) ) {
  10217. if ( data.events ) {
  10218. for ( type in data.events ) {
  10219. if ( special[ type ] ) {
  10220. jQuery.event.remove( elem, type );
  10221. // This is a shortcut to avoid jQuery.event.remove's overhead
  10222. } else {
  10223. jQuery.removeEvent( elem, type, data.handle );
  10224. }
  10225. }
  10226. }
  10227. // Support: Chrome <=35 - 45+
  10228. // Assign undefined instead of using delete, see Data#remove
  10229. elem[ dataPriv.expando ] = undefined;
  10230. }
  10231. if ( elem[ dataUser.expando ] ) {
  10232. // Support: Chrome <=35 - 45+
  10233. // Assign undefined instead of using delete, see Data#remove
  10234. elem[ dataUser.expando ] = undefined;
  10235. }
  10236. }
  10237. }
  10238. }
  10239. } );
  10240. jQuery.fn.extend( {
  10241. detach: function( selector ) {
  10242. return remove( this, selector, true );
  10243. },
  10244. remove: function( selector ) {
  10245. return remove( this, selector );
  10246. },
  10247. text: function( value ) {
  10248. return access( this, function( value ) {
  10249. return value === undefined ?
  10250. jQuery.text( this ) :
  10251. this.empty().each( function() {
  10252. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10253. this.textContent = value;
  10254. }
  10255. } );
  10256. }, null, value, arguments.length );
  10257. },
  10258. append: function() {
  10259. return domManip( this, arguments, function( elem ) {
  10260. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10261. var target = manipulationTarget( this, elem );
  10262. target.appendChild( elem );
  10263. }
  10264. } );
  10265. },
  10266. prepend: function() {
  10267. return domManip( this, arguments, function( elem ) {
  10268. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10269. var target = manipulationTarget( this, elem );
  10270. target.insertBefore( elem, target.firstChild );
  10271. }
  10272. } );
  10273. },
  10274. before: function() {
  10275. return domManip( this, arguments, function( elem ) {
  10276. if ( this.parentNode ) {
  10277. this.parentNode.insertBefore( elem, this );
  10278. }
  10279. } );
  10280. },
  10281. after: function() {
  10282. return domManip( this, arguments, function( elem ) {
  10283. if ( this.parentNode ) {
  10284. this.parentNode.insertBefore( elem, this.nextSibling );
  10285. }
  10286. } );
  10287. },
  10288. empty: function() {
  10289. var elem,
  10290. i = 0;
  10291. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  10292. if ( elem.nodeType === 1 ) {
  10293. // Prevent memory leaks
  10294. jQuery.cleanData( getAll( elem, false ) );
  10295. // Remove any remaining nodes
  10296. elem.textContent = "";
  10297. }
  10298. }
  10299. return this;
  10300. },
  10301. clone: function( dataAndEvents, deepDataAndEvents ) {
  10302. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  10303. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  10304. return this.map( function() {
  10305. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  10306. } );
  10307. },
  10308. html: function( value ) {
  10309. return access( this, function( value ) {
  10310. var elem = this[ 0 ] || {},
  10311. i = 0,
  10312. l = this.length;
  10313. if ( value === undefined && elem.nodeType === 1 ) {
  10314. return elem.innerHTML;
  10315. }
  10316. // See if we can take a shortcut and just use innerHTML
  10317. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  10318. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  10319. value = jQuery.htmlPrefilter( value );
  10320. try {
  10321. for ( ; i < l; i++ ) {
  10322. elem = this[ i ] || {};
  10323. // Remove element nodes and prevent memory leaks
  10324. if ( elem.nodeType === 1 ) {
  10325. jQuery.cleanData( getAll( elem, false ) );
  10326. elem.innerHTML = value;
  10327. }
  10328. }
  10329. elem = 0;
  10330. // If using innerHTML throws an exception, use the fallback method
  10331. } catch ( e ) {}
  10332. }
  10333. if ( elem ) {
  10334. this.empty().append( value );
  10335. }
  10336. }, null, value, arguments.length );
  10337. },
  10338. replaceWith: function() {
  10339. var ignored = [];
  10340. // Make the changes, replacing each non-ignored context element with the new content
  10341. return domManip( this, arguments, function( elem ) {
  10342. var parent = this.parentNode;
  10343. if ( jQuery.inArray( this, ignored ) < 0 ) {
  10344. jQuery.cleanData( getAll( this ) );
  10345. if ( parent ) {
  10346. parent.replaceChild( elem, this );
  10347. }
  10348. }
  10349. // Force callback invocation
  10350. }, ignored );
  10351. }
  10352. } );
  10353. jQuery.each( {
  10354. appendTo: "append",
  10355. prependTo: "prepend",
  10356. insertBefore: "before",
  10357. insertAfter: "after",
  10358. replaceAll: "replaceWith"
  10359. }, function( name, original ) {
  10360. jQuery.fn[ name ] = function( selector ) {
  10361. var elems,
  10362. ret = [],
  10363. insert = jQuery( selector ),
  10364. last = insert.length - 1,
  10365. i = 0;
  10366. for ( ; i <= last; i++ ) {
  10367. elems = i === last ? this : this.clone( true );
  10368. jQuery( insert[ i ] )[ original ]( elems );
  10369. // Support: Android <=4.0 only, PhantomJS 1 only
  10370. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  10371. push.apply( ret, elems.get() );
  10372. }
  10373. return this.pushStack( ret );
  10374. };
  10375. } );
  10376. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  10377. var getStyles = function( elem ) {
  10378. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  10379. // IE throws on elements created in popups
  10380. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  10381. var view = elem.ownerDocument.defaultView;
  10382. if ( !view || !view.opener ) {
  10383. view = window;
  10384. }
  10385. return view.getComputedStyle( elem );
  10386. };
  10387. var swap = function( elem, options, callback ) {
  10388. var ret, name,
  10389. old = {};
  10390. // Remember the old values, and insert the new ones
  10391. for ( name in options ) {
  10392. old[ name ] = elem.style[ name ];
  10393. elem.style[ name ] = options[ name ];
  10394. }
  10395. ret = callback.call( elem );
  10396. // Revert the old values
  10397. for ( name in options ) {
  10398. elem.style[ name ] = old[ name ];
  10399. }
  10400. return ret;
  10401. };
  10402. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  10403. ( function() {
  10404. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  10405. // so they're executed at the same time to save the second computation.
  10406. function computeStyleTests() {
  10407. // This is a singleton, we need to execute it only once
  10408. if ( !div ) {
  10409. return;
  10410. }
  10411. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  10412. "margin-top:1px;padding:0;border:0";
  10413. div.style.cssText =
  10414. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  10415. "margin:auto;border:1px;padding:1px;" +
  10416. "width:60%;top:1%";
  10417. documentElement.appendChild( container ).appendChild( div );
  10418. var divStyle = window.getComputedStyle( div );
  10419. pixelPositionVal = divStyle.top !== "1%";
  10420. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  10421. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  10422. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  10423. // Some styles come back with percentage values, even though they shouldn't
  10424. div.style.right = "60%";
  10425. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  10426. // Support: IE 9 - 11 only
  10427. // Detect misreporting of content dimensions for box-sizing:border-box elements
  10428. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  10429. // Support: IE 9 only
  10430. // Detect overflow:scroll screwiness (gh-3699)
  10431. // Support: Chrome <=64
  10432. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  10433. div.style.position = "absolute";
  10434. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  10435. documentElement.removeChild( container );
  10436. // Nullify the div so it wouldn't be stored in the memory and
  10437. // it will also be a sign that checks already performed
  10438. div = null;
  10439. }
  10440. function roundPixelMeasures( measure ) {
  10441. return Math.round( parseFloat( measure ) );
  10442. }
  10443. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  10444. reliableTrDimensionsVal, reliableMarginLeftVal,
  10445. container = document.createElement( "div" ),
  10446. div = document.createElement( "div" );
  10447. // Finish early in limited (non-browser) environments
  10448. if ( !div.style ) {
  10449. return;
  10450. }
  10451. // Support: IE <=9 - 11 only
  10452. // Style of cloned element affects source element cloned (#8908)
  10453. div.style.backgroundClip = "content-box";
  10454. div.cloneNode( true ).style.backgroundClip = "";
  10455. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  10456. jQuery.extend( support, {
  10457. boxSizingReliable: function() {
  10458. computeStyleTests();
  10459. return boxSizingReliableVal;
  10460. },
  10461. pixelBoxStyles: function() {
  10462. computeStyleTests();
  10463. return pixelBoxStylesVal;
  10464. },
  10465. pixelPosition: function() {
  10466. computeStyleTests();
  10467. return pixelPositionVal;
  10468. },
  10469. reliableMarginLeft: function() {
  10470. computeStyleTests();
  10471. return reliableMarginLeftVal;
  10472. },
  10473. scrollboxSize: function() {
  10474. computeStyleTests();
  10475. return scrollboxSizeVal;
  10476. },
  10477. // Support: IE 9 - 11+, Edge 15 - 18+
  10478. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  10479. // set in CSS while `offset*` properties report correct values.
  10480. // Behavior in IE 9 is more subtle than in newer versions & it passes
  10481. // some versions of this test; make sure not to make it pass there!
  10482. reliableTrDimensions: function() {
  10483. var table, tr, trChild, trStyle;
  10484. if ( reliableTrDimensionsVal == null ) {
  10485. table = document.createElement( "table" );
  10486. tr = document.createElement( "tr" );
  10487. trChild = document.createElement( "div" );
  10488. table.style.cssText = "position:absolute;left:-11111px";
  10489. tr.style.height = "1px";
  10490. trChild.style.height = "9px";
  10491. documentElement
  10492. .appendChild( table )
  10493. .appendChild( tr )
  10494. .appendChild( trChild );
  10495. trStyle = window.getComputedStyle( tr );
  10496. reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
  10497. documentElement.removeChild( table );
  10498. }
  10499. return reliableTrDimensionsVal;
  10500. }
  10501. } );
  10502. } )();
  10503. function curCSS( elem, name, computed ) {
  10504. var width, minWidth, maxWidth, ret,
  10505. // Support: Firefox 51+
  10506. // Retrieving style before computed somehow
  10507. // fixes an issue with getting wrong values
  10508. // on detached elements
  10509. style = elem.style;
  10510. computed = computed || getStyles( elem );
  10511. // getPropertyValue is needed for:
  10512. // .css('filter') (IE 9 only, #12537)
  10513. // .css('--customProperty) (#3144)
  10514. if ( computed ) {
  10515. ret = computed.getPropertyValue( name ) || computed[ name ];
  10516. if ( ret === "" && !isAttached( elem ) ) {
  10517. ret = jQuery.style( elem, name );
  10518. }
  10519. // A tribute to the "awesome hack by Dean Edwards"
  10520. // Android Browser returns percentage for some values,
  10521. // but width seems to be reliably pixels.
  10522. // This is against the CSSOM draft spec:
  10523. // https://drafts.csswg.org/cssom/#resolved-values
  10524. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  10525. // Remember the original values
  10526. width = style.width;
  10527. minWidth = style.minWidth;
  10528. maxWidth = style.maxWidth;
  10529. // Put in the new values to get a computed value out
  10530. style.minWidth = style.maxWidth = style.width = ret;
  10531. ret = computed.width;
  10532. // Revert the changed values
  10533. style.width = width;
  10534. style.minWidth = minWidth;
  10535. style.maxWidth = maxWidth;
  10536. }
  10537. }
  10538. return ret !== undefined ?
  10539. // Support: IE <=9 - 11 only
  10540. // IE returns zIndex value as an integer.
  10541. ret + "" :
  10542. ret;
  10543. }
  10544. function addGetHookIf( conditionFn, hookFn ) {
  10545. // Define the hook, we'll check on the first run if it's really needed.
  10546. return {
  10547. get: function() {
  10548. if ( conditionFn() ) {
  10549. // Hook not needed (or it's not possible to use it due
  10550. // to missing dependency), remove it.
  10551. delete this.get;
  10552. return;
  10553. }
  10554. // Hook needed; redefine it so that the support test is not executed again.
  10555. return ( this.get = hookFn ).apply( this, arguments );
  10556. }
  10557. };
  10558. }
  10559. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  10560. emptyStyle = document.createElement( "div" ).style,
  10561. vendorProps = {};
  10562. // Return a vendor-prefixed property or undefined
  10563. function vendorPropName( name ) {
  10564. // Check for vendor prefixed names
  10565. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  10566. i = cssPrefixes.length;
  10567. while ( i-- ) {
  10568. name = cssPrefixes[ i ] + capName;
  10569. if ( name in emptyStyle ) {
  10570. return name;
  10571. }
  10572. }
  10573. }
  10574. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  10575. function finalPropName( name ) {
  10576. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  10577. if ( final ) {
  10578. return final;
  10579. }
  10580. if ( name in emptyStyle ) {
  10581. return name;
  10582. }
  10583. return vendorProps[ name ] = vendorPropName( name ) || name;
  10584. }
  10585. var
  10586. // Swappable if display is none or starts with table
  10587. // except "table", "table-cell", or "table-caption"
  10588. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  10589. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  10590. rcustomProp = /^--/,
  10591. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  10592. cssNormalTransform = {
  10593. letterSpacing: "0",
  10594. fontWeight: "400"
  10595. };
  10596. function setPositiveNumber( _elem, value, subtract ) {
  10597. // Any relative (+/-) values have already been
  10598. // normalized at this point
  10599. var matches = rcssNum.exec( value );
  10600. return matches ?
  10601. // Guard against undefined "subtract", e.g., when used as in cssHooks
  10602. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  10603. value;
  10604. }
  10605. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  10606. var i = dimension === "width" ? 1 : 0,
  10607. extra = 0,
  10608. delta = 0;
  10609. // Adjustment may not be necessary
  10610. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  10611. return 0;
  10612. }
  10613. for ( ; i < 4; i += 2 ) {
  10614. // Both box models exclude margin
  10615. if ( box === "margin" ) {
  10616. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  10617. }
  10618. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  10619. if ( !isBorderBox ) {
  10620. // Add padding
  10621. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10622. // For "border" or "margin", add border
  10623. if ( box !== "padding" ) {
  10624. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10625. // But still keep track of it otherwise
  10626. } else {
  10627. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10628. }
  10629. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  10630. // "padding" or "margin"
  10631. } else {
  10632. // For "content", subtract padding
  10633. if ( box === "content" ) {
  10634. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10635. }
  10636. // For "content" or "padding", subtract border
  10637. if ( box !== "margin" ) {
  10638. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10639. }
  10640. }
  10641. }
  10642. // Account for positive content-box scroll gutter when requested by providing computedVal
  10643. if ( !isBorderBox && computedVal >= 0 ) {
  10644. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  10645. // Assuming integer scroll gutter, subtract the rest and round down
  10646. delta += Math.max( 0, Math.ceil(
  10647. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10648. computedVal -
  10649. delta -
  10650. extra -
  10651. 0.5
  10652. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  10653. // Use an explicit zero to avoid NaN (gh-3964)
  10654. ) ) || 0;
  10655. }
  10656. return delta;
  10657. }
  10658. function getWidthOrHeight( elem, dimension, extra ) {
  10659. // Start with computed style
  10660. var styles = getStyles( elem ),
  10661. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  10662. // Fake content-box until we know it's needed to know the true value.
  10663. boxSizingNeeded = !support.boxSizingReliable() || extra,
  10664. isBorderBox = boxSizingNeeded &&
  10665. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10666. valueIsBorderBox = isBorderBox,
  10667. val = curCSS( elem, dimension, styles ),
  10668. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  10669. // Support: Firefox <=54
  10670. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  10671. if ( rnumnonpx.test( val ) ) {
  10672. if ( !extra ) {
  10673. return val;
  10674. }
  10675. val = "auto";
  10676. }
  10677. // Support: IE 9 - 11 only
  10678. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  10679. // In those cases, the computed value can be trusted to be border-box.
  10680. if ( ( !support.boxSizingReliable() && isBorderBox ||
  10681. // Support: IE 10 - 11+, Edge 15 - 18+
  10682. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  10683. // set in CSS while `offset*` properties report correct values.
  10684. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  10685. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  10686. // Fall back to offsetWidth/offsetHeight when value is "auto"
  10687. // This happens for inline elements with no explicit setting (gh-3571)
  10688. val === "auto" ||
  10689. // Support: Android <=4.1 - 4.3 only
  10690. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  10691. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  10692. // Make sure the element is visible & connected
  10693. elem.getClientRects().length ) {
  10694. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  10695. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  10696. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  10697. // retrieved value as a content box dimension.
  10698. valueIsBorderBox = offsetProp in elem;
  10699. if ( valueIsBorderBox ) {
  10700. val = elem[ offsetProp ];
  10701. }
  10702. }
  10703. // Normalize "" and auto
  10704. val = parseFloat( val ) || 0;
  10705. // Adjust for the element's box model
  10706. return ( val +
  10707. boxModelAdjustment(
  10708. elem,
  10709. dimension,
  10710. extra || ( isBorderBox ? "border" : "content" ),
  10711. valueIsBorderBox,
  10712. styles,
  10713. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  10714. val
  10715. )
  10716. ) + "px";
  10717. }
  10718. jQuery.extend( {
  10719. // Add in style property hooks for overriding the default
  10720. // behavior of getting and setting a style property
  10721. cssHooks: {
  10722. opacity: {
  10723. get: function( elem, computed ) {
  10724. if ( computed ) {
  10725. // We should always get a number back from opacity
  10726. var ret = curCSS( elem, "opacity" );
  10727. return ret === "" ? "1" : ret;
  10728. }
  10729. }
  10730. }
  10731. },
  10732. // Don't automatically add "px" to these possibly-unitless properties
  10733. cssNumber: {
  10734. "animationIterationCount": true,
  10735. "columnCount": true,
  10736. "fillOpacity": true,
  10737. "flexGrow": true,
  10738. "flexShrink": true,
  10739. "fontWeight": true,
  10740. "gridArea": true,
  10741. "gridColumn": true,
  10742. "gridColumnEnd": true,
  10743. "gridColumnStart": true,
  10744. "gridRow": true,
  10745. "gridRowEnd": true,
  10746. "gridRowStart": true,
  10747. "lineHeight": true,
  10748. "opacity": true,
  10749. "order": true,
  10750. "orphans": true,
  10751. "widows": true,
  10752. "zIndex": true,
  10753. "zoom": true
  10754. },
  10755. // Add in properties whose names you wish to fix before
  10756. // setting or getting the value
  10757. cssProps: {},
  10758. // Get and set the style property on a DOM Node
  10759. style: function( elem, name, value, extra ) {
  10760. // Don't set styles on text and comment nodes
  10761. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  10762. return;
  10763. }
  10764. // Make sure that we're working with the right name
  10765. var ret, type, hooks,
  10766. origName = camelCase( name ),
  10767. isCustomProp = rcustomProp.test( name ),
  10768. style = elem.style;
  10769. // Make sure that we're working with the right name. We don't
  10770. // want to query the value if it is a CSS custom property
  10771. // since they are user-defined.
  10772. if ( !isCustomProp ) {
  10773. name = finalPropName( origName );
  10774. }
  10775. // Gets hook for the prefixed version, then unprefixed version
  10776. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10777. // Check if we're setting a value
  10778. if ( value !== undefined ) {
  10779. type = typeof value;
  10780. // Convert "+=" or "-=" to relative numbers (#7345)
  10781. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  10782. value = adjustCSS( elem, name, ret );
  10783. // Fixes bug #9237
  10784. type = "number";
  10785. }
  10786. // Make sure that null and NaN values aren't set (#7116)
  10787. if ( value == null || value !== value ) {
  10788. return;
  10789. }
  10790. // If a number was passed in, add the unit (except for certain CSS properties)
  10791. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  10792. // "px" to a few hardcoded values.
  10793. if ( type === "number" && !isCustomProp ) {
  10794. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  10795. }
  10796. // background-* props affect original clone's values
  10797. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  10798. style[ name ] = "inherit";
  10799. }
  10800. // If a hook was provided, use that value, otherwise just set the specified value
  10801. if ( !hooks || !( "set" in hooks ) ||
  10802. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  10803. if ( isCustomProp ) {
  10804. style.setProperty( name, value );
  10805. } else {
  10806. style[ name ] = value;
  10807. }
  10808. }
  10809. } else {
  10810. // If a hook was provided get the non-computed value from there
  10811. if ( hooks && "get" in hooks &&
  10812. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  10813. return ret;
  10814. }
  10815. // Otherwise just get the value from the style object
  10816. return style[ name ];
  10817. }
  10818. },
  10819. css: function( elem, name, extra, styles ) {
  10820. var val, num, hooks,
  10821. origName = camelCase( name ),
  10822. isCustomProp = rcustomProp.test( name );
  10823. // Make sure that we're working with the right name. We don't
  10824. // want to modify the value if it is a CSS custom property
  10825. // since they are user-defined.
  10826. if ( !isCustomProp ) {
  10827. name = finalPropName( origName );
  10828. }
  10829. // Try prefixed name followed by the unprefixed name
  10830. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10831. // If a hook was provided get the computed value from there
  10832. if ( hooks && "get" in hooks ) {
  10833. val = hooks.get( elem, true, extra );
  10834. }
  10835. // Otherwise, if a way to get the computed value exists, use that
  10836. if ( val === undefined ) {
  10837. val = curCSS( elem, name, styles );
  10838. }
  10839. // Convert "normal" to computed value
  10840. if ( val === "normal" && name in cssNormalTransform ) {
  10841. val = cssNormalTransform[ name ];
  10842. }
  10843. // Make numeric if forced or a qualifier was provided and val looks numeric
  10844. if ( extra === "" || extra ) {
  10845. num = parseFloat( val );
  10846. return extra === true || isFinite( num ) ? num || 0 : val;
  10847. }
  10848. return val;
  10849. }
  10850. } );
  10851. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  10852. jQuery.cssHooks[ dimension ] = {
  10853. get: function( elem, computed, extra ) {
  10854. if ( computed ) {
  10855. // Certain elements can have dimension info if we invisibly show them
  10856. // but it must have a current display style that would benefit
  10857. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  10858. // Support: Safari 8+
  10859. // Table columns in Safari have non-zero offsetWidth & zero
  10860. // getBoundingClientRect().width unless display is changed.
  10861. // Support: IE <=11 only
  10862. // Running getBoundingClientRect on a disconnected node
  10863. // in IE throws an error.
  10864. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  10865. swap( elem, cssShow, function() {
  10866. return getWidthOrHeight( elem, dimension, extra );
  10867. } ) :
  10868. getWidthOrHeight( elem, dimension, extra );
  10869. }
  10870. },
  10871. set: function( elem, value, extra ) {
  10872. var matches,
  10873. styles = getStyles( elem ),
  10874. // Only read styles.position if the test has a chance to fail
  10875. // to avoid forcing a reflow.
  10876. scrollboxSizeBuggy = !support.scrollboxSize() &&
  10877. styles.position === "absolute",
  10878. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  10879. boxSizingNeeded = scrollboxSizeBuggy || extra,
  10880. isBorderBox = boxSizingNeeded &&
  10881. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10882. subtract = extra ?
  10883. boxModelAdjustment(
  10884. elem,
  10885. dimension,
  10886. extra,
  10887. isBorderBox,
  10888. styles
  10889. ) :
  10890. 0;
  10891. // Account for unreliable border-box dimensions by comparing offset* to computed and
  10892. // faking a content-box to get border and padding (gh-3699)
  10893. if ( isBorderBox && scrollboxSizeBuggy ) {
  10894. subtract -= Math.ceil(
  10895. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10896. parseFloat( styles[ dimension ] ) -
  10897. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  10898. 0.5
  10899. );
  10900. }
  10901. // Convert to pixels if value adjustment is needed
  10902. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  10903. ( matches[ 3 ] || "px" ) !== "px" ) {
  10904. elem.style[ dimension ] = value;
  10905. value = jQuery.css( elem, dimension );
  10906. }
  10907. return setPositiveNumber( elem, value, subtract );
  10908. }
  10909. };
  10910. } );
  10911. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  10912. function( elem, computed ) {
  10913. if ( computed ) {
  10914. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  10915. elem.getBoundingClientRect().left -
  10916. swap( elem, { marginLeft: 0 }, function() {
  10917. return elem.getBoundingClientRect().left;
  10918. } )
  10919. ) + "px";
  10920. }
  10921. }
  10922. );
  10923. // These hooks are used by animate to expand properties
  10924. jQuery.each( {
  10925. margin: "",
  10926. padding: "",
  10927. border: "Width"
  10928. }, function( prefix, suffix ) {
  10929. jQuery.cssHooks[ prefix + suffix ] = {
  10930. expand: function( value ) {
  10931. var i = 0,
  10932. expanded = {},
  10933. // Assumes a single number if not a string
  10934. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  10935. for ( ; i < 4; i++ ) {
  10936. expanded[ prefix + cssExpand[ i ] + suffix ] =
  10937. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  10938. }
  10939. return expanded;
  10940. }
  10941. };
  10942. if ( prefix !== "margin" ) {
  10943. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  10944. }
  10945. } );
  10946. jQuery.fn.extend( {
  10947. css: function( name, value ) {
  10948. return access( this, function( elem, name, value ) {
  10949. var styles, len,
  10950. map = {},
  10951. i = 0;
  10952. if ( Array.isArray( name ) ) {
  10953. styles = getStyles( elem );
  10954. len = name.length;
  10955. for ( ; i < len; i++ ) {
  10956. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  10957. }
  10958. return map;
  10959. }
  10960. return value !== undefined ?
  10961. jQuery.style( elem, name, value ) :
  10962. jQuery.css( elem, name );
  10963. }, name, value, arguments.length > 1 );
  10964. }
  10965. } );
  10966. function Tween( elem, options, prop, end, easing ) {
  10967. return new Tween.prototype.init( elem, options, prop, end, easing );
  10968. }
  10969. jQuery.Tween = Tween;
  10970. Tween.prototype = {
  10971. constructor: Tween,
  10972. init: function( elem, options, prop, end, easing, unit ) {
  10973. this.elem = elem;
  10974. this.prop = prop;
  10975. this.easing = easing || jQuery.easing._default;
  10976. this.options = options;
  10977. this.start = this.now = this.cur();
  10978. this.end = end;
  10979. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  10980. },
  10981. cur: function() {
  10982. var hooks = Tween.propHooks[ this.prop ];
  10983. return hooks && hooks.get ?
  10984. hooks.get( this ) :
  10985. Tween.propHooks._default.get( this );
  10986. },
  10987. run: function( percent ) {
  10988. var eased,
  10989. hooks = Tween.propHooks[ this.prop ];
  10990. if ( this.options.duration ) {
  10991. this.pos = eased = jQuery.easing[ this.easing ](
  10992. percent, this.options.duration * percent, 0, 1, this.options.duration
  10993. );
  10994. } else {
  10995. this.pos = eased = percent;
  10996. }
  10997. this.now = ( this.end - this.start ) * eased + this.start;
  10998. if ( this.options.step ) {
  10999. this.options.step.call( this.elem, this.now, this );
  11000. }
  11001. if ( hooks && hooks.set ) {
  11002. hooks.set( this );
  11003. } else {
  11004. Tween.propHooks._default.set( this );
  11005. }
  11006. return this;
  11007. }
  11008. };
  11009. Tween.prototype.init.prototype = Tween.prototype;
  11010. Tween.propHooks = {
  11011. _default: {
  11012. get: function( tween ) {
  11013. var result;
  11014. // Use a property on the element directly when it is not a DOM element,
  11015. // or when there is no matching style property that exists.
  11016. if ( tween.elem.nodeType !== 1 ||
  11017. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  11018. return tween.elem[ tween.prop ];
  11019. }
  11020. // Passing an empty string as a 3rd parameter to .css will automatically
  11021. // attempt a parseFloat and fallback to a string if the parse fails.
  11022. // Simple values such as "10px" are parsed to Float;
  11023. // complex values such as "rotate(1rad)" are returned as-is.
  11024. result = jQuery.css( tween.elem, tween.prop, "" );
  11025. // Empty strings, null, undefined and "auto" are converted to 0.
  11026. return !result || result === "auto" ? 0 : result;
  11027. },
  11028. set: function( tween ) {
  11029. // Use step hook for back compat.
  11030. // Use cssHook if its there.
  11031. // Use .style if available and use plain properties where available.
  11032. if ( jQuery.fx.step[ tween.prop ] ) {
  11033. jQuery.fx.step[ tween.prop ]( tween );
  11034. } else if ( tween.elem.nodeType === 1 && (
  11035. jQuery.cssHooks[ tween.prop ] ||
  11036. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  11037. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  11038. } else {
  11039. tween.elem[ tween.prop ] = tween.now;
  11040. }
  11041. }
  11042. }
  11043. };
  11044. // Support: IE <=9 only
  11045. // Panic based approach to setting things on disconnected nodes
  11046. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  11047. set: function( tween ) {
  11048. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  11049. tween.elem[ tween.prop ] = tween.now;
  11050. }
  11051. }
  11052. };
  11053. jQuery.easing = {
  11054. linear: function( p ) {
  11055. return p;
  11056. },
  11057. swing: function( p ) {
  11058. return 0.5 - Math.cos( p * Math.PI ) / 2;
  11059. },
  11060. _default: "swing"
  11061. };
  11062. jQuery.fx = Tween.prototype.init;
  11063. // Back compat <1.8 extension point
  11064. jQuery.fx.step = {};
  11065. var
  11066. fxNow, inProgress,
  11067. rfxtypes = /^(?:toggle|show|hide)$/,
  11068. rrun = /queueHooks$/;
  11069. function schedule() {
  11070. if ( inProgress ) {
  11071. if ( document.hidden === false && window.requestAnimationFrame ) {
  11072. window.requestAnimationFrame( schedule );
  11073. } else {
  11074. window.setTimeout( schedule, jQuery.fx.interval );
  11075. }
  11076. jQuery.fx.tick();
  11077. }
  11078. }
  11079. // Animations created synchronously will run synchronously
  11080. function createFxNow() {
  11081. window.setTimeout( function() {
  11082. fxNow = undefined;
  11083. } );
  11084. return ( fxNow = Date.now() );
  11085. }
  11086. // Generate parameters to create a standard animation
  11087. function genFx( type, includeWidth ) {
  11088. var which,
  11089. i = 0,
  11090. attrs = { height: type };
  11091. // If we include width, step value is 1 to do all cssExpand values,
  11092. // otherwise step value is 2 to skip over Left and Right
  11093. includeWidth = includeWidth ? 1 : 0;
  11094. for ( ; i < 4; i += 2 - includeWidth ) {
  11095. which = cssExpand[ i ];
  11096. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  11097. }
  11098. if ( includeWidth ) {
  11099. attrs.opacity = attrs.width = type;
  11100. }
  11101. return attrs;
  11102. }
  11103. function createTween( value, prop, animation ) {
  11104. var tween,
  11105. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  11106. index = 0,
  11107. length = collection.length;
  11108. for ( ; index < length; index++ ) {
  11109. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  11110. // We're done with this property
  11111. return tween;
  11112. }
  11113. }
  11114. }
  11115. function defaultPrefilter( elem, props, opts ) {
  11116. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  11117. isBox = "width" in props || "height" in props,
  11118. anim = this,
  11119. orig = {},
  11120. style = elem.style,
  11121. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  11122. dataShow = dataPriv.get( elem, "fxshow" );
  11123. // Queue-skipping animations hijack the fx hooks
  11124. if ( !opts.queue ) {
  11125. hooks = jQuery._queueHooks( elem, "fx" );
  11126. if ( hooks.unqueued == null ) {
  11127. hooks.unqueued = 0;
  11128. oldfire = hooks.empty.fire;
  11129. hooks.empty.fire = function() {
  11130. if ( !hooks.unqueued ) {
  11131. oldfire();
  11132. }
  11133. };
  11134. }
  11135. hooks.unqueued++;
  11136. anim.always( function() {
  11137. // Ensure the complete handler is called before this completes
  11138. anim.always( function() {
  11139. hooks.unqueued--;
  11140. if ( !jQuery.queue( elem, "fx" ).length ) {
  11141. hooks.empty.fire();
  11142. }
  11143. } );
  11144. } );
  11145. }
  11146. // Detect show/hide animations
  11147. for ( prop in props ) {
  11148. value = props[ prop ];
  11149. if ( rfxtypes.test( value ) ) {
  11150. delete props[ prop ];
  11151. toggle = toggle || value === "toggle";
  11152. if ( value === ( hidden ? "hide" : "show" ) ) {
  11153. // Pretend to be hidden if this is a "show" and
  11154. // there is still data from a stopped show/hide
  11155. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  11156. hidden = true;
  11157. // Ignore all other no-op show/hide data
  11158. } else {
  11159. continue;
  11160. }
  11161. }
  11162. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  11163. }
  11164. }
  11165. // Bail out if this is a no-op like .hide().hide()
  11166. propTween = !jQuery.isEmptyObject( props );
  11167. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  11168. return;
  11169. }
  11170. // Restrict "overflow" and "display" styles during box animations
  11171. if ( isBox && elem.nodeType === 1 ) {
  11172. // Support: IE <=9 - 11, Edge 12 - 15
  11173. // Record all 3 overflow attributes because IE does not infer the shorthand
  11174. // from identically-valued overflowX and overflowY and Edge just mirrors
  11175. // the overflowX value there.
  11176. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  11177. // Identify a display type, preferring old show/hide data over the CSS cascade
  11178. restoreDisplay = dataShow && dataShow.display;
  11179. if ( restoreDisplay == null ) {
  11180. restoreDisplay = dataPriv.get( elem, "display" );
  11181. }
  11182. display = jQuery.css( elem, "display" );
  11183. if ( display === "none" ) {
  11184. if ( restoreDisplay ) {
  11185. display = restoreDisplay;
  11186. } else {
  11187. // Get nonempty value(s) by temporarily forcing visibility
  11188. showHide( [ elem ], true );
  11189. restoreDisplay = elem.style.display || restoreDisplay;
  11190. display = jQuery.css( elem, "display" );
  11191. showHide( [ elem ] );
  11192. }
  11193. }
  11194. // Animate inline elements as inline-block
  11195. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  11196. if ( jQuery.css( elem, "float" ) === "none" ) {
  11197. // Restore the original display value at the end of pure show/hide animations
  11198. if ( !propTween ) {
  11199. anim.done( function() {
  11200. style.display = restoreDisplay;
  11201. } );
  11202. if ( restoreDisplay == null ) {
  11203. display = style.display;
  11204. restoreDisplay = display === "none" ? "" : display;
  11205. }
  11206. }
  11207. style.display = "inline-block";
  11208. }
  11209. }
  11210. }
  11211. if ( opts.overflow ) {
  11212. style.overflow = "hidden";
  11213. anim.always( function() {
  11214. style.overflow = opts.overflow[ 0 ];
  11215. style.overflowX = opts.overflow[ 1 ];
  11216. style.overflowY = opts.overflow[ 2 ];
  11217. } );
  11218. }
  11219. // Implement show/hide animations
  11220. propTween = false;
  11221. for ( prop in orig ) {
  11222. // General show/hide setup for this element animation
  11223. if ( !propTween ) {
  11224. if ( dataShow ) {
  11225. if ( "hidden" in dataShow ) {
  11226. hidden = dataShow.hidden;
  11227. }
  11228. } else {
  11229. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  11230. }
  11231. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  11232. if ( toggle ) {
  11233. dataShow.hidden = !hidden;
  11234. }
  11235. // Show elements before animating them
  11236. if ( hidden ) {
  11237. showHide( [ elem ], true );
  11238. }
  11239. /* eslint-disable no-loop-func */
  11240. anim.done( function() {
  11241. /* eslint-enable no-loop-func */
  11242. // The final step of a "hide" animation is actually hiding the element
  11243. if ( !hidden ) {
  11244. showHide( [ elem ] );
  11245. }
  11246. dataPriv.remove( elem, "fxshow" );
  11247. for ( prop in orig ) {
  11248. jQuery.style( elem, prop, orig[ prop ] );
  11249. }
  11250. } );
  11251. }
  11252. // Per-property setup
  11253. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  11254. if ( !( prop in dataShow ) ) {
  11255. dataShow[ prop ] = propTween.start;
  11256. if ( hidden ) {
  11257. propTween.end = propTween.start;
  11258. propTween.start = 0;
  11259. }
  11260. }
  11261. }
  11262. }
  11263. function propFilter( props, specialEasing ) {
  11264. var index, name, easing, value, hooks;
  11265. // camelCase, specialEasing and expand cssHook pass
  11266. for ( index in props ) {
  11267. name = camelCase( index );
  11268. easing = specialEasing[ name ];
  11269. value = props[ index ];
  11270. if ( Array.isArray( value ) ) {
  11271. easing = value[ 1 ];
  11272. value = props[ index ] = value[ 0 ];
  11273. }
  11274. if ( index !== name ) {
  11275. props[ name ] = value;
  11276. delete props[ index ];
  11277. }
  11278. hooks = jQuery.cssHooks[ name ];
  11279. if ( hooks && "expand" in hooks ) {
  11280. value = hooks.expand( value );
  11281. delete props[ name ];
  11282. // Not quite $.extend, this won't overwrite existing keys.
  11283. // Reusing 'index' because we have the correct "name"
  11284. for ( index in value ) {
  11285. if ( !( index in props ) ) {
  11286. props[ index ] = value[ index ];
  11287. specialEasing[ index ] = easing;
  11288. }
  11289. }
  11290. } else {
  11291. specialEasing[ name ] = easing;
  11292. }
  11293. }
  11294. }
  11295. function Animation( elem, properties, options ) {
  11296. var result,
  11297. stopped,
  11298. index = 0,
  11299. length = Animation.prefilters.length,
  11300. deferred = jQuery.Deferred().always( function() {
  11301. // Don't match elem in the :animated selector
  11302. delete tick.elem;
  11303. } ),
  11304. tick = function() {
  11305. if ( stopped ) {
  11306. return false;
  11307. }
  11308. var currentTime = fxNow || createFxNow(),
  11309. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  11310. // Support: Android 2.3 only
  11311. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  11312. temp = remaining / animation.duration || 0,
  11313. percent = 1 - temp,
  11314. index = 0,
  11315. length = animation.tweens.length;
  11316. for ( ; index < length; index++ ) {
  11317. animation.tweens[ index ].run( percent );
  11318. }
  11319. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  11320. // If there's more to do, yield
  11321. if ( percent < 1 && length ) {
  11322. return remaining;
  11323. }
  11324. // If this was an empty animation, synthesize a final progress notification
  11325. if ( !length ) {
  11326. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11327. }
  11328. // Resolve the animation and report its conclusion
  11329. deferred.resolveWith( elem, [ animation ] );
  11330. return false;
  11331. },
  11332. animation = deferred.promise( {
  11333. elem: elem,
  11334. props: jQuery.extend( {}, properties ),
  11335. opts: jQuery.extend( true, {
  11336. specialEasing: {},
  11337. easing: jQuery.easing._default
  11338. }, options ),
  11339. originalProperties: properties,
  11340. originalOptions: options,
  11341. startTime: fxNow || createFxNow(),
  11342. duration: options.duration,
  11343. tweens: [],
  11344. createTween: function( prop, end ) {
  11345. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  11346. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  11347. animation.tweens.push( tween );
  11348. return tween;
  11349. },
  11350. stop: function( gotoEnd ) {
  11351. var index = 0,
  11352. // If we are going to the end, we want to run all the tweens
  11353. // otherwise we skip this part
  11354. length = gotoEnd ? animation.tweens.length : 0;
  11355. if ( stopped ) {
  11356. return this;
  11357. }
  11358. stopped = true;
  11359. for ( ; index < length; index++ ) {
  11360. animation.tweens[ index ].run( 1 );
  11361. }
  11362. // Resolve when we played the last frame; otherwise, reject
  11363. if ( gotoEnd ) {
  11364. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11365. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  11366. } else {
  11367. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  11368. }
  11369. return this;
  11370. }
  11371. } ),
  11372. props = animation.props;
  11373. propFilter( props, animation.opts.specialEasing );
  11374. for ( ; index < length; index++ ) {
  11375. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  11376. if ( result ) {
  11377. if ( isFunction( result.stop ) ) {
  11378. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  11379. result.stop.bind( result );
  11380. }
  11381. return result;
  11382. }
  11383. }
  11384. jQuery.map( props, createTween, animation );
  11385. if ( isFunction( animation.opts.start ) ) {
  11386. animation.opts.start.call( elem, animation );
  11387. }
  11388. // Attach callbacks from options
  11389. animation
  11390. .progress( animation.opts.progress )
  11391. .done( animation.opts.done, animation.opts.complete )
  11392. .fail( animation.opts.fail )
  11393. .always( animation.opts.always );
  11394. jQuery.fx.timer(
  11395. jQuery.extend( tick, {
  11396. elem: elem,
  11397. anim: animation,
  11398. queue: animation.opts.queue
  11399. } )
  11400. );
  11401. return animation;
  11402. }
  11403. jQuery.Animation = jQuery.extend( Animation, {
  11404. tweeners: {
  11405. "*": [ function( prop, value ) {
  11406. var tween = this.createTween( prop, value );
  11407. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  11408. return tween;
  11409. } ]
  11410. },
  11411. tweener: function( props, callback ) {
  11412. if ( isFunction( props ) ) {
  11413. callback = props;
  11414. props = [ "*" ];
  11415. } else {
  11416. props = props.match( rnothtmlwhite );
  11417. }
  11418. var prop,
  11419. index = 0,
  11420. length = props.length;
  11421. for ( ; index < length; index++ ) {
  11422. prop = props[ index ];
  11423. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  11424. Animation.tweeners[ prop ].unshift( callback );
  11425. }
  11426. },
  11427. prefilters: [ defaultPrefilter ],
  11428. prefilter: function( callback, prepend ) {
  11429. if ( prepend ) {
  11430. Animation.prefilters.unshift( callback );
  11431. } else {
  11432. Animation.prefilters.push( callback );
  11433. }
  11434. }
  11435. } );
  11436. jQuery.speed = function( speed, easing, fn ) {
  11437. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  11438. complete: fn || !fn && easing ||
  11439. isFunction( speed ) && speed,
  11440. duration: speed,
  11441. easing: fn && easing || easing && !isFunction( easing ) && easing
  11442. };
  11443. // Go to the end state if fx are off
  11444. if ( jQuery.fx.off ) {
  11445. opt.duration = 0;
  11446. } else {
  11447. if ( typeof opt.duration !== "number" ) {
  11448. if ( opt.duration in jQuery.fx.speeds ) {
  11449. opt.duration = jQuery.fx.speeds[ opt.duration ];
  11450. } else {
  11451. opt.duration = jQuery.fx.speeds._default;
  11452. }
  11453. }
  11454. }
  11455. // Normalize opt.queue - true/undefined/null -> "fx"
  11456. if ( opt.queue == null || opt.queue === true ) {
  11457. opt.queue = "fx";
  11458. }
  11459. // Queueing
  11460. opt.old = opt.complete;
  11461. opt.complete = function() {
  11462. if ( isFunction( opt.old ) ) {
  11463. opt.old.call( this );
  11464. }
  11465. if ( opt.queue ) {
  11466. jQuery.dequeue( this, opt.queue );
  11467. }
  11468. };
  11469. return opt;
  11470. };
  11471. jQuery.fn.extend( {
  11472. fadeTo: function( speed, to, easing, callback ) {
  11473. // Show any hidden elements after setting opacity to 0
  11474. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  11475. // Animate to the value specified
  11476. .end().animate( { opacity: to }, speed, easing, callback );
  11477. },
  11478. animate: function( prop, speed, easing, callback ) {
  11479. var empty = jQuery.isEmptyObject( prop ),
  11480. optall = jQuery.speed( speed, easing, callback ),
  11481. doAnimation = function() {
  11482. // Operate on a copy of prop so per-property easing won't be lost
  11483. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  11484. // Empty animations, or finishing resolves immediately
  11485. if ( empty || dataPriv.get( this, "finish" ) ) {
  11486. anim.stop( true );
  11487. }
  11488. };
  11489. doAnimation.finish = doAnimation;
  11490. return empty || optall.queue === false ?
  11491. this.each( doAnimation ) :
  11492. this.queue( optall.queue, doAnimation );
  11493. },
  11494. stop: function( type, clearQueue, gotoEnd ) {
  11495. var stopQueue = function( hooks ) {
  11496. var stop = hooks.stop;
  11497. delete hooks.stop;
  11498. stop( gotoEnd );
  11499. };
  11500. if ( typeof type !== "string" ) {
  11501. gotoEnd = clearQueue;
  11502. clearQueue = type;
  11503. type = undefined;
  11504. }
  11505. if ( clearQueue ) {
  11506. this.queue( type || "fx", [] );
  11507. }
  11508. return this.each( function() {
  11509. var dequeue = true,
  11510. index = type != null && type + "queueHooks",
  11511. timers = jQuery.timers,
  11512. data = dataPriv.get( this );
  11513. if ( index ) {
  11514. if ( data[ index ] && data[ index ].stop ) {
  11515. stopQueue( data[ index ] );
  11516. }
  11517. } else {
  11518. for ( index in data ) {
  11519. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  11520. stopQueue( data[ index ] );
  11521. }
  11522. }
  11523. }
  11524. for ( index = timers.length; index--; ) {
  11525. if ( timers[ index ].elem === this &&
  11526. ( type == null || timers[ index ].queue === type ) ) {
  11527. timers[ index ].anim.stop( gotoEnd );
  11528. dequeue = false;
  11529. timers.splice( index, 1 );
  11530. }
  11531. }
  11532. // Start the next in the queue if the last step wasn't forced.
  11533. // Timers currently will call their complete callbacks, which
  11534. // will dequeue but only if they were gotoEnd.
  11535. if ( dequeue || !gotoEnd ) {
  11536. jQuery.dequeue( this, type );
  11537. }
  11538. } );
  11539. },
  11540. finish: function( type ) {
  11541. if ( type !== false ) {
  11542. type = type || "fx";
  11543. }
  11544. return this.each( function() {
  11545. var index,
  11546. data = dataPriv.get( this ),
  11547. queue = data[ type + "queue" ],
  11548. hooks = data[ type + "queueHooks" ],
  11549. timers = jQuery.timers,
  11550. length = queue ? queue.length : 0;
  11551. // Enable finishing flag on private data
  11552. data.finish = true;
  11553. // Empty the queue first
  11554. jQuery.queue( this, type, [] );
  11555. if ( hooks && hooks.stop ) {
  11556. hooks.stop.call( this, true );
  11557. }
  11558. // Look for any active animations, and finish them
  11559. for ( index = timers.length; index--; ) {
  11560. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  11561. timers[ index ].anim.stop( true );
  11562. timers.splice( index, 1 );
  11563. }
  11564. }
  11565. // Look for any animations in the old queue and finish them
  11566. for ( index = 0; index < length; index++ ) {
  11567. if ( queue[ index ] && queue[ index ].finish ) {
  11568. queue[ index ].finish.call( this );
  11569. }
  11570. }
  11571. // Turn off finishing flag
  11572. delete data.finish;
  11573. } );
  11574. }
  11575. } );
  11576. jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
  11577. var cssFn = jQuery.fn[ name ];
  11578. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11579. return speed == null || typeof speed === "boolean" ?
  11580. cssFn.apply( this, arguments ) :
  11581. this.animate( genFx( name, true ), speed, easing, callback );
  11582. };
  11583. } );
  11584. // Generate shortcuts for custom animations
  11585. jQuery.each( {
  11586. slideDown: genFx( "show" ),
  11587. slideUp: genFx( "hide" ),
  11588. slideToggle: genFx( "toggle" ),
  11589. fadeIn: { opacity: "show" },
  11590. fadeOut: { opacity: "hide" },
  11591. fadeToggle: { opacity: "toggle" }
  11592. }, function( name, props ) {
  11593. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11594. return this.animate( props, speed, easing, callback );
  11595. };
  11596. } );
  11597. jQuery.timers = [];
  11598. jQuery.fx.tick = function() {
  11599. var timer,
  11600. i = 0,
  11601. timers = jQuery.timers;
  11602. fxNow = Date.now();
  11603. for ( ; i < timers.length; i++ ) {
  11604. timer = timers[ i ];
  11605. // Run the timer and safely remove it when done (allowing for external removal)
  11606. if ( !timer() && timers[ i ] === timer ) {
  11607. timers.splice( i--, 1 );
  11608. }
  11609. }
  11610. if ( !timers.length ) {
  11611. jQuery.fx.stop();
  11612. }
  11613. fxNow = undefined;
  11614. };
  11615. jQuery.fx.timer = function( timer ) {
  11616. jQuery.timers.push( timer );
  11617. jQuery.fx.start();
  11618. };
  11619. jQuery.fx.interval = 13;
  11620. jQuery.fx.start = function() {
  11621. if ( inProgress ) {
  11622. return;
  11623. }
  11624. inProgress = true;
  11625. schedule();
  11626. };
  11627. jQuery.fx.stop = function() {
  11628. inProgress = null;
  11629. };
  11630. jQuery.fx.speeds = {
  11631. slow: 600,
  11632. fast: 200,
  11633. // Default speed
  11634. _default: 400
  11635. };
  11636. // Based off of the plugin by Clint Helfers, with permission.
  11637. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  11638. jQuery.fn.delay = function( time, type ) {
  11639. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  11640. type = type || "fx";
  11641. return this.queue( type, function( next, hooks ) {
  11642. var timeout = window.setTimeout( next, time );
  11643. hooks.stop = function() {
  11644. window.clearTimeout( timeout );
  11645. };
  11646. } );
  11647. };
  11648. ( function() {
  11649. var input = document.createElement( "input" ),
  11650. select = document.createElement( "select" ),
  11651. opt = select.appendChild( document.createElement( "option" ) );
  11652. input.type = "checkbox";
  11653. // Support: Android <=4.3 only
  11654. // Default value for a checkbox should be "on"
  11655. support.checkOn = input.value !== "";
  11656. // Support: IE <=11 only
  11657. // Must access selectedIndex to make default options select
  11658. support.optSelected = opt.selected;
  11659. // Support: IE <=11 only
  11660. // An input loses its value after becoming a radio
  11661. input = document.createElement( "input" );
  11662. input.value = "t";
  11663. input.type = "radio";
  11664. support.radioValue = input.value === "t";
  11665. } )();
  11666. var boolHook,
  11667. attrHandle = jQuery.expr.attrHandle;
  11668. jQuery.fn.extend( {
  11669. attr: function( name, value ) {
  11670. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  11671. },
  11672. removeAttr: function( name ) {
  11673. return this.each( function() {
  11674. jQuery.removeAttr( this, name );
  11675. } );
  11676. }
  11677. } );
  11678. jQuery.extend( {
  11679. attr: function( elem, name, value ) {
  11680. var ret, hooks,
  11681. nType = elem.nodeType;
  11682. // Don't get/set attributes on text, comment and attribute nodes
  11683. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11684. return;
  11685. }
  11686. // Fallback to prop when attributes are not supported
  11687. if ( typeof elem.getAttribute === "undefined" ) {
  11688. return jQuery.prop( elem, name, value );
  11689. }
  11690. // Attribute hooks are determined by the lowercase version
  11691. // Grab necessary hook if one is defined
  11692. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11693. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  11694. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  11695. }
  11696. if ( value !== undefined ) {
  11697. if ( value === null ) {
  11698. jQuery.removeAttr( elem, name );
  11699. return;
  11700. }
  11701. if ( hooks && "set" in hooks &&
  11702. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11703. return ret;
  11704. }
  11705. elem.setAttribute( name, value + "" );
  11706. return value;
  11707. }
  11708. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11709. return ret;
  11710. }
  11711. ret = jQuery.find.attr( elem, name );
  11712. // Non-existent attributes return null, we normalize to undefined
  11713. return ret == null ? undefined : ret;
  11714. },
  11715. attrHooks: {
  11716. type: {
  11717. set: function( elem, value ) {
  11718. if ( !support.radioValue && value === "radio" &&
  11719. nodeName( elem, "input" ) ) {
  11720. var val = elem.value;
  11721. elem.setAttribute( "type", value );
  11722. if ( val ) {
  11723. elem.value = val;
  11724. }
  11725. return value;
  11726. }
  11727. }
  11728. }
  11729. },
  11730. removeAttr: function( elem, value ) {
  11731. var name,
  11732. i = 0,
  11733. // Attribute names can contain non-HTML whitespace characters
  11734. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  11735. attrNames = value && value.match( rnothtmlwhite );
  11736. if ( attrNames && elem.nodeType === 1 ) {
  11737. while ( ( name = attrNames[ i++ ] ) ) {
  11738. elem.removeAttribute( name );
  11739. }
  11740. }
  11741. }
  11742. } );
  11743. // Hooks for boolean attributes
  11744. boolHook = {
  11745. set: function( elem, value, name ) {
  11746. if ( value === false ) {
  11747. // Remove boolean attributes when set to false
  11748. jQuery.removeAttr( elem, name );
  11749. } else {
  11750. elem.setAttribute( name, name );
  11751. }
  11752. return name;
  11753. }
  11754. };
  11755. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  11756. var getter = attrHandle[ name ] || jQuery.find.attr;
  11757. attrHandle[ name ] = function( elem, name, isXML ) {
  11758. var ret, handle,
  11759. lowercaseName = name.toLowerCase();
  11760. if ( !isXML ) {
  11761. // Avoid an infinite loop by temporarily removing this function from the getter
  11762. handle = attrHandle[ lowercaseName ];
  11763. attrHandle[ lowercaseName ] = ret;
  11764. ret = getter( elem, name, isXML ) != null ?
  11765. lowercaseName :
  11766. null;
  11767. attrHandle[ lowercaseName ] = handle;
  11768. }
  11769. return ret;
  11770. };
  11771. } );
  11772. var rfocusable = /^(?:input|select|textarea|button)$/i,
  11773. rclickable = /^(?:a|area)$/i;
  11774. jQuery.fn.extend( {
  11775. prop: function( name, value ) {
  11776. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  11777. },
  11778. removeProp: function( name ) {
  11779. return this.each( function() {
  11780. delete this[ jQuery.propFix[ name ] || name ];
  11781. } );
  11782. }
  11783. } );
  11784. jQuery.extend( {
  11785. prop: function( elem, name, value ) {
  11786. var ret, hooks,
  11787. nType = elem.nodeType;
  11788. // Don't get/set properties on text, comment and attribute nodes
  11789. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11790. return;
  11791. }
  11792. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11793. // Fix name and attach hooks
  11794. name = jQuery.propFix[ name ] || name;
  11795. hooks = jQuery.propHooks[ name ];
  11796. }
  11797. if ( value !== undefined ) {
  11798. if ( hooks && "set" in hooks &&
  11799. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11800. return ret;
  11801. }
  11802. return ( elem[ name ] = value );
  11803. }
  11804. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11805. return ret;
  11806. }
  11807. return elem[ name ];
  11808. },
  11809. propHooks: {
  11810. tabIndex: {
  11811. get: function( elem ) {
  11812. // Support: IE <=9 - 11 only
  11813. // elem.tabIndex doesn't always return the
  11814. // correct value when it hasn't been explicitly set
  11815. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  11816. // Use proper attribute retrieval(#12072)
  11817. var tabindex = jQuery.find.attr( elem, "tabindex" );
  11818. if ( tabindex ) {
  11819. return parseInt( tabindex, 10 );
  11820. }
  11821. if (
  11822. rfocusable.test( elem.nodeName ) ||
  11823. rclickable.test( elem.nodeName ) &&
  11824. elem.href
  11825. ) {
  11826. return 0;
  11827. }
  11828. return -1;
  11829. }
  11830. }
  11831. },
  11832. propFix: {
  11833. "for": "htmlFor",
  11834. "class": "className"
  11835. }
  11836. } );
  11837. // Support: IE <=11 only
  11838. // Accessing the selectedIndex property
  11839. // forces the browser to respect setting selected
  11840. // on the option
  11841. // The getter ensures a default option is selected
  11842. // when in an optgroup
  11843. // eslint rule "no-unused-expressions" is disabled for this code
  11844. // since it considers such accessions noop
  11845. if ( !support.optSelected ) {
  11846. jQuery.propHooks.selected = {
  11847. get: function( elem ) {
  11848. /* eslint no-unused-expressions: "off" */
  11849. var parent = elem.parentNode;
  11850. if ( parent && parent.parentNode ) {
  11851. parent.parentNode.selectedIndex;
  11852. }
  11853. return null;
  11854. },
  11855. set: function( elem ) {
  11856. /* eslint no-unused-expressions: "off" */
  11857. var parent = elem.parentNode;
  11858. if ( parent ) {
  11859. parent.selectedIndex;
  11860. if ( parent.parentNode ) {
  11861. parent.parentNode.selectedIndex;
  11862. }
  11863. }
  11864. }
  11865. };
  11866. }
  11867. jQuery.each( [
  11868. "tabIndex",
  11869. "readOnly",
  11870. "maxLength",
  11871. "cellSpacing",
  11872. "cellPadding",
  11873. "rowSpan",
  11874. "colSpan",
  11875. "useMap",
  11876. "frameBorder",
  11877. "contentEditable"
  11878. ], function() {
  11879. jQuery.propFix[ this.toLowerCase() ] = this;
  11880. } );
  11881. // Strip and collapse whitespace according to HTML spec
  11882. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  11883. function stripAndCollapse( value ) {
  11884. var tokens = value.match( rnothtmlwhite ) || [];
  11885. return tokens.join( " " );
  11886. }
  11887. function getClass( elem ) {
  11888. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  11889. }
  11890. function classesToArray( value ) {
  11891. if ( Array.isArray( value ) ) {
  11892. return value;
  11893. }
  11894. if ( typeof value === "string" ) {
  11895. return value.match( rnothtmlwhite ) || [];
  11896. }
  11897. return [];
  11898. }
  11899. jQuery.fn.extend( {
  11900. addClass: function( value ) {
  11901. var classes, elem, cur, curValue, clazz, j, finalValue,
  11902. i = 0;
  11903. if ( isFunction( value ) ) {
  11904. return this.each( function( j ) {
  11905. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  11906. } );
  11907. }
  11908. classes = classesToArray( value );
  11909. if ( classes.length ) {
  11910. while ( ( elem = this[ i++ ] ) ) {
  11911. curValue = getClass( elem );
  11912. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11913. if ( cur ) {
  11914. j = 0;
  11915. while ( ( clazz = classes[ j++ ] ) ) {
  11916. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  11917. cur += clazz + " ";
  11918. }
  11919. }
  11920. // Only assign if different to avoid unneeded rendering.
  11921. finalValue = stripAndCollapse( cur );
  11922. if ( curValue !== finalValue ) {
  11923. elem.setAttribute( "class", finalValue );
  11924. }
  11925. }
  11926. }
  11927. }
  11928. return this;
  11929. },
  11930. removeClass: function( value ) {
  11931. var classes, elem, cur, curValue, clazz, j, finalValue,
  11932. i = 0;
  11933. if ( isFunction( value ) ) {
  11934. return this.each( function( j ) {
  11935. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  11936. } );
  11937. }
  11938. if ( !arguments.length ) {
  11939. return this.attr( "class", "" );
  11940. }
  11941. classes = classesToArray( value );
  11942. if ( classes.length ) {
  11943. while ( ( elem = this[ i++ ] ) ) {
  11944. curValue = getClass( elem );
  11945. // This expression is here for better compressibility (see addClass)
  11946. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11947. if ( cur ) {
  11948. j = 0;
  11949. while ( ( clazz = classes[ j++ ] ) ) {
  11950. // Remove *all* instances
  11951. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  11952. cur = cur.replace( " " + clazz + " ", " " );
  11953. }
  11954. }
  11955. // Only assign if different to avoid unneeded rendering.
  11956. finalValue = stripAndCollapse( cur );
  11957. if ( curValue !== finalValue ) {
  11958. elem.setAttribute( "class", finalValue );
  11959. }
  11960. }
  11961. }
  11962. }
  11963. return this;
  11964. },
  11965. toggleClass: function( value, stateVal ) {
  11966. var type = typeof value,
  11967. isValidValue = type === "string" || Array.isArray( value );
  11968. if ( typeof stateVal === "boolean" && isValidValue ) {
  11969. return stateVal ? this.addClass( value ) : this.removeClass( value );
  11970. }
  11971. if ( isFunction( value ) ) {
  11972. return this.each( function( i ) {
  11973. jQuery( this ).toggleClass(
  11974. value.call( this, i, getClass( this ), stateVal ),
  11975. stateVal
  11976. );
  11977. } );
  11978. }
  11979. return this.each( function() {
  11980. var className, i, self, classNames;
  11981. if ( isValidValue ) {
  11982. // Toggle individual class names
  11983. i = 0;
  11984. self = jQuery( this );
  11985. classNames = classesToArray( value );
  11986. while ( ( className = classNames[ i++ ] ) ) {
  11987. // Check each className given, space separated list
  11988. if ( self.hasClass( className ) ) {
  11989. self.removeClass( className );
  11990. } else {
  11991. self.addClass( className );
  11992. }
  11993. }
  11994. // Toggle whole class name
  11995. } else if ( value === undefined || type === "boolean" ) {
  11996. className = getClass( this );
  11997. if ( className ) {
  11998. // Store className if set
  11999. dataPriv.set( this, "__className__", className );
  12000. }
  12001. // If the element has a class name or if we're passed `false`,
  12002. // then remove the whole classname (if there was one, the above saved it).
  12003. // Otherwise bring back whatever was previously saved (if anything),
  12004. // falling back to the empty string if nothing was stored.
  12005. if ( this.setAttribute ) {
  12006. this.setAttribute( "class",
  12007. className || value === false ?
  12008. "" :
  12009. dataPriv.get( this, "__className__" ) || ""
  12010. );
  12011. }
  12012. }
  12013. } );
  12014. },
  12015. hasClass: function( selector ) {
  12016. var className, elem,
  12017. i = 0;
  12018. className = " " + selector + " ";
  12019. while ( ( elem = this[ i++ ] ) ) {
  12020. if ( elem.nodeType === 1 &&
  12021. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  12022. return true;
  12023. }
  12024. }
  12025. return false;
  12026. }
  12027. } );
  12028. var rreturn = /\r/g;
  12029. jQuery.fn.extend( {
  12030. val: function( value ) {
  12031. var hooks, ret, valueIsFunction,
  12032. elem = this[ 0 ];
  12033. if ( !arguments.length ) {
  12034. if ( elem ) {
  12035. hooks = jQuery.valHooks[ elem.type ] ||
  12036. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  12037. if ( hooks &&
  12038. "get" in hooks &&
  12039. ( ret = hooks.get( elem, "value" ) ) !== undefined
  12040. ) {
  12041. return ret;
  12042. }
  12043. ret = elem.value;
  12044. // Handle most common string cases
  12045. if ( typeof ret === "string" ) {
  12046. return ret.replace( rreturn, "" );
  12047. }
  12048. // Handle cases where value is null/undef or number
  12049. return ret == null ? "" : ret;
  12050. }
  12051. return;
  12052. }
  12053. valueIsFunction = isFunction( value );
  12054. return this.each( function( i ) {
  12055. var val;
  12056. if ( this.nodeType !== 1 ) {
  12057. return;
  12058. }
  12059. if ( valueIsFunction ) {
  12060. val = value.call( this, i, jQuery( this ).val() );
  12061. } else {
  12062. val = value;
  12063. }
  12064. // Treat null/undefined as ""; convert numbers to string
  12065. if ( val == null ) {
  12066. val = "";
  12067. } else if ( typeof val === "number" ) {
  12068. val += "";
  12069. } else if ( Array.isArray( val ) ) {
  12070. val = jQuery.map( val, function( value ) {
  12071. return value == null ? "" : value + "";
  12072. } );
  12073. }
  12074. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  12075. // If set returns undefined, fall back to normal setting
  12076. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  12077. this.value = val;
  12078. }
  12079. } );
  12080. }
  12081. } );
  12082. jQuery.extend( {
  12083. valHooks: {
  12084. option: {
  12085. get: function( elem ) {
  12086. var val = jQuery.find.attr( elem, "value" );
  12087. return val != null ?
  12088. val :
  12089. // Support: IE <=10 - 11 only
  12090. // option.text throws exceptions (#14686, #14858)
  12091. // Strip and collapse whitespace
  12092. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  12093. stripAndCollapse( jQuery.text( elem ) );
  12094. }
  12095. },
  12096. select: {
  12097. get: function( elem ) {
  12098. var value, option, i,
  12099. options = elem.options,
  12100. index = elem.selectedIndex,
  12101. one = elem.type === "select-one",
  12102. values = one ? null : [],
  12103. max = one ? index + 1 : options.length;
  12104. if ( index < 0 ) {
  12105. i = max;
  12106. } else {
  12107. i = one ? index : 0;
  12108. }
  12109. // Loop through all the selected options
  12110. for ( ; i < max; i++ ) {
  12111. option = options[ i ];
  12112. // Support: IE <=9 only
  12113. // IE8-9 doesn't update selected after form reset (#2551)
  12114. if ( ( option.selected || i === index ) &&
  12115. // Don't return options that are disabled or in a disabled optgroup
  12116. !option.disabled &&
  12117. ( !option.parentNode.disabled ||
  12118. !nodeName( option.parentNode, "optgroup" ) ) ) {
  12119. // Get the specific value for the option
  12120. value = jQuery( option ).val();
  12121. // We don't need an array for one selects
  12122. if ( one ) {
  12123. return value;
  12124. }
  12125. // Multi-Selects return an array
  12126. values.push( value );
  12127. }
  12128. }
  12129. return values;
  12130. },
  12131. set: function( elem, value ) {
  12132. var optionSet, option,
  12133. options = elem.options,
  12134. values = jQuery.makeArray( value ),
  12135. i = options.length;
  12136. while ( i-- ) {
  12137. option = options[ i ];
  12138. /* eslint-disable no-cond-assign */
  12139. if ( option.selected =
  12140. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  12141. ) {
  12142. optionSet = true;
  12143. }
  12144. /* eslint-enable no-cond-assign */
  12145. }
  12146. // Force browsers to behave consistently when non-matching value is set
  12147. if ( !optionSet ) {
  12148. elem.selectedIndex = -1;
  12149. }
  12150. return values;
  12151. }
  12152. }
  12153. }
  12154. } );
  12155. // Radios and checkboxes getter/setter
  12156. jQuery.each( [ "radio", "checkbox" ], function() {
  12157. jQuery.valHooks[ this ] = {
  12158. set: function( elem, value ) {
  12159. if ( Array.isArray( value ) ) {
  12160. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  12161. }
  12162. }
  12163. };
  12164. if ( !support.checkOn ) {
  12165. jQuery.valHooks[ this ].get = function( elem ) {
  12166. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  12167. };
  12168. }
  12169. } );
  12170. // Return jQuery for attributes-only inclusion
  12171. support.focusin = "onfocusin" in window;
  12172. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  12173. stopPropagationCallback = function( e ) {
  12174. e.stopPropagation();
  12175. };
  12176. jQuery.extend( jQuery.event, {
  12177. trigger: function( event, data, elem, onlyHandlers ) {
  12178. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  12179. eventPath = [ elem || document ],
  12180. type = hasOwn.call( event, "type" ) ? event.type : event,
  12181. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  12182. cur = lastElement = tmp = elem = elem || document;
  12183. // Don't do events on text and comment nodes
  12184. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  12185. return;
  12186. }
  12187. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  12188. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  12189. return;
  12190. }
  12191. if ( type.indexOf( "." ) > -1 ) {
  12192. // Namespaced trigger; create a regexp to match event type in handle()
  12193. namespaces = type.split( "." );
  12194. type = namespaces.shift();
  12195. namespaces.sort();
  12196. }
  12197. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  12198. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  12199. event = event[ jQuery.expando ] ?
  12200. event :
  12201. new jQuery.Event( type, typeof event === "object" && event );
  12202. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  12203. event.isTrigger = onlyHandlers ? 2 : 3;
  12204. event.namespace = namespaces.join( "." );
  12205. event.rnamespace = event.namespace ?
  12206. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  12207. null;
  12208. // Clean up the event in case it is being reused
  12209. event.result = undefined;
  12210. if ( !event.target ) {
  12211. event.target = elem;
  12212. }
  12213. // Clone any incoming data and prepend the event, creating the handler arg list
  12214. data = data == null ?
  12215. [ event ] :
  12216. jQuery.makeArray( data, [ event ] );
  12217. // Allow special events to draw outside the lines
  12218. special = jQuery.event.special[ type ] || {};
  12219. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  12220. return;
  12221. }
  12222. // Determine event propagation path in advance, per W3C events spec (#9951)
  12223. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  12224. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  12225. bubbleType = special.delegateType || type;
  12226. if ( !rfocusMorph.test( bubbleType + type ) ) {
  12227. cur = cur.parentNode;
  12228. }
  12229. for ( ; cur; cur = cur.parentNode ) {
  12230. eventPath.push( cur );
  12231. tmp = cur;
  12232. }
  12233. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  12234. if ( tmp === ( elem.ownerDocument || document ) ) {
  12235. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  12236. }
  12237. }
  12238. // Fire handlers on the event path
  12239. i = 0;
  12240. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  12241. lastElement = cur;
  12242. event.type = i > 1 ?
  12243. bubbleType :
  12244. special.bindType || type;
  12245. // jQuery handler
  12246. handle = (
  12247. dataPriv.get( cur, "events" ) || Object.create( null )
  12248. )[ event.type ] &&
  12249. dataPriv.get( cur, "handle" );
  12250. if ( handle ) {
  12251. handle.apply( cur, data );
  12252. }
  12253. // Native handler
  12254. handle = ontype && cur[ ontype ];
  12255. if ( handle && handle.apply && acceptData( cur ) ) {
  12256. event.result = handle.apply( cur, data );
  12257. if ( event.result === false ) {
  12258. event.preventDefault();
  12259. }
  12260. }
  12261. }
  12262. event.type = type;
  12263. // If nobody prevented the default action, do it now
  12264. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  12265. if ( ( !special._default ||
  12266. special._default.apply( eventPath.pop(), data ) === false ) &&
  12267. acceptData( elem ) ) {
  12268. // Call a native DOM method on the target with the same name as the event.
  12269. // Don't do default actions on window, that's where global variables be (#6170)
  12270. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  12271. // Don't re-trigger an onFOO event when we call its FOO() method
  12272. tmp = elem[ ontype ];
  12273. if ( tmp ) {
  12274. elem[ ontype ] = null;
  12275. }
  12276. // Prevent re-triggering of the same event, since we already bubbled it above
  12277. jQuery.event.triggered = type;
  12278. if ( event.isPropagationStopped() ) {
  12279. lastElement.addEventListener( type, stopPropagationCallback );
  12280. }
  12281. elem[ type ]();
  12282. if ( event.isPropagationStopped() ) {
  12283. lastElement.removeEventListener( type, stopPropagationCallback );
  12284. }
  12285. jQuery.event.triggered = undefined;
  12286. if ( tmp ) {
  12287. elem[ ontype ] = tmp;
  12288. }
  12289. }
  12290. }
  12291. }
  12292. return event.result;
  12293. },
  12294. // Piggyback on a donor event to simulate a different one
  12295. // Used only for `focus(in | out)` events
  12296. simulate: function( type, elem, event ) {
  12297. var e = jQuery.extend(
  12298. new jQuery.Event(),
  12299. event,
  12300. {
  12301. type: type,
  12302. isSimulated: true
  12303. }
  12304. );
  12305. jQuery.event.trigger( e, null, elem );
  12306. }
  12307. } );
  12308. jQuery.fn.extend( {
  12309. trigger: function( type, data ) {
  12310. return this.each( function() {
  12311. jQuery.event.trigger( type, data, this );
  12312. } );
  12313. },
  12314. triggerHandler: function( type, data ) {
  12315. var elem = this[ 0 ];
  12316. if ( elem ) {
  12317. return jQuery.event.trigger( type, data, elem, true );
  12318. }
  12319. }
  12320. } );
  12321. // Support: Firefox <=44
  12322. // Firefox doesn't have focus(in | out) events
  12323. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  12324. //
  12325. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  12326. // focus(in | out) events fire after focus & blur events,
  12327. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  12328. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  12329. if ( !support.focusin ) {
  12330. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  12331. // Attach a single capturing handler on the document while someone wants focusin/focusout
  12332. var handler = function( event ) {
  12333. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  12334. };
  12335. jQuery.event.special[ fix ] = {
  12336. setup: function() {
  12337. // Handle: regular nodes (via `this.ownerDocument`), window
  12338. // (via `this.document`) & document (via `this`).
  12339. var doc = this.ownerDocument || this.document || this,
  12340. attaches = dataPriv.access( doc, fix );
  12341. if ( !attaches ) {
  12342. doc.addEventListener( orig, handler, true );
  12343. }
  12344. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  12345. },
  12346. teardown: function() {
  12347. var doc = this.ownerDocument || this.document || this,
  12348. attaches = dataPriv.access( doc, fix ) - 1;
  12349. if ( !attaches ) {
  12350. doc.removeEventListener( orig, handler, true );
  12351. dataPriv.remove( doc, fix );
  12352. } else {
  12353. dataPriv.access( doc, fix, attaches );
  12354. }
  12355. }
  12356. };
  12357. } );
  12358. }
  12359. var location = window.location;
  12360. var nonce = { guid: Date.now() };
  12361. var rquery = ( /\?/ );
  12362. // Cross-browser xml parsing
  12363. jQuery.parseXML = function( data ) {
  12364. var xml;
  12365. if ( !data || typeof data !== "string" ) {
  12366. return null;
  12367. }
  12368. // Support: IE 9 - 11 only
  12369. // IE throws on parseFromString with invalid input.
  12370. try {
  12371. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  12372. } catch ( e ) {
  12373. xml = undefined;
  12374. }
  12375. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  12376. jQuery.error( "Invalid XML: " + data );
  12377. }
  12378. return xml;
  12379. };
  12380. var
  12381. rbracket = /\[\]$/,
  12382. rCRLF = /\r?\n/g,
  12383. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  12384. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  12385. function buildParams( prefix, obj, traditional, add ) {
  12386. var name;
  12387. if ( Array.isArray( obj ) ) {
  12388. // Serialize array item.
  12389. jQuery.each( obj, function( i, v ) {
  12390. if ( traditional || rbracket.test( prefix ) ) {
  12391. // Treat each array item as a scalar.
  12392. add( prefix, v );
  12393. } else {
  12394. // Item is non-scalar (array or object), encode its numeric index.
  12395. buildParams(
  12396. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  12397. v,
  12398. traditional,
  12399. add
  12400. );
  12401. }
  12402. } );
  12403. } else if ( !traditional && toType( obj ) === "object" ) {
  12404. // Serialize object item.
  12405. for ( name in obj ) {
  12406. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  12407. }
  12408. } else {
  12409. // Serialize scalar item.
  12410. add( prefix, obj );
  12411. }
  12412. }
  12413. // Serialize an array of form elements or a set of
  12414. // key/values into a query string
  12415. jQuery.param = function( a, traditional ) {
  12416. var prefix,
  12417. s = [],
  12418. add = function( key, valueOrFunction ) {
  12419. // If value is a function, invoke it and use its return value
  12420. var value = isFunction( valueOrFunction ) ?
  12421. valueOrFunction() :
  12422. valueOrFunction;
  12423. s[ s.length ] = encodeURIComponent( key ) + "=" +
  12424. encodeURIComponent( value == null ? "" : value );
  12425. };
  12426. if ( a == null ) {
  12427. return "";
  12428. }
  12429. // If an array was passed in, assume that it is an array of form elements.
  12430. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  12431. // Serialize the form elements
  12432. jQuery.each( a, function() {
  12433. add( this.name, this.value );
  12434. } );
  12435. } else {
  12436. // If traditional, encode the "old" way (the way 1.3.2 or older
  12437. // did it), otherwise encode params recursively.
  12438. for ( prefix in a ) {
  12439. buildParams( prefix, a[ prefix ], traditional, add );
  12440. }
  12441. }
  12442. // Return the resulting serialization
  12443. return s.join( "&" );
  12444. };
  12445. jQuery.fn.extend( {
  12446. serialize: function() {
  12447. return jQuery.param( this.serializeArray() );
  12448. },
  12449. serializeArray: function() {
  12450. return this.map( function() {
  12451. // Can add propHook for "elements" to filter or add form elements
  12452. var elements = jQuery.prop( this, "elements" );
  12453. return elements ? jQuery.makeArray( elements ) : this;
  12454. } )
  12455. .filter( function() {
  12456. var type = this.type;
  12457. // Use .is( ":disabled" ) so that fieldset[disabled] works
  12458. return this.name && !jQuery( this ).is( ":disabled" ) &&
  12459. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  12460. ( this.checked || !rcheckableType.test( type ) );
  12461. } )
  12462. .map( function( _i, elem ) {
  12463. var val = jQuery( this ).val();
  12464. if ( val == null ) {
  12465. return null;
  12466. }
  12467. if ( Array.isArray( val ) ) {
  12468. return jQuery.map( val, function( val ) {
  12469. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12470. } );
  12471. }
  12472. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12473. } ).get();
  12474. }
  12475. } );
  12476. var
  12477. r20 = /%20/g,
  12478. rhash = /#.*$/,
  12479. rantiCache = /([?&])_=[^&]*/,
  12480. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  12481. // #7653, #8125, #8152: local protocol detection
  12482. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  12483. rnoContent = /^(?:GET|HEAD)$/,
  12484. rprotocol = /^\/\//,
  12485. /* Prefilters
  12486. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  12487. * 2) These are called:
  12488. * - BEFORE asking for a transport
  12489. * - AFTER param serialization (s.data is a string if s.processData is true)
  12490. * 3) key is the dataType
  12491. * 4) the catchall symbol "*" can be used
  12492. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  12493. */
  12494. prefilters = {},
  12495. /* Transports bindings
  12496. * 1) key is the dataType
  12497. * 2) the catchall symbol "*" can be used
  12498. * 3) selection will start with transport dataType and THEN go to "*" if needed
  12499. */
  12500. transports = {},
  12501. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  12502. allTypes = "*/".concat( "*" ),
  12503. // Anchor tag for parsing the document origin
  12504. originAnchor = document.createElement( "a" );
  12505. originAnchor.href = location.href;
  12506. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  12507. function addToPrefiltersOrTransports( structure ) {
  12508. // dataTypeExpression is optional and defaults to "*"
  12509. return function( dataTypeExpression, func ) {
  12510. if ( typeof dataTypeExpression !== "string" ) {
  12511. func = dataTypeExpression;
  12512. dataTypeExpression = "*";
  12513. }
  12514. var dataType,
  12515. i = 0,
  12516. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  12517. if ( isFunction( func ) ) {
  12518. // For each dataType in the dataTypeExpression
  12519. while ( ( dataType = dataTypes[ i++ ] ) ) {
  12520. // Prepend if requested
  12521. if ( dataType[ 0 ] === "+" ) {
  12522. dataType = dataType.slice( 1 ) || "*";
  12523. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  12524. // Otherwise append
  12525. } else {
  12526. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  12527. }
  12528. }
  12529. }
  12530. };
  12531. }
  12532. // Base inspection function for prefilters and transports
  12533. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  12534. var inspected = {},
  12535. seekingTransport = ( structure === transports );
  12536. function inspect( dataType ) {
  12537. var selected;
  12538. inspected[ dataType ] = true;
  12539. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  12540. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  12541. if ( typeof dataTypeOrTransport === "string" &&
  12542. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  12543. options.dataTypes.unshift( dataTypeOrTransport );
  12544. inspect( dataTypeOrTransport );
  12545. return false;
  12546. } else if ( seekingTransport ) {
  12547. return !( selected = dataTypeOrTransport );
  12548. }
  12549. } );
  12550. return selected;
  12551. }
  12552. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  12553. }
  12554. // A special extend for ajax options
  12555. // that takes "flat" options (not to be deep extended)
  12556. // Fixes #9887
  12557. function ajaxExtend( target, src ) {
  12558. var key, deep,
  12559. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  12560. for ( key in src ) {
  12561. if ( src[ key ] !== undefined ) {
  12562. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  12563. }
  12564. }
  12565. if ( deep ) {
  12566. jQuery.extend( true, target, deep );
  12567. }
  12568. return target;
  12569. }
  12570. /* Handles responses to an ajax request:
  12571. * - finds the right dataType (mediates between content-type and expected dataType)
  12572. * - returns the corresponding response
  12573. */
  12574. function ajaxHandleResponses( s, jqXHR, responses ) {
  12575. var ct, type, finalDataType, firstDataType,
  12576. contents = s.contents,
  12577. dataTypes = s.dataTypes;
  12578. // Remove auto dataType and get content-type in the process
  12579. while ( dataTypes[ 0 ] === "*" ) {
  12580. dataTypes.shift();
  12581. if ( ct === undefined ) {
  12582. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  12583. }
  12584. }
  12585. // Check if we're dealing with a known content-type
  12586. if ( ct ) {
  12587. for ( type in contents ) {
  12588. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  12589. dataTypes.unshift( type );
  12590. break;
  12591. }
  12592. }
  12593. }
  12594. // Check to see if we have a response for the expected dataType
  12595. if ( dataTypes[ 0 ] in responses ) {
  12596. finalDataType = dataTypes[ 0 ];
  12597. } else {
  12598. // Try convertible dataTypes
  12599. for ( type in responses ) {
  12600. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  12601. finalDataType = type;
  12602. break;
  12603. }
  12604. if ( !firstDataType ) {
  12605. firstDataType = type;
  12606. }
  12607. }
  12608. // Or just use first one
  12609. finalDataType = finalDataType || firstDataType;
  12610. }
  12611. // If we found a dataType
  12612. // We add the dataType to the list if needed
  12613. // and return the corresponding response
  12614. if ( finalDataType ) {
  12615. if ( finalDataType !== dataTypes[ 0 ] ) {
  12616. dataTypes.unshift( finalDataType );
  12617. }
  12618. return responses[ finalDataType ];
  12619. }
  12620. }
  12621. /* Chain conversions given the request and the original response
  12622. * Also sets the responseXXX fields on the jqXHR instance
  12623. */
  12624. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  12625. var conv2, current, conv, tmp, prev,
  12626. converters = {},
  12627. // Work with a copy of dataTypes in case we need to modify it for conversion
  12628. dataTypes = s.dataTypes.slice();
  12629. // Create converters map with lowercased keys
  12630. if ( dataTypes[ 1 ] ) {
  12631. for ( conv in s.converters ) {
  12632. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  12633. }
  12634. }
  12635. current = dataTypes.shift();
  12636. // Convert to each sequential dataType
  12637. while ( current ) {
  12638. if ( s.responseFields[ current ] ) {
  12639. jqXHR[ s.responseFields[ current ] ] = response;
  12640. }
  12641. // Apply the dataFilter if provided
  12642. if ( !prev && isSuccess && s.dataFilter ) {
  12643. response = s.dataFilter( response, s.dataType );
  12644. }
  12645. prev = current;
  12646. current = dataTypes.shift();
  12647. if ( current ) {
  12648. // There's only work to do if current dataType is non-auto
  12649. if ( current === "*" ) {
  12650. current = prev;
  12651. // Convert response if prev dataType is non-auto and differs from current
  12652. } else if ( prev !== "*" && prev !== current ) {
  12653. // Seek a direct converter
  12654. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  12655. // If none found, seek a pair
  12656. if ( !conv ) {
  12657. for ( conv2 in converters ) {
  12658. // If conv2 outputs current
  12659. tmp = conv2.split( " " );
  12660. if ( tmp[ 1 ] === current ) {
  12661. // If prev can be converted to accepted input
  12662. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  12663. converters[ "* " + tmp[ 0 ] ];
  12664. if ( conv ) {
  12665. // Condense equivalence converters
  12666. if ( conv === true ) {
  12667. conv = converters[ conv2 ];
  12668. // Otherwise, insert the intermediate dataType
  12669. } else if ( converters[ conv2 ] !== true ) {
  12670. current = tmp[ 0 ];
  12671. dataTypes.unshift( tmp[ 1 ] );
  12672. }
  12673. break;
  12674. }
  12675. }
  12676. }
  12677. }
  12678. // Apply converter (if not an equivalence)
  12679. if ( conv !== true ) {
  12680. // Unless errors are allowed to bubble, catch and return them
  12681. if ( conv && s.throws ) {
  12682. response = conv( response );
  12683. } else {
  12684. try {
  12685. response = conv( response );
  12686. } catch ( e ) {
  12687. return {
  12688. state: "parsererror",
  12689. error: conv ? e : "No conversion from " + prev + " to " + current
  12690. };
  12691. }
  12692. }
  12693. }
  12694. }
  12695. }
  12696. }
  12697. return { state: "success", data: response };
  12698. }
  12699. jQuery.extend( {
  12700. // Counter for holding the number of active queries
  12701. active: 0,
  12702. // Last-Modified header cache for next request
  12703. lastModified: {},
  12704. etag: {},
  12705. ajaxSettings: {
  12706. url: location.href,
  12707. type: "GET",
  12708. isLocal: rlocalProtocol.test( location.protocol ),
  12709. global: true,
  12710. processData: true,
  12711. async: true,
  12712. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  12713. /*
  12714. timeout: 0,
  12715. data: null,
  12716. dataType: null,
  12717. username: null,
  12718. password: null,
  12719. cache: null,
  12720. throws: false,
  12721. traditional: false,
  12722. headers: {},
  12723. */
  12724. accepts: {
  12725. "*": allTypes,
  12726. text: "text/plain",
  12727. html: "text/html",
  12728. xml: "application/xml, text/xml",
  12729. json: "application/json, text/javascript"
  12730. },
  12731. contents: {
  12732. xml: /\bxml\b/,
  12733. html: /\bhtml/,
  12734. json: /\bjson\b/
  12735. },
  12736. responseFields: {
  12737. xml: "responseXML",
  12738. text: "responseText",
  12739. json: "responseJSON"
  12740. },
  12741. // Data converters
  12742. // Keys separate source (or catchall "*") and destination types with a single space
  12743. converters: {
  12744. // Convert anything to text
  12745. "* text": String,
  12746. // Text to html (true = no transformation)
  12747. "text html": true,
  12748. // Evaluate text as a json expression
  12749. "text json": JSON.parse,
  12750. // Parse text as xml
  12751. "text xml": jQuery.parseXML
  12752. },
  12753. // For options that shouldn't be deep extended:
  12754. // you can add your own custom options here if
  12755. // and when you create one that shouldn't be
  12756. // deep extended (see ajaxExtend)
  12757. flatOptions: {
  12758. url: true,
  12759. context: true
  12760. }
  12761. },
  12762. // Creates a full fledged settings object into target
  12763. // with both ajaxSettings and settings fields.
  12764. // If target is omitted, writes into ajaxSettings.
  12765. ajaxSetup: function( target, settings ) {
  12766. return settings ?
  12767. // Building a settings object
  12768. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  12769. // Extending ajaxSettings
  12770. ajaxExtend( jQuery.ajaxSettings, target );
  12771. },
  12772. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  12773. ajaxTransport: addToPrefiltersOrTransports( transports ),
  12774. // Main method
  12775. ajax: function( url, options ) {
  12776. // If url is an object, simulate pre-1.5 signature
  12777. if ( typeof url === "object" ) {
  12778. options = url;
  12779. url = undefined;
  12780. }
  12781. // Force options to be an object
  12782. options = options || {};
  12783. var transport,
  12784. // URL without anti-cache param
  12785. cacheURL,
  12786. // Response headers
  12787. responseHeadersString,
  12788. responseHeaders,
  12789. // timeout handle
  12790. timeoutTimer,
  12791. // Url cleanup var
  12792. urlAnchor,
  12793. // Request state (becomes false upon send and true upon completion)
  12794. completed,
  12795. // To know if global events are to be dispatched
  12796. fireGlobals,
  12797. // Loop variable
  12798. i,
  12799. // uncached part of the url
  12800. uncached,
  12801. // Create the final options object
  12802. s = jQuery.ajaxSetup( {}, options ),
  12803. // Callbacks context
  12804. callbackContext = s.context || s,
  12805. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  12806. globalEventContext = s.context &&
  12807. ( callbackContext.nodeType || callbackContext.jquery ) ?
  12808. jQuery( callbackContext ) :
  12809. jQuery.event,
  12810. // Deferreds
  12811. deferred = jQuery.Deferred(),
  12812. completeDeferred = jQuery.Callbacks( "once memory" ),
  12813. // Status-dependent callbacks
  12814. statusCode = s.statusCode || {},
  12815. // Headers (they are sent all at once)
  12816. requestHeaders = {},
  12817. requestHeadersNames = {},
  12818. // Default abort message
  12819. strAbort = "canceled",
  12820. // Fake xhr
  12821. jqXHR = {
  12822. readyState: 0,
  12823. // Builds headers hashtable if needed
  12824. getResponseHeader: function( key ) {
  12825. var match;
  12826. if ( completed ) {
  12827. if ( !responseHeaders ) {
  12828. responseHeaders = {};
  12829. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  12830. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  12831. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  12832. .concat( match[ 2 ] );
  12833. }
  12834. }
  12835. match = responseHeaders[ key.toLowerCase() + " " ];
  12836. }
  12837. return match == null ? null : match.join( ", " );
  12838. },
  12839. // Raw string
  12840. getAllResponseHeaders: function() {
  12841. return completed ? responseHeadersString : null;
  12842. },
  12843. // Caches the header
  12844. setRequestHeader: function( name, value ) {
  12845. if ( completed == null ) {
  12846. name = requestHeadersNames[ name.toLowerCase() ] =
  12847. requestHeadersNames[ name.toLowerCase() ] || name;
  12848. requestHeaders[ name ] = value;
  12849. }
  12850. return this;
  12851. },
  12852. // Overrides response content-type header
  12853. overrideMimeType: function( type ) {
  12854. if ( completed == null ) {
  12855. s.mimeType = type;
  12856. }
  12857. return this;
  12858. },
  12859. // Status-dependent callbacks
  12860. statusCode: function( map ) {
  12861. var code;
  12862. if ( map ) {
  12863. if ( completed ) {
  12864. // Execute the appropriate callbacks
  12865. jqXHR.always( map[ jqXHR.status ] );
  12866. } else {
  12867. // Lazy-add the new callbacks in a way that preserves old ones
  12868. for ( code in map ) {
  12869. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  12870. }
  12871. }
  12872. }
  12873. return this;
  12874. },
  12875. // Cancel the request
  12876. abort: function( statusText ) {
  12877. var finalText = statusText || strAbort;
  12878. if ( transport ) {
  12879. transport.abort( finalText );
  12880. }
  12881. done( 0, finalText );
  12882. return this;
  12883. }
  12884. };
  12885. // Attach deferreds
  12886. deferred.promise( jqXHR );
  12887. // Add protocol if not provided (prefilters might expect it)
  12888. // Handle falsy url in the settings object (#10093: consistency with old signature)
  12889. // We also use the url parameter if available
  12890. s.url = ( ( url || s.url || location.href ) + "" )
  12891. .replace( rprotocol, location.protocol + "//" );
  12892. // Alias method option to type as per ticket #12004
  12893. s.type = options.method || options.type || s.method || s.type;
  12894. // Extract dataTypes list
  12895. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  12896. // A cross-domain request is in order when the origin doesn't match the current origin.
  12897. if ( s.crossDomain == null ) {
  12898. urlAnchor = document.createElement( "a" );
  12899. // Support: IE <=8 - 11, Edge 12 - 15
  12900. // IE throws exception on accessing the href property if url is malformed,
  12901. // e.g. http://example.com:80x/
  12902. try {
  12903. urlAnchor.href = s.url;
  12904. // Support: IE <=8 - 11 only
  12905. // Anchor's host property isn't correctly set when s.url is relative
  12906. urlAnchor.href = urlAnchor.href;
  12907. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  12908. urlAnchor.protocol + "//" + urlAnchor.host;
  12909. } catch ( e ) {
  12910. // If there is an error parsing the URL, assume it is crossDomain,
  12911. // it can be rejected by the transport if it is invalid
  12912. s.crossDomain = true;
  12913. }
  12914. }
  12915. // Convert data if not already a string
  12916. if ( s.data && s.processData && typeof s.data !== "string" ) {
  12917. s.data = jQuery.param( s.data, s.traditional );
  12918. }
  12919. // Apply prefilters
  12920. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  12921. // If request was aborted inside a prefilter, stop there
  12922. if ( completed ) {
  12923. return jqXHR;
  12924. }
  12925. // We can fire global events as of now if asked to
  12926. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  12927. fireGlobals = jQuery.event && s.global;
  12928. // Watch for a new set of requests
  12929. if ( fireGlobals && jQuery.active++ === 0 ) {
  12930. jQuery.event.trigger( "ajaxStart" );
  12931. }
  12932. // Uppercase the type
  12933. s.type = s.type.toUpperCase();
  12934. // Determine if request has content
  12935. s.hasContent = !rnoContent.test( s.type );
  12936. // Save the URL in case we're toying with the If-Modified-Since
  12937. // and/or If-None-Match header later on
  12938. // Remove hash to simplify url manipulation
  12939. cacheURL = s.url.replace( rhash, "" );
  12940. // More options handling for requests with no content
  12941. if ( !s.hasContent ) {
  12942. // Remember the hash so we can put it back
  12943. uncached = s.url.slice( cacheURL.length );
  12944. // If data is available and should be processed, append data to url
  12945. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  12946. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  12947. // #9682: remove data so that it's not used in an eventual retry
  12948. delete s.data;
  12949. }
  12950. // Add or update anti-cache param if needed
  12951. if ( s.cache === false ) {
  12952. cacheURL = cacheURL.replace( rantiCache, "$1" );
  12953. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
  12954. uncached;
  12955. }
  12956. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  12957. s.url = cacheURL + uncached;
  12958. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  12959. } else if ( s.data && s.processData &&
  12960. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  12961. s.data = s.data.replace( r20, "+" );
  12962. }
  12963. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12964. if ( s.ifModified ) {
  12965. if ( jQuery.lastModified[ cacheURL ] ) {
  12966. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  12967. }
  12968. if ( jQuery.etag[ cacheURL ] ) {
  12969. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  12970. }
  12971. }
  12972. // Set the correct header, if data is being sent
  12973. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  12974. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  12975. }
  12976. // Set the Accepts header for the server, depending on the dataType
  12977. jqXHR.setRequestHeader(
  12978. "Accept",
  12979. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  12980. s.accepts[ s.dataTypes[ 0 ] ] +
  12981. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  12982. s.accepts[ "*" ]
  12983. );
  12984. // Check for headers option
  12985. for ( i in s.headers ) {
  12986. jqXHR.setRequestHeader( i, s.headers[ i ] );
  12987. }
  12988. // Allow custom headers/mimetypes and early abort
  12989. if ( s.beforeSend &&
  12990. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  12991. // Abort if not done already and return
  12992. return jqXHR.abort();
  12993. }
  12994. // Aborting is no longer a cancellation
  12995. strAbort = "abort";
  12996. // Install callbacks on deferreds
  12997. completeDeferred.add( s.complete );
  12998. jqXHR.done( s.success );
  12999. jqXHR.fail( s.error );
  13000. // Get transport
  13001. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  13002. // If no transport, we auto-abort
  13003. if ( !transport ) {
  13004. done( -1, "No Transport" );
  13005. } else {
  13006. jqXHR.readyState = 1;
  13007. // Send global event
  13008. if ( fireGlobals ) {
  13009. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  13010. }
  13011. // If request was aborted inside ajaxSend, stop there
  13012. if ( completed ) {
  13013. return jqXHR;
  13014. }
  13015. // Timeout
  13016. if ( s.async && s.timeout > 0 ) {
  13017. timeoutTimer = window.setTimeout( function() {
  13018. jqXHR.abort( "timeout" );
  13019. }, s.timeout );
  13020. }
  13021. try {
  13022. completed = false;
  13023. transport.send( requestHeaders, done );
  13024. } catch ( e ) {
  13025. // Rethrow post-completion exceptions
  13026. if ( completed ) {
  13027. throw e;
  13028. }
  13029. // Propagate others as results
  13030. done( -1, e );
  13031. }
  13032. }
  13033. // Callback for when everything is done
  13034. function done( status, nativeStatusText, responses, headers ) {
  13035. var isSuccess, success, error, response, modified,
  13036. statusText = nativeStatusText;
  13037. // Ignore repeat invocations
  13038. if ( completed ) {
  13039. return;
  13040. }
  13041. completed = true;
  13042. // Clear timeout if it exists
  13043. if ( timeoutTimer ) {
  13044. window.clearTimeout( timeoutTimer );
  13045. }
  13046. // Dereference transport for early garbage collection
  13047. // (no matter how long the jqXHR object will be used)
  13048. transport = undefined;
  13049. // Cache response headers
  13050. responseHeadersString = headers || "";
  13051. // Set readyState
  13052. jqXHR.readyState = status > 0 ? 4 : 0;
  13053. // Determine if successful
  13054. isSuccess = status >= 200 && status < 300 || status === 304;
  13055. // Get response data
  13056. if ( responses ) {
  13057. response = ajaxHandleResponses( s, jqXHR, responses );
  13058. }
  13059. // Use a noop converter for missing script
  13060. if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
  13061. s.converters[ "text script" ] = function() {};
  13062. }
  13063. // Convert no matter what (that way responseXXX fields are always set)
  13064. response = ajaxConvert( s, response, jqXHR, isSuccess );
  13065. // If successful, handle type chaining
  13066. if ( isSuccess ) {
  13067. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  13068. if ( s.ifModified ) {
  13069. modified = jqXHR.getResponseHeader( "Last-Modified" );
  13070. if ( modified ) {
  13071. jQuery.lastModified[ cacheURL ] = modified;
  13072. }
  13073. modified = jqXHR.getResponseHeader( "etag" );
  13074. if ( modified ) {
  13075. jQuery.etag[ cacheURL ] = modified;
  13076. }
  13077. }
  13078. // if no content
  13079. if ( status === 204 || s.type === "HEAD" ) {
  13080. statusText = "nocontent";
  13081. // if not modified
  13082. } else if ( status === 304 ) {
  13083. statusText = "notmodified";
  13084. // If we have data, let's convert it
  13085. } else {
  13086. statusText = response.state;
  13087. success = response.data;
  13088. error = response.error;
  13089. isSuccess = !error;
  13090. }
  13091. } else {
  13092. // Extract error from statusText and normalize for non-aborts
  13093. error = statusText;
  13094. if ( status || !statusText ) {
  13095. statusText = "error";
  13096. if ( status < 0 ) {
  13097. status = 0;
  13098. }
  13099. }
  13100. }
  13101. // Set data for the fake xhr object
  13102. jqXHR.status = status;
  13103. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  13104. // Success/Error
  13105. if ( isSuccess ) {
  13106. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  13107. } else {
  13108. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  13109. }
  13110. // Status-dependent callbacks
  13111. jqXHR.statusCode( statusCode );
  13112. statusCode = undefined;
  13113. if ( fireGlobals ) {
  13114. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  13115. [ jqXHR, s, isSuccess ? success : error ] );
  13116. }
  13117. // Complete
  13118. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  13119. if ( fireGlobals ) {
  13120. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  13121. // Handle the global AJAX counter
  13122. if ( !( --jQuery.active ) ) {
  13123. jQuery.event.trigger( "ajaxStop" );
  13124. }
  13125. }
  13126. }
  13127. return jqXHR;
  13128. },
  13129. getJSON: function( url, data, callback ) {
  13130. return jQuery.get( url, data, callback, "json" );
  13131. },
  13132. getScript: function( url, callback ) {
  13133. return jQuery.get( url, undefined, callback, "script" );
  13134. }
  13135. } );
  13136. jQuery.each( [ "get", "post" ], function( _i, method ) {
  13137. jQuery[ method ] = function( url, data, callback, type ) {
  13138. // Shift arguments if data argument was omitted
  13139. if ( isFunction( data ) ) {
  13140. type = type || callback;
  13141. callback = data;
  13142. data = undefined;
  13143. }
  13144. // The url can be an options object (which then must have .url)
  13145. return jQuery.ajax( jQuery.extend( {
  13146. url: url,
  13147. type: method,
  13148. dataType: type,
  13149. data: data,
  13150. success: callback
  13151. }, jQuery.isPlainObject( url ) && url ) );
  13152. };
  13153. } );
  13154. jQuery.ajaxPrefilter( function( s ) {
  13155. var i;
  13156. for ( i in s.headers ) {
  13157. if ( i.toLowerCase() === "content-type" ) {
  13158. s.contentType = s.headers[ i ] || "";
  13159. }
  13160. }
  13161. } );
  13162. jQuery._evalUrl = function( url, options, doc ) {
  13163. return jQuery.ajax( {
  13164. url: url,
  13165. // Make this explicit, since user can override this through ajaxSetup (#11264)
  13166. type: "GET",
  13167. dataType: "script",
  13168. cache: true,
  13169. async: false,
  13170. global: false,
  13171. // Only evaluate the response if it is successful (gh-4126)
  13172. // dataFilter is not invoked for failure responses, so using it instead
  13173. // of the default converter is kludgy but it works.
  13174. converters: {
  13175. "text script": function() {}
  13176. },
  13177. dataFilter: function( response ) {
  13178. jQuery.globalEval( response, options, doc );
  13179. }
  13180. } );
  13181. };
  13182. jQuery.fn.extend( {
  13183. wrapAll: function( html ) {
  13184. var wrap;
  13185. if ( this[ 0 ] ) {
  13186. if ( isFunction( html ) ) {
  13187. html = html.call( this[ 0 ] );
  13188. }
  13189. // The elements to wrap the target around
  13190. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  13191. if ( this[ 0 ].parentNode ) {
  13192. wrap.insertBefore( this[ 0 ] );
  13193. }
  13194. wrap.map( function() {
  13195. var elem = this;
  13196. while ( elem.firstElementChild ) {
  13197. elem = elem.firstElementChild;
  13198. }
  13199. return elem;
  13200. } ).append( this );
  13201. }
  13202. return this;
  13203. },
  13204. wrapInner: function( html ) {
  13205. if ( isFunction( html ) ) {
  13206. return this.each( function( i ) {
  13207. jQuery( this ).wrapInner( html.call( this, i ) );
  13208. } );
  13209. }
  13210. return this.each( function() {
  13211. var self = jQuery( this ),
  13212. contents = self.contents();
  13213. if ( contents.length ) {
  13214. contents.wrapAll( html );
  13215. } else {
  13216. self.append( html );
  13217. }
  13218. } );
  13219. },
  13220. wrap: function( html ) {
  13221. var htmlIsFunction = isFunction( html );
  13222. return this.each( function( i ) {
  13223. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  13224. } );
  13225. },
  13226. unwrap: function( selector ) {
  13227. this.parent( selector ).not( "body" ).each( function() {
  13228. jQuery( this ).replaceWith( this.childNodes );
  13229. } );
  13230. return this;
  13231. }
  13232. } );
  13233. jQuery.expr.pseudos.hidden = function( elem ) {
  13234. return !jQuery.expr.pseudos.visible( elem );
  13235. };
  13236. jQuery.expr.pseudos.visible = function( elem ) {
  13237. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  13238. };
  13239. jQuery.ajaxSettings.xhr = function() {
  13240. try {
  13241. return new window.XMLHttpRequest();
  13242. } catch ( e ) {}
  13243. };
  13244. var xhrSuccessStatus = {
  13245. // File protocol always yields status code 0, assume 200
  13246. 0: 200,
  13247. // Support: IE <=9 only
  13248. // #1450: sometimes IE returns 1223 when it should be 204
  13249. 1223: 204
  13250. },
  13251. xhrSupported = jQuery.ajaxSettings.xhr();
  13252. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  13253. support.ajax = xhrSupported = !!xhrSupported;
  13254. jQuery.ajaxTransport( function( options ) {
  13255. var callback, errorCallback;
  13256. // Cross domain only allowed if supported through XMLHttpRequest
  13257. if ( support.cors || xhrSupported && !options.crossDomain ) {
  13258. return {
  13259. send: function( headers, complete ) {
  13260. var i,
  13261. xhr = options.xhr();
  13262. xhr.open(
  13263. options.type,
  13264. options.url,
  13265. options.async,
  13266. options.username,
  13267. options.password
  13268. );
  13269. // Apply custom fields if provided
  13270. if ( options.xhrFields ) {
  13271. for ( i in options.xhrFields ) {
  13272. xhr[ i ] = options.xhrFields[ i ];
  13273. }
  13274. }
  13275. // Override mime type if needed
  13276. if ( options.mimeType && xhr.overrideMimeType ) {
  13277. xhr.overrideMimeType( options.mimeType );
  13278. }
  13279. // X-Requested-With header
  13280. // For cross-domain requests, seeing as conditions for a preflight are
  13281. // akin to a jigsaw puzzle, we simply never set it to be sure.
  13282. // (it can always be set on a per-request basis or even using ajaxSetup)
  13283. // For same-domain requests, won't change header if already provided.
  13284. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  13285. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  13286. }
  13287. // Set headers
  13288. for ( i in headers ) {
  13289. xhr.setRequestHeader( i, headers[ i ] );
  13290. }
  13291. // Callback
  13292. callback = function( type ) {
  13293. return function() {
  13294. if ( callback ) {
  13295. callback = errorCallback = xhr.onload =
  13296. xhr.onerror = xhr.onabort = xhr.ontimeout =
  13297. xhr.onreadystatechange = null;
  13298. if ( type === "abort" ) {
  13299. xhr.abort();
  13300. } else if ( type === "error" ) {
  13301. // Support: IE <=9 only
  13302. // On a manual native abort, IE9 throws
  13303. // errors on any property access that is not readyState
  13304. if ( typeof xhr.status !== "number" ) {
  13305. complete( 0, "error" );
  13306. } else {
  13307. complete(
  13308. // File: protocol always yields status 0; see #8605, #14207
  13309. xhr.status,
  13310. xhr.statusText
  13311. );
  13312. }
  13313. } else {
  13314. complete(
  13315. xhrSuccessStatus[ xhr.status ] || xhr.status,
  13316. xhr.statusText,
  13317. // Support: IE <=9 only
  13318. // IE9 has no XHR2 but throws on binary (trac-11426)
  13319. // For XHR2 non-text, let the caller handle it (gh-2498)
  13320. ( xhr.responseType || "text" ) !== "text" ||
  13321. typeof xhr.responseText !== "string" ?
  13322. { binary: xhr.response } :
  13323. { text: xhr.responseText },
  13324. xhr.getAllResponseHeaders()
  13325. );
  13326. }
  13327. }
  13328. };
  13329. };
  13330. // Listen to events
  13331. xhr.onload = callback();
  13332. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  13333. // Support: IE 9 only
  13334. // Use onreadystatechange to replace onabort
  13335. // to handle uncaught aborts
  13336. if ( xhr.onabort !== undefined ) {
  13337. xhr.onabort = errorCallback;
  13338. } else {
  13339. xhr.onreadystatechange = function() {
  13340. // Check readyState before timeout as it changes
  13341. if ( xhr.readyState === 4 ) {
  13342. // Allow onerror to be called first,
  13343. // but that will not handle a native abort
  13344. // Also, save errorCallback to a variable
  13345. // as xhr.onerror cannot be accessed
  13346. window.setTimeout( function() {
  13347. if ( callback ) {
  13348. errorCallback();
  13349. }
  13350. } );
  13351. }
  13352. };
  13353. }
  13354. // Create the abort callback
  13355. callback = callback( "abort" );
  13356. try {
  13357. // Do send the request (this may raise an exception)
  13358. xhr.send( options.hasContent && options.data || null );
  13359. } catch ( e ) {
  13360. // #14683: Only rethrow if this hasn't been notified as an error yet
  13361. if ( callback ) {
  13362. throw e;
  13363. }
  13364. }
  13365. },
  13366. abort: function() {
  13367. if ( callback ) {
  13368. callback();
  13369. }
  13370. }
  13371. };
  13372. }
  13373. } );
  13374. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  13375. jQuery.ajaxPrefilter( function( s ) {
  13376. if ( s.crossDomain ) {
  13377. s.contents.script = false;
  13378. }
  13379. } );
  13380. // Install script dataType
  13381. jQuery.ajaxSetup( {
  13382. accepts: {
  13383. script: "text/javascript, application/javascript, " +
  13384. "application/ecmascript, application/x-ecmascript"
  13385. },
  13386. contents: {
  13387. script: /\b(?:java|ecma)script\b/
  13388. },
  13389. converters: {
  13390. "text script": function( text ) {
  13391. jQuery.globalEval( text );
  13392. return text;
  13393. }
  13394. }
  13395. } );
  13396. // Handle cache's special case and crossDomain
  13397. jQuery.ajaxPrefilter( "script", function( s ) {
  13398. if ( s.cache === undefined ) {
  13399. s.cache = false;
  13400. }
  13401. if ( s.crossDomain ) {
  13402. s.type = "GET";
  13403. }
  13404. } );
  13405. // Bind script tag hack transport
  13406. jQuery.ajaxTransport( "script", function( s ) {
  13407. // This transport only deals with cross domain or forced-by-attrs requests
  13408. if ( s.crossDomain || s.scriptAttrs ) {
  13409. var script, callback;
  13410. return {
  13411. send: function( _, complete ) {
  13412. script = jQuery( "<script>" )
  13413. .attr( s.scriptAttrs || {} )
  13414. .prop( { charset: s.scriptCharset, src: s.url } )
  13415. .on( "load error", callback = function( evt ) {
  13416. script.remove();
  13417. callback = null;
  13418. if ( evt ) {
  13419. complete( evt.type === "error" ? 404 : 200, evt.type );
  13420. }
  13421. } );
  13422. // Use native DOM manipulation to avoid our domManip AJAX trickery
  13423. document.head.appendChild( script[ 0 ] );
  13424. },
  13425. abort: function() {
  13426. if ( callback ) {
  13427. callback();
  13428. }
  13429. }
  13430. };
  13431. }
  13432. } );
  13433. var oldCallbacks = [],
  13434. rjsonp = /(=)\?(?=&|$)|\?\?/;
  13435. // Default jsonp settings
  13436. jQuery.ajaxSetup( {
  13437. jsonp: "callback",
  13438. jsonpCallback: function() {
  13439. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
  13440. this[ callback ] = true;
  13441. return callback;
  13442. }
  13443. } );
  13444. // Detect, normalize options and install callbacks for jsonp requests
  13445. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  13446. var callbackName, overwritten, responseContainer,
  13447. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  13448. "url" :
  13449. typeof s.data === "string" &&
  13450. ( s.contentType || "" )
  13451. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  13452. rjsonp.test( s.data ) && "data"
  13453. );
  13454. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  13455. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  13456. // Get callback name, remembering preexisting value associated with it
  13457. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  13458. s.jsonpCallback() :
  13459. s.jsonpCallback;
  13460. // Insert callback into url or form data
  13461. if ( jsonProp ) {
  13462. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  13463. } else if ( s.jsonp !== false ) {
  13464. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  13465. }
  13466. // Use data converter to retrieve json after script execution
  13467. s.converters[ "script json" ] = function() {
  13468. if ( !responseContainer ) {
  13469. jQuery.error( callbackName + " was not called" );
  13470. }
  13471. return responseContainer[ 0 ];
  13472. };
  13473. // Force json dataType
  13474. s.dataTypes[ 0 ] = "json";
  13475. // Install callback
  13476. overwritten = window[ callbackName ];
  13477. window[ callbackName ] = function() {
  13478. responseContainer = arguments;
  13479. };
  13480. // Clean-up function (fires after converters)
  13481. jqXHR.always( function() {
  13482. // If previous value didn't exist - remove it
  13483. if ( overwritten === undefined ) {
  13484. jQuery( window ).removeProp( callbackName );
  13485. // Otherwise restore preexisting value
  13486. } else {
  13487. window[ callbackName ] = overwritten;
  13488. }
  13489. // Save back as free
  13490. if ( s[ callbackName ] ) {
  13491. // Make sure that re-using the options doesn't screw things around
  13492. s.jsonpCallback = originalSettings.jsonpCallback;
  13493. // Save the callback name for future use
  13494. oldCallbacks.push( callbackName );
  13495. }
  13496. // Call if it was a function and we have a response
  13497. if ( responseContainer && isFunction( overwritten ) ) {
  13498. overwritten( responseContainer[ 0 ] );
  13499. }
  13500. responseContainer = overwritten = undefined;
  13501. } );
  13502. // Delegate to script
  13503. return "script";
  13504. }
  13505. } );
  13506. // Support: Safari 8 only
  13507. // In Safari 8 documents created via document.implementation.createHTMLDocument
  13508. // collapse sibling forms: the second one becomes a child of the first one.
  13509. // Because of that, this security measure has to be disabled in Safari 8.
  13510. // https://bugs.webkit.org/show_bug.cgi?id=137337
  13511. support.createHTMLDocument = ( function() {
  13512. var body = document.implementation.createHTMLDocument( "" ).body;
  13513. body.innerHTML = "<form></form><form></form>";
  13514. return body.childNodes.length === 2;
  13515. } )();
  13516. // Argument "data" should be string of html
  13517. // context (optional): If specified, the fragment will be created in this context,
  13518. // defaults to document
  13519. // keepScripts (optional): If true, will include scripts passed in the html string
  13520. jQuery.parseHTML = function( data, context, keepScripts ) {
  13521. if ( typeof data !== "string" ) {
  13522. return [];
  13523. }
  13524. if ( typeof context === "boolean" ) {
  13525. keepScripts = context;
  13526. context = false;
  13527. }
  13528. var base, parsed, scripts;
  13529. if ( !context ) {
  13530. // Stop scripts or inline event handlers from being executed immediately
  13531. // by using document.implementation
  13532. if ( support.createHTMLDocument ) {
  13533. context = document.implementation.createHTMLDocument( "" );
  13534. // Set the base href for the created document
  13535. // so any parsed elements with URLs
  13536. // are based on the document's URL (gh-2965)
  13537. base = context.createElement( "base" );
  13538. base.href = document.location.href;
  13539. context.head.appendChild( base );
  13540. } else {
  13541. context = document;
  13542. }
  13543. }
  13544. parsed = rsingleTag.exec( data );
  13545. scripts = !keepScripts && [];
  13546. // Single tag
  13547. if ( parsed ) {
  13548. return [ context.createElement( parsed[ 1 ] ) ];
  13549. }
  13550. parsed = buildFragment( [ data ], context, scripts );
  13551. if ( scripts && scripts.length ) {
  13552. jQuery( scripts ).remove();
  13553. }
  13554. return jQuery.merge( [], parsed.childNodes );
  13555. };
  13556. /**
  13557. * Load a url into a page
  13558. */
  13559. jQuery.fn.load = function( url, params, callback ) {
  13560. var selector, type, response,
  13561. self = this,
  13562. off = url.indexOf( " " );
  13563. if ( off > -1 ) {
  13564. selector = stripAndCollapse( url.slice( off ) );
  13565. url = url.slice( 0, off );
  13566. }
  13567. // If it's a function
  13568. if ( isFunction( params ) ) {
  13569. // We assume that it's the callback
  13570. callback = params;
  13571. params = undefined;
  13572. // Otherwise, build a param string
  13573. } else if ( params && typeof params === "object" ) {
  13574. type = "POST";
  13575. }
  13576. // If we have elements to modify, make the request
  13577. if ( self.length > 0 ) {
  13578. jQuery.ajax( {
  13579. url: url,
  13580. // If "type" variable is undefined, then "GET" method will be used.
  13581. // Make value of this field explicit since
  13582. // user can override it through ajaxSetup method
  13583. type: type || "GET",
  13584. dataType: "html",
  13585. data: params
  13586. } ).done( function( responseText ) {
  13587. // Save response for use in complete callback
  13588. response = arguments;
  13589. self.html( selector ?
  13590. // If a selector was specified, locate the right elements in a dummy div
  13591. // Exclude scripts to avoid IE 'Permission Denied' errors
  13592. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  13593. // Otherwise use the full result
  13594. responseText );
  13595. // If the request succeeds, this function gets "data", "status", "jqXHR"
  13596. // but they are ignored because response was set above.
  13597. // If it fails, this function gets "jqXHR", "status", "error"
  13598. } ).always( callback && function( jqXHR, status ) {
  13599. self.each( function() {
  13600. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  13601. } );
  13602. } );
  13603. }
  13604. return this;
  13605. };
  13606. jQuery.expr.pseudos.animated = function( elem ) {
  13607. return jQuery.grep( jQuery.timers, function( fn ) {
  13608. return elem === fn.elem;
  13609. } ).length;
  13610. };
  13611. jQuery.offset = {
  13612. setOffset: function( elem, options, i ) {
  13613. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  13614. position = jQuery.css( elem, "position" ),
  13615. curElem = jQuery( elem ),
  13616. props = {};
  13617. // Set position first, in-case top/left are set even on static elem
  13618. if ( position === "static" ) {
  13619. elem.style.position = "relative";
  13620. }
  13621. curOffset = curElem.offset();
  13622. curCSSTop = jQuery.css( elem, "top" );
  13623. curCSSLeft = jQuery.css( elem, "left" );
  13624. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  13625. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  13626. // Need to be able to calculate position if either
  13627. // top or left is auto and position is either absolute or fixed
  13628. if ( calculatePosition ) {
  13629. curPosition = curElem.position();
  13630. curTop = curPosition.top;
  13631. curLeft = curPosition.left;
  13632. } else {
  13633. curTop = parseFloat( curCSSTop ) || 0;
  13634. curLeft = parseFloat( curCSSLeft ) || 0;
  13635. }
  13636. if ( isFunction( options ) ) {
  13637. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  13638. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  13639. }
  13640. if ( options.top != null ) {
  13641. props.top = ( options.top - curOffset.top ) + curTop;
  13642. }
  13643. if ( options.left != null ) {
  13644. props.left = ( options.left - curOffset.left ) + curLeft;
  13645. }
  13646. if ( "using" in options ) {
  13647. options.using.call( elem, props );
  13648. } else {
  13649. if ( typeof props.top === "number" ) {
  13650. props.top += "px";
  13651. }
  13652. if ( typeof props.left === "number" ) {
  13653. props.left += "px";
  13654. }
  13655. curElem.css( props );
  13656. }
  13657. }
  13658. };
  13659. jQuery.fn.extend( {
  13660. // offset() relates an element's border box to the document origin
  13661. offset: function( options ) {
  13662. // Preserve chaining for setter
  13663. if ( arguments.length ) {
  13664. return options === undefined ?
  13665. this :
  13666. this.each( function( i ) {
  13667. jQuery.offset.setOffset( this, options, i );
  13668. } );
  13669. }
  13670. var rect, win,
  13671. elem = this[ 0 ];
  13672. if ( !elem ) {
  13673. return;
  13674. }
  13675. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  13676. // Support: IE <=11 only
  13677. // Running getBoundingClientRect on a
  13678. // disconnected node in IE throws an error
  13679. if ( !elem.getClientRects().length ) {
  13680. return { top: 0, left: 0 };
  13681. }
  13682. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  13683. rect = elem.getBoundingClientRect();
  13684. win = elem.ownerDocument.defaultView;
  13685. return {
  13686. top: rect.top + win.pageYOffset,
  13687. left: rect.left + win.pageXOffset
  13688. };
  13689. },
  13690. // position() relates an element's margin box to its offset parent's padding box
  13691. // This corresponds to the behavior of CSS absolute positioning
  13692. position: function() {
  13693. if ( !this[ 0 ] ) {
  13694. return;
  13695. }
  13696. var offsetParent, offset, doc,
  13697. elem = this[ 0 ],
  13698. parentOffset = { top: 0, left: 0 };
  13699. // position:fixed elements are offset from the viewport, which itself always has zero offset
  13700. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  13701. // Assume position:fixed implies availability of getBoundingClientRect
  13702. offset = elem.getBoundingClientRect();
  13703. } else {
  13704. offset = this.offset();
  13705. // Account for the *real* offset parent, which can be the document or its root element
  13706. // when a statically positioned element is identified
  13707. doc = elem.ownerDocument;
  13708. offsetParent = elem.offsetParent || doc.documentElement;
  13709. while ( offsetParent &&
  13710. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  13711. jQuery.css( offsetParent, "position" ) === "static" ) {
  13712. offsetParent = offsetParent.parentNode;
  13713. }
  13714. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  13715. // Incorporate borders into its offset, since they are outside its content origin
  13716. parentOffset = jQuery( offsetParent ).offset();
  13717. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  13718. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  13719. }
  13720. }
  13721. // Subtract parent offsets and element margins
  13722. return {
  13723. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  13724. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  13725. };
  13726. },
  13727. // This method will return documentElement in the following cases:
  13728. // 1) For the element inside the iframe without offsetParent, this method will return
  13729. // documentElement of the parent window
  13730. // 2) For the hidden or detached element
  13731. // 3) For body or html element, i.e. in case of the html node - it will return itself
  13732. //
  13733. // but those exceptions were never presented as a real life use-cases
  13734. // and might be considered as more preferable results.
  13735. //
  13736. // This logic, however, is not guaranteed and can change at any point in the future
  13737. offsetParent: function() {
  13738. return this.map( function() {
  13739. var offsetParent = this.offsetParent;
  13740. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  13741. offsetParent = offsetParent.offsetParent;
  13742. }
  13743. return offsetParent || documentElement;
  13744. } );
  13745. }
  13746. } );
  13747. // Create scrollLeft and scrollTop methods
  13748. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  13749. var top = "pageYOffset" === prop;
  13750. jQuery.fn[ method ] = function( val ) {
  13751. return access( this, function( elem, method, val ) {
  13752. // Coalesce documents and windows
  13753. var win;
  13754. if ( isWindow( elem ) ) {
  13755. win = elem;
  13756. } else if ( elem.nodeType === 9 ) {
  13757. win = elem.defaultView;
  13758. }
  13759. if ( val === undefined ) {
  13760. return win ? win[ prop ] : elem[ method ];
  13761. }
  13762. if ( win ) {
  13763. win.scrollTo(
  13764. !top ? val : win.pageXOffset,
  13765. top ? val : win.pageYOffset
  13766. );
  13767. } else {
  13768. elem[ method ] = val;
  13769. }
  13770. }, method, val, arguments.length );
  13771. };
  13772. } );
  13773. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  13774. // Add the top/left cssHooks using jQuery.fn.position
  13775. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  13776. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  13777. // getComputedStyle returns percent when specified for top/left/bottom/right;
  13778. // rather than make the css module depend on the offset module, just check for it here
  13779. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  13780. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  13781. function( elem, computed ) {
  13782. if ( computed ) {
  13783. computed = curCSS( elem, prop );
  13784. // If curCSS returns percentage, fallback to offset
  13785. return rnumnonpx.test( computed ) ?
  13786. jQuery( elem ).position()[ prop ] + "px" :
  13787. computed;
  13788. }
  13789. }
  13790. );
  13791. } );
  13792. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  13793. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  13794. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  13795. function( defaultExtra, funcName ) {
  13796. // Margin is only for outerHeight, outerWidth
  13797. jQuery.fn[ funcName ] = function( margin, value ) {
  13798. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  13799. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  13800. return access( this, function( elem, type, value ) {
  13801. var doc;
  13802. if ( isWindow( elem ) ) {
  13803. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  13804. return funcName.indexOf( "outer" ) === 0 ?
  13805. elem[ "inner" + name ] :
  13806. elem.document.documentElement[ "client" + name ];
  13807. }
  13808. // Get document width or height
  13809. if ( elem.nodeType === 9 ) {
  13810. doc = elem.documentElement;
  13811. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  13812. // whichever is greatest
  13813. return Math.max(
  13814. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  13815. elem.body[ "offset" + name ], doc[ "offset" + name ],
  13816. doc[ "client" + name ]
  13817. );
  13818. }
  13819. return value === undefined ?
  13820. // Get width or height on the element, requesting but not forcing parseFloat
  13821. jQuery.css( elem, type, extra ) :
  13822. // Set width or height on the element
  13823. jQuery.style( elem, type, value, extra );
  13824. }, type, chainable ? margin : undefined, chainable );
  13825. };
  13826. } );
  13827. } );
  13828. jQuery.each( [
  13829. "ajaxStart",
  13830. "ajaxStop",
  13831. "ajaxComplete",
  13832. "ajaxError",
  13833. "ajaxSuccess",
  13834. "ajaxSend"
  13835. ], function( _i, type ) {
  13836. jQuery.fn[ type ] = function( fn ) {
  13837. return this.on( type, fn );
  13838. };
  13839. } );
  13840. jQuery.fn.extend( {
  13841. bind: function( types, data, fn ) {
  13842. return this.on( types, null, data, fn );
  13843. },
  13844. unbind: function( types, fn ) {
  13845. return this.off( types, null, fn );
  13846. },
  13847. delegate: function( selector, types, data, fn ) {
  13848. return this.on( types, selector, data, fn );
  13849. },
  13850. undelegate: function( selector, types, fn ) {
  13851. // ( namespace ) or ( selector, types [, fn] )
  13852. return arguments.length === 1 ?
  13853. this.off( selector, "**" ) :
  13854. this.off( types, selector || "**", fn );
  13855. },
  13856. hover: function( fnOver, fnOut ) {
  13857. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  13858. }
  13859. } );
  13860. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  13861. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  13862. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13863. function( _i, name ) {
  13864. // Handle event binding
  13865. jQuery.fn[ name ] = function( data, fn ) {
  13866. return arguments.length > 0 ?
  13867. this.on( name, null, data, fn ) :
  13868. this.trigger( name );
  13869. };
  13870. } );
  13871. // Support: Android <=4.0 only
  13872. // Make sure we trim BOM and NBSP
  13873. var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  13874. // Bind a function to a context, optionally partially applying any
  13875. // arguments.
  13876. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  13877. // However, it is not slated for removal any time soon
  13878. jQuery.proxy = function( fn, context ) {
  13879. var tmp, args, proxy;
  13880. if ( typeof context === "string" ) {
  13881. tmp = fn[ context ];
  13882. context = fn;
  13883. fn = tmp;
  13884. }
  13885. // Quick check to determine if target is callable, in the spec
  13886. // this throws a TypeError, but we will just return undefined.
  13887. if ( !isFunction( fn ) ) {
  13888. return undefined;
  13889. }
  13890. // Simulated bind
  13891. args = slice.call( arguments, 2 );
  13892. proxy = function() {
  13893. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  13894. };
  13895. // Set the guid of unique handler to the same of original handler, so it can be removed
  13896. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  13897. return proxy;
  13898. };
  13899. jQuery.holdReady = function( hold ) {
  13900. if ( hold ) {
  13901. jQuery.readyWait++;
  13902. } else {
  13903. jQuery.ready( true );
  13904. }
  13905. };
  13906. jQuery.isArray = Array.isArray;
  13907. jQuery.parseJSON = JSON.parse;
  13908. jQuery.nodeName = nodeName;
  13909. jQuery.isFunction = isFunction;
  13910. jQuery.isWindow = isWindow;
  13911. jQuery.camelCase = camelCase;
  13912. jQuery.type = toType;
  13913. jQuery.now = Date.now;
  13914. jQuery.isNumeric = function( obj ) {
  13915. // As of jQuery 3.0, isNumeric is limited to
  13916. // strings and numbers (primitives or objects)
  13917. // that can be coerced to finite numbers (gh-2662)
  13918. var type = jQuery.type( obj );
  13919. return ( type === "number" || type === "string" ) &&
  13920. // parseFloat NaNs numeric-cast false positives ("")
  13921. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  13922. // subtraction forces infinities to NaN
  13923. !isNaN( obj - parseFloat( obj ) );
  13924. };
  13925. jQuery.trim = function( text ) {
  13926. return text == null ?
  13927. "" :
  13928. ( text + "" ).replace( rtrim, "" );
  13929. };
  13930. // Register as a named AMD module, since jQuery can be concatenated with other
  13931. // files that may use define, but not via a proper concatenation script that
  13932. // understands anonymous AMD modules. A named AMD is safest and most robust
  13933. // way to register. Lowercase jquery is used because AMD module names are
  13934. // derived from file names, and jQuery is normally delivered in a lowercase
  13935. // file name. Do this after creating the global so that if an AMD module wants
  13936. // to call noConflict to hide this version of jQuery, it will work.
  13937. // Note that for maximum portability, libraries that are not jQuery should
  13938. // declare themselves as anonymous modules, and avoid setting a global if an
  13939. // AMD loader is present. jQuery is a special case. For more information, see
  13940. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  13941. if ( true ) {
  13942. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  13943. return jQuery;
  13944. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  13945. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13946. }
  13947. var
  13948. // Map over jQuery in case of overwrite
  13949. _jQuery = window.jQuery,
  13950. // Map over the $ in case of overwrite
  13951. _$ = window.$;
  13952. jQuery.noConflict = function( deep ) {
  13953. if ( window.$ === jQuery ) {
  13954. window.$ = _$;
  13955. }
  13956. if ( deep && window.jQuery === jQuery ) {
  13957. window.jQuery = _jQuery;
  13958. }
  13959. return jQuery;
  13960. };
  13961. // Expose jQuery and $ identifiers, even in AMD
  13962. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  13963. // and CommonJS for browser emulators (#13566)
  13964. if ( typeof noGlobal === "undefined" ) {
  13965. window.jQuery = window.$ = jQuery;
  13966. }
  13967. return jQuery;
  13968. } );
  13969. /***/ }),
  13970. /***/ "./node_modules/lodash/lodash.js":
  13971. /*!***************************************!*\
  13972. !*** ./node_modules/lodash/lodash.js ***!
  13973. \***************************************/
  13974. /*! no static exports found */
  13975. /***/ (function(module, exports, __webpack_require__) {
  13976. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  13977. * @license
  13978. * Lodash <https://lodash.com/>
  13979. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  13980. * Released under MIT license <https://lodash.com/license>
  13981. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  13982. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  13983. */
  13984. ;(function() {
  13985. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  13986. var undefined;
  13987. /** Used as the semantic version number. */
  13988. var VERSION = '4.17.20';
  13989. /** Used as the size to enable large array optimizations. */
  13990. var LARGE_ARRAY_SIZE = 200;
  13991. /** Error message constants. */
  13992. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  13993. FUNC_ERROR_TEXT = 'Expected a function';
  13994. /** Used to stand-in for `undefined` hash values. */
  13995. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  13996. /** Used as the maximum memoize cache size. */
  13997. var MAX_MEMOIZE_SIZE = 500;
  13998. /** Used as the internal argument placeholder. */
  13999. var PLACEHOLDER = '__lodash_placeholder__';
  14000. /** Used to compose bitmasks for cloning. */
  14001. var CLONE_DEEP_FLAG = 1,
  14002. CLONE_FLAT_FLAG = 2,
  14003. CLONE_SYMBOLS_FLAG = 4;
  14004. /** Used to compose bitmasks for value comparisons. */
  14005. var COMPARE_PARTIAL_FLAG = 1,
  14006. COMPARE_UNORDERED_FLAG = 2;
  14007. /** Used to compose bitmasks for function metadata. */
  14008. var WRAP_BIND_FLAG = 1,
  14009. WRAP_BIND_KEY_FLAG = 2,
  14010. WRAP_CURRY_BOUND_FLAG = 4,
  14011. WRAP_CURRY_FLAG = 8,
  14012. WRAP_CURRY_RIGHT_FLAG = 16,
  14013. WRAP_PARTIAL_FLAG = 32,
  14014. WRAP_PARTIAL_RIGHT_FLAG = 64,
  14015. WRAP_ARY_FLAG = 128,
  14016. WRAP_REARG_FLAG = 256,
  14017. WRAP_FLIP_FLAG = 512;
  14018. /** Used as default options for `_.truncate`. */
  14019. var DEFAULT_TRUNC_LENGTH = 30,
  14020. DEFAULT_TRUNC_OMISSION = '...';
  14021. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  14022. var HOT_COUNT = 800,
  14023. HOT_SPAN = 16;
  14024. /** Used to indicate the type of lazy iteratees. */
  14025. var LAZY_FILTER_FLAG = 1,
  14026. LAZY_MAP_FLAG = 2,
  14027. LAZY_WHILE_FLAG = 3;
  14028. /** Used as references for various `Number` constants. */
  14029. var INFINITY = 1 / 0,
  14030. MAX_SAFE_INTEGER = 9007199254740991,
  14031. MAX_INTEGER = 1.7976931348623157e+308,
  14032. NAN = 0 / 0;
  14033. /** Used as references for the maximum length and index of an array. */
  14034. var MAX_ARRAY_LENGTH = 4294967295,
  14035. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  14036. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  14037. /** Used to associate wrap methods with their bit flags. */
  14038. var wrapFlags = [
  14039. ['ary', WRAP_ARY_FLAG],
  14040. ['bind', WRAP_BIND_FLAG],
  14041. ['bindKey', WRAP_BIND_KEY_FLAG],
  14042. ['curry', WRAP_CURRY_FLAG],
  14043. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  14044. ['flip', WRAP_FLIP_FLAG],
  14045. ['partial', WRAP_PARTIAL_FLAG],
  14046. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  14047. ['rearg', WRAP_REARG_FLAG]
  14048. ];
  14049. /** `Object#toString` result references. */
  14050. var argsTag = '[object Arguments]',
  14051. arrayTag = '[object Array]',
  14052. asyncTag = '[object AsyncFunction]',
  14053. boolTag = '[object Boolean]',
  14054. dateTag = '[object Date]',
  14055. domExcTag = '[object DOMException]',
  14056. errorTag = '[object Error]',
  14057. funcTag = '[object Function]',
  14058. genTag = '[object GeneratorFunction]',
  14059. mapTag = '[object Map]',
  14060. numberTag = '[object Number]',
  14061. nullTag = '[object Null]',
  14062. objectTag = '[object Object]',
  14063. promiseTag = '[object Promise]',
  14064. proxyTag = '[object Proxy]',
  14065. regexpTag = '[object RegExp]',
  14066. setTag = '[object Set]',
  14067. stringTag = '[object String]',
  14068. symbolTag = '[object Symbol]',
  14069. undefinedTag = '[object Undefined]',
  14070. weakMapTag = '[object WeakMap]',
  14071. weakSetTag = '[object WeakSet]';
  14072. var arrayBufferTag = '[object ArrayBuffer]',
  14073. dataViewTag = '[object DataView]',
  14074. float32Tag = '[object Float32Array]',
  14075. float64Tag = '[object Float64Array]',
  14076. int8Tag = '[object Int8Array]',
  14077. int16Tag = '[object Int16Array]',
  14078. int32Tag = '[object Int32Array]',
  14079. uint8Tag = '[object Uint8Array]',
  14080. uint8ClampedTag = '[object Uint8ClampedArray]',
  14081. uint16Tag = '[object Uint16Array]',
  14082. uint32Tag = '[object Uint32Array]';
  14083. /** Used to match empty string literals in compiled template source. */
  14084. var reEmptyStringLeading = /\b__p \+= '';/g,
  14085. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  14086. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  14087. /** Used to match HTML entities and HTML characters. */
  14088. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  14089. reUnescapedHtml = /[&<>"']/g,
  14090. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  14091. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  14092. /** Used to match template delimiters. */
  14093. var reEscape = /<%-([\s\S]+?)%>/g,
  14094. reEvaluate = /<%([\s\S]+?)%>/g,
  14095. reInterpolate = /<%=([\s\S]+?)%>/g;
  14096. /** Used to match property names within property paths. */
  14097. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  14098. reIsPlainProp = /^\w*$/,
  14099. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  14100. /**
  14101. * Used to match `RegExp`
  14102. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  14103. */
  14104. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  14105. reHasRegExpChar = RegExp(reRegExpChar.source);
  14106. /** Used to match leading and trailing whitespace. */
  14107. var reTrim = /^\s+|\s+$/g,
  14108. reTrimStart = /^\s+/,
  14109. reTrimEnd = /\s+$/;
  14110. /** Used to match wrap detail comments. */
  14111. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  14112. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  14113. reSplitDetails = /,? & /;
  14114. /** Used to match words composed of alphanumeric characters. */
  14115. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  14116. /** Used to match backslashes in property paths. */
  14117. var reEscapeChar = /\\(\\)?/g;
  14118. /**
  14119. * Used to match
  14120. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  14121. */
  14122. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  14123. /** Used to match `RegExp` flags from their coerced string values. */
  14124. var reFlags = /\w*$/;
  14125. /** Used to detect bad signed hexadecimal string values. */
  14126. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14127. /** Used to detect binary string values. */
  14128. var reIsBinary = /^0b[01]+$/i;
  14129. /** Used to detect host constructors (Safari). */
  14130. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14131. /** Used to detect octal string values. */
  14132. var reIsOctal = /^0o[0-7]+$/i;
  14133. /** Used to detect unsigned integer values. */
  14134. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14135. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  14136. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  14137. /** Used to ensure capturing order of template delimiters. */
  14138. var reNoMatch = /($^)/;
  14139. /** Used to match unescaped characters in compiled string literals. */
  14140. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  14141. /** Used to compose unicode character classes. */
  14142. var rsAstralRange = '\\ud800-\\udfff',
  14143. rsComboMarksRange = '\\u0300-\\u036f',
  14144. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  14145. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  14146. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  14147. rsDingbatRange = '\\u2700-\\u27bf',
  14148. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  14149. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  14150. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  14151. rsPunctuationRange = '\\u2000-\\u206f',
  14152. 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',
  14153. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  14154. rsVarRange = '\\ufe0e\\ufe0f',
  14155. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  14156. /** Used to compose unicode capture groups. */
  14157. var rsApos = "['\u2019]",
  14158. rsAstral = '[' + rsAstralRange + ']',
  14159. rsBreak = '[' + rsBreakRange + ']',
  14160. rsCombo = '[' + rsComboRange + ']',
  14161. rsDigits = '\\d+',
  14162. rsDingbat = '[' + rsDingbatRange + ']',
  14163. rsLower = '[' + rsLowerRange + ']',
  14164. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  14165. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  14166. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  14167. rsNonAstral = '[^' + rsAstralRange + ']',
  14168. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  14169. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  14170. rsUpper = '[' + rsUpperRange + ']',
  14171. rsZWJ = '\\u200d';
  14172. /** Used to compose unicode regexes. */
  14173. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  14174. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  14175. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  14176. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  14177. reOptMod = rsModifier + '?',
  14178. rsOptVar = '[' + rsVarRange + ']?',
  14179. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  14180. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  14181. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  14182. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  14183. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  14184. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  14185. /** Used to match apostrophes. */
  14186. var reApos = RegExp(rsApos, 'g');
  14187. /**
  14188. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  14189. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  14190. */
  14191. var reComboMark = RegExp(rsCombo, 'g');
  14192. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  14193. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  14194. /** Used to match complex or compound words. */
  14195. var reUnicodeWord = RegExp([
  14196. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  14197. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  14198. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  14199. rsUpper + '+' + rsOptContrUpper,
  14200. rsOrdUpper,
  14201. rsOrdLower,
  14202. rsDigits,
  14203. rsEmoji
  14204. ].join('|'), 'g');
  14205. /** 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/). */
  14206. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  14207. /** Used to detect strings that need a more robust regexp to match words. */
  14208. 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 ]/;
  14209. /** Used to assign default `context` object properties. */
  14210. var contextProps = [
  14211. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  14212. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  14213. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  14214. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  14215. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  14216. ];
  14217. /** Used to make template sourceURLs easier to identify. */
  14218. var templateCounter = -1;
  14219. /** Used to identify `toStringTag` values of typed arrays. */
  14220. var typedArrayTags = {};
  14221. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  14222. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  14223. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  14224. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  14225. typedArrayTags[uint32Tag] = true;
  14226. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  14227. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  14228. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  14229. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  14230. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  14231. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  14232. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  14233. typedArrayTags[weakMapTag] = false;
  14234. /** Used to identify `toStringTag` values supported by `_.clone`. */
  14235. var cloneableTags = {};
  14236. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  14237. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  14238. cloneableTags[boolTag] = cloneableTags[dateTag] =
  14239. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  14240. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  14241. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  14242. cloneableTags[numberTag] = cloneableTags[objectTag] =
  14243. cloneableTags[regexpTag] = cloneableTags[setTag] =
  14244. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  14245. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  14246. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  14247. cloneableTags[errorTag] = cloneableTags[funcTag] =
  14248. cloneableTags[weakMapTag] = false;
  14249. /** Used to map Latin Unicode letters to basic Latin letters. */
  14250. var deburredLetters = {
  14251. // Latin-1 Supplement block.
  14252. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  14253. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  14254. '\xc7': 'C', '\xe7': 'c',
  14255. '\xd0': 'D', '\xf0': 'd',
  14256. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  14257. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  14258. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  14259. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  14260. '\xd1': 'N', '\xf1': 'n',
  14261. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  14262. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  14263. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  14264. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  14265. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  14266. '\xc6': 'Ae', '\xe6': 'ae',
  14267. '\xde': 'Th', '\xfe': 'th',
  14268. '\xdf': 'ss',
  14269. // Latin Extended-A block.
  14270. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  14271. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  14272. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  14273. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  14274. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  14275. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  14276. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  14277. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  14278. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  14279. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  14280. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  14281. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  14282. '\u0134': 'J', '\u0135': 'j',
  14283. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  14284. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  14285. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  14286. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  14287. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  14288. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  14289. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  14290. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  14291. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  14292. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  14293. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  14294. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  14295. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  14296. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  14297. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  14298. '\u0174': 'W', '\u0175': 'w',
  14299. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  14300. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  14301. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  14302. '\u0132': 'IJ', '\u0133': 'ij',
  14303. '\u0152': 'Oe', '\u0153': 'oe',
  14304. '\u0149': "'n", '\u017f': 's'
  14305. };
  14306. /** Used to map characters to HTML entities. */
  14307. var htmlEscapes = {
  14308. '&': '&amp;',
  14309. '<': '&lt;',
  14310. '>': '&gt;',
  14311. '"': '&quot;',
  14312. "'": '&#39;'
  14313. };
  14314. /** Used to map HTML entities to characters. */
  14315. var htmlUnescapes = {
  14316. '&amp;': '&',
  14317. '&lt;': '<',
  14318. '&gt;': '>',
  14319. '&quot;': '"',
  14320. '&#39;': "'"
  14321. };
  14322. /** Used to escape characters for inclusion in compiled string literals. */
  14323. var stringEscapes = {
  14324. '\\': '\\',
  14325. "'": "'",
  14326. '\n': 'n',
  14327. '\r': 'r',
  14328. '\u2028': 'u2028',
  14329. '\u2029': 'u2029'
  14330. };
  14331. /** Built-in method references without a dependency on `root`. */
  14332. var freeParseFloat = parseFloat,
  14333. freeParseInt = parseInt;
  14334. /** Detect free variable `global` from Node.js. */
  14335. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  14336. /** Detect free variable `self`. */
  14337. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  14338. /** Used as a reference to the global object. */
  14339. var root = freeGlobal || freeSelf || Function('return this')();
  14340. /** Detect free variable `exports`. */
  14341. var freeExports = true && exports && !exports.nodeType && exports;
  14342. /** Detect free variable `module`. */
  14343. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  14344. /** Detect the popular CommonJS extension `module.exports`. */
  14345. var moduleExports = freeModule && freeModule.exports === freeExports;
  14346. /** Detect free variable `process` from Node.js. */
  14347. var freeProcess = moduleExports && freeGlobal.process;
  14348. /** Used to access faster Node.js helpers. */
  14349. var nodeUtil = (function() {
  14350. try {
  14351. // Use `util.types` for Node.js 10+.
  14352. var types = freeModule && freeModule.require && freeModule.require('util').types;
  14353. if (types) {
  14354. return types;
  14355. }
  14356. // Legacy `process.binding('util')` for Node.js < 10.
  14357. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  14358. } catch (e) {}
  14359. }());
  14360. /* Node.js helper references. */
  14361. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  14362. nodeIsDate = nodeUtil && nodeUtil.isDate,
  14363. nodeIsMap = nodeUtil && nodeUtil.isMap,
  14364. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  14365. nodeIsSet = nodeUtil && nodeUtil.isSet,
  14366. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  14367. /*--------------------------------------------------------------------------*/
  14368. /**
  14369. * A faster alternative to `Function#apply`, this function invokes `func`
  14370. * with the `this` binding of `thisArg` and the arguments of `args`.
  14371. *
  14372. * @private
  14373. * @param {Function} func The function to invoke.
  14374. * @param {*} thisArg The `this` binding of `func`.
  14375. * @param {Array} args The arguments to invoke `func` with.
  14376. * @returns {*} Returns the result of `func`.
  14377. */
  14378. function apply(func, thisArg, args) {
  14379. switch (args.length) {
  14380. case 0: return func.call(thisArg);
  14381. case 1: return func.call(thisArg, args[0]);
  14382. case 2: return func.call(thisArg, args[0], args[1]);
  14383. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  14384. }
  14385. return func.apply(thisArg, args);
  14386. }
  14387. /**
  14388. * A specialized version of `baseAggregator` for arrays.
  14389. *
  14390. * @private
  14391. * @param {Array} [array] The array to iterate over.
  14392. * @param {Function} setter The function to set `accumulator` values.
  14393. * @param {Function} iteratee The iteratee to transform keys.
  14394. * @param {Object} accumulator The initial aggregated object.
  14395. * @returns {Function} Returns `accumulator`.
  14396. */
  14397. function arrayAggregator(array, setter, iteratee, accumulator) {
  14398. var index = -1,
  14399. length = array == null ? 0 : array.length;
  14400. while (++index < length) {
  14401. var value = array[index];
  14402. setter(accumulator, value, iteratee(value), array);
  14403. }
  14404. return accumulator;
  14405. }
  14406. /**
  14407. * A specialized version of `_.forEach` for arrays without support for
  14408. * iteratee shorthands.
  14409. *
  14410. * @private
  14411. * @param {Array} [array] The array to iterate over.
  14412. * @param {Function} iteratee The function invoked per iteration.
  14413. * @returns {Array} Returns `array`.
  14414. */
  14415. function arrayEach(array, iteratee) {
  14416. var index = -1,
  14417. length = array == null ? 0 : array.length;
  14418. while (++index < length) {
  14419. if (iteratee(array[index], index, array) === false) {
  14420. break;
  14421. }
  14422. }
  14423. return array;
  14424. }
  14425. /**
  14426. * A specialized version of `_.forEachRight` for arrays without support for
  14427. * iteratee shorthands.
  14428. *
  14429. * @private
  14430. * @param {Array} [array] The array to iterate over.
  14431. * @param {Function} iteratee The function invoked per iteration.
  14432. * @returns {Array} Returns `array`.
  14433. */
  14434. function arrayEachRight(array, iteratee) {
  14435. var length = array == null ? 0 : array.length;
  14436. while (length--) {
  14437. if (iteratee(array[length], length, array) === false) {
  14438. break;
  14439. }
  14440. }
  14441. return array;
  14442. }
  14443. /**
  14444. * A specialized version of `_.every` for arrays without support for
  14445. * iteratee shorthands.
  14446. *
  14447. * @private
  14448. * @param {Array} [array] The array to iterate over.
  14449. * @param {Function} predicate The function invoked per iteration.
  14450. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14451. * else `false`.
  14452. */
  14453. function arrayEvery(array, predicate) {
  14454. var index = -1,
  14455. length = array == null ? 0 : array.length;
  14456. while (++index < length) {
  14457. if (!predicate(array[index], index, array)) {
  14458. return false;
  14459. }
  14460. }
  14461. return true;
  14462. }
  14463. /**
  14464. * A specialized version of `_.filter` for arrays without support for
  14465. * iteratee shorthands.
  14466. *
  14467. * @private
  14468. * @param {Array} [array] The array to iterate over.
  14469. * @param {Function} predicate The function invoked per iteration.
  14470. * @returns {Array} Returns the new filtered array.
  14471. */
  14472. function arrayFilter(array, predicate) {
  14473. var index = -1,
  14474. length = array == null ? 0 : array.length,
  14475. resIndex = 0,
  14476. result = [];
  14477. while (++index < length) {
  14478. var value = array[index];
  14479. if (predicate(value, index, array)) {
  14480. result[resIndex++] = value;
  14481. }
  14482. }
  14483. return result;
  14484. }
  14485. /**
  14486. * A specialized version of `_.includes` for arrays without support for
  14487. * specifying an index to search from.
  14488. *
  14489. * @private
  14490. * @param {Array} [array] The array to inspect.
  14491. * @param {*} target The value to search for.
  14492. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14493. */
  14494. function arrayIncludes(array, value) {
  14495. var length = array == null ? 0 : array.length;
  14496. return !!length && baseIndexOf(array, value, 0) > -1;
  14497. }
  14498. /**
  14499. * This function is like `arrayIncludes` except that it accepts a comparator.
  14500. *
  14501. * @private
  14502. * @param {Array} [array] The array to inspect.
  14503. * @param {*} target The value to search for.
  14504. * @param {Function} comparator The comparator invoked per element.
  14505. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14506. */
  14507. function arrayIncludesWith(array, value, comparator) {
  14508. var index = -1,
  14509. length = array == null ? 0 : array.length;
  14510. while (++index < length) {
  14511. if (comparator(value, array[index])) {
  14512. return true;
  14513. }
  14514. }
  14515. return false;
  14516. }
  14517. /**
  14518. * A specialized version of `_.map` for arrays without support for iteratee
  14519. * shorthands.
  14520. *
  14521. * @private
  14522. * @param {Array} [array] The array to iterate over.
  14523. * @param {Function} iteratee The function invoked per iteration.
  14524. * @returns {Array} Returns the new mapped array.
  14525. */
  14526. function arrayMap(array, iteratee) {
  14527. var index = -1,
  14528. length = array == null ? 0 : array.length,
  14529. result = Array(length);
  14530. while (++index < length) {
  14531. result[index] = iteratee(array[index], index, array);
  14532. }
  14533. return result;
  14534. }
  14535. /**
  14536. * Appends the elements of `values` to `array`.
  14537. *
  14538. * @private
  14539. * @param {Array} array The array to modify.
  14540. * @param {Array} values The values to append.
  14541. * @returns {Array} Returns `array`.
  14542. */
  14543. function arrayPush(array, values) {
  14544. var index = -1,
  14545. length = values.length,
  14546. offset = array.length;
  14547. while (++index < length) {
  14548. array[offset + index] = values[index];
  14549. }
  14550. return array;
  14551. }
  14552. /**
  14553. * A specialized version of `_.reduce` for arrays without support for
  14554. * iteratee shorthands.
  14555. *
  14556. * @private
  14557. * @param {Array} [array] The array to iterate over.
  14558. * @param {Function} iteratee The function invoked per iteration.
  14559. * @param {*} [accumulator] The initial value.
  14560. * @param {boolean} [initAccum] Specify using the first element of `array` as
  14561. * the initial value.
  14562. * @returns {*} Returns the accumulated value.
  14563. */
  14564. function arrayReduce(array, iteratee, accumulator, initAccum) {
  14565. var index = -1,
  14566. length = array == null ? 0 : array.length;
  14567. if (initAccum && length) {
  14568. accumulator = array[++index];
  14569. }
  14570. while (++index < length) {
  14571. accumulator = iteratee(accumulator, array[index], index, array);
  14572. }
  14573. return accumulator;
  14574. }
  14575. /**
  14576. * A specialized version of `_.reduceRight` for arrays without support for
  14577. * iteratee shorthands.
  14578. *
  14579. * @private
  14580. * @param {Array} [array] The array to iterate over.
  14581. * @param {Function} iteratee The function invoked per iteration.
  14582. * @param {*} [accumulator] The initial value.
  14583. * @param {boolean} [initAccum] Specify using the last element of `array` as
  14584. * the initial value.
  14585. * @returns {*} Returns the accumulated value.
  14586. */
  14587. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  14588. var length = array == null ? 0 : array.length;
  14589. if (initAccum && length) {
  14590. accumulator = array[--length];
  14591. }
  14592. while (length--) {
  14593. accumulator = iteratee(accumulator, array[length], length, array);
  14594. }
  14595. return accumulator;
  14596. }
  14597. /**
  14598. * A specialized version of `_.some` for arrays without support for iteratee
  14599. * shorthands.
  14600. *
  14601. * @private
  14602. * @param {Array} [array] The array to iterate over.
  14603. * @param {Function} predicate The function invoked per iteration.
  14604. * @returns {boolean} Returns `true` if any element passes the predicate check,
  14605. * else `false`.
  14606. */
  14607. function arraySome(array, predicate) {
  14608. var index = -1,
  14609. length = array == null ? 0 : array.length;
  14610. while (++index < length) {
  14611. if (predicate(array[index], index, array)) {
  14612. return true;
  14613. }
  14614. }
  14615. return false;
  14616. }
  14617. /**
  14618. * Gets the size of an ASCII `string`.
  14619. *
  14620. * @private
  14621. * @param {string} string The string inspect.
  14622. * @returns {number} Returns the string size.
  14623. */
  14624. var asciiSize = baseProperty('length');
  14625. /**
  14626. * Converts an ASCII `string` to an array.
  14627. *
  14628. * @private
  14629. * @param {string} string The string to convert.
  14630. * @returns {Array} Returns the converted array.
  14631. */
  14632. function asciiToArray(string) {
  14633. return string.split('');
  14634. }
  14635. /**
  14636. * Splits an ASCII `string` into an array of its words.
  14637. *
  14638. * @private
  14639. * @param {string} The string to inspect.
  14640. * @returns {Array} Returns the words of `string`.
  14641. */
  14642. function asciiWords(string) {
  14643. return string.match(reAsciiWord) || [];
  14644. }
  14645. /**
  14646. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  14647. * without support for iteratee shorthands, which iterates over `collection`
  14648. * using `eachFunc`.
  14649. *
  14650. * @private
  14651. * @param {Array|Object} collection The collection to inspect.
  14652. * @param {Function} predicate The function invoked per iteration.
  14653. * @param {Function} eachFunc The function to iterate over `collection`.
  14654. * @returns {*} Returns the found element or its key, else `undefined`.
  14655. */
  14656. function baseFindKey(collection, predicate, eachFunc) {
  14657. var result;
  14658. eachFunc(collection, function(value, key, collection) {
  14659. if (predicate(value, key, collection)) {
  14660. result = key;
  14661. return false;
  14662. }
  14663. });
  14664. return result;
  14665. }
  14666. /**
  14667. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  14668. * support for iteratee shorthands.
  14669. *
  14670. * @private
  14671. * @param {Array} array The array to inspect.
  14672. * @param {Function} predicate The function invoked per iteration.
  14673. * @param {number} fromIndex The index to search from.
  14674. * @param {boolean} [fromRight] Specify iterating from right to left.
  14675. * @returns {number} Returns the index of the matched value, else `-1`.
  14676. */
  14677. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  14678. var length = array.length,
  14679. index = fromIndex + (fromRight ? 1 : -1);
  14680. while ((fromRight ? index-- : ++index < length)) {
  14681. if (predicate(array[index], index, array)) {
  14682. return index;
  14683. }
  14684. }
  14685. return -1;
  14686. }
  14687. /**
  14688. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  14689. *
  14690. * @private
  14691. * @param {Array} array The array to inspect.
  14692. * @param {*} value The value to search for.
  14693. * @param {number} fromIndex The index to search from.
  14694. * @returns {number} Returns the index of the matched value, else `-1`.
  14695. */
  14696. function baseIndexOf(array, value, fromIndex) {
  14697. return value === value
  14698. ? strictIndexOf(array, value, fromIndex)
  14699. : baseFindIndex(array, baseIsNaN, fromIndex);
  14700. }
  14701. /**
  14702. * This function is like `baseIndexOf` except that it accepts a comparator.
  14703. *
  14704. * @private
  14705. * @param {Array} array The array to inspect.
  14706. * @param {*} value The value to search for.
  14707. * @param {number} fromIndex The index to search from.
  14708. * @param {Function} comparator The comparator invoked per element.
  14709. * @returns {number} Returns the index of the matched value, else `-1`.
  14710. */
  14711. function baseIndexOfWith(array, value, fromIndex, comparator) {
  14712. var index = fromIndex - 1,
  14713. length = array.length;
  14714. while (++index < length) {
  14715. if (comparator(array[index], value)) {
  14716. return index;
  14717. }
  14718. }
  14719. return -1;
  14720. }
  14721. /**
  14722. * The base implementation of `_.isNaN` without support for number objects.
  14723. *
  14724. * @private
  14725. * @param {*} value The value to check.
  14726. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  14727. */
  14728. function baseIsNaN(value) {
  14729. return value !== value;
  14730. }
  14731. /**
  14732. * The base implementation of `_.mean` and `_.meanBy` without support for
  14733. * iteratee shorthands.
  14734. *
  14735. * @private
  14736. * @param {Array} array The array to iterate over.
  14737. * @param {Function} iteratee The function invoked per iteration.
  14738. * @returns {number} Returns the mean.
  14739. */
  14740. function baseMean(array, iteratee) {
  14741. var length = array == null ? 0 : array.length;
  14742. return length ? (baseSum(array, iteratee) / length) : NAN;
  14743. }
  14744. /**
  14745. * The base implementation of `_.property` without support for deep paths.
  14746. *
  14747. * @private
  14748. * @param {string} key The key of the property to get.
  14749. * @returns {Function} Returns the new accessor function.
  14750. */
  14751. function baseProperty(key) {
  14752. return function(object) {
  14753. return object == null ? undefined : object[key];
  14754. };
  14755. }
  14756. /**
  14757. * The base implementation of `_.propertyOf` without support for deep paths.
  14758. *
  14759. * @private
  14760. * @param {Object} object The object to query.
  14761. * @returns {Function} Returns the new accessor function.
  14762. */
  14763. function basePropertyOf(object) {
  14764. return function(key) {
  14765. return object == null ? undefined : object[key];
  14766. };
  14767. }
  14768. /**
  14769. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  14770. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  14771. *
  14772. * @private
  14773. * @param {Array|Object} collection The collection to iterate over.
  14774. * @param {Function} iteratee The function invoked per iteration.
  14775. * @param {*} accumulator The initial value.
  14776. * @param {boolean} initAccum Specify using the first or last element of
  14777. * `collection` as the initial value.
  14778. * @param {Function} eachFunc The function to iterate over `collection`.
  14779. * @returns {*} Returns the accumulated value.
  14780. */
  14781. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  14782. eachFunc(collection, function(value, index, collection) {
  14783. accumulator = initAccum
  14784. ? (initAccum = false, value)
  14785. : iteratee(accumulator, value, index, collection);
  14786. });
  14787. return accumulator;
  14788. }
  14789. /**
  14790. * The base implementation of `_.sortBy` which uses `comparer` to define the
  14791. * sort order of `array` and replaces criteria objects with their corresponding
  14792. * values.
  14793. *
  14794. * @private
  14795. * @param {Array} array The array to sort.
  14796. * @param {Function} comparer The function to define sort order.
  14797. * @returns {Array} Returns `array`.
  14798. */
  14799. function baseSortBy(array, comparer) {
  14800. var length = array.length;
  14801. array.sort(comparer);
  14802. while (length--) {
  14803. array[length] = array[length].value;
  14804. }
  14805. return array;
  14806. }
  14807. /**
  14808. * The base implementation of `_.sum` and `_.sumBy` without support for
  14809. * iteratee shorthands.
  14810. *
  14811. * @private
  14812. * @param {Array} array The array to iterate over.
  14813. * @param {Function} iteratee The function invoked per iteration.
  14814. * @returns {number} Returns the sum.
  14815. */
  14816. function baseSum(array, iteratee) {
  14817. var result,
  14818. index = -1,
  14819. length = array.length;
  14820. while (++index < length) {
  14821. var current = iteratee(array[index]);
  14822. if (current !== undefined) {
  14823. result = result === undefined ? current : (result + current);
  14824. }
  14825. }
  14826. return result;
  14827. }
  14828. /**
  14829. * The base implementation of `_.times` without support for iteratee shorthands
  14830. * or max array length checks.
  14831. *
  14832. * @private
  14833. * @param {number} n The number of times to invoke `iteratee`.
  14834. * @param {Function} iteratee The function invoked per iteration.
  14835. * @returns {Array} Returns the array of results.
  14836. */
  14837. function baseTimes(n, iteratee) {
  14838. var index = -1,
  14839. result = Array(n);
  14840. while (++index < n) {
  14841. result[index] = iteratee(index);
  14842. }
  14843. return result;
  14844. }
  14845. /**
  14846. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  14847. * of key-value pairs for `object` corresponding to the property names of `props`.
  14848. *
  14849. * @private
  14850. * @param {Object} object The object to query.
  14851. * @param {Array} props The property names to get values for.
  14852. * @returns {Object} Returns the key-value pairs.
  14853. */
  14854. function baseToPairs(object, props) {
  14855. return arrayMap(props, function(key) {
  14856. return [key, object[key]];
  14857. });
  14858. }
  14859. /**
  14860. * The base implementation of `_.unary` without support for storing metadata.
  14861. *
  14862. * @private
  14863. * @param {Function} func The function to cap arguments for.
  14864. * @returns {Function} Returns the new capped function.
  14865. */
  14866. function baseUnary(func) {
  14867. return function(value) {
  14868. return func(value);
  14869. };
  14870. }
  14871. /**
  14872. * The base implementation of `_.values` and `_.valuesIn` which creates an
  14873. * array of `object` property values corresponding to the property names
  14874. * of `props`.
  14875. *
  14876. * @private
  14877. * @param {Object} object The object to query.
  14878. * @param {Array} props The property names to get values for.
  14879. * @returns {Object} Returns the array of property values.
  14880. */
  14881. function baseValues(object, props) {
  14882. return arrayMap(props, function(key) {
  14883. return object[key];
  14884. });
  14885. }
  14886. /**
  14887. * Checks if a `cache` value for `key` exists.
  14888. *
  14889. * @private
  14890. * @param {Object} cache The cache to query.
  14891. * @param {string} key The key of the entry to check.
  14892. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14893. */
  14894. function cacheHas(cache, key) {
  14895. return cache.has(key);
  14896. }
  14897. /**
  14898. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  14899. * that is not found in the character symbols.
  14900. *
  14901. * @private
  14902. * @param {Array} strSymbols The string symbols to inspect.
  14903. * @param {Array} chrSymbols The character symbols to find.
  14904. * @returns {number} Returns the index of the first unmatched string symbol.
  14905. */
  14906. function charsStartIndex(strSymbols, chrSymbols) {
  14907. var index = -1,
  14908. length = strSymbols.length;
  14909. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14910. return index;
  14911. }
  14912. /**
  14913. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  14914. * that is not found in the character symbols.
  14915. *
  14916. * @private
  14917. * @param {Array} strSymbols The string symbols to inspect.
  14918. * @param {Array} chrSymbols The character symbols to find.
  14919. * @returns {number} Returns the index of the last unmatched string symbol.
  14920. */
  14921. function charsEndIndex(strSymbols, chrSymbols) {
  14922. var index = strSymbols.length;
  14923. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14924. return index;
  14925. }
  14926. /**
  14927. * Gets the number of `placeholder` occurrences in `array`.
  14928. *
  14929. * @private
  14930. * @param {Array} array The array to inspect.
  14931. * @param {*} placeholder The placeholder to search for.
  14932. * @returns {number} Returns the placeholder count.
  14933. */
  14934. function countHolders(array, placeholder) {
  14935. var length = array.length,
  14936. result = 0;
  14937. while (length--) {
  14938. if (array[length] === placeholder) {
  14939. ++result;
  14940. }
  14941. }
  14942. return result;
  14943. }
  14944. /**
  14945. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  14946. * letters to basic Latin letters.
  14947. *
  14948. * @private
  14949. * @param {string} letter The matched letter to deburr.
  14950. * @returns {string} Returns the deburred letter.
  14951. */
  14952. var deburrLetter = basePropertyOf(deburredLetters);
  14953. /**
  14954. * Used by `_.escape` to convert characters to HTML entities.
  14955. *
  14956. * @private
  14957. * @param {string} chr The matched character to escape.
  14958. * @returns {string} Returns the escaped character.
  14959. */
  14960. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  14961. /**
  14962. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  14963. *
  14964. * @private
  14965. * @param {string} chr The matched character to escape.
  14966. * @returns {string} Returns the escaped character.
  14967. */
  14968. function escapeStringChar(chr) {
  14969. return '\\' + stringEscapes[chr];
  14970. }
  14971. /**
  14972. * Gets the value at `key` of `object`.
  14973. *
  14974. * @private
  14975. * @param {Object} [object] The object to query.
  14976. * @param {string} key The key of the property to get.
  14977. * @returns {*} Returns the property value.
  14978. */
  14979. function getValue(object, key) {
  14980. return object == null ? undefined : object[key];
  14981. }
  14982. /**
  14983. * Checks if `string` contains Unicode symbols.
  14984. *
  14985. * @private
  14986. * @param {string} string The string to inspect.
  14987. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  14988. */
  14989. function hasUnicode(string) {
  14990. return reHasUnicode.test(string);
  14991. }
  14992. /**
  14993. * Checks if `string` contains a word composed of Unicode symbols.
  14994. *
  14995. * @private
  14996. * @param {string} string The string to inspect.
  14997. * @returns {boolean} Returns `true` if a word is found, else `false`.
  14998. */
  14999. function hasUnicodeWord(string) {
  15000. return reHasUnicodeWord.test(string);
  15001. }
  15002. /**
  15003. * Converts `iterator` to an array.
  15004. *
  15005. * @private
  15006. * @param {Object} iterator The iterator to convert.
  15007. * @returns {Array} Returns the converted array.
  15008. */
  15009. function iteratorToArray(iterator) {
  15010. var data,
  15011. result = [];
  15012. while (!(data = iterator.next()).done) {
  15013. result.push(data.value);
  15014. }
  15015. return result;
  15016. }
  15017. /**
  15018. * Converts `map` to its key-value pairs.
  15019. *
  15020. * @private
  15021. * @param {Object} map The map to convert.
  15022. * @returns {Array} Returns the key-value pairs.
  15023. */
  15024. function mapToArray(map) {
  15025. var index = -1,
  15026. result = Array(map.size);
  15027. map.forEach(function(value, key) {
  15028. result[++index] = [key, value];
  15029. });
  15030. return result;
  15031. }
  15032. /**
  15033. * Creates a unary function that invokes `func` with its argument transformed.
  15034. *
  15035. * @private
  15036. * @param {Function} func The function to wrap.
  15037. * @param {Function} transform The argument transform.
  15038. * @returns {Function} Returns the new function.
  15039. */
  15040. function overArg(func, transform) {
  15041. return function(arg) {
  15042. return func(transform(arg));
  15043. };
  15044. }
  15045. /**
  15046. * Replaces all `placeholder` elements in `array` with an internal placeholder
  15047. * and returns an array of their indexes.
  15048. *
  15049. * @private
  15050. * @param {Array} array The array to modify.
  15051. * @param {*} placeholder The placeholder to replace.
  15052. * @returns {Array} Returns the new array of placeholder indexes.
  15053. */
  15054. function replaceHolders(array, placeholder) {
  15055. var index = -1,
  15056. length = array.length,
  15057. resIndex = 0,
  15058. result = [];
  15059. while (++index < length) {
  15060. var value = array[index];
  15061. if (value === placeholder || value === PLACEHOLDER) {
  15062. array[index] = PLACEHOLDER;
  15063. result[resIndex++] = index;
  15064. }
  15065. }
  15066. return result;
  15067. }
  15068. /**
  15069. * Converts `set` to an array of its values.
  15070. *
  15071. * @private
  15072. * @param {Object} set The set to convert.
  15073. * @returns {Array} Returns the values.
  15074. */
  15075. function setToArray(set) {
  15076. var index = -1,
  15077. result = Array(set.size);
  15078. set.forEach(function(value) {
  15079. result[++index] = value;
  15080. });
  15081. return result;
  15082. }
  15083. /**
  15084. * Converts `set` to its value-value pairs.
  15085. *
  15086. * @private
  15087. * @param {Object} set The set to convert.
  15088. * @returns {Array} Returns the value-value pairs.
  15089. */
  15090. function setToPairs(set) {
  15091. var index = -1,
  15092. result = Array(set.size);
  15093. set.forEach(function(value) {
  15094. result[++index] = [value, value];
  15095. });
  15096. return result;
  15097. }
  15098. /**
  15099. * A specialized version of `_.indexOf` which performs strict equality
  15100. * comparisons of values, i.e. `===`.
  15101. *
  15102. * @private
  15103. * @param {Array} array The array to inspect.
  15104. * @param {*} value The value to search for.
  15105. * @param {number} fromIndex The index to search from.
  15106. * @returns {number} Returns the index of the matched value, else `-1`.
  15107. */
  15108. function strictIndexOf(array, value, fromIndex) {
  15109. var index = fromIndex - 1,
  15110. length = array.length;
  15111. while (++index < length) {
  15112. if (array[index] === value) {
  15113. return index;
  15114. }
  15115. }
  15116. return -1;
  15117. }
  15118. /**
  15119. * A specialized version of `_.lastIndexOf` which performs strict equality
  15120. * comparisons of values, i.e. `===`.
  15121. *
  15122. * @private
  15123. * @param {Array} array The array to inspect.
  15124. * @param {*} value The value to search for.
  15125. * @param {number} fromIndex The index to search from.
  15126. * @returns {number} Returns the index of the matched value, else `-1`.
  15127. */
  15128. function strictLastIndexOf(array, value, fromIndex) {
  15129. var index = fromIndex + 1;
  15130. while (index--) {
  15131. if (array[index] === value) {
  15132. return index;
  15133. }
  15134. }
  15135. return index;
  15136. }
  15137. /**
  15138. * Gets the number of symbols in `string`.
  15139. *
  15140. * @private
  15141. * @param {string} string The string to inspect.
  15142. * @returns {number} Returns the string size.
  15143. */
  15144. function stringSize(string) {
  15145. return hasUnicode(string)
  15146. ? unicodeSize(string)
  15147. : asciiSize(string);
  15148. }
  15149. /**
  15150. * Converts `string` to an array.
  15151. *
  15152. * @private
  15153. * @param {string} string The string to convert.
  15154. * @returns {Array} Returns the converted array.
  15155. */
  15156. function stringToArray(string) {
  15157. return hasUnicode(string)
  15158. ? unicodeToArray(string)
  15159. : asciiToArray(string);
  15160. }
  15161. /**
  15162. * Used by `_.unescape` to convert HTML entities to characters.
  15163. *
  15164. * @private
  15165. * @param {string} chr The matched character to unescape.
  15166. * @returns {string} Returns the unescaped character.
  15167. */
  15168. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  15169. /**
  15170. * Gets the size of a Unicode `string`.
  15171. *
  15172. * @private
  15173. * @param {string} string The string inspect.
  15174. * @returns {number} Returns the string size.
  15175. */
  15176. function unicodeSize(string) {
  15177. var result = reUnicode.lastIndex = 0;
  15178. while (reUnicode.test(string)) {
  15179. ++result;
  15180. }
  15181. return result;
  15182. }
  15183. /**
  15184. * Converts a Unicode `string` to an array.
  15185. *
  15186. * @private
  15187. * @param {string} string The string to convert.
  15188. * @returns {Array} Returns the converted array.
  15189. */
  15190. function unicodeToArray(string) {
  15191. return string.match(reUnicode) || [];
  15192. }
  15193. /**
  15194. * Splits a Unicode `string` into an array of its words.
  15195. *
  15196. * @private
  15197. * @param {string} The string to inspect.
  15198. * @returns {Array} Returns the words of `string`.
  15199. */
  15200. function unicodeWords(string) {
  15201. return string.match(reUnicodeWord) || [];
  15202. }
  15203. /*--------------------------------------------------------------------------*/
  15204. /**
  15205. * Create a new pristine `lodash` function using the `context` object.
  15206. *
  15207. * @static
  15208. * @memberOf _
  15209. * @since 1.1.0
  15210. * @category Util
  15211. * @param {Object} [context=root] The context object.
  15212. * @returns {Function} Returns a new `lodash` function.
  15213. * @example
  15214. *
  15215. * _.mixin({ 'foo': _.constant('foo') });
  15216. *
  15217. * var lodash = _.runInContext();
  15218. * lodash.mixin({ 'bar': lodash.constant('bar') });
  15219. *
  15220. * _.isFunction(_.foo);
  15221. * // => true
  15222. * _.isFunction(_.bar);
  15223. * // => false
  15224. *
  15225. * lodash.isFunction(lodash.foo);
  15226. * // => false
  15227. * lodash.isFunction(lodash.bar);
  15228. * // => true
  15229. *
  15230. * // Create a suped-up `defer` in Node.js.
  15231. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  15232. */
  15233. var runInContext = (function runInContext(context) {
  15234. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  15235. /** Built-in constructor references. */
  15236. var Array = context.Array,
  15237. Date = context.Date,
  15238. Error = context.Error,
  15239. Function = context.Function,
  15240. Math = context.Math,
  15241. Object = context.Object,
  15242. RegExp = context.RegExp,
  15243. String = context.String,
  15244. TypeError = context.TypeError;
  15245. /** Used for built-in method references. */
  15246. var arrayProto = Array.prototype,
  15247. funcProto = Function.prototype,
  15248. objectProto = Object.prototype;
  15249. /** Used to detect overreaching core-js shims. */
  15250. var coreJsData = context['__core-js_shared__'];
  15251. /** Used to resolve the decompiled source of functions. */
  15252. var funcToString = funcProto.toString;
  15253. /** Used to check objects for own properties. */
  15254. var hasOwnProperty = objectProto.hasOwnProperty;
  15255. /** Used to generate unique IDs. */
  15256. var idCounter = 0;
  15257. /** Used to detect methods masquerading as native. */
  15258. var maskSrcKey = (function() {
  15259. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  15260. return uid ? ('Symbol(src)_1.' + uid) : '';
  15261. }());
  15262. /**
  15263. * Used to resolve the
  15264. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  15265. * of values.
  15266. */
  15267. var nativeObjectToString = objectProto.toString;
  15268. /** Used to infer the `Object` constructor. */
  15269. var objectCtorString = funcToString.call(Object);
  15270. /** Used to restore the original `_` reference in `_.noConflict`. */
  15271. var oldDash = root._;
  15272. /** Used to detect if a method is native. */
  15273. var reIsNative = RegExp('^' +
  15274. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  15275. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  15276. );
  15277. /** Built-in value references. */
  15278. var Buffer = moduleExports ? context.Buffer : undefined,
  15279. Symbol = context.Symbol,
  15280. Uint8Array = context.Uint8Array,
  15281. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  15282. getPrototype = overArg(Object.getPrototypeOf, Object),
  15283. objectCreate = Object.create,
  15284. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  15285. splice = arrayProto.splice,
  15286. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  15287. symIterator = Symbol ? Symbol.iterator : undefined,
  15288. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  15289. var defineProperty = (function() {
  15290. try {
  15291. var func = getNative(Object, 'defineProperty');
  15292. func({}, '', {});
  15293. return func;
  15294. } catch (e) {}
  15295. }());
  15296. /** Mocked built-ins. */
  15297. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  15298. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  15299. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  15300. /* Built-in method references for those with the same name as other `lodash` methods. */
  15301. var nativeCeil = Math.ceil,
  15302. nativeFloor = Math.floor,
  15303. nativeGetSymbols = Object.getOwnPropertySymbols,
  15304. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  15305. nativeIsFinite = context.isFinite,
  15306. nativeJoin = arrayProto.join,
  15307. nativeKeys = overArg(Object.keys, Object),
  15308. nativeMax = Math.max,
  15309. nativeMin = Math.min,
  15310. nativeNow = Date.now,
  15311. nativeParseInt = context.parseInt,
  15312. nativeRandom = Math.random,
  15313. nativeReverse = arrayProto.reverse;
  15314. /* Built-in method references that are verified to be native. */
  15315. var DataView = getNative(context, 'DataView'),
  15316. Map = getNative(context, 'Map'),
  15317. Promise = getNative(context, 'Promise'),
  15318. Set = getNative(context, 'Set'),
  15319. WeakMap = getNative(context, 'WeakMap'),
  15320. nativeCreate = getNative(Object, 'create');
  15321. /** Used to store function metadata. */
  15322. var metaMap = WeakMap && new WeakMap;
  15323. /** Used to lookup unminified function names. */
  15324. var realNames = {};
  15325. /** Used to detect maps, sets, and weakmaps. */
  15326. var dataViewCtorString = toSource(DataView),
  15327. mapCtorString = toSource(Map),
  15328. promiseCtorString = toSource(Promise),
  15329. setCtorString = toSource(Set),
  15330. weakMapCtorString = toSource(WeakMap);
  15331. /** Used to convert symbols to primitives and strings. */
  15332. var symbolProto = Symbol ? Symbol.prototype : undefined,
  15333. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  15334. symbolToString = symbolProto ? symbolProto.toString : undefined;
  15335. /*------------------------------------------------------------------------*/
  15336. /**
  15337. * Creates a `lodash` object which wraps `value` to enable implicit method
  15338. * chain sequences. Methods that operate on and return arrays, collections,
  15339. * and functions can be chained together. Methods that retrieve a single value
  15340. * or may return a primitive value will automatically end the chain sequence
  15341. * and return the unwrapped value. Otherwise, the value must be unwrapped
  15342. * with `_#value`.
  15343. *
  15344. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  15345. * enabled using `_.chain`.
  15346. *
  15347. * The execution of chained methods is lazy, that is, it's deferred until
  15348. * `_#value` is implicitly or explicitly called.
  15349. *
  15350. * Lazy evaluation allows several methods to support shortcut fusion.
  15351. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  15352. * the creation of intermediate arrays and can greatly reduce the number of
  15353. * iteratee executions. Sections of a chain sequence qualify for shortcut
  15354. * fusion if the section is applied to an array and iteratees accept only
  15355. * one argument. The heuristic for whether a section qualifies for shortcut
  15356. * fusion is subject to change.
  15357. *
  15358. * Chaining is supported in custom builds as long as the `_#value` method is
  15359. * directly or indirectly included in the build.
  15360. *
  15361. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  15362. *
  15363. * The wrapper `Array` methods are:
  15364. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  15365. *
  15366. * The wrapper `String` methods are:
  15367. * `replace` and `split`
  15368. *
  15369. * The wrapper methods that support shortcut fusion are:
  15370. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  15371. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  15372. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  15373. *
  15374. * The chainable wrapper methods are:
  15375. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  15376. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  15377. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  15378. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  15379. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  15380. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  15381. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  15382. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  15383. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  15384. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  15385. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  15386. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  15387. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  15388. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  15389. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  15390. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  15391. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  15392. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  15393. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  15394. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  15395. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  15396. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  15397. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  15398. * `zipObject`, `zipObjectDeep`, and `zipWith`
  15399. *
  15400. * The wrapper methods that are **not** chainable by default are:
  15401. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  15402. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  15403. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  15404. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  15405. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  15406. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  15407. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  15408. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  15409. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  15410. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  15411. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  15412. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  15413. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  15414. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  15415. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  15416. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  15417. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  15418. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  15419. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  15420. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  15421. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  15422. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  15423. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  15424. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  15425. * `upperFirst`, `value`, and `words`
  15426. *
  15427. * @name _
  15428. * @constructor
  15429. * @category Seq
  15430. * @param {*} value The value to wrap in a `lodash` instance.
  15431. * @returns {Object} Returns the new `lodash` wrapper instance.
  15432. * @example
  15433. *
  15434. * function square(n) {
  15435. * return n * n;
  15436. * }
  15437. *
  15438. * var wrapped = _([1, 2, 3]);
  15439. *
  15440. * // Returns an unwrapped value.
  15441. * wrapped.reduce(_.add);
  15442. * // => 6
  15443. *
  15444. * // Returns a wrapped value.
  15445. * var squares = wrapped.map(square);
  15446. *
  15447. * _.isArray(squares);
  15448. * // => false
  15449. *
  15450. * _.isArray(squares.value());
  15451. * // => true
  15452. */
  15453. function lodash(value) {
  15454. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  15455. if (value instanceof LodashWrapper) {
  15456. return value;
  15457. }
  15458. if (hasOwnProperty.call(value, '__wrapped__')) {
  15459. return wrapperClone(value);
  15460. }
  15461. }
  15462. return new LodashWrapper(value);
  15463. }
  15464. /**
  15465. * The base implementation of `_.create` without support for assigning
  15466. * properties to the created object.
  15467. *
  15468. * @private
  15469. * @param {Object} proto The object to inherit from.
  15470. * @returns {Object} Returns the new object.
  15471. */
  15472. var baseCreate = (function() {
  15473. function object() {}
  15474. return function(proto) {
  15475. if (!isObject(proto)) {
  15476. return {};
  15477. }
  15478. if (objectCreate) {
  15479. return objectCreate(proto);
  15480. }
  15481. object.prototype = proto;
  15482. var result = new object;
  15483. object.prototype = undefined;
  15484. return result;
  15485. };
  15486. }());
  15487. /**
  15488. * The function whose prototype chain sequence wrappers inherit from.
  15489. *
  15490. * @private
  15491. */
  15492. function baseLodash() {
  15493. // No operation performed.
  15494. }
  15495. /**
  15496. * The base constructor for creating `lodash` wrapper objects.
  15497. *
  15498. * @private
  15499. * @param {*} value The value to wrap.
  15500. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  15501. */
  15502. function LodashWrapper(value, chainAll) {
  15503. this.__wrapped__ = value;
  15504. this.__actions__ = [];
  15505. this.__chain__ = !!chainAll;
  15506. this.__index__ = 0;
  15507. this.__values__ = undefined;
  15508. }
  15509. /**
  15510. * By default, the template delimiters used by lodash are like those in
  15511. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  15512. * following template settings to use alternative delimiters.
  15513. *
  15514. * @static
  15515. * @memberOf _
  15516. * @type {Object}
  15517. */
  15518. lodash.templateSettings = {
  15519. /**
  15520. * Used to detect `data` property values to be HTML-escaped.
  15521. *
  15522. * @memberOf _.templateSettings
  15523. * @type {RegExp}
  15524. */
  15525. 'escape': reEscape,
  15526. /**
  15527. * Used to detect code to be evaluated.
  15528. *
  15529. * @memberOf _.templateSettings
  15530. * @type {RegExp}
  15531. */
  15532. 'evaluate': reEvaluate,
  15533. /**
  15534. * Used to detect `data` property values to inject.
  15535. *
  15536. * @memberOf _.templateSettings
  15537. * @type {RegExp}
  15538. */
  15539. 'interpolate': reInterpolate,
  15540. /**
  15541. * Used to reference the data object in the template text.
  15542. *
  15543. * @memberOf _.templateSettings
  15544. * @type {string}
  15545. */
  15546. 'variable': '',
  15547. /**
  15548. * Used to import variables into the compiled template.
  15549. *
  15550. * @memberOf _.templateSettings
  15551. * @type {Object}
  15552. */
  15553. 'imports': {
  15554. /**
  15555. * A reference to the `lodash` function.
  15556. *
  15557. * @memberOf _.templateSettings.imports
  15558. * @type {Function}
  15559. */
  15560. '_': lodash
  15561. }
  15562. };
  15563. // Ensure wrappers are instances of `baseLodash`.
  15564. lodash.prototype = baseLodash.prototype;
  15565. lodash.prototype.constructor = lodash;
  15566. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  15567. LodashWrapper.prototype.constructor = LodashWrapper;
  15568. /*------------------------------------------------------------------------*/
  15569. /**
  15570. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  15571. *
  15572. * @private
  15573. * @constructor
  15574. * @param {*} value The value to wrap.
  15575. */
  15576. function LazyWrapper(value) {
  15577. this.__wrapped__ = value;
  15578. this.__actions__ = [];
  15579. this.__dir__ = 1;
  15580. this.__filtered__ = false;
  15581. this.__iteratees__ = [];
  15582. this.__takeCount__ = MAX_ARRAY_LENGTH;
  15583. this.__views__ = [];
  15584. }
  15585. /**
  15586. * Creates a clone of the lazy wrapper object.
  15587. *
  15588. * @private
  15589. * @name clone
  15590. * @memberOf LazyWrapper
  15591. * @returns {Object} Returns the cloned `LazyWrapper` object.
  15592. */
  15593. function lazyClone() {
  15594. var result = new LazyWrapper(this.__wrapped__);
  15595. result.__actions__ = copyArray(this.__actions__);
  15596. result.__dir__ = this.__dir__;
  15597. result.__filtered__ = this.__filtered__;
  15598. result.__iteratees__ = copyArray(this.__iteratees__);
  15599. result.__takeCount__ = this.__takeCount__;
  15600. result.__views__ = copyArray(this.__views__);
  15601. return result;
  15602. }
  15603. /**
  15604. * Reverses the direction of lazy iteration.
  15605. *
  15606. * @private
  15607. * @name reverse
  15608. * @memberOf LazyWrapper
  15609. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  15610. */
  15611. function lazyReverse() {
  15612. if (this.__filtered__) {
  15613. var result = new LazyWrapper(this);
  15614. result.__dir__ = -1;
  15615. result.__filtered__ = true;
  15616. } else {
  15617. result = this.clone();
  15618. result.__dir__ *= -1;
  15619. }
  15620. return result;
  15621. }
  15622. /**
  15623. * Extracts the unwrapped value from its lazy wrapper.
  15624. *
  15625. * @private
  15626. * @name value
  15627. * @memberOf LazyWrapper
  15628. * @returns {*} Returns the unwrapped value.
  15629. */
  15630. function lazyValue() {
  15631. var array = this.__wrapped__.value(),
  15632. dir = this.__dir__,
  15633. isArr = isArray(array),
  15634. isRight = dir < 0,
  15635. arrLength = isArr ? array.length : 0,
  15636. view = getView(0, arrLength, this.__views__),
  15637. start = view.start,
  15638. end = view.end,
  15639. length = end - start,
  15640. index = isRight ? end : (start - 1),
  15641. iteratees = this.__iteratees__,
  15642. iterLength = iteratees.length,
  15643. resIndex = 0,
  15644. takeCount = nativeMin(length, this.__takeCount__);
  15645. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  15646. return baseWrapperValue(array, this.__actions__);
  15647. }
  15648. var result = [];
  15649. outer:
  15650. while (length-- && resIndex < takeCount) {
  15651. index += dir;
  15652. var iterIndex = -1,
  15653. value = array[index];
  15654. while (++iterIndex < iterLength) {
  15655. var data = iteratees[iterIndex],
  15656. iteratee = data.iteratee,
  15657. type = data.type,
  15658. computed = iteratee(value);
  15659. if (type == LAZY_MAP_FLAG) {
  15660. value = computed;
  15661. } else if (!computed) {
  15662. if (type == LAZY_FILTER_FLAG) {
  15663. continue outer;
  15664. } else {
  15665. break outer;
  15666. }
  15667. }
  15668. }
  15669. result[resIndex++] = value;
  15670. }
  15671. return result;
  15672. }
  15673. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  15674. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  15675. LazyWrapper.prototype.constructor = LazyWrapper;
  15676. /*------------------------------------------------------------------------*/
  15677. /**
  15678. * Creates a hash object.
  15679. *
  15680. * @private
  15681. * @constructor
  15682. * @param {Array} [entries] The key-value pairs to cache.
  15683. */
  15684. function Hash(entries) {
  15685. var index = -1,
  15686. length = entries == null ? 0 : entries.length;
  15687. this.clear();
  15688. while (++index < length) {
  15689. var entry = entries[index];
  15690. this.set(entry[0], entry[1]);
  15691. }
  15692. }
  15693. /**
  15694. * Removes all key-value entries from the hash.
  15695. *
  15696. * @private
  15697. * @name clear
  15698. * @memberOf Hash
  15699. */
  15700. function hashClear() {
  15701. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  15702. this.size = 0;
  15703. }
  15704. /**
  15705. * Removes `key` and its value from the hash.
  15706. *
  15707. * @private
  15708. * @name delete
  15709. * @memberOf Hash
  15710. * @param {Object} hash The hash to modify.
  15711. * @param {string} key The key of the value to remove.
  15712. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15713. */
  15714. function hashDelete(key) {
  15715. var result = this.has(key) && delete this.__data__[key];
  15716. this.size -= result ? 1 : 0;
  15717. return result;
  15718. }
  15719. /**
  15720. * Gets the hash value for `key`.
  15721. *
  15722. * @private
  15723. * @name get
  15724. * @memberOf Hash
  15725. * @param {string} key The key of the value to get.
  15726. * @returns {*} Returns the entry value.
  15727. */
  15728. function hashGet(key) {
  15729. var data = this.__data__;
  15730. if (nativeCreate) {
  15731. var result = data[key];
  15732. return result === HASH_UNDEFINED ? undefined : result;
  15733. }
  15734. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  15735. }
  15736. /**
  15737. * Checks if a hash value for `key` exists.
  15738. *
  15739. * @private
  15740. * @name has
  15741. * @memberOf Hash
  15742. * @param {string} key The key of the entry to check.
  15743. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15744. */
  15745. function hashHas(key) {
  15746. var data = this.__data__;
  15747. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  15748. }
  15749. /**
  15750. * Sets the hash `key` to `value`.
  15751. *
  15752. * @private
  15753. * @name set
  15754. * @memberOf Hash
  15755. * @param {string} key The key of the value to set.
  15756. * @param {*} value The value to set.
  15757. * @returns {Object} Returns the hash instance.
  15758. */
  15759. function hashSet(key, value) {
  15760. var data = this.__data__;
  15761. this.size += this.has(key) ? 0 : 1;
  15762. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  15763. return this;
  15764. }
  15765. // Add methods to `Hash`.
  15766. Hash.prototype.clear = hashClear;
  15767. Hash.prototype['delete'] = hashDelete;
  15768. Hash.prototype.get = hashGet;
  15769. Hash.prototype.has = hashHas;
  15770. Hash.prototype.set = hashSet;
  15771. /*------------------------------------------------------------------------*/
  15772. /**
  15773. * Creates an list cache object.
  15774. *
  15775. * @private
  15776. * @constructor
  15777. * @param {Array} [entries] The key-value pairs to cache.
  15778. */
  15779. function ListCache(entries) {
  15780. var index = -1,
  15781. length = entries == null ? 0 : entries.length;
  15782. this.clear();
  15783. while (++index < length) {
  15784. var entry = entries[index];
  15785. this.set(entry[0], entry[1]);
  15786. }
  15787. }
  15788. /**
  15789. * Removes all key-value entries from the list cache.
  15790. *
  15791. * @private
  15792. * @name clear
  15793. * @memberOf ListCache
  15794. */
  15795. function listCacheClear() {
  15796. this.__data__ = [];
  15797. this.size = 0;
  15798. }
  15799. /**
  15800. * Removes `key` and its value from the list cache.
  15801. *
  15802. * @private
  15803. * @name delete
  15804. * @memberOf ListCache
  15805. * @param {string} key The key of the value to remove.
  15806. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15807. */
  15808. function listCacheDelete(key) {
  15809. var data = this.__data__,
  15810. index = assocIndexOf(data, key);
  15811. if (index < 0) {
  15812. return false;
  15813. }
  15814. var lastIndex = data.length - 1;
  15815. if (index == lastIndex) {
  15816. data.pop();
  15817. } else {
  15818. splice.call(data, index, 1);
  15819. }
  15820. --this.size;
  15821. return true;
  15822. }
  15823. /**
  15824. * Gets the list cache value for `key`.
  15825. *
  15826. * @private
  15827. * @name get
  15828. * @memberOf ListCache
  15829. * @param {string} key The key of the value to get.
  15830. * @returns {*} Returns the entry value.
  15831. */
  15832. function listCacheGet(key) {
  15833. var data = this.__data__,
  15834. index = assocIndexOf(data, key);
  15835. return index < 0 ? undefined : data[index][1];
  15836. }
  15837. /**
  15838. * Checks if a list cache value for `key` exists.
  15839. *
  15840. * @private
  15841. * @name has
  15842. * @memberOf ListCache
  15843. * @param {string} key The key of the entry to check.
  15844. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15845. */
  15846. function listCacheHas(key) {
  15847. return assocIndexOf(this.__data__, key) > -1;
  15848. }
  15849. /**
  15850. * Sets the list cache `key` to `value`.
  15851. *
  15852. * @private
  15853. * @name set
  15854. * @memberOf ListCache
  15855. * @param {string} key The key of the value to set.
  15856. * @param {*} value The value to set.
  15857. * @returns {Object} Returns the list cache instance.
  15858. */
  15859. function listCacheSet(key, value) {
  15860. var data = this.__data__,
  15861. index = assocIndexOf(data, key);
  15862. if (index < 0) {
  15863. ++this.size;
  15864. data.push([key, value]);
  15865. } else {
  15866. data[index][1] = value;
  15867. }
  15868. return this;
  15869. }
  15870. // Add methods to `ListCache`.
  15871. ListCache.prototype.clear = listCacheClear;
  15872. ListCache.prototype['delete'] = listCacheDelete;
  15873. ListCache.prototype.get = listCacheGet;
  15874. ListCache.prototype.has = listCacheHas;
  15875. ListCache.prototype.set = listCacheSet;
  15876. /*------------------------------------------------------------------------*/
  15877. /**
  15878. * Creates a map cache object to store key-value pairs.
  15879. *
  15880. * @private
  15881. * @constructor
  15882. * @param {Array} [entries] The key-value pairs to cache.
  15883. */
  15884. function MapCache(entries) {
  15885. var index = -1,
  15886. length = entries == null ? 0 : entries.length;
  15887. this.clear();
  15888. while (++index < length) {
  15889. var entry = entries[index];
  15890. this.set(entry[0], entry[1]);
  15891. }
  15892. }
  15893. /**
  15894. * Removes all key-value entries from the map.
  15895. *
  15896. * @private
  15897. * @name clear
  15898. * @memberOf MapCache
  15899. */
  15900. function mapCacheClear() {
  15901. this.size = 0;
  15902. this.__data__ = {
  15903. 'hash': new Hash,
  15904. 'map': new (Map || ListCache),
  15905. 'string': new Hash
  15906. };
  15907. }
  15908. /**
  15909. * Removes `key` and its value from the map.
  15910. *
  15911. * @private
  15912. * @name delete
  15913. * @memberOf MapCache
  15914. * @param {string} key The key of the value to remove.
  15915. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15916. */
  15917. function mapCacheDelete(key) {
  15918. var result = getMapData(this, key)['delete'](key);
  15919. this.size -= result ? 1 : 0;
  15920. return result;
  15921. }
  15922. /**
  15923. * Gets the map value for `key`.
  15924. *
  15925. * @private
  15926. * @name get
  15927. * @memberOf MapCache
  15928. * @param {string} key The key of the value to get.
  15929. * @returns {*} Returns the entry value.
  15930. */
  15931. function mapCacheGet(key) {
  15932. return getMapData(this, key).get(key);
  15933. }
  15934. /**
  15935. * Checks if a map value for `key` exists.
  15936. *
  15937. * @private
  15938. * @name has
  15939. * @memberOf MapCache
  15940. * @param {string} key The key of the entry to check.
  15941. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15942. */
  15943. function mapCacheHas(key) {
  15944. return getMapData(this, key).has(key);
  15945. }
  15946. /**
  15947. * Sets the map `key` to `value`.
  15948. *
  15949. * @private
  15950. * @name set
  15951. * @memberOf MapCache
  15952. * @param {string} key The key of the value to set.
  15953. * @param {*} value The value to set.
  15954. * @returns {Object} Returns the map cache instance.
  15955. */
  15956. function mapCacheSet(key, value) {
  15957. var data = getMapData(this, key),
  15958. size = data.size;
  15959. data.set(key, value);
  15960. this.size += data.size == size ? 0 : 1;
  15961. return this;
  15962. }
  15963. // Add methods to `MapCache`.
  15964. MapCache.prototype.clear = mapCacheClear;
  15965. MapCache.prototype['delete'] = mapCacheDelete;
  15966. MapCache.prototype.get = mapCacheGet;
  15967. MapCache.prototype.has = mapCacheHas;
  15968. MapCache.prototype.set = mapCacheSet;
  15969. /*------------------------------------------------------------------------*/
  15970. /**
  15971. *
  15972. * Creates an array cache object to store unique values.
  15973. *
  15974. * @private
  15975. * @constructor
  15976. * @param {Array} [values] The values to cache.
  15977. */
  15978. function SetCache(values) {
  15979. var index = -1,
  15980. length = values == null ? 0 : values.length;
  15981. this.__data__ = new MapCache;
  15982. while (++index < length) {
  15983. this.add(values[index]);
  15984. }
  15985. }
  15986. /**
  15987. * Adds `value` to the array cache.
  15988. *
  15989. * @private
  15990. * @name add
  15991. * @memberOf SetCache
  15992. * @alias push
  15993. * @param {*} value The value to cache.
  15994. * @returns {Object} Returns the cache instance.
  15995. */
  15996. function setCacheAdd(value) {
  15997. this.__data__.set(value, HASH_UNDEFINED);
  15998. return this;
  15999. }
  16000. /**
  16001. * Checks if `value` is in the array cache.
  16002. *
  16003. * @private
  16004. * @name has
  16005. * @memberOf SetCache
  16006. * @param {*} value The value to search for.
  16007. * @returns {number} Returns `true` if `value` is found, else `false`.
  16008. */
  16009. function setCacheHas(value) {
  16010. return this.__data__.has(value);
  16011. }
  16012. // Add methods to `SetCache`.
  16013. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  16014. SetCache.prototype.has = setCacheHas;
  16015. /*------------------------------------------------------------------------*/
  16016. /**
  16017. * Creates a stack cache object to store key-value pairs.
  16018. *
  16019. * @private
  16020. * @constructor
  16021. * @param {Array} [entries] The key-value pairs to cache.
  16022. */
  16023. function Stack(entries) {
  16024. var data = this.__data__ = new ListCache(entries);
  16025. this.size = data.size;
  16026. }
  16027. /**
  16028. * Removes all key-value entries from the stack.
  16029. *
  16030. * @private
  16031. * @name clear
  16032. * @memberOf Stack
  16033. */
  16034. function stackClear() {
  16035. this.__data__ = new ListCache;
  16036. this.size = 0;
  16037. }
  16038. /**
  16039. * Removes `key` and its value from the stack.
  16040. *
  16041. * @private
  16042. * @name delete
  16043. * @memberOf Stack
  16044. * @param {string} key The key of the value to remove.
  16045. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  16046. */
  16047. function stackDelete(key) {
  16048. var data = this.__data__,
  16049. result = data['delete'](key);
  16050. this.size = data.size;
  16051. return result;
  16052. }
  16053. /**
  16054. * Gets the stack value for `key`.
  16055. *
  16056. * @private
  16057. * @name get
  16058. * @memberOf Stack
  16059. * @param {string} key The key of the value to get.
  16060. * @returns {*} Returns the entry value.
  16061. */
  16062. function stackGet(key) {
  16063. return this.__data__.get(key);
  16064. }
  16065. /**
  16066. * Checks if a stack value for `key` exists.
  16067. *
  16068. * @private
  16069. * @name has
  16070. * @memberOf Stack
  16071. * @param {string} key The key of the entry to check.
  16072. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  16073. */
  16074. function stackHas(key) {
  16075. return this.__data__.has(key);
  16076. }
  16077. /**
  16078. * Sets the stack `key` to `value`.
  16079. *
  16080. * @private
  16081. * @name set
  16082. * @memberOf Stack
  16083. * @param {string} key The key of the value to set.
  16084. * @param {*} value The value to set.
  16085. * @returns {Object} Returns the stack cache instance.
  16086. */
  16087. function stackSet(key, value) {
  16088. var data = this.__data__;
  16089. if (data instanceof ListCache) {
  16090. var pairs = data.__data__;
  16091. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  16092. pairs.push([key, value]);
  16093. this.size = ++data.size;
  16094. return this;
  16095. }
  16096. data = this.__data__ = new MapCache(pairs);
  16097. }
  16098. data.set(key, value);
  16099. this.size = data.size;
  16100. return this;
  16101. }
  16102. // Add methods to `Stack`.
  16103. Stack.prototype.clear = stackClear;
  16104. Stack.prototype['delete'] = stackDelete;
  16105. Stack.prototype.get = stackGet;
  16106. Stack.prototype.has = stackHas;
  16107. Stack.prototype.set = stackSet;
  16108. /*------------------------------------------------------------------------*/
  16109. /**
  16110. * Creates an array of the enumerable property names of the array-like `value`.
  16111. *
  16112. * @private
  16113. * @param {*} value The value to query.
  16114. * @param {boolean} inherited Specify returning inherited property names.
  16115. * @returns {Array} Returns the array of property names.
  16116. */
  16117. function arrayLikeKeys(value, inherited) {
  16118. var isArr = isArray(value),
  16119. isArg = !isArr && isArguments(value),
  16120. isBuff = !isArr && !isArg && isBuffer(value),
  16121. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  16122. skipIndexes = isArr || isArg || isBuff || isType,
  16123. result = skipIndexes ? baseTimes(value.length, String) : [],
  16124. length = result.length;
  16125. for (var key in value) {
  16126. if ((inherited || hasOwnProperty.call(value, key)) &&
  16127. !(skipIndexes && (
  16128. // Safari 9 has enumerable `arguments.length` in strict mode.
  16129. key == 'length' ||
  16130. // Node.js 0.10 has enumerable non-index properties on buffers.
  16131. (isBuff && (key == 'offset' || key == 'parent')) ||
  16132. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  16133. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  16134. // Skip index properties.
  16135. isIndex(key, length)
  16136. ))) {
  16137. result.push(key);
  16138. }
  16139. }
  16140. return result;
  16141. }
  16142. /**
  16143. * A specialized version of `_.sample` for arrays.
  16144. *
  16145. * @private
  16146. * @param {Array} array The array to sample.
  16147. * @returns {*} Returns the random element.
  16148. */
  16149. function arraySample(array) {
  16150. var length = array.length;
  16151. return length ? array[baseRandom(0, length - 1)] : undefined;
  16152. }
  16153. /**
  16154. * A specialized version of `_.sampleSize` for arrays.
  16155. *
  16156. * @private
  16157. * @param {Array} array The array to sample.
  16158. * @param {number} n The number of elements to sample.
  16159. * @returns {Array} Returns the random elements.
  16160. */
  16161. function arraySampleSize(array, n) {
  16162. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  16163. }
  16164. /**
  16165. * A specialized version of `_.shuffle` for arrays.
  16166. *
  16167. * @private
  16168. * @param {Array} array The array to shuffle.
  16169. * @returns {Array} Returns the new shuffled array.
  16170. */
  16171. function arrayShuffle(array) {
  16172. return shuffleSelf(copyArray(array));
  16173. }
  16174. /**
  16175. * This function is like `assignValue` except that it doesn't assign
  16176. * `undefined` values.
  16177. *
  16178. * @private
  16179. * @param {Object} object The object to modify.
  16180. * @param {string} key The key of the property to assign.
  16181. * @param {*} value The value to assign.
  16182. */
  16183. function assignMergeValue(object, key, value) {
  16184. if ((value !== undefined && !eq(object[key], value)) ||
  16185. (value === undefined && !(key in object))) {
  16186. baseAssignValue(object, key, value);
  16187. }
  16188. }
  16189. /**
  16190. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  16191. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16192. * for equality comparisons.
  16193. *
  16194. * @private
  16195. * @param {Object} object The object to modify.
  16196. * @param {string} key The key of the property to assign.
  16197. * @param {*} value The value to assign.
  16198. */
  16199. function assignValue(object, key, value) {
  16200. var objValue = object[key];
  16201. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  16202. (value === undefined && !(key in object))) {
  16203. baseAssignValue(object, key, value);
  16204. }
  16205. }
  16206. /**
  16207. * Gets the index at which the `key` is found in `array` of key-value pairs.
  16208. *
  16209. * @private
  16210. * @param {Array} array The array to inspect.
  16211. * @param {*} key The key to search for.
  16212. * @returns {number} Returns the index of the matched value, else `-1`.
  16213. */
  16214. function assocIndexOf(array, key) {
  16215. var length = array.length;
  16216. while (length--) {
  16217. if (eq(array[length][0], key)) {
  16218. return length;
  16219. }
  16220. }
  16221. return -1;
  16222. }
  16223. /**
  16224. * Aggregates elements of `collection` on `accumulator` with keys transformed
  16225. * by `iteratee` and values set by `setter`.
  16226. *
  16227. * @private
  16228. * @param {Array|Object} collection The collection to iterate over.
  16229. * @param {Function} setter The function to set `accumulator` values.
  16230. * @param {Function} iteratee The iteratee to transform keys.
  16231. * @param {Object} accumulator The initial aggregated object.
  16232. * @returns {Function} Returns `accumulator`.
  16233. */
  16234. function baseAggregator(collection, setter, iteratee, accumulator) {
  16235. baseEach(collection, function(value, key, collection) {
  16236. setter(accumulator, value, iteratee(value), collection);
  16237. });
  16238. return accumulator;
  16239. }
  16240. /**
  16241. * The base implementation of `_.assign` without support for multiple sources
  16242. * or `customizer` functions.
  16243. *
  16244. * @private
  16245. * @param {Object} object The destination object.
  16246. * @param {Object} source The source object.
  16247. * @returns {Object} Returns `object`.
  16248. */
  16249. function baseAssign(object, source) {
  16250. return object && copyObject(source, keys(source), object);
  16251. }
  16252. /**
  16253. * The base implementation of `_.assignIn` without support for multiple sources
  16254. * or `customizer` functions.
  16255. *
  16256. * @private
  16257. * @param {Object} object The destination object.
  16258. * @param {Object} source The source object.
  16259. * @returns {Object} Returns `object`.
  16260. */
  16261. function baseAssignIn(object, source) {
  16262. return object && copyObject(source, keysIn(source), object);
  16263. }
  16264. /**
  16265. * The base implementation of `assignValue` and `assignMergeValue` without
  16266. * value checks.
  16267. *
  16268. * @private
  16269. * @param {Object} object The object to modify.
  16270. * @param {string} key The key of the property to assign.
  16271. * @param {*} value The value to assign.
  16272. */
  16273. function baseAssignValue(object, key, value) {
  16274. if (key == '__proto__' && defineProperty) {
  16275. defineProperty(object, key, {
  16276. 'configurable': true,
  16277. 'enumerable': true,
  16278. 'value': value,
  16279. 'writable': true
  16280. });
  16281. } else {
  16282. object[key] = value;
  16283. }
  16284. }
  16285. /**
  16286. * The base implementation of `_.at` without support for individual paths.
  16287. *
  16288. * @private
  16289. * @param {Object} object The object to iterate over.
  16290. * @param {string[]} paths The property paths to pick.
  16291. * @returns {Array} Returns the picked elements.
  16292. */
  16293. function baseAt(object, paths) {
  16294. var index = -1,
  16295. length = paths.length,
  16296. result = Array(length),
  16297. skip = object == null;
  16298. while (++index < length) {
  16299. result[index] = skip ? undefined : get(object, paths[index]);
  16300. }
  16301. return result;
  16302. }
  16303. /**
  16304. * The base implementation of `_.clamp` which doesn't coerce arguments.
  16305. *
  16306. * @private
  16307. * @param {number} number The number to clamp.
  16308. * @param {number} [lower] The lower bound.
  16309. * @param {number} upper The upper bound.
  16310. * @returns {number} Returns the clamped number.
  16311. */
  16312. function baseClamp(number, lower, upper) {
  16313. if (number === number) {
  16314. if (upper !== undefined) {
  16315. number = number <= upper ? number : upper;
  16316. }
  16317. if (lower !== undefined) {
  16318. number = number >= lower ? number : lower;
  16319. }
  16320. }
  16321. return number;
  16322. }
  16323. /**
  16324. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  16325. * traversed objects.
  16326. *
  16327. * @private
  16328. * @param {*} value The value to clone.
  16329. * @param {boolean} bitmask The bitmask flags.
  16330. * 1 - Deep clone
  16331. * 2 - Flatten inherited properties
  16332. * 4 - Clone symbols
  16333. * @param {Function} [customizer] The function to customize cloning.
  16334. * @param {string} [key] The key of `value`.
  16335. * @param {Object} [object] The parent object of `value`.
  16336. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  16337. * @returns {*} Returns the cloned value.
  16338. */
  16339. function baseClone(value, bitmask, customizer, key, object, stack) {
  16340. var result,
  16341. isDeep = bitmask & CLONE_DEEP_FLAG,
  16342. isFlat = bitmask & CLONE_FLAT_FLAG,
  16343. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  16344. if (customizer) {
  16345. result = object ? customizer(value, key, object, stack) : customizer(value);
  16346. }
  16347. if (result !== undefined) {
  16348. return result;
  16349. }
  16350. if (!isObject(value)) {
  16351. return value;
  16352. }
  16353. var isArr = isArray(value);
  16354. if (isArr) {
  16355. result = initCloneArray(value);
  16356. if (!isDeep) {
  16357. return copyArray(value, result);
  16358. }
  16359. } else {
  16360. var tag = getTag(value),
  16361. isFunc = tag == funcTag || tag == genTag;
  16362. if (isBuffer(value)) {
  16363. return cloneBuffer(value, isDeep);
  16364. }
  16365. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  16366. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  16367. if (!isDeep) {
  16368. return isFlat
  16369. ? copySymbolsIn(value, baseAssignIn(result, value))
  16370. : copySymbols(value, baseAssign(result, value));
  16371. }
  16372. } else {
  16373. if (!cloneableTags[tag]) {
  16374. return object ? value : {};
  16375. }
  16376. result = initCloneByTag(value, tag, isDeep);
  16377. }
  16378. }
  16379. // Check for circular references and return its corresponding clone.
  16380. stack || (stack = new Stack);
  16381. var stacked = stack.get(value);
  16382. if (stacked) {
  16383. return stacked;
  16384. }
  16385. stack.set(value, result);
  16386. if (isSet(value)) {
  16387. value.forEach(function(subValue) {
  16388. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  16389. });
  16390. } else if (isMap(value)) {
  16391. value.forEach(function(subValue, key) {
  16392. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16393. });
  16394. }
  16395. var keysFunc = isFull
  16396. ? (isFlat ? getAllKeysIn : getAllKeys)
  16397. : (isFlat ? keysIn : keys);
  16398. var props = isArr ? undefined : keysFunc(value);
  16399. arrayEach(props || value, function(subValue, key) {
  16400. if (props) {
  16401. key = subValue;
  16402. subValue = value[key];
  16403. }
  16404. // Recursively populate clone (susceptible to call stack limits).
  16405. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16406. });
  16407. return result;
  16408. }
  16409. /**
  16410. * The base implementation of `_.conforms` which doesn't clone `source`.
  16411. *
  16412. * @private
  16413. * @param {Object} source The object of property predicates to conform to.
  16414. * @returns {Function} Returns the new spec function.
  16415. */
  16416. function baseConforms(source) {
  16417. var props = keys(source);
  16418. return function(object) {
  16419. return baseConformsTo(object, source, props);
  16420. };
  16421. }
  16422. /**
  16423. * The base implementation of `_.conformsTo` which accepts `props` to check.
  16424. *
  16425. * @private
  16426. * @param {Object} object The object to inspect.
  16427. * @param {Object} source The object of property predicates to conform to.
  16428. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  16429. */
  16430. function baseConformsTo(object, source, props) {
  16431. var length = props.length;
  16432. if (object == null) {
  16433. return !length;
  16434. }
  16435. object = Object(object);
  16436. while (length--) {
  16437. var key = props[length],
  16438. predicate = source[key],
  16439. value = object[key];
  16440. if ((value === undefined && !(key in object)) || !predicate(value)) {
  16441. return false;
  16442. }
  16443. }
  16444. return true;
  16445. }
  16446. /**
  16447. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  16448. * to provide to `func`.
  16449. *
  16450. * @private
  16451. * @param {Function} func The function to delay.
  16452. * @param {number} wait The number of milliseconds to delay invocation.
  16453. * @param {Array} args The arguments to provide to `func`.
  16454. * @returns {number|Object} Returns the timer id or timeout object.
  16455. */
  16456. function baseDelay(func, wait, args) {
  16457. if (typeof func != 'function') {
  16458. throw new TypeError(FUNC_ERROR_TEXT);
  16459. }
  16460. return setTimeout(function() { func.apply(undefined, args); }, wait);
  16461. }
  16462. /**
  16463. * The base implementation of methods like `_.difference` without support
  16464. * for excluding multiple arrays or iteratee shorthands.
  16465. *
  16466. * @private
  16467. * @param {Array} array The array to inspect.
  16468. * @param {Array} values The values to exclude.
  16469. * @param {Function} [iteratee] The iteratee invoked per element.
  16470. * @param {Function} [comparator] The comparator invoked per element.
  16471. * @returns {Array} Returns the new array of filtered values.
  16472. */
  16473. function baseDifference(array, values, iteratee, comparator) {
  16474. var index = -1,
  16475. includes = arrayIncludes,
  16476. isCommon = true,
  16477. length = array.length,
  16478. result = [],
  16479. valuesLength = values.length;
  16480. if (!length) {
  16481. return result;
  16482. }
  16483. if (iteratee) {
  16484. values = arrayMap(values, baseUnary(iteratee));
  16485. }
  16486. if (comparator) {
  16487. includes = arrayIncludesWith;
  16488. isCommon = false;
  16489. }
  16490. else if (values.length >= LARGE_ARRAY_SIZE) {
  16491. includes = cacheHas;
  16492. isCommon = false;
  16493. values = new SetCache(values);
  16494. }
  16495. outer:
  16496. while (++index < length) {
  16497. var value = array[index],
  16498. computed = iteratee == null ? value : iteratee(value);
  16499. value = (comparator || value !== 0) ? value : 0;
  16500. if (isCommon && computed === computed) {
  16501. var valuesIndex = valuesLength;
  16502. while (valuesIndex--) {
  16503. if (values[valuesIndex] === computed) {
  16504. continue outer;
  16505. }
  16506. }
  16507. result.push(value);
  16508. }
  16509. else if (!includes(values, computed, comparator)) {
  16510. result.push(value);
  16511. }
  16512. }
  16513. return result;
  16514. }
  16515. /**
  16516. * The base implementation of `_.forEach` without support for iteratee shorthands.
  16517. *
  16518. * @private
  16519. * @param {Array|Object} collection The collection to iterate over.
  16520. * @param {Function} iteratee The function invoked per iteration.
  16521. * @returns {Array|Object} Returns `collection`.
  16522. */
  16523. var baseEach = createBaseEach(baseForOwn);
  16524. /**
  16525. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  16526. *
  16527. * @private
  16528. * @param {Array|Object} collection The collection to iterate over.
  16529. * @param {Function} iteratee The function invoked per iteration.
  16530. * @returns {Array|Object} Returns `collection`.
  16531. */
  16532. var baseEachRight = createBaseEach(baseForOwnRight, true);
  16533. /**
  16534. * The base implementation of `_.every` without support for iteratee shorthands.
  16535. *
  16536. * @private
  16537. * @param {Array|Object} collection The collection to iterate over.
  16538. * @param {Function} predicate The function invoked per iteration.
  16539. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  16540. * else `false`
  16541. */
  16542. function baseEvery(collection, predicate) {
  16543. var result = true;
  16544. baseEach(collection, function(value, index, collection) {
  16545. result = !!predicate(value, index, collection);
  16546. return result;
  16547. });
  16548. return result;
  16549. }
  16550. /**
  16551. * The base implementation of methods like `_.max` and `_.min` which accepts a
  16552. * `comparator` to determine the extremum value.
  16553. *
  16554. * @private
  16555. * @param {Array} array The array to iterate over.
  16556. * @param {Function} iteratee The iteratee invoked per iteration.
  16557. * @param {Function} comparator The comparator used to compare values.
  16558. * @returns {*} Returns the extremum value.
  16559. */
  16560. function baseExtremum(array, iteratee, comparator) {
  16561. var index = -1,
  16562. length = array.length;
  16563. while (++index < length) {
  16564. var value = array[index],
  16565. current = iteratee(value);
  16566. if (current != null && (computed === undefined
  16567. ? (current === current && !isSymbol(current))
  16568. : comparator(current, computed)
  16569. )) {
  16570. var computed = current,
  16571. result = value;
  16572. }
  16573. }
  16574. return result;
  16575. }
  16576. /**
  16577. * The base implementation of `_.fill` without an iteratee call guard.
  16578. *
  16579. * @private
  16580. * @param {Array} array The array to fill.
  16581. * @param {*} value The value to fill `array` with.
  16582. * @param {number} [start=0] The start position.
  16583. * @param {number} [end=array.length] The end position.
  16584. * @returns {Array} Returns `array`.
  16585. */
  16586. function baseFill(array, value, start, end) {
  16587. var length = array.length;
  16588. start = toInteger(start);
  16589. if (start < 0) {
  16590. start = -start > length ? 0 : (length + start);
  16591. }
  16592. end = (end === undefined || end > length) ? length : toInteger(end);
  16593. if (end < 0) {
  16594. end += length;
  16595. }
  16596. end = start > end ? 0 : toLength(end);
  16597. while (start < end) {
  16598. array[start++] = value;
  16599. }
  16600. return array;
  16601. }
  16602. /**
  16603. * The base implementation of `_.filter` without support for iteratee shorthands.
  16604. *
  16605. * @private
  16606. * @param {Array|Object} collection The collection to iterate over.
  16607. * @param {Function} predicate The function invoked per iteration.
  16608. * @returns {Array} Returns the new filtered array.
  16609. */
  16610. function baseFilter(collection, predicate) {
  16611. var result = [];
  16612. baseEach(collection, function(value, index, collection) {
  16613. if (predicate(value, index, collection)) {
  16614. result.push(value);
  16615. }
  16616. });
  16617. return result;
  16618. }
  16619. /**
  16620. * The base implementation of `_.flatten` with support for restricting flattening.
  16621. *
  16622. * @private
  16623. * @param {Array} array The array to flatten.
  16624. * @param {number} depth The maximum recursion depth.
  16625. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  16626. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  16627. * @param {Array} [result=[]] The initial result value.
  16628. * @returns {Array} Returns the new flattened array.
  16629. */
  16630. function baseFlatten(array, depth, predicate, isStrict, result) {
  16631. var index = -1,
  16632. length = array.length;
  16633. predicate || (predicate = isFlattenable);
  16634. result || (result = []);
  16635. while (++index < length) {
  16636. var value = array[index];
  16637. if (depth > 0 && predicate(value)) {
  16638. if (depth > 1) {
  16639. // Recursively flatten arrays (susceptible to call stack limits).
  16640. baseFlatten(value, depth - 1, predicate, isStrict, result);
  16641. } else {
  16642. arrayPush(result, value);
  16643. }
  16644. } else if (!isStrict) {
  16645. result[result.length] = value;
  16646. }
  16647. }
  16648. return result;
  16649. }
  16650. /**
  16651. * The base implementation of `baseForOwn` which iterates over `object`
  16652. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  16653. * Iteratee functions may exit iteration early by explicitly returning `false`.
  16654. *
  16655. * @private
  16656. * @param {Object} object The object to iterate over.
  16657. * @param {Function} iteratee The function invoked per iteration.
  16658. * @param {Function} keysFunc The function to get the keys of `object`.
  16659. * @returns {Object} Returns `object`.
  16660. */
  16661. var baseFor = createBaseFor();
  16662. /**
  16663. * This function is like `baseFor` except that it iterates over properties
  16664. * in the opposite order.
  16665. *
  16666. * @private
  16667. * @param {Object} object The object to iterate over.
  16668. * @param {Function} iteratee The function invoked per iteration.
  16669. * @param {Function} keysFunc The function to get the keys of `object`.
  16670. * @returns {Object} Returns `object`.
  16671. */
  16672. var baseForRight = createBaseFor(true);
  16673. /**
  16674. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  16675. *
  16676. * @private
  16677. * @param {Object} object The object to iterate over.
  16678. * @param {Function} iteratee The function invoked per iteration.
  16679. * @returns {Object} Returns `object`.
  16680. */
  16681. function baseForOwn(object, iteratee) {
  16682. return object && baseFor(object, iteratee, keys);
  16683. }
  16684. /**
  16685. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  16686. *
  16687. * @private
  16688. * @param {Object} object The object to iterate over.
  16689. * @param {Function} iteratee The function invoked per iteration.
  16690. * @returns {Object} Returns `object`.
  16691. */
  16692. function baseForOwnRight(object, iteratee) {
  16693. return object && baseForRight(object, iteratee, keys);
  16694. }
  16695. /**
  16696. * The base implementation of `_.functions` which creates an array of
  16697. * `object` function property names filtered from `props`.
  16698. *
  16699. * @private
  16700. * @param {Object} object The object to inspect.
  16701. * @param {Array} props The property names to filter.
  16702. * @returns {Array} Returns the function names.
  16703. */
  16704. function baseFunctions(object, props) {
  16705. return arrayFilter(props, function(key) {
  16706. return isFunction(object[key]);
  16707. });
  16708. }
  16709. /**
  16710. * The base implementation of `_.get` without support for default values.
  16711. *
  16712. * @private
  16713. * @param {Object} object The object to query.
  16714. * @param {Array|string} path The path of the property to get.
  16715. * @returns {*} Returns the resolved value.
  16716. */
  16717. function baseGet(object, path) {
  16718. path = castPath(path, object);
  16719. var index = 0,
  16720. length = path.length;
  16721. while (object != null && index < length) {
  16722. object = object[toKey(path[index++])];
  16723. }
  16724. return (index && index == length) ? object : undefined;
  16725. }
  16726. /**
  16727. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  16728. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  16729. * symbols of `object`.
  16730. *
  16731. * @private
  16732. * @param {Object} object The object to query.
  16733. * @param {Function} keysFunc The function to get the keys of `object`.
  16734. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  16735. * @returns {Array} Returns the array of property names and symbols.
  16736. */
  16737. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  16738. var result = keysFunc(object);
  16739. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  16740. }
  16741. /**
  16742. * The base implementation of `getTag` without fallbacks for buggy environments.
  16743. *
  16744. * @private
  16745. * @param {*} value The value to query.
  16746. * @returns {string} Returns the `toStringTag`.
  16747. */
  16748. function baseGetTag(value) {
  16749. if (value == null) {
  16750. return value === undefined ? undefinedTag : nullTag;
  16751. }
  16752. return (symToStringTag && symToStringTag in Object(value))
  16753. ? getRawTag(value)
  16754. : objectToString(value);
  16755. }
  16756. /**
  16757. * The base implementation of `_.gt` which doesn't coerce arguments.
  16758. *
  16759. * @private
  16760. * @param {*} value The value to compare.
  16761. * @param {*} other The other value to compare.
  16762. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  16763. * else `false`.
  16764. */
  16765. function baseGt(value, other) {
  16766. return value > other;
  16767. }
  16768. /**
  16769. * The base implementation of `_.has` without support for deep paths.
  16770. *
  16771. * @private
  16772. * @param {Object} [object] The object to query.
  16773. * @param {Array|string} key The key to check.
  16774. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16775. */
  16776. function baseHas(object, key) {
  16777. return object != null && hasOwnProperty.call(object, key);
  16778. }
  16779. /**
  16780. * The base implementation of `_.hasIn` without support for deep paths.
  16781. *
  16782. * @private
  16783. * @param {Object} [object] The object to query.
  16784. * @param {Array|string} key The key to check.
  16785. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16786. */
  16787. function baseHasIn(object, key) {
  16788. return object != null && key in Object(object);
  16789. }
  16790. /**
  16791. * The base implementation of `_.inRange` which doesn't coerce arguments.
  16792. *
  16793. * @private
  16794. * @param {number} number The number to check.
  16795. * @param {number} start The start of the range.
  16796. * @param {number} end The end of the range.
  16797. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  16798. */
  16799. function baseInRange(number, start, end) {
  16800. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  16801. }
  16802. /**
  16803. * The base implementation of methods like `_.intersection`, without support
  16804. * for iteratee shorthands, that accepts an array of arrays to inspect.
  16805. *
  16806. * @private
  16807. * @param {Array} arrays The arrays to inspect.
  16808. * @param {Function} [iteratee] The iteratee invoked per element.
  16809. * @param {Function} [comparator] The comparator invoked per element.
  16810. * @returns {Array} Returns the new array of shared values.
  16811. */
  16812. function baseIntersection(arrays, iteratee, comparator) {
  16813. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  16814. length = arrays[0].length,
  16815. othLength = arrays.length,
  16816. othIndex = othLength,
  16817. caches = Array(othLength),
  16818. maxLength = Infinity,
  16819. result = [];
  16820. while (othIndex--) {
  16821. var array = arrays[othIndex];
  16822. if (othIndex && iteratee) {
  16823. array = arrayMap(array, baseUnary(iteratee));
  16824. }
  16825. maxLength = nativeMin(array.length, maxLength);
  16826. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  16827. ? new SetCache(othIndex && array)
  16828. : undefined;
  16829. }
  16830. array = arrays[0];
  16831. var index = -1,
  16832. seen = caches[0];
  16833. outer:
  16834. while (++index < length && result.length < maxLength) {
  16835. var value = array[index],
  16836. computed = iteratee ? iteratee(value) : value;
  16837. value = (comparator || value !== 0) ? value : 0;
  16838. if (!(seen
  16839. ? cacheHas(seen, computed)
  16840. : includes(result, computed, comparator)
  16841. )) {
  16842. othIndex = othLength;
  16843. while (--othIndex) {
  16844. var cache = caches[othIndex];
  16845. if (!(cache
  16846. ? cacheHas(cache, computed)
  16847. : includes(arrays[othIndex], computed, comparator))
  16848. ) {
  16849. continue outer;
  16850. }
  16851. }
  16852. if (seen) {
  16853. seen.push(computed);
  16854. }
  16855. result.push(value);
  16856. }
  16857. }
  16858. return result;
  16859. }
  16860. /**
  16861. * The base implementation of `_.invert` and `_.invertBy` which inverts
  16862. * `object` with values transformed by `iteratee` and set by `setter`.
  16863. *
  16864. * @private
  16865. * @param {Object} object The object to iterate over.
  16866. * @param {Function} setter The function to set `accumulator` values.
  16867. * @param {Function} iteratee The iteratee to transform values.
  16868. * @param {Object} accumulator The initial inverted object.
  16869. * @returns {Function} Returns `accumulator`.
  16870. */
  16871. function baseInverter(object, setter, iteratee, accumulator) {
  16872. baseForOwn(object, function(value, key, object) {
  16873. setter(accumulator, iteratee(value), key, object);
  16874. });
  16875. return accumulator;
  16876. }
  16877. /**
  16878. * The base implementation of `_.invoke` without support for individual
  16879. * method arguments.
  16880. *
  16881. * @private
  16882. * @param {Object} object The object to query.
  16883. * @param {Array|string} path The path of the method to invoke.
  16884. * @param {Array} args The arguments to invoke the method with.
  16885. * @returns {*} Returns the result of the invoked method.
  16886. */
  16887. function baseInvoke(object, path, args) {
  16888. path = castPath(path, object);
  16889. object = parent(object, path);
  16890. var func = object == null ? object : object[toKey(last(path))];
  16891. return func == null ? undefined : apply(func, object, args);
  16892. }
  16893. /**
  16894. * The base implementation of `_.isArguments`.
  16895. *
  16896. * @private
  16897. * @param {*} value The value to check.
  16898. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  16899. */
  16900. function baseIsArguments(value) {
  16901. return isObjectLike(value) && baseGetTag(value) == argsTag;
  16902. }
  16903. /**
  16904. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  16905. *
  16906. * @private
  16907. * @param {*} value The value to check.
  16908. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  16909. */
  16910. function baseIsArrayBuffer(value) {
  16911. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  16912. }
  16913. /**
  16914. * The base implementation of `_.isDate` without Node.js optimizations.
  16915. *
  16916. * @private
  16917. * @param {*} value The value to check.
  16918. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  16919. */
  16920. function baseIsDate(value) {
  16921. return isObjectLike(value) && baseGetTag(value) == dateTag;
  16922. }
  16923. /**
  16924. * The base implementation of `_.isEqual` which supports partial comparisons
  16925. * and tracks traversed objects.
  16926. *
  16927. * @private
  16928. * @param {*} value The value to compare.
  16929. * @param {*} other The other value to compare.
  16930. * @param {boolean} bitmask The bitmask flags.
  16931. * 1 - Unordered comparison
  16932. * 2 - Partial comparison
  16933. * @param {Function} [customizer] The function to customize comparisons.
  16934. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  16935. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16936. */
  16937. function baseIsEqual(value, other, bitmask, customizer, stack) {
  16938. if (value === other) {
  16939. return true;
  16940. }
  16941. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  16942. return value !== value && other !== other;
  16943. }
  16944. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  16945. }
  16946. /**
  16947. * A specialized version of `baseIsEqual` for arrays and objects which performs
  16948. * deep comparisons and tracks traversed objects enabling objects with circular
  16949. * references to be compared.
  16950. *
  16951. * @private
  16952. * @param {Object} object The object to compare.
  16953. * @param {Object} other The other object to compare.
  16954. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16955. * @param {Function} customizer The function to customize comparisons.
  16956. * @param {Function} equalFunc The function to determine equivalents of values.
  16957. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  16958. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16959. */
  16960. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  16961. var objIsArr = isArray(object),
  16962. othIsArr = isArray(other),
  16963. objTag = objIsArr ? arrayTag : getTag(object),
  16964. othTag = othIsArr ? arrayTag : getTag(other);
  16965. objTag = objTag == argsTag ? objectTag : objTag;
  16966. othTag = othTag == argsTag ? objectTag : othTag;
  16967. var objIsObj = objTag == objectTag,
  16968. othIsObj = othTag == objectTag,
  16969. isSameTag = objTag == othTag;
  16970. if (isSameTag && isBuffer(object)) {
  16971. if (!isBuffer(other)) {
  16972. return false;
  16973. }
  16974. objIsArr = true;
  16975. objIsObj = false;
  16976. }
  16977. if (isSameTag && !objIsObj) {
  16978. stack || (stack = new Stack);
  16979. return (objIsArr || isTypedArray(object))
  16980. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  16981. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  16982. }
  16983. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  16984. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  16985. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  16986. if (objIsWrapped || othIsWrapped) {
  16987. var objUnwrapped = objIsWrapped ? object.value() : object,
  16988. othUnwrapped = othIsWrapped ? other.value() : other;
  16989. stack || (stack = new Stack);
  16990. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  16991. }
  16992. }
  16993. if (!isSameTag) {
  16994. return false;
  16995. }
  16996. stack || (stack = new Stack);
  16997. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  16998. }
  16999. /**
  17000. * The base implementation of `_.isMap` without Node.js optimizations.
  17001. *
  17002. * @private
  17003. * @param {*} value The value to check.
  17004. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  17005. */
  17006. function baseIsMap(value) {
  17007. return isObjectLike(value) && getTag(value) == mapTag;
  17008. }
  17009. /**
  17010. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  17011. *
  17012. * @private
  17013. * @param {Object} object The object to inspect.
  17014. * @param {Object} source The object of property values to match.
  17015. * @param {Array} matchData The property names, values, and compare flags to match.
  17016. * @param {Function} [customizer] The function to customize comparisons.
  17017. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  17018. */
  17019. function baseIsMatch(object, source, matchData, customizer) {
  17020. var index = matchData.length,
  17021. length = index,
  17022. noCustomizer = !customizer;
  17023. if (object == null) {
  17024. return !length;
  17025. }
  17026. object = Object(object);
  17027. while (index--) {
  17028. var data = matchData[index];
  17029. if ((noCustomizer && data[2])
  17030. ? data[1] !== object[data[0]]
  17031. : !(data[0] in object)
  17032. ) {
  17033. return false;
  17034. }
  17035. }
  17036. while (++index < length) {
  17037. data = matchData[index];
  17038. var key = data[0],
  17039. objValue = object[key],
  17040. srcValue = data[1];
  17041. if (noCustomizer && data[2]) {
  17042. if (objValue === undefined && !(key in object)) {
  17043. return false;
  17044. }
  17045. } else {
  17046. var stack = new Stack;
  17047. if (customizer) {
  17048. var result = customizer(objValue, srcValue, key, object, source, stack);
  17049. }
  17050. if (!(result === undefined
  17051. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  17052. : result
  17053. )) {
  17054. return false;
  17055. }
  17056. }
  17057. }
  17058. return true;
  17059. }
  17060. /**
  17061. * The base implementation of `_.isNative` without bad shim checks.
  17062. *
  17063. * @private
  17064. * @param {*} value The value to check.
  17065. * @returns {boolean} Returns `true` if `value` is a native function,
  17066. * else `false`.
  17067. */
  17068. function baseIsNative(value) {
  17069. if (!isObject(value) || isMasked(value)) {
  17070. return false;
  17071. }
  17072. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  17073. return pattern.test(toSource(value));
  17074. }
  17075. /**
  17076. * The base implementation of `_.isRegExp` without Node.js optimizations.
  17077. *
  17078. * @private
  17079. * @param {*} value The value to check.
  17080. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  17081. */
  17082. function baseIsRegExp(value) {
  17083. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  17084. }
  17085. /**
  17086. * The base implementation of `_.isSet` without Node.js optimizations.
  17087. *
  17088. * @private
  17089. * @param {*} value The value to check.
  17090. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  17091. */
  17092. function baseIsSet(value) {
  17093. return isObjectLike(value) && getTag(value) == setTag;
  17094. }
  17095. /**
  17096. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  17097. *
  17098. * @private
  17099. * @param {*} value The value to check.
  17100. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  17101. */
  17102. function baseIsTypedArray(value) {
  17103. return isObjectLike(value) &&
  17104. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  17105. }
  17106. /**
  17107. * The base implementation of `_.iteratee`.
  17108. *
  17109. * @private
  17110. * @param {*} [value=_.identity] The value to convert to an iteratee.
  17111. * @returns {Function} Returns the iteratee.
  17112. */
  17113. function baseIteratee(value) {
  17114. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  17115. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  17116. if (typeof value == 'function') {
  17117. return value;
  17118. }
  17119. if (value == null) {
  17120. return identity;
  17121. }
  17122. if (typeof value == 'object') {
  17123. return isArray(value)
  17124. ? baseMatchesProperty(value[0], value[1])
  17125. : baseMatches(value);
  17126. }
  17127. return property(value);
  17128. }
  17129. /**
  17130. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  17131. *
  17132. * @private
  17133. * @param {Object} object The object to query.
  17134. * @returns {Array} Returns the array of property names.
  17135. */
  17136. function baseKeys(object) {
  17137. if (!isPrototype(object)) {
  17138. return nativeKeys(object);
  17139. }
  17140. var result = [];
  17141. for (var key in Object(object)) {
  17142. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  17143. result.push(key);
  17144. }
  17145. }
  17146. return result;
  17147. }
  17148. /**
  17149. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  17150. *
  17151. * @private
  17152. * @param {Object} object The object to query.
  17153. * @returns {Array} Returns the array of property names.
  17154. */
  17155. function baseKeysIn(object) {
  17156. if (!isObject(object)) {
  17157. return nativeKeysIn(object);
  17158. }
  17159. var isProto = isPrototype(object),
  17160. result = [];
  17161. for (var key in object) {
  17162. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  17163. result.push(key);
  17164. }
  17165. }
  17166. return result;
  17167. }
  17168. /**
  17169. * The base implementation of `_.lt` which doesn't coerce arguments.
  17170. *
  17171. * @private
  17172. * @param {*} value The value to compare.
  17173. * @param {*} other The other value to compare.
  17174. * @returns {boolean} Returns `true` if `value` is less than `other`,
  17175. * else `false`.
  17176. */
  17177. function baseLt(value, other) {
  17178. return value < other;
  17179. }
  17180. /**
  17181. * The base implementation of `_.map` without support for iteratee shorthands.
  17182. *
  17183. * @private
  17184. * @param {Array|Object} collection The collection to iterate over.
  17185. * @param {Function} iteratee The function invoked per iteration.
  17186. * @returns {Array} Returns the new mapped array.
  17187. */
  17188. function baseMap(collection, iteratee) {
  17189. var index = -1,
  17190. result = isArrayLike(collection) ? Array(collection.length) : [];
  17191. baseEach(collection, function(value, key, collection) {
  17192. result[++index] = iteratee(value, key, collection);
  17193. });
  17194. return result;
  17195. }
  17196. /**
  17197. * The base implementation of `_.matches` which doesn't clone `source`.
  17198. *
  17199. * @private
  17200. * @param {Object} source The object of property values to match.
  17201. * @returns {Function} Returns the new spec function.
  17202. */
  17203. function baseMatches(source) {
  17204. var matchData = getMatchData(source);
  17205. if (matchData.length == 1 && matchData[0][2]) {
  17206. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  17207. }
  17208. return function(object) {
  17209. return object === source || baseIsMatch(object, source, matchData);
  17210. };
  17211. }
  17212. /**
  17213. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  17214. *
  17215. * @private
  17216. * @param {string} path The path of the property to get.
  17217. * @param {*} srcValue The value to match.
  17218. * @returns {Function} Returns the new spec function.
  17219. */
  17220. function baseMatchesProperty(path, srcValue) {
  17221. if (isKey(path) && isStrictComparable(srcValue)) {
  17222. return matchesStrictComparable(toKey(path), srcValue);
  17223. }
  17224. return function(object) {
  17225. var objValue = get(object, path);
  17226. return (objValue === undefined && objValue === srcValue)
  17227. ? hasIn(object, path)
  17228. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  17229. };
  17230. }
  17231. /**
  17232. * The base implementation of `_.merge` without support for multiple sources.
  17233. *
  17234. * @private
  17235. * @param {Object} object The destination object.
  17236. * @param {Object} source The source object.
  17237. * @param {number} srcIndex The index of `source`.
  17238. * @param {Function} [customizer] The function to customize merged values.
  17239. * @param {Object} [stack] Tracks traversed source values and their merged
  17240. * counterparts.
  17241. */
  17242. function baseMerge(object, source, srcIndex, customizer, stack) {
  17243. if (object === source) {
  17244. return;
  17245. }
  17246. baseFor(source, function(srcValue, key) {
  17247. stack || (stack = new Stack);
  17248. if (isObject(srcValue)) {
  17249. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  17250. }
  17251. else {
  17252. var newValue = customizer
  17253. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  17254. : undefined;
  17255. if (newValue === undefined) {
  17256. newValue = srcValue;
  17257. }
  17258. assignMergeValue(object, key, newValue);
  17259. }
  17260. }, keysIn);
  17261. }
  17262. /**
  17263. * A specialized version of `baseMerge` for arrays and objects which performs
  17264. * deep merges and tracks traversed objects enabling objects with circular
  17265. * references to be merged.
  17266. *
  17267. * @private
  17268. * @param {Object} object The destination object.
  17269. * @param {Object} source The source object.
  17270. * @param {string} key The key of the value to merge.
  17271. * @param {number} srcIndex The index of `source`.
  17272. * @param {Function} mergeFunc The function to merge values.
  17273. * @param {Function} [customizer] The function to customize assigned values.
  17274. * @param {Object} [stack] Tracks traversed source values and their merged
  17275. * counterparts.
  17276. */
  17277. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  17278. var objValue = safeGet(object, key),
  17279. srcValue = safeGet(source, key),
  17280. stacked = stack.get(srcValue);
  17281. if (stacked) {
  17282. assignMergeValue(object, key, stacked);
  17283. return;
  17284. }
  17285. var newValue = customizer
  17286. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  17287. : undefined;
  17288. var isCommon = newValue === undefined;
  17289. if (isCommon) {
  17290. var isArr = isArray(srcValue),
  17291. isBuff = !isArr && isBuffer(srcValue),
  17292. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  17293. newValue = srcValue;
  17294. if (isArr || isBuff || isTyped) {
  17295. if (isArray(objValue)) {
  17296. newValue = objValue;
  17297. }
  17298. else if (isArrayLikeObject(objValue)) {
  17299. newValue = copyArray(objValue);
  17300. }
  17301. else if (isBuff) {
  17302. isCommon = false;
  17303. newValue = cloneBuffer(srcValue, true);
  17304. }
  17305. else if (isTyped) {
  17306. isCommon = false;
  17307. newValue = cloneTypedArray(srcValue, true);
  17308. }
  17309. else {
  17310. newValue = [];
  17311. }
  17312. }
  17313. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  17314. newValue = objValue;
  17315. if (isArguments(objValue)) {
  17316. newValue = toPlainObject(objValue);
  17317. }
  17318. else if (!isObject(objValue) || isFunction(objValue)) {
  17319. newValue = initCloneObject(srcValue);
  17320. }
  17321. }
  17322. else {
  17323. isCommon = false;
  17324. }
  17325. }
  17326. if (isCommon) {
  17327. // Recursively merge objects and arrays (susceptible to call stack limits).
  17328. stack.set(srcValue, newValue);
  17329. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  17330. stack['delete'](srcValue);
  17331. }
  17332. assignMergeValue(object, key, newValue);
  17333. }
  17334. /**
  17335. * The base implementation of `_.nth` which doesn't coerce arguments.
  17336. *
  17337. * @private
  17338. * @param {Array} array The array to query.
  17339. * @param {number} n The index of the element to return.
  17340. * @returns {*} Returns the nth element of `array`.
  17341. */
  17342. function baseNth(array, n) {
  17343. var length = array.length;
  17344. if (!length) {
  17345. return;
  17346. }
  17347. n += n < 0 ? length : 0;
  17348. return isIndex(n, length) ? array[n] : undefined;
  17349. }
  17350. /**
  17351. * The base implementation of `_.orderBy` without param guards.
  17352. *
  17353. * @private
  17354. * @param {Array|Object} collection The collection to iterate over.
  17355. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  17356. * @param {string[]} orders The sort orders of `iteratees`.
  17357. * @returns {Array} Returns the new sorted array.
  17358. */
  17359. function baseOrderBy(collection, iteratees, orders) {
  17360. if (iteratees.length) {
  17361. iteratees = arrayMap(iteratees, function(iteratee) {
  17362. if (isArray(iteratee)) {
  17363. return function(value) {
  17364. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  17365. }
  17366. }
  17367. return iteratee;
  17368. });
  17369. } else {
  17370. iteratees = [identity];
  17371. }
  17372. var index = -1;
  17373. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  17374. var result = baseMap(collection, function(value, key, collection) {
  17375. var criteria = arrayMap(iteratees, function(iteratee) {
  17376. return iteratee(value);
  17377. });
  17378. return { 'criteria': criteria, 'index': ++index, 'value': value };
  17379. });
  17380. return baseSortBy(result, function(object, other) {
  17381. return compareMultiple(object, other, orders);
  17382. });
  17383. }
  17384. /**
  17385. * The base implementation of `_.pick` without support for individual
  17386. * property identifiers.
  17387. *
  17388. * @private
  17389. * @param {Object} object The source object.
  17390. * @param {string[]} paths The property paths to pick.
  17391. * @returns {Object} Returns the new object.
  17392. */
  17393. function basePick(object, paths) {
  17394. return basePickBy(object, paths, function(value, path) {
  17395. return hasIn(object, path);
  17396. });
  17397. }
  17398. /**
  17399. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  17400. *
  17401. * @private
  17402. * @param {Object} object The source object.
  17403. * @param {string[]} paths The property paths to pick.
  17404. * @param {Function} predicate The function invoked per property.
  17405. * @returns {Object} Returns the new object.
  17406. */
  17407. function basePickBy(object, paths, predicate) {
  17408. var index = -1,
  17409. length = paths.length,
  17410. result = {};
  17411. while (++index < length) {
  17412. var path = paths[index],
  17413. value = baseGet(object, path);
  17414. if (predicate(value, path)) {
  17415. baseSet(result, castPath(path, object), value);
  17416. }
  17417. }
  17418. return result;
  17419. }
  17420. /**
  17421. * A specialized version of `baseProperty` which supports deep paths.
  17422. *
  17423. * @private
  17424. * @param {Array|string} path The path of the property to get.
  17425. * @returns {Function} Returns the new accessor function.
  17426. */
  17427. function basePropertyDeep(path) {
  17428. return function(object) {
  17429. return baseGet(object, path);
  17430. };
  17431. }
  17432. /**
  17433. * The base implementation of `_.pullAllBy` without support for iteratee
  17434. * shorthands.
  17435. *
  17436. * @private
  17437. * @param {Array} array The array to modify.
  17438. * @param {Array} values The values to remove.
  17439. * @param {Function} [iteratee] The iteratee invoked per element.
  17440. * @param {Function} [comparator] The comparator invoked per element.
  17441. * @returns {Array} Returns `array`.
  17442. */
  17443. function basePullAll(array, values, iteratee, comparator) {
  17444. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  17445. index = -1,
  17446. length = values.length,
  17447. seen = array;
  17448. if (array === values) {
  17449. values = copyArray(values);
  17450. }
  17451. if (iteratee) {
  17452. seen = arrayMap(array, baseUnary(iteratee));
  17453. }
  17454. while (++index < length) {
  17455. var fromIndex = 0,
  17456. value = values[index],
  17457. computed = iteratee ? iteratee(value) : value;
  17458. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  17459. if (seen !== array) {
  17460. splice.call(seen, fromIndex, 1);
  17461. }
  17462. splice.call(array, fromIndex, 1);
  17463. }
  17464. }
  17465. return array;
  17466. }
  17467. /**
  17468. * The base implementation of `_.pullAt` without support for individual
  17469. * indexes or capturing the removed elements.
  17470. *
  17471. * @private
  17472. * @param {Array} array The array to modify.
  17473. * @param {number[]} indexes The indexes of elements to remove.
  17474. * @returns {Array} Returns `array`.
  17475. */
  17476. function basePullAt(array, indexes) {
  17477. var length = array ? indexes.length : 0,
  17478. lastIndex = length - 1;
  17479. while (length--) {
  17480. var index = indexes[length];
  17481. if (length == lastIndex || index !== previous) {
  17482. var previous = index;
  17483. if (isIndex(index)) {
  17484. splice.call(array, index, 1);
  17485. } else {
  17486. baseUnset(array, index);
  17487. }
  17488. }
  17489. }
  17490. return array;
  17491. }
  17492. /**
  17493. * The base implementation of `_.random` without support for returning
  17494. * floating-point numbers.
  17495. *
  17496. * @private
  17497. * @param {number} lower The lower bound.
  17498. * @param {number} upper The upper bound.
  17499. * @returns {number} Returns the random number.
  17500. */
  17501. function baseRandom(lower, upper) {
  17502. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  17503. }
  17504. /**
  17505. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  17506. * coerce arguments.
  17507. *
  17508. * @private
  17509. * @param {number} start The start of the range.
  17510. * @param {number} end The end of the range.
  17511. * @param {number} step The value to increment or decrement by.
  17512. * @param {boolean} [fromRight] Specify iterating from right to left.
  17513. * @returns {Array} Returns the range of numbers.
  17514. */
  17515. function baseRange(start, end, step, fromRight) {
  17516. var index = -1,
  17517. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  17518. result = Array(length);
  17519. while (length--) {
  17520. result[fromRight ? length : ++index] = start;
  17521. start += step;
  17522. }
  17523. return result;
  17524. }
  17525. /**
  17526. * The base implementation of `_.repeat` which doesn't coerce arguments.
  17527. *
  17528. * @private
  17529. * @param {string} string The string to repeat.
  17530. * @param {number} n The number of times to repeat the string.
  17531. * @returns {string} Returns the repeated string.
  17532. */
  17533. function baseRepeat(string, n) {
  17534. var result = '';
  17535. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  17536. return result;
  17537. }
  17538. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  17539. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  17540. do {
  17541. if (n % 2) {
  17542. result += string;
  17543. }
  17544. n = nativeFloor(n / 2);
  17545. if (n) {
  17546. string += string;
  17547. }
  17548. } while (n);
  17549. return result;
  17550. }
  17551. /**
  17552. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  17553. *
  17554. * @private
  17555. * @param {Function} func The function to apply a rest parameter to.
  17556. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17557. * @returns {Function} Returns the new function.
  17558. */
  17559. function baseRest(func, start) {
  17560. return setToString(overRest(func, start, identity), func + '');
  17561. }
  17562. /**
  17563. * The base implementation of `_.sample`.
  17564. *
  17565. * @private
  17566. * @param {Array|Object} collection The collection to sample.
  17567. * @returns {*} Returns the random element.
  17568. */
  17569. function baseSample(collection) {
  17570. return arraySample(values(collection));
  17571. }
  17572. /**
  17573. * The base implementation of `_.sampleSize` without param guards.
  17574. *
  17575. * @private
  17576. * @param {Array|Object} collection The collection to sample.
  17577. * @param {number} n The number of elements to sample.
  17578. * @returns {Array} Returns the random elements.
  17579. */
  17580. function baseSampleSize(collection, n) {
  17581. var array = values(collection);
  17582. return shuffleSelf(array, baseClamp(n, 0, array.length));
  17583. }
  17584. /**
  17585. * The base implementation of `_.set`.
  17586. *
  17587. * @private
  17588. * @param {Object} object The object to modify.
  17589. * @param {Array|string} path The path of the property to set.
  17590. * @param {*} value The value to set.
  17591. * @param {Function} [customizer] The function to customize path creation.
  17592. * @returns {Object} Returns `object`.
  17593. */
  17594. function baseSet(object, path, value, customizer) {
  17595. if (!isObject(object)) {
  17596. return object;
  17597. }
  17598. path = castPath(path, object);
  17599. var index = -1,
  17600. length = path.length,
  17601. lastIndex = length - 1,
  17602. nested = object;
  17603. while (nested != null && ++index < length) {
  17604. var key = toKey(path[index]),
  17605. newValue = value;
  17606. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  17607. return object;
  17608. }
  17609. if (index != lastIndex) {
  17610. var objValue = nested[key];
  17611. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  17612. if (newValue === undefined) {
  17613. newValue = isObject(objValue)
  17614. ? objValue
  17615. : (isIndex(path[index + 1]) ? [] : {});
  17616. }
  17617. }
  17618. assignValue(nested, key, newValue);
  17619. nested = nested[key];
  17620. }
  17621. return object;
  17622. }
  17623. /**
  17624. * The base implementation of `setData` without support for hot loop shorting.
  17625. *
  17626. * @private
  17627. * @param {Function} func The function to associate metadata with.
  17628. * @param {*} data The metadata.
  17629. * @returns {Function} Returns `func`.
  17630. */
  17631. var baseSetData = !metaMap ? identity : function(func, data) {
  17632. metaMap.set(func, data);
  17633. return func;
  17634. };
  17635. /**
  17636. * The base implementation of `setToString` without support for hot loop shorting.
  17637. *
  17638. * @private
  17639. * @param {Function} func The function to modify.
  17640. * @param {Function} string The `toString` result.
  17641. * @returns {Function} Returns `func`.
  17642. */
  17643. var baseSetToString = !defineProperty ? identity : function(func, string) {
  17644. return defineProperty(func, 'toString', {
  17645. 'configurable': true,
  17646. 'enumerable': false,
  17647. 'value': constant(string),
  17648. 'writable': true
  17649. });
  17650. };
  17651. /**
  17652. * The base implementation of `_.shuffle`.
  17653. *
  17654. * @private
  17655. * @param {Array|Object} collection The collection to shuffle.
  17656. * @returns {Array} Returns the new shuffled array.
  17657. */
  17658. function baseShuffle(collection) {
  17659. return shuffleSelf(values(collection));
  17660. }
  17661. /**
  17662. * The base implementation of `_.slice` without an iteratee call guard.
  17663. *
  17664. * @private
  17665. * @param {Array} array The array to slice.
  17666. * @param {number} [start=0] The start position.
  17667. * @param {number} [end=array.length] The end position.
  17668. * @returns {Array} Returns the slice of `array`.
  17669. */
  17670. function baseSlice(array, start, end) {
  17671. var index = -1,
  17672. length = array.length;
  17673. if (start < 0) {
  17674. start = -start > length ? 0 : (length + start);
  17675. }
  17676. end = end > length ? length : end;
  17677. if (end < 0) {
  17678. end += length;
  17679. }
  17680. length = start > end ? 0 : ((end - start) >>> 0);
  17681. start >>>= 0;
  17682. var result = Array(length);
  17683. while (++index < length) {
  17684. result[index] = array[index + start];
  17685. }
  17686. return result;
  17687. }
  17688. /**
  17689. * The base implementation of `_.some` without support for iteratee shorthands.
  17690. *
  17691. * @private
  17692. * @param {Array|Object} collection The collection to iterate over.
  17693. * @param {Function} predicate The function invoked per iteration.
  17694. * @returns {boolean} Returns `true` if any element passes the predicate check,
  17695. * else `false`.
  17696. */
  17697. function baseSome(collection, predicate) {
  17698. var result;
  17699. baseEach(collection, function(value, index, collection) {
  17700. result = predicate(value, index, collection);
  17701. return !result;
  17702. });
  17703. return !!result;
  17704. }
  17705. /**
  17706. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  17707. * performs a binary search of `array` to determine the index at which `value`
  17708. * should be inserted into `array` in order to maintain its sort order.
  17709. *
  17710. * @private
  17711. * @param {Array} array The sorted array to inspect.
  17712. * @param {*} value The value to evaluate.
  17713. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17714. * @returns {number} Returns the index at which `value` should be inserted
  17715. * into `array`.
  17716. */
  17717. function baseSortedIndex(array, value, retHighest) {
  17718. var low = 0,
  17719. high = array == null ? low : array.length;
  17720. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  17721. while (low < high) {
  17722. var mid = (low + high) >>> 1,
  17723. computed = array[mid];
  17724. if (computed !== null && !isSymbol(computed) &&
  17725. (retHighest ? (computed <= value) : (computed < value))) {
  17726. low = mid + 1;
  17727. } else {
  17728. high = mid;
  17729. }
  17730. }
  17731. return high;
  17732. }
  17733. return baseSortedIndexBy(array, value, identity, retHighest);
  17734. }
  17735. /**
  17736. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  17737. * which invokes `iteratee` for `value` and each element of `array` to compute
  17738. * their sort ranking. The iteratee is invoked with one argument; (value).
  17739. *
  17740. * @private
  17741. * @param {Array} array The sorted array to inspect.
  17742. * @param {*} value The value to evaluate.
  17743. * @param {Function} iteratee The iteratee invoked per element.
  17744. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17745. * @returns {number} Returns the index at which `value` should be inserted
  17746. * into `array`.
  17747. */
  17748. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  17749. var low = 0,
  17750. high = array == null ? 0 : array.length;
  17751. if (high === 0) {
  17752. return 0;
  17753. }
  17754. value = iteratee(value);
  17755. var valIsNaN = value !== value,
  17756. valIsNull = value === null,
  17757. valIsSymbol = isSymbol(value),
  17758. valIsUndefined = value === undefined;
  17759. while (low < high) {
  17760. var mid = nativeFloor((low + high) / 2),
  17761. computed = iteratee(array[mid]),
  17762. othIsDefined = computed !== undefined,
  17763. othIsNull = computed === null,
  17764. othIsReflexive = computed === computed,
  17765. othIsSymbol = isSymbol(computed);
  17766. if (valIsNaN) {
  17767. var setLow = retHighest || othIsReflexive;
  17768. } else if (valIsUndefined) {
  17769. setLow = othIsReflexive && (retHighest || othIsDefined);
  17770. } else if (valIsNull) {
  17771. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  17772. } else if (valIsSymbol) {
  17773. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  17774. } else if (othIsNull || othIsSymbol) {
  17775. setLow = false;
  17776. } else {
  17777. setLow = retHighest ? (computed <= value) : (computed < value);
  17778. }
  17779. if (setLow) {
  17780. low = mid + 1;
  17781. } else {
  17782. high = mid;
  17783. }
  17784. }
  17785. return nativeMin(high, MAX_ARRAY_INDEX);
  17786. }
  17787. /**
  17788. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  17789. * support for iteratee shorthands.
  17790. *
  17791. * @private
  17792. * @param {Array} array The array to inspect.
  17793. * @param {Function} [iteratee] The iteratee invoked per element.
  17794. * @returns {Array} Returns the new duplicate free array.
  17795. */
  17796. function baseSortedUniq(array, iteratee) {
  17797. var index = -1,
  17798. length = array.length,
  17799. resIndex = 0,
  17800. result = [];
  17801. while (++index < length) {
  17802. var value = array[index],
  17803. computed = iteratee ? iteratee(value) : value;
  17804. if (!index || !eq(computed, seen)) {
  17805. var seen = computed;
  17806. result[resIndex++] = value === 0 ? 0 : value;
  17807. }
  17808. }
  17809. return result;
  17810. }
  17811. /**
  17812. * The base implementation of `_.toNumber` which doesn't ensure correct
  17813. * conversions of binary, hexadecimal, or octal string values.
  17814. *
  17815. * @private
  17816. * @param {*} value The value to process.
  17817. * @returns {number} Returns the number.
  17818. */
  17819. function baseToNumber(value) {
  17820. if (typeof value == 'number') {
  17821. return value;
  17822. }
  17823. if (isSymbol(value)) {
  17824. return NAN;
  17825. }
  17826. return +value;
  17827. }
  17828. /**
  17829. * The base implementation of `_.toString` which doesn't convert nullish
  17830. * values to empty strings.
  17831. *
  17832. * @private
  17833. * @param {*} value The value to process.
  17834. * @returns {string} Returns the string.
  17835. */
  17836. function baseToString(value) {
  17837. // Exit early for strings to avoid a performance hit in some environments.
  17838. if (typeof value == 'string') {
  17839. return value;
  17840. }
  17841. if (isArray(value)) {
  17842. // Recursively convert values (susceptible to call stack limits).
  17843. return arrayMap(value, baseToString) + '';
  17844. }
  17845. if (isSymbol(value)) {
  17846. return symbolToString ? symbolToString.call(value) : '';
  17847. }
  17848. var result = (value + '');
  17849. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17850. }
  17851. /**
  17852. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  17853. *
  17854. * @private
  17855. * @param {Array} array The array to inspect.
  17856. * @param {Function} [iteratee] The iteratee invoked per element.
  17857. * @param {Function} [comparator] The comparator invoked per element.
  17858. * @returns {Array} Returns the new duplicate free array.
  17859. */
  17860. function baseUniq(array, iteratee, comparator) {
  17861. var index = -1,
  17862. includes = arrayIncludes,
  17863. length = array.length,
  17864. isCommon = true,
  17865. result = [],
  17866. seen = result;
  17867. if (comparator) {
  17868. isCommon = false;
  17869. includes = arrayIncludesWith;
  17870. }
  17871. else if (length >= LARGE_ARRAY_SIZE) {
  17872. var set = iteratee ? null : createSet(array);
  17873. if (set) {
  17874. return setToArray(set);
  17875. }
  17876. isCommon = false;
  17877. includes = cacheHas;
  17878. seen = new SetCache;
  17879. }
  17880. else {
  17881. seen = iteratee ? [] : result;
  17882. }
  17883. outer:
  17884. while (++index < length) {
  17885. var value = array[index],
  17886. computed = iteratee ? iteratee(value) : value;
  17887. value = (comparator || value !== 0) ? value : 0;
  17888. if (isCommon && computed === computed) {
  17889. var seenIndex = seen.length;
  17890. while (seenIndex--) {
  17891. if (seen[seenIndex] === computed) {
  17892. continue outer;
  17893. }
  17894. }
  17895. if (iteratee) {
  17896. seen.push(computed);
  17897. }
  17898. result.push(value);
  17899. }
  17900. else if (!includes(seen, computed, comparator)) {
  17901. if (seen !== result) {
  17902. seen.push(computed);
  17903. }
  17904. result.push(value);
  17905. }
  17906. }
  17907. return result;
  17908. }
  17909. /**
  17910. * The base implementation of `_.unset`.
  17911. *
  17912. * @private
  17913. * @param {Object} object The object to modify.
  17914. * @param {Array|string} path The property path to unset.
  17915. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  17916. */
  17917. function baseUnset(object, path) {
  17918. path = castPath(path, object);
  17919. object = parent(object, path);
  17920. return object == null || delete object[toKey(last(path))];
  17921. }
  17922. /**
  17923. * The base implementation of `_.update`.
  17924. *
  17925. * @private
  17926. * @param {Object} object The object to modify.
  17927. * @param {Array|string} path The path of the property to update.
  17928. * @param {Function} updater The function to produce the updated value.
  17929. * @param {Function} [customizer] The function to customize path creation.
  17930. * @returns {Object} Returns `object`.
  17931. */
  17932. function baseUpdate(object, path, updater, customizer) {
  17933. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  17934. }
  17935. /**
  17936. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  17937. * without support for iteratee shorthands.
  17938. *
  17939. * @private
  17940. * @param {Array} array The array to query.
  17941. * @param {Function} predicate The function invoked per iteration.
  17942. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  17943. * @param {boolean} [fromRight] Specify iterating from right to left.
  17944. * @returns {Array} Returns the slice of `array`.
  17945. */
  17946. function baseWhile(array, predicate, isDrop, fromRight) {
  17947. var length = array.length,
  17948. index = fromRight ? length : -1;
  17949. while ((fromRight ? index-- : ++index < length) &&
  17950. predicate(array[index], index, array)) {}
  17951. return isDrop
  17952. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  17953. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  17954. }
  17955. /**
  17956. * The base implementation of `wrapperValue` which returns the result of
  17957. * performing a sequence of actions on the unwrapped `value`, where each
  17958. * successive action is supplied the return value of the previous.
  17959. *
  17960. * @private
  17961. * @param {*} value The unwrapped value.
  17962. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  17963. * @returns {*} Returns the resolved value.
  17964. */
  17965. function baseWrapperValue(value, actions) {
  17966. var result = value;
  17967. if (result instanceof LazyWrapper) {
  17968. result = result.value();
  17969. }
  17970. return arrayReduce(actions, function(result, action) {
  17971. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  17972. }, result);
  17973. }
  17974. /**
  17975. * The base implementation of methods like `_.xor`, without support for
  17976. * iteratee shorthands, that accepts an array of arrays to inspect.
  17977. *
  17978. * @private
  17979. * @param {Array} arrays The arrays to inspect.
  17980. * @param {Function} [iteratee] The iteratee invoked per element.
  17981. * @param {Function} [comparator] The comparator invoked per element.
  17982. * @returns {Array} Returns the new array of values.
  17983. */
  17984. function baseXor(arrays, iteratee, comparator) {
  17985. var length = arrays.length;
  17986. if (length < 2) {
  17987. return length ? baseUniq(arrays[0]) : [];
  17988. }
  17989. var index = -1,
  17990. result = Array(length);
  17991. while (++index < length) {
  17992. var array = arrays[index],
  17993. othIndex = -1;
  17994. while (++othIndex < length) {
  17995. if (othIndex != index) {
  17996. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  17997. }
  17998. }
  17999. }
  18000. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  18001. }
  18002. /**
  18003. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  18004. *
  18005. * @private
  18006. * @param {Array} props The property identifiers.
  18007. * @param {Array} values The property values.
  18008. * @param {Function} assignFunc The function to assign values.
  18009. * @returns {Object} Returns the new object.
  18010. */
  18011. function baseZipObject(props, values, assignFunc) {
  18012. var index = -1,
  18013. length = props.length,
  18014. valsLength = values.length,
  18015. result = {};
  18016. while (++index < length) {
  18017. var value = index < valsLength ? values[index] : undefined;
  18018. assignFunc(result, props[index], value);
  18019. }
  18020. return result;
  18021. }
  18022. /**
  18023. * Casts `value` to an empty array if it's not an array like object.
  18024. *
  18025. * @private
  18026. * @param {*} value The value to inspect.
  18027. * @returns {Array|Object} Returns the cast array-like object.
  18028. */
  18029. function castArrayLikeObject(value) {
  18030. return isArrayLikeObject(value) ? value : [];
  18031. }
  18032. /**
  18033. * Casts `value` to `identity` if it's not a function.
  18034. *
  18035. * @private
  18036. * @param {*} value The value to inspect.
  18037. * @returns {Function} Returns cast function.
  18038. */
  18039. function castFunction(value) {
  18040. return typeof value == 'function' ? value : identity;
  18041. }
  18042. /**
  18043. * Casts `value` to a path array if it's not one.
  18044. *
  18045. * @private
  18046. * @param {*} value The value to inspect.
  18047. * @param {Object} [object] The object to query keys on.
  18048. * @returns {Array} Returns the cast property path array.
  18049. */
  18050. function castPath(value, object) {
  18051. if (isArray(value)) {
  18052. return value;
  18053. }
  18054. return isKey(value, object) ? [value] : stringToPath(toString(value));
  18055. }
  18056. /**
  18057. * A `baseRest` alias which can be replaced with `identity` by module
  18058. * replacement plugins.
  18059. *
  18060. * @private
  18061. * @type {Function}
  18062. * @param {Function} func The function to apply a rest parameter to.
  18063. * @returns {Function} Returns the new function.
  18064. */
  18065. var castRest = baseRest;
  18066. /**
  18067. * Casts `array` to a slice if it's needed.
  18068. *
  18069. * @private
  18070. * @param {Array} array The array to inspect.
  18071. * @param {number} start The start position.
  18072. * @param {number} [end=array.length] The end position.
  18073. * @returns {Array} Returns the cast slice.
  18074. */
  18075. function castSlice(array, start, end) {
  18076. var length = array.length;
  18077. end = end === undefined ? length : end;
  18078. return (!start && end >= length) ? array : baseSlice(array, start, end);
  18079. }
  18080. /**
  18081. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  18082. *
  18083. * @private
  18084. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  18085. */
  18086. var clearTimeout = ctxClearTimeout || function(id) {
  18087. return root.clearTimeout(id);
  18088. };
  18089. /**
  18090. * Creates a clone of `buffer`.
  18091. *
  18092. * @private
  18093. * @param {Buffer} buffer The buffer to clone.
  18094. * @param {boolean} [isDeep] Specify a deep clone.
  18095. * @returns {Buffer} Returns the cloned buffer.
  18096. */
  18097. function cloneBuffer(buffer, isDeep) {
  18098. if (isDeep) {
  18099. return buffer.slice();
  18100. }
  18101. var length = buffer.length,
  18102. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  18103. buffer.copy(result);
  18104. return result;
  18105. }
  18106. /**
  18107. * Creates a clone of `arrayBuffer`.
  18108. *
  18109. * @private
  18110. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  18111. * @returns {ArrayBuffer} Returns the cloned array buffer.
  18112. */
  18113. function cloneArrayBuffer(arrayBuffer) {
  18114. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  18115. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  18116. return result;
  18117. }
  18118. /**
  18119. * Creates a clone of `dataView`.
  18120. *
  18121. * @private
  18122. * @param {Object} dataView The data view to clone.
  18123. * @param {boolean} [isDeep] Specify a deep clone.
  18124. * @returns {Object} Returns the cloned data view.
  18125. */
  18126. function cloneDataView(dataView, isDeep) {
  18127. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  18128. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  18129. }
  18130. /**
  18131. * Creates a clone of `regexp`.
  18132. *
  18133. * @private
  18134. * @param {Object} regexp The regexp to clone.
  18135. * @returns {Object} Returns the cloned regexp.
  18136. */
  18137. function cloneRegExp(regexp) {
  18138. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  18139. result.lastIndex = regexp.lastIndex;
  18140. return result;
  18141. }
  18142. /**
  18143. * Creates a clone of the `symbol` object.
  18144. *
  18145. * @private
  18146. * @param {Object} symbol The symbol object to clone.
  18147. * @returns {Object} Returns the cloned symbol object.
  18148. */
  18149. function cloneSymbol(symbol) {
  18150. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  18151. }
  18152. /**
  18153. * Creates a clone of `typedArray`.
  18154. *
  18155. * @private
  18156. * @param {Object} typedArray The typed array to clone.
  18157. * @param {boolean} [isDeep] Specify a deep clone.
  18158. * @returns {Object} Returns the cloned typed array.
  18159. */
  18160. function cloneTypedArray(typedArray, isDeep) {
  18161. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  18162. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  18163. }
  18164. /**
  18165. * Compares values to sort them in ascending order.
  18166. *
  18167. * @private
  18168. * @param {*} value The value to compare.
  18169. * @param {*} other The other value to compare.
  18170. * @returns {number} Returns the sort order indicator for `value`.
  18171. */
  18172. function compareAscending(value, other) {
  18173. if (value !== other) {
  18174. var valIsDefined = value !== undefined,
  18175. valIsNull = value === null,
  18176. valIsReflexive = value === value,
  18177. valIsSymbol = isSymbol(value);
  18178. var othIsDefined = other !== undefined,
  18179. othIsNull = other === null,
  18180. othIsReflexive = other === other,
  18181. othIsSymbol = isSymbol(other);
  18182. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  18183. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  18184. (valIsNull && othIsDefined && othIsReflexive) ||
  18185. (!valIsDefined && othIsReflexive) ||
  18186. !valIsReflexive) {
  18187. return 1;
  18188. }
  18189. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  18190. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  18191. (othIsNull && valIsDefined && valIsReflexive) ||
  18192. (!othIsDefined && valIsReflexive) ||
  18193. !othIsReflexive) {
  18194. return -1;
  18195. }
  18196. }
  18197. return 0;
  18198. }
  18199. /**
  18200. * Used by `_.orderBy` to compare multiple properties of a value to another
  18201. * and stable sort them.
  18202. *
  18203. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  18204. * specify an order of "desc" for descending or "asc" for ascending sort order
  18205. * of corresponding values.
  18206. *
  18207. * @private
  18208. * @param {Object} object The object to compare.
  18209. * @param {Object} other The other object to compare.
  18210. * @param {boolean[]|string[]} orders The order to sort by for each property.
  18211. * @returns {number} Returns the sort order indicator for `object`.
  18212. */
  18213. function compareMultiple(object, other, orders) {
  18214. var index = -1,
  18215. objCriteria = object.criteria,
  18216. othCriteria = other.criteria,
  18217. length = objCriteria.length,
  18218. ordersLength = orders.length;
  18219. while (++index < length) {
  18220. var result = compareAscending(objCriteria[index], othCriteria[index]);
  18221. if (result) {
  18222. if (index >= ordersLength) {
  18223. return result;
  18224. }
  18225. var order = orders[index];
  18226. return result * (order == 'desc' ? -1 : 1);
  18227. }
  18228. }
  18229. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  18230. // that causes it, under certain circumstances, to provide the same value for
  18231. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  18232. // for more details.
  18233. //
  18234. // This also ensures a stable sort in V8 and other engines.
  18235. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  18236. return object.index - other.index;
  18237. }
  18238. /**
  18239. * Creates an array that is the composition of partially applied arguments,
  18240. * placeholders, and provided arguments into a single array of arguments.
  18241. *
  18242. * @private
  18243. * @param {Array} args The provided arguments.
  18244. * @param {Array} partials The arguments to prepend to those provided.
  18245. * @param {Array} holders The `partials` placeholder indexes.
  18246. * @params {boolean} [isCurried] Specify composing for a curried function.
  18247. * @returns {Array} Returns the new array of composed arguments.
  18248. */
  18249. function composeArgs(args, partials, holders, isCurried) {
  18250. var argsIndex = -1,
  18251. argsLength = args.length,
  18252. holdersLength = holders.length,
  18253. leftIndex = -1,
  18254. leftLength = partials.length,
  18255. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18256. result = Array(leftLength + rangeLength),
  18257. isUncurried = !isCurried;
  18258. while (++leftIndex < leftLength) {
  18259. result[leftIndex] = partials[leftIndex];
  18260. }
  18261. while (++argsIndex < holdersLength) {
  18262. if (isUncurried || argsIndex < argsLength) {
  18263. result[holders[argsIndex]] = args[argsIndex];
  18264. }
  18265. }
  18266. while (rangeLength--) {
  18267. result[leftIndex++] = args[argsIndex++];
  18268. }
  18269. return result;
  18270. }
  18271. /**
  18272. * This function is like `composeArgs` except that the arguments composition
  18273. * is tailored for `_.partialRight`.
  18274. *
  18275. * @private
  18276. * @param {Array} args The provided arguments.
  18277. * @param {Array} partials The arguments to append to those provided.
  18278. * @param {Array} holders The `partials` placeholder indexes.
  18279. * @params {boolean} [isCurried] Specify composing for a curried function.
  18280. * @returns {Array} Returns the new array of composed arguments.
  18281. */
  18282. function composeArgsRight(args, partials, holders, isCurried) {
  18283. var argsIndex = -1,
  18284. argsLength = args.length,
  18285. holdersIndex = -1,
  18286. holdersLength = holders.length,
  18287. rightIndex = -1,
  18288. rightLength = partials.length,
  18289. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18290. result = Array(rangeLength + rightLength),
  18291. isUncurried = !isCurried;
  18292. while (++argsIndex < rangeLength) {
  18293. result[argsIndex] = args[argsIndex];
  18294. }
  18295. var offset = argsIndex;
  18296. while (++rightIndex < rightLength) {
  18297. result[offset + rightIndex] = partials[rightIndex];
  18298. }
  18299. while (++holdersIndex < holdersLength) {
  18300. if (isUncurried || argsIndex < argsLength) {
  18301. result[offset + holders[holdersIndex]] = args[argsIndex++];
  18302. }
  18303. }
  18304. return result;
  18305. }
  18306. /**
  18307. * Copies the values of `source` to `array`.
  18308. *
  18309. * @private
  18310. * @param {Array} source The array to copy values from.
  18311. * @param {Array} [array=[]] The array to copy values to.
  18312. * @returns {Array} Returns `array`.
  18313. */
  18314. function copyArray(source, array) {
  18315. var index = -1,
  18316. length = source.length;
  18317. array || (array = Array(length));
  18318. while (++index < length) {
  18319. array[index] = source[index];
  18320. }
  18321. return array;
  18322. }
  18323. /**
  18324. * Copies properties of `source` to `object`.
  18325. *
  18326. * @private
  18327. * @param {Object} source The object to copy properties from.
  18328. * @param {Array} props The property identifiers to copy.
  18329. * @param {Object} [object={}] The object to copy properties to.
  18330. * @param {Function} [customizer] The function to customize copied values.
  18331. * @returns {Object} Returns `object`.
  18332. */
  18333. function copyObject(source, props, object, customizer) {
  18334. var isNew = !object;
  18335. object || (object = {});
  18336. var index = -1,
  18337. length = props.length;
  18338. while (++index < length) {
  18339. var key = props[index];
  18340. var newValue = customizer
  18341. ? customizer(object[key], source[key], key, object, source)
  18342. : undefined;
  18343. if (newValue === undefined) {
  18344. newValue = source[key];
  18345. }
  18346. if (isNew) {
  18347. baseAssignValue(object, key, newValue);
  18348. } else {
  18349. assignValue(object, key, newValue);
  18350. }
  18351. }
  18352. return object;
  18353. }
  18354. /**
  18355. * Copies own symbols of `source` to `object`.
  18356. *
  18357. * @private
  18358. * @param {Object} source The object to copy symbols from.
  18359. * @param {Object} [object={}] The object to copy symbols to.
  18360. * @returns {Object} Returns `object`.
  18361. */
  18362. function copySymbols(source, object) {
  18363. return copyObject(source, getSymbols(source), object);
  18364. }
  18365. /**
  18366. * Copies own and inherited symbols of `source` to `object`.
  18367. *
  18368. * @private
  18369. * @param {Object} source The object to copy symbols from.
  18370. * @param {Object} [object={}] The object to copy symbols to.
  18371. * @returns {Object} Returns `object`.
  18372. */
  18373. function copySymbolsIn(source, object) {
  18374. return copyObject(source, getSymbolsIn(source), object);
  18375. }
  18376. /**
  18377. * Creates a function like `_.groupBy`.
  18378. *
  18379. * @private
  18380. * @param {Function} setter The function to set accumulator values.
  18381. * @param {Function} [initializer] The accumulator object initializer.
  18382. * @returns {Function} Returns the new aggregator function.
  18383. */
  18384. function createAggregator(setter, initializer) {
  18385. return function(collection, iteratee) {
  18386. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  18387. accumulator = initializer ? initializer() : {};
  18388. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  18389. };
  18390. }
  18391. /**
  18392. * Creates a function like `_.assign`.
  18393. *
  18394. * @private
  18395. * @param {Function} assigner The function to assign values.
  18396. * @returns {Function} Returns the new assigner function.
  18397. */
  18398. function createAssigner(assigner) {
  18399. return baseRest(function(object, sources) {
  18400. var index = -1,
  18401. length = sources.length,
  18402. customizer = length > 1 ? sources[length - 1] : undefined,
  18403. guard = length > 2 ? sources[2] : undefined;
  18404. customizer = (assigner.length > 3 && typeof customizer == 'function')
  18405. ? (length--, customizer)
  18406. : undefined;
  18407. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  18408. customizer = length < 3 ? undefined : customizer;
  18409. length = 1;
  18410. }
  18411. object = Object(object);
  18412. while (++index < length) {
  18413. var source = sources[index];
  18414. if (source) {
  18415. assigner(object, source, index, customizer);
  18416. }
  18417. }
  18418. return object;
  18419. });
  18420. }
  18421. /**
  18422. * Creates a `baseEach` or `baseEachRight` function.
  18423. *
  18424. * @private
  18425. * @param {Function} eachFunc The function to iterate over a collection.
  18426. * @param {boolean} [fromRight] Specify iterating from right to left.
  18427. * @returns {Function} Returns the new base function.
  18428. */
  18429. function createBaseEach(eachFunc, fromRight) {
  18430. return function(collection, iteratee) {
  18431. if (collection == null) {
  18432. return collection;
  18433. }
  18434. if (!isArrayLike(collection)) {
  18435. return eachFunc(collection, iteratee);
  18436. }
  18437. var length = collection.length,
  18438. index = fromRight ? length : -1,
  18439. iterable = Object(collection);
  18440. while ((fromRight ? index-- : ++index < length)) {
  18441. if (iteratee(iterable[index], index, iterable) === false) {
  18442. break;
  18443. }
  18444. }
  18445. return collection;
  18446. };
  18447. }
  18448. /**
  18449. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  18450. *
  18451. * @private
  18452. * @param {boolean} [fromRight] Specify iterating from right to left.
  18453. * @returns {Function} Returns the new base function.
  18454. */
  18455. function createBaseFor(fromRight) {
  18456. return function(object, iteratee, keysFunc) {
  18457. var index = -1,
  18458. iterable = Object(object),
  18459. props = keysFunc(object),
  18460. length = props.length;
  18461. while (length--) {
  18462. var key = props[fromRight ? length : ++index];
  18463. if (iteratee(iterable[key], key, iterable) === false) {
  18464. break;
  18465. }
  18466. }
  18467. return object;
  18468. };
  18469. }
  18470. /**
  18471. * Creates a function that wraps `func` to invoke it with the optional `this`
  18472. * binding of `thisArg`.
  18473. *
  18474. * @private
  18475. * @param {Function} func The function to wrap.
  18476. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18477. * @param {*} [thisArg] The `this` binding of `func`.
  18478. * @returns {Function} Returns the new wrapped function.
  18479. */
  18480. function createBind(func, bitmask, thisArg) {
  18481. var isBind = bitmask & WRAP_BIND_FLAG,
  18482. Ctor = createCtor(func);
  18483. function wrapper() {
  18484. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18485. return fn.apply(isBind ? thisArg : this, arguments);
  18486. }
  18487. return wrapper;
  18488. }
  18489. /**
  18490. * Creates a function like `_.lowerFirst`.
  18491. *
  18492. * @private
  18493. * @param {string} methodName The name of the `String` case method to use.
  18494. * @returns {Function} Returns the new case function.
  18495. */
  18496. function createCaseFirst(methodName) {
  18497. return function(string) {
  18498. string = toString(string);
  18499. var strSymbols = hasUnicode(string)
  18500. ? stringToArray(string)
  18501. : undefined;
  18502. var chr = strSymbols
  18503. ? strSymbols[0]
  18504. : string.charAt(0);
  18505. var trailing = strSymbols
  18506. ? castSlice(strSymbols, 1).join('')
  18507. : string.slice(1);
  18508. return chr[methodName]() + trailing;
  18509. };
  18510. }
  18511. /**
  18512. * Creates a function like `_.camelCase`.
  18513. *
  18514. * @private
  18515. * @param {Function} callback The function to combine each word.
  18516. * @returns {Function} Returns the new compounder function.
  18517. */
  18518. function createCompounder(callback) {
  18519. return function(string) {
  18520. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  18521. };
  18522. }
  18523. /**
  18524. * Creates a function that produces an instance of `Ctor` regardless of
  18525. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  18526. *
  18527. * @private
  18528. * @param {Function} Ctor The constructor to wrap.
  18529. * @returns {Function} Returns the new wrapped function.
  18530. */
  18531. function createCtor(Ctor) {
  18532. return function() {
  18533. // Use a `switch` statement to work with class constructors. See
  18534. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  18535. // for more details.
  18536. var args = arguments;
  18537. switch (args.length) {
  18538. case 0: return new Ctor;
  18539. case 1: return new Ctor(args[0]);
  18540. case 2: return new Ctor(args[0], args[1]);
  18541. case 3: return new Ctor(args[0], args[1], args[2]);
  18542. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  18543. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  18544. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  18545. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  18546. }
  18547. var thisBinding = baseCreate(Ctor.prototype),
  18548. result = Ctor.apply(thisBinding, args);
  18549. // Mimic the constructor's `return` behavior.
  18550. // See https://es5.github.io/#x13.2.2 for more details.
  18551. return isObject(result) ? result : thisBinding;
  18552. };
  18553. }
  18554. /**
  18555. * Creates a function that wraps `func` to enable currying.
  18556. *
  18557. * @private
  18558. * @param {Function} func The function to wrap.
  18559. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18560. * @param {number} arity The arity of `func`.
  18561. * @returns {Function} Returns the new wrapped function.
  18562. */
  18563. function createCurry(func, bitmask, arity) {
  18564. var Ctor = createCtor(func);
  18565. function wrapper() {
  18566. var length = arguments.length,
  18567. args = Array(length),
  18568. index = length,
  18569. placeholder = getHolder(wrapper);
  18570. while (index--) {
  18571. args[index] = arguments[index];
  18572. }
  18573. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  18574. ? []
  18575. : replaceHolders(args, placeholder);
  18576. length -= holders.length;
  18577. if (length < arity) {
  18578. return createRecurry(
  18579. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  18580. args, holders, undefined, undefined, arity - length);
  18581. }
  18582. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18583. return apply(fn, this, args);
  18584. }
  18585. return wrapper;
  18586. }
  18587. /**
  18588. * Creates a `_.find` or `_.findLast` function.
  18589. *
  18590. * @private
  18591. * @param {Function} findIndexFunc The function to find the collection index.
  18592. * @returns {Function} Returns the new find function.
  18593. */
  18594. function createFind(findIndexFunc) {
  18595. return function(collection, predicate, fromIndex) {
  18596. var iterable = Object(collection);
  18597. if (!isArrayLike(collection)) {
  18598. var iteratee = getIteratee(predicate, 3);
  18599. collection = keys(collection);
  18600. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  18601. }
  18602. var index = findIndexFunc(collection, predicate, fromIndex);
  18603. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  18604. };
  18605. }
  18606. /**
  18607. * Creates a `_.flow` or `_.flowRight` function.
  18608. *
  18609. * @private
  18610. * @param {boolean} [fromRight] Specify iterating from right to left.
  18611. * @returns {Function} Returns the new flow function.
  18612. */
  18613. function createFlow(fromRight) {
  18614. return flatRest(function(funcs) {
  18615. var length = funcs.length,
  18616. index = length,
  18617. prereq = LodashWrapper.prototype.thru;
  18618. if (fromRight) {
  18619. funcs.reverse();
  18620. }
  18621. while (index--) {
  18622. var func = funcs[index];
  18623. if (typeof func != 'function') {
  18624. throw new TypeError(FUNC_ERROR_TEXT);
  18625. }
  18626. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  18627. var wrapper = new LodashWrapper([], true);
  18628. }
  18629. }
  18630. index = wrapper ? index : length;
  18631. while (++index < length) {
  18632. func = funcs[index];
  18633. var funcName = getFuncName(func),
  18634. data = funcName == 'wrapper' ? getData(func) : undefined;
  18635. if (data && isLaziable(data[0]) &&
  18636. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  18637. !data[4].length && data[9] == 1
  18638. ) {
  18639. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  18640. } else {
  18641. wrapper = (func.length == 1 && isLaziable(func))
  18642. ? wrapper[funcName]()
  18643. : wrapper.thru(func);
  18644. }
  18645. }
  18646. return function() {
  18647. var args = arguments,
  18648. value = args[0];
  18649. if (wrapper && args.length == 1 && isArray(value)) {
  18650. return wrapper.plant(value).value();
  18651. }
  18652. var index = 0,
  18653. result = length ? funcs[index].apply(this, args) : value;
  18654. while (++index < length) {
  18655. result = funcs[index].call(this, result);
  18656. }
  18657. return result;
  18658. };
  18659. });
  18660. }
  18661. /**
  18662. * Creates a function that wraps `func` to invoke it with optional `this`
  18663. * binding of `thisArg`, partial application, and currying.
  18664. *
  18665. * @private
  18666. * @param {Function|string} func The function or method name to wrap.
  18667. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18668. * @param {*} [thisArg] The `this` binding of `func`.
  18669. * @param {Array} [partials] The arguments to prepend to those provided to
  18670. * the new function.
  18671. * @param {Array} [holders] The `partials` placeholder indexes.
  18672. * @param {Array} [partialsRight] The arguments to append to those provided
  18673. * to the new function.
  18674. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  18675. * @param {Array} [argPos] The argument positions of the new function.
  18676. * @param {number} [ary] The arity cap of `func`.
  18677. * @param {number} [arity] The arity of `func`.
  18678. * @returns {Function} Returns the new wrapped function.
  18679. */
  18680. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  18681. var isAry = bitmask & WRAP_ARY_FLAG,
  18682. isBind = bitmask & WRAP_BIND_FLAG,
  18683. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  18684. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  18685. isFlip = bitmask & WRAP_FLIP_FLAG,
  18686. Ctor = isBindKey ? undefined : createCtor(func);
  18687. function wrapper() {
  18688. var length = arguments.length,
  18689. args = Array(length),
  18690. index = length;
  18691. while (index--) {
  18692. args[index] = arguments[index];
  18693. }
  18694. if (isCurried) {
  18695. var placeholder = getHolder(wrapper),
  18696. holdersCount = countHolders(args, placeholder);
  18697. }
  18698. if (partials) {
  18699. args = composeArgs(args, partials, holders, isCurried);
  18700. }
  18701. if (partialsRight) {
  18702. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  18703. }
  18704. length -= holdersCount;
  18705. if (isCurried && length < arity) {
  18706. var newHolders = replaceHolders(args, placeholder);
  18707. return createRecurry(
  18708. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  18709. args, newHolders, argPos, ary, arity - length
  18710. );
  18711. }
  18712. var thisBinding = isBind ? thisArg : this,
  18713. fn = isBindKey ? thisBinding[func] : func;
  18714. length = args.length;
  18715. if (argPos) {
  18716. args = reorder(args, argPos);
  18717. } else if (isFlip && length > 1) {
  18718. args.reverse();
  18719. }
  18720. if (isAry && ary < length) {
  18721. args.length = ary;
  18722. }
  18723. if (this && this !== root && this instanceof wrapper) {
  18724. fn = Ctor || createCtor(fn);
  18725. }
  18726. return fn.apply(thisBinding, args);
  18727. }
  18728. return wrapper;
  18729. }
  18730. /**
  18731. * Creates a function like `_.invertBy`.
  18732. *
  18733. * @private
  18734. * @param {Function} setter The function to set accumulator values.
  18735. * @param {Function} toIteratee The function to resolve iteratees.
  18736. * @returns {Function} Returns the new inverter function.
  18737. */
  18738. function createInverter(setter, toIteratee) {
  18739. return function(object, iteratee) {
  18740. return baseInverter(object, setter, toIteratee(iteratee), {});
  18741. };
  18742. }
  18743. /**
  18744. * Creates a function that performs a mathematical operation on two values.
  18745. *
  18746. * @private
  18747. * @param {Function} operator The function to perform the operation.
  18748. * @param {number} [defaultValue] The value used for `undefined` arguments.
  18749. * @returns {Function} Returns the new mathematical operation function.
  18750. */
  18751. function createMathOperation(operator, defaultValue) {
  18752. return function(value, other) {
  18753. var result;
  18754. if (value === undefined && other === undefined) {
  18755. return defaultValue;
  18756. }
  18757. if (value !== undefined) {
  18758. result = value;
  18759. }
  18760. if (other !== undefined) {
  18761. if (result === undefined) {
  18762. return other;
  18763. }
  18764. if (typeof value == 'string' || typeof other == 'string') {
  18765. value = baseToString(value);
  18766. other = baseToString(other);
  18767. } else {
  18768. value = baseToNumber(value);
  18769. other = baseToNumber(other);
  18770. }
  18771. result = operator(value, other);
  18772. }
  18773. return result;
  18774. };
  18775. }
  18776. /**
  18777. * Creates a function like `_.over`.
  18778. *
  18779. * @private
  18780. * @param {Function} arrayFunc The function to iterate over iteratees.
  18781. * @returns {Function} Returns the new over function.
  18782. */
  18783. function createOver(arrayFunc) {
  18784. return flatRest(function(iteratees) {
  18785. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  18786. return baseRest(function(args) {
  18787. var thisArg = this;
  18788. return arrayFunc(iteratees, function(iteratee) {
  18789. return apply(iteratee, thisArg, args);
  18790. });
  18791. });
  18792. });
  18793. }
  18794. /**
  18795. * Creates the padding for `string` based on `length`. The `chars` string
  18796. * is truncated if the number of characters exceeds `length`.
  18797. *
  18798. * @private
  18799. * @param {number} length The padding length.
  18800. * @param {string} [chars=' '] The string used as padding.
  18801. * @returns {string} Returns the padding for `string`.
  18802. */
  18803. function createPadding(length, chars) {
  18804. chars = chars === undefined ? ' ' : baseToString(chars);
  18805. var charsLength = chars.length;
  18806. if (charsLength < 2) {
  18807. return charsLength ? baseRepeat(chars, length) : chars;
  18808. }
  18809. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  18810. return hasUnicode(chars)
  18811. ? castSlice(stringToArray(result), 0, length).join('')
  18812. : result.slice(0, length);
  18813. }
  18814. /**
  18815. * Creates a function that wraps `func` to invoke it with the `this` binding
  18816. * of `thisArg` and `partials` prepended to the arguments it receives.
  18817. *
  18818. * @private
  18819. * @param {Function} func The function to wrap.
  18820. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18821. * @param {*} thisArg The `this` binding of `func`.
  18822. * @param {Array} partials The arguments to prepend to those provided to
  18823. * the new function.
  18824. * @returns {Function} Returns the new wrapped function.
  18825. */
  18826. function createPartial(func, bitmask, thisArg, partials) {
  18827. var isBind = bitmask & WRAP_BIND_FLAG,
  18828. Ctor = createCtor(func);
  18829. function wrapper() {
  18830. var argsIndex = -1,
  18831. argsLength = arguments.length,
  18832. leftIndex = -1,
  18833. leftLength = partials.length,
  18834. args = Array(leftLength + argsLength),
  18835. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18836. while (++leftIndex < leftLength) {
  18837. args[leftIndex] = partials[leftIndex];
  18838. }
  18839. while (argsLength--) {
  18840. args[leftIndex++] = arguments[++argsIndex];
  18841. }
  18842. return apply(fn, isBind ? thisArg : this, args);
  18843. }
  18844. return wrapper;
  18845. }
  18846. /**
  18847. * Creates a `_.range` or `_.rangeRight` function.
  18848. *
  18849. * @private
  18850. * @param {boolean} [fromRight] Specify iterating from right to left.
  18851. * @returns {Function} Returns the new range function.
  18852. */
  18853. function createRange(fromRight) {
  18854. return function(start, end, step) {
  18855. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  18856. end = step = undefined;
  18857. }
  18858. // Ensure the sign of `-0` is preserved.
  18859. start = toFinite(start);
  18860. if (end === undefined) {
  18861. end = start;
  18862. start = 0;
  18863. } else {
  18864. end = toFinite(end);
  18865. }
  18866. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  18867. return baseRange(start, end, step, fromRight);
  18868. };
  18869. }
  18870. /**
  18871. * Creates a function that performs a relational operation on two values.
  18872. *
  18873. * @private
  18874. * @param {Function} operator The function to perform the operation.
  18875. * @returns {Function} Returns the new relational operation function.
  18876. */
  18877. function createRelationalOperation(operator) {
  18878. return function(value, other) {
  18879. if (!(typeof value == 'string' && typeof other == 'string')) {
  18880. value = toNumber(value);
  18881. other = toNumber(other);
  18882. }
  18883. return operator(value, other);
  18884. };
  18885. }
  18886. /**
  18887. * Creates a function that wraps `func` to continue currying.
  18888. *
  18889. * @private
  18890. * @param {Function} func The function to wrap.
  18891. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18892. * @param {Function} wrapFunc The function to create the `func` wrapper.
  18893. * @param {*} placeholder The placeholder value.
  18894. * @param {*} [thisArg] The `this` binding of `func`.
  18895. * @param {Array} [partials] The arguments to prepend to those provided to
  18896. * the new function.
  18897. * @param {Array} [holders] The `partials` placeholder indexes.
  18898. * @param {Array} [argPos] The argument positions of the new function.
  18899. * @param {number} [ary] The arity cap of `func`.
  18900. * @param {number} [arity] The arity of `func`.
  18901. * @returns {Function} Returns the new wrapped function.
  18902. */
  18903. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  18904. var isCurry = bitmask & WRAP_CURRY_FLAG,
  18905. newHolders = isCurry ? holders : undefined,
  18906. newHoldersRight = isCurry ? undefined : holders,
  18907. newPartials = isCurry ? partials : undefined,
  18908. newPartialsRight = isCurry ? undefined : partials;
  18909. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  18910. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  18911. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  18912. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  18913. }
  18914. var newData = [
  18915. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  18916. newHoldersRight, argPos, ary, arity
  18917. ];
  18918. var result = wrapFunc.apply(undefined, newData);
  18919. if (isLaziable(func)) {
  18920. setData(result, newData);
  18921. }
  18922. result.placeholder = placeholder;
  18923. return setWrapToString(result, func, bitmask);
  18924. }
  18925. /**
  18926. * Creates a function like `_.round`.
  18927. *
  18928. * @private
  18929. * @param {string} methodName The name of the `Math` method to use when rounding.
  18930. * @returns {Function} Returns the new round function.
  18931. */
  18932. function createRound(methodName) {
  18933. var func = Math[methodName];
  18934. return function(number, precision) {
  18935. number = toNumber(number);
  18936. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  18937. if (precision && nativeIsFinite(number)) {
  18938. // Shift with exponential notation to avoid floating-point issues.
  18939. // See [MDN](https://mdn.io/round#Examples) for more details.
  18940. var pair = (toString(number) + 'e').split('e'),
  18941. value = func(pair[0] + 'e' + (+pair[1] + precision));
  18942. pair = (toString(value) + 'e').split('e');
  18943. return +(pair[0] + 'e' + (+pair[1] - precision));
  18944. }
  18945. return func(number);
  18946. };
  18947. }
  18948. /**
  18949. * Creates a set object of `values`.
  18950. *
  18951. * @private
  18952. * @param {Array} values The values to add to the set.
  18953. * @returns {Object} Returns the new set.
  18954. */
  18955. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  18956. return new Set(values);
  18957. };
  18958. /**
  18959. * Creates a `_.toPairs` or `_.toPairsIn` function.
  18960. *
  18961. * @private
  18962. * @param {Function} keysFunc The function to get the keys of a given object.
  18963. * @returns {Function} Returns the new pairs function.
  18964. */
  18965. function createToPairs(keysFunc) {
  18966. return function(object) {
  18967. var tag = getTag(object);
  18968. if (tag == mapTag) {
  18969. return mapToArray(object);
  18970. }
  18971. if (tag == setTag) {
  18972. return setToPairs(object);
  18973. }
  18974. return baseToPairs(object, keysFunc(object));
  18975. };
  18976. }
  18977. /**
  18978. * Creates a function that either curries or invokes `func` with optional
  18979. * `this` binding and partially applied arguments.
  18980. *
  18981. * @private
  18982. * @param {Function|string} func The function or method name to wrap.
  18983. * @param {number} bitmask The bitmask flags.
  18984. * 1 - `_.bind`
  18985. * 2 - `_.bindKey`
  18986. * 4 - `_.curry` or `_.curryRight` of a bound function
  18987. * 8 - `_.curry`
  18988. * 16 - `_.curryRight`
  18989. * 32 - `_.partial`
  18990. * 64 - `_.partialRight`
  18991. * 128 - `_.rearg`
  18992. * 256 - `_.ary`
  18993. * 512 - `_.flip`
  18994. * @param {*} [thisArg] The `this` binding of `func`.
  18995. * @param {Array} [partials] The arguments to be partially applied.
  18996. * @param {Array} [holders] The `partials` placeholder indexes.
  18997. * @param {Array} [argPos] The argument positions of the new function.
  18998. * @param {number} [ary] The arity cap of `func`.
  18999. * @param {number} [arity] The arity of `func`.
  19000. * @returns {Function} Returns the new wrapped function.
  19001. */
  19002. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  19003. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  19004. if (!isBindKey && typeof func != 'function') {
  19005. throw new TypeError(FUNC_ERROR_TEXT);
  19006. }
  19007. var length = partials ? partials.length : 0;
  19008. if (!length) {
  19009. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  19010. partials = holders = undefined;
  19011. }
  19012. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  19013. arity = arity === undefined ? arity : toInteger(arity);
  19014. length -= holders ? holders.length : 0;
  19015. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  19016. var partialsRight = partials,
  19017. holdersRight = holders;
  19018. partials = holders = undefined;
  19019. }
  19020. var data = isBindKey ? undefined : getData(func);
  19021. var newData = [
  19022. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  19023. argPos, ary, arity
  19024. ];
  19025. if (data) {
  19026. mergeData(newData, data);
  19027. }
  19028. func = newData[0];
  19029. bitmask = newData[1];
  19030. thisArg = newData[2];
  19031. partials = newData[3];
  19032. holders = newData[4];
  19033. arity = newData[9] = newData[9] === undefined
  19034. ? (isBindKey ? 0 : func.length)
  19035. : nativeMax(newData[9] - length, 0);
  19036. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  19037. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  19038. }
  19039. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  19040. var result = createBind(func, bitmask, thisArg);
  19041. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  19042. result = createCurry(func, bitmask, arity);
  19043. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  19044. result = createPartial(func, bitmask, thisArg, partials);
  19045. } else {
  19046. result = createHybrid.apply(undefined, newData);
  19047. }
  19048. var setter = data ? baseSetData : setData;
  19049. return setWrapToString(setter(result, newData), func, bitmask);
  19050. }
  19051. /**
  19052. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  19053. * of source objects to the destination object for all destination properties
  19054. * that resolve to `undefined`.
  19055. *
  19056. * @private
  19057. * @param {*} objValue The destination value.
  19058. * @param {*} srcValue The source value.
  19059. * @param {string} key The key of the property to assign.
  19060. * @param {Object} object The parent object of `objValue`.
  19061. * @returns {*} Returns the value to assign.
  19062. */
  19063. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  19064. if (objValue === undefined ||
  19065. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  19066. return srcValue;
  19067. }
  19068. return objValue;
  19069. }
  19070. /**
  19071. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  19072. * objects into destination objects that are passed thru.
  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 merge.
  19078. * @param {Object} object The parent object of `objValue`.
  19079. * @param {Object} source The parent object of `srcValue`.
  19080. * @param {Object} [stack] Tracks traversed source values and their merged
  19081. * counterparts.
  19082. * @returns {*} Returns the value to assign.
  19083. */
  19084. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  19085. if (isObject(objValue) && isObject(srcValue)) {
  19086. // Recursively merge objects and arrays (susceptible to call stack limits).
  19087. stack.set(srcValue, objValue);
  19088. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  19089. stack['delete'](srcValue);
  19090. }
  19091. return objValue;
  19092. }
  19093. /**
  19094. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  19095. * objects.
  19096. *
  19097. * @private
  19098. * @param {*} value The value to inspect.
  19099. * @param {string} key The key of the property to inspect.
  19100. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  19101. */
  19102. function customOmitClone(value) {
  19103. return isPlainObject(value) ? undefined : value;
  19104. }
  19105. /**
  19106. * A specialized version of `baseIsEqualDeep` for arrays with support for
  19107. * partial deep comparisons.
  19108. *
  19109. * @private
  19110. * @param {Array} array The array to compare.
  19111. * @param {Array} other The other array to compare.
  19112. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19113. * @param {Function} customizer The function to customize comparisons.
  19114. * @param {Function} equalFunc The function to determine equivalents of values.
  19115. * @param {Object} stack Tracks traversed `array` and `other` objects.
  19116. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  19117. */
  19118. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  19119. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19120. arrLength = array.length,
  19121. othLength = other.length;
  19122. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  19123. return false;
  19124. }
  19125. // Check that cyclic values are equal.
  19126. var arrStacked = stack.get(array);
  19127. var othStacked = stack.get(other);
  19128. if (arrStacked && othStacked) {
  19129. return arrStacked == other && othStacked == array;
  19130. }
  19131. var index = -1,
  19132. result = true,
  19133. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  19134. stack.set(array, other);
  19135. stack.set(other, array);
  19136. // Ignore non-index properties.
  19137. while (++index < arrLength) {
  19138. var arrValue = array[index],
  19139. othValue = other[index];
  19140. if (customizer) {
  19141. var compared = isPartial
  19142. ? customizer(othValue, arrValue, index, other, array, stack)
  19143. : customizer(arrValue, othValue, index, array, other, stack);
  19144. }
  19145. if (compared !== undefined) {
  19146. if (compared) {
  19147. continue;
  19148. }
  19149. result = false;
  19150. break;
  19151. }
  19152. // Recursively compare arrays (susceptible to call stack limits).
  19153. if (seen) {
  19154. if (!arraySome(other, function(othValue, othIndex) {
  19155. if (!cacheHas(seen, othIndex) &&
  19156. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  19157. return seen.push(othIndex);
  19158. }
  19159. })) {
  19160. result = false;
  19161. break;
  19162. }
  19163. } else if (!(
  19164. arrValue === othValue ||
  19165. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  19166. )) {
  19167. result = false;
  19168. break;
  19169. }
  19170. }
  19171. stack['delete'](array);
  19172. stack['delete'](other);
  19173. return result;
  19174. }
  19175. /**
  19176. * A specialized version of `baseIsEqualDeep` for comparing objects of
  19177. * the same `toStringTag`.
  19178. *
  19179. * **Note:** This function only supports comparing values with tags of
  19180. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  19181. *
  19182. * @private
  19183. * @param {Object} object The object to compare.
  19184. * @param {Object} other The other object to compare.
  19185. * @param {string} tag The `toStringTag` of the objects to compare.
  19186. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19187. * @param {Function} customizer The function to customize comparisons.
  19188. * @param {Function} equalFunc The function to determine equivalents of values.
  19189. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19190. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19191. */
  19192. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  19193. switch (tag) {
  19194. case dataViewTag:
  19195. if ((object.byteLength != other.byteLength) ||
  19196. (object.byteOffset != other.byteOffset)) {
  19197. return false;
  19198. }
  19199. object = object.buffer;
  19200. other = other.buffer;
  19201. case arrayBufferTag:
  19202. if ((object.byteLength != other.byteLength) ||
  19203. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  19204. return false;
  19205. }
  19206. return true;
  19207. case boolTag:
  19208. case dateTag:
  19209. case numberTag:
  19210. // Coerce booleans to `1` or `0` and dates to milliseconds.
  19211. // Invalid dates are coerced to `NaN`.
  19212. return eq(+object, +other);
  19213. case errorTag:
  19214. return object.name == other.name && object.message == other.message;
  19215. case regexpTag:
  19216. case stringTag:
  19217. // Coerce regexes to strings and treat strings, primitives and objects,
  19218. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  19219. // for more details.
  19220. return object == (other + '');
  19221. case mapTag:
  19222. var convert = mapToArray;
  19223. case setTag:
  19224. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  19225. convert || (convert = setToArray);
  19226. if (object.size != other.size && !isPartial) {
  19227. return false;
  19228. }
  19229. // Assume cyclic values are equal.
  19230. var stacked = stack.get(object);
  19231. if (stacked) {
  19232. return stacked == other;
  19233. }
  19234. bitmask |= COMPARE_UNORDERED_FLAG;
  19235. // Recursively compare objects (susceptible to call stack limits).
  19236. stack.set(object, other);
  19237. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  19238. stack['delete'](object);
  19239. return result;
  19240. case symbolTag:
  19241. if (symbolValueOf) {
  19242. return symbolValueOf.call(object) == symbolValueOf.call(other);
  19243. }
  19244. }
  19245. return false;
  19246. }
  19247. /**
  19248. * A specialized version of `baseIsEqualDeep` for objects with support for
  19249. * partial deep comparisons.
  19250. *
  19251. * @private
  19252. * @param {Object} object The object to compare.
  19253. * @param {Object} other The other object to compare.
  19254. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19255. * @param {Function} customizer The function to customize comparisons.
  19256. * @param {Function} equalFunc The function to determine equivalents of values.
  19257. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19258. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19259. */
  19260. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  19261. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19262. objProps = getAllKeys(object),
  19263. objLength = objProps.length,
  19264. othProps = getAllKeys(other),
  19265. othLength = othProps.length;
  19266. if (objLength != othLength && !isPartial) {
  19267. return false;
  19268. }
  19269. var index = objLength;
  19270. while (index--) {
  19271. var key = objProps[index];
  19272. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  19273. return false;
  19274. }
  19275. }
  19276. // Check that cyclic values are equal.
  19277. var objStacked = stack.get(object);
  19278. var othStacked = stack.get(other);
  19279. if (objStacked && othStacked) {
  19280. return objStacked == other && othStacked == object;
  19281. }
  19282. var result = true;
  19283. stack.set(object, other);
  19284. stack.set(other, object);
  19285. var skipCtor = isPartial;
  19286. while (++index < objLength) {
  19287. key = objProps[index];
  19288. var objValue = object[key],
  19289. othValue = other[key];
  19290. if (customizer) {
  19291. var compared = isPartial
  19292. ? customizer(othValue, objValue, key, other, object, stack)
  19293. : customizer(objValue, othValue, key, object, other, stack);
  19294. }
  19295. // Recursively compare objects (susceptible to call stack limits).
  19296. if (!(compared === undefined
  19297. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  19298. : compared
  19299. )) {
  19300. result = false;
  19301. break;
  19302. }
  19303. skipCtor || (skipCtor = key == 'constructor');
  19304. }
  19305. if (result && !skipCtor) {
  19306. var objCtor = object.constructor,
  19307. othCtor = other.constructor;
  19308. // Non `Object` object instances with different constructors are not equal.
  19309. if (objCtor != othCtor &&
  19310. ('constructor' in object && 'constructor' in other) &&
  19311. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  19312. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  19313. result = false;
  19314. }
  19315. }
  19316. stack['delete'](object);
  19317. stack['delete'](other);
  19318. return result;
  19319. }
  19320. /**
  19321. * A specialized version of `baseRest` which flattens the rest array.
  19322. *
  19323. * @private
  19324. * @param {Function} func The function to apply a rest parameter to.
  19325. * @returns {Function} Returns the new function.
  19326. */
  19327. function flatRest(func) {
  19328. return setToString(overRest(func, undefined, flatten), func + '');
  19329. }
  19330. /**
  19331. * Creates an array of own enumerable property names and symbols of `object`.
  19332. *
  19333. * @private
  19334. * @param {Object} object The object to query.
  19335. * @returns {Array} Returns the array of property names and symbols.
  19336. */
  19337. function getAllKeys(object) {
  19338. return baseGetAllKeys(object, keys, getSymbols);
  19339. }
  19340. /**
  19341. * Creates an array of own and inherited enumerable property names and
  19342. * symbols of `object`.
  19343. *
  19344. * @private
  19345. * @param {Object} object The object to query.
  19346. * @returns {Array} Returns the array of property names and symbols.
  19347. */
  19348. function getAllKeysIn(object) {
  19349. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  19350. }
  19351. /**
  19352. * Gets metadata for `func`.
  19353. *
  19354. * @private
  19355. * @param {Function} func The function to query.
  19356. * @returns {*} Returns the metadata for `func`.
  19357. */
  19358. var getData = !metaMap ? noop : function(func) {
  19359. return metaMap.get(func);
  19360. };
  19361. /**
  19362. * Gets the name of `func`.
  19363. *
  19364. * @private
  19365. * @param {Function} func The function to query.
  19366. * @returns {string} Returns the function name.
  19367. */
  19368. function getFuncName(func) {
  19369. var result = (func.name + ''),
  19370. array = realNames[result],
  19371. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  19372. while (length--) {
  19373. var data = array[length],
  19374. otherFunc = data.func;
  19375. if (otherFunc == null || otherFunc == func) {
  19376. return data.name;
  19377. }
  19378. }
  19379. return result;
  19380. }
  19381. /**
  19382. * Gets the argument placeholder value for `func`.
  19383. *
  19384. * @private
  19385. * @param {Function} func The function to inspect.
  19386. * @returns {*} Returns the placeholder value.
  19387. */
  19388. function getHolder(func) {
  19389. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  19390. return object.placeholder;
  19391. }
  19392. /**
  19393. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  19394. * this function returns the custom method, otherwise it returns `baseIteratee`.
  19395. * If arguments are provided, the chosen function is invoked with them and
  19396. * its result is returned.
  19397. *
  19398. * @private
  19399. * @param {*} [value] The value to convert to an iteratee.
  19400. * @param {number} [arity] The arity of the created iteratee.
  19401. * @returns {Function} Returns the chosen function or its result.
  19402. */
  19403. function getIteratee() {
  19404. var result = lodash.iteratee || iteratee;
  19405. result = result === iteratee ? baseIteratee : result;
  19406. return arguments.length ? result(arguments[0], arguments[1]) : result;
  19407. }
  19408. /**
  19409. * Gets the data for `map`.
  19410. *
  19411. * @private
  19412. * @param {Object} map The map to query.
  19413. * @param {string} key The reference key.
  19414. * @returns {*} Returns the map data.
  19415. */
  19416. function getMapData(map, key) {
  19417. var data = map.__data__;
  19418. return isKeyable(key)
  19419. ? data[typeof key == 'string' ? 'string' : 'hash']
  19420. : data.map;
  19421. }
  19422. /**
  19423. * Gets the property names, values, and compare flags of `object`.
  19424. *
  19425. * @private
  19426. * @param {Object} object The object to query.
  19427. * @returns {Array} Returns the match data of `object`.
  19428. */
  19429. function getMatchData(object) {
  19430. var result = keys(object),
  19431. length = result.length;
  19432. while (length--) {
  19433. var key = result[length],
  19434. value = object[key];
  19435. result[length] = [key, value, isStrictComparable(value)];
  19436. }
  19437. return result;
  19438. }
  19439. /**
  19440. * Gets the native function at `key` of `object`.
  19441. *
  19442. * @private
  19443. * @param {Object} object The object to query.
  19444. * @param {string} key The key of the method to get.
  19445. * @returns {*} Returns the function if it's native, else `undefined`.
  19446. */
  19447. function getNative(object, key) {
  19448. var value = getValue(object, key);
  19449. return baseIsNative(value) ? value : undefined;
  19450. }
  19451. /**
  19452. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  19453. *
  19454. * @private
  19455. * @param {*} value The value to query.
  19456. * @returns {string} Returns the raw `toStringTag`.
  19457. */
  19458. function getRawTag(value) {
  19459. var isOwn = hasOwnProperty.call(value, symToStringTag),
  19460. tag = value[symToStringTag];
  19461. try {
  19462. value[symToStringTag] = undefined;
  19463. var unmasked = true;
  19464. } catch (e) {}
  19465. var result = nativeObjectToString.call(value);
  19466. if (unmasked) {
  19467. if (isOwn) {
  19468. value[symToStringTag] = tag;
  19469. } else {
  19470. delete value[symToStringTag];
  19471. }
  19472. }
  19473. return result;
  19474. }
  19475. /**
  19476. * Creates an array of the own enumerable symbols of `object`.
  19477. *
  19478. * @private
  19479. * @param {Object} object The object to query.
  19480. * @returns {Array} Returns the array of symbols.
  19481. */
  19482. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  19483. if (object == null) {
  19484. return [];
  19485. }
  19486. object = Object(object);
  19487. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  19488. return propertyIsEnumerable.call(object, symbol);
  19489. });
  19490. };
  19491. /**
  19492. * Creates an array of the own and inherited enumerable symbols of `object`.
  19493. *
  19494. * @private
  19495. * @param {Object} object The object to query.
  19496. * @returns {Array} Returns the array of symbols.
  19497. */
  19498. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  19499. var result = [];
  19500. while (object) {
  19501. arrayPush(result, getSymbols(object));
  19502. object = getPrototype(object);
  19503. }
  19504. return result;
  19505. };
  19506. /**
  19507. * Gets the `toStringTag` of `value`.
  19508. *
  19509. * @private
  19510. * @param {*} value The value to query.
  19511. * @returns {string} Returns the `toStringTag`.
  19512. */
  19513. var getTag = baseGetTag;
  19514. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  19515. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  19516. (Map && getTag(new Map) != mapTag) ||
  19517. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  19518. (Set && getTag(new Set) != setTag) ||
  19519. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  19520. getTag = function(value) {
  19521. var result = baseGetTag(value),
  19522. Ctor = result == objectTag ? value.constructor : undefined,
  19523. ctorString = Ctor ? toSource(Ctor) : '';
  19524. if (ctorString) {
  19525. switch (ctorString) {
  19526. case dataViewCtorString: return dataViewTag;
  19527. case mapCtorString: return mapTag;
  19528. case promiseCtorString: return promiseTag;
  19529. case setCtorString: return setTag;
  19530. case weakMapCtorString: return weakMapTag;
  19531. }
  19532. }
  19533. return result;
  19534. };
  19535. }
  19536. /**
  19537. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  19538. *
  19539. * @private
  19540. * @param {number} start The start of the view.
  19541. * @param {number} end The end of the view.
  19542. * @param {Array} transforms The transformations to apply to the view.
  19543. * @returns {Object} Returns an object containing the `start` and `end`
  19544. * positions of the view.
  19545. */
  19546. function getView(start, end, transforms) {
  19547. var index = -1,
  19548. length = transforms.length;
  19549. while (++index < length) {
  19550. var data = transforms[index],
  19551. size = data.size;
  19552. switch (data.type) {
  19553. case 'drop': start += size; break;
  19554. case 'dropRight': end -= size; break;
  19555. case 'take': end = nativeMin(end, start + size); break;
  19556. case 'takeRight': start = nativeMax(start, end - size); break;
  19557. }
  19558. }
  19559. return { 'start': start, 'end': end };
  19560. }
  19561. /**
  19562. * Extracts wrapper details from the `source` body comment.
  19563. *
  19564. * @private
  19565. * @param {string} source The source to inspect.
  19566. * @returns {Array} Returns the wrapper details.
  19567. */
  19568. function getWrapDetails(source) {
  19569. var match = source.match(reWrapDetails);
  19570. return match ? match[1].split(reSplitDetails) : [];
  19571. }
  19572. /**
  19573. * Checks if `path` exists on `object`.
  19574. *
  19575. * @private
  19576. * @param {Object} object The object to query.
  19577. * @param {Array|string} path The path to check.
  19578. * @param {Function} hasFunc The function to check properties.
  19579. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  19580. */
  19581. function hasPath(object, path, hasFunc) {
  19582. path = castPath(path, object);
  19583. var index = -1,
  19584. length = path.length,
  19585. result = false;
  19586. while (++index < length) {
  19587. var key = toKey(path[index]);
  19588. if (!(result = object != null && hasFunc(object, key))) {
  19589. break;
  19590. }
  19591. object = object[key];
  19592. }
  19593. if (result || ++index != length) {
  19594. return result;
  19595. }
  19596. length = object == null ? 0 : object.length;
  19597. return !!length && isLength(length) && isIndex(key, length) &&
  19598. (isArray(object) || isArguments(object));
  19599. }
  19600. /**
  19601. * Initializes an array clone.
  19602. *
  19603. * @private
  19604. * @param {Array} array The array to clone.
  19605. * @returns {Array} Returns the initialized clone.
  19606. */
  19607. function initCloneArray(array) {
  19608. var length = array.length,
  19609. result = new array.constructor(length);
  19610. // Add properties assigned by `RegExp#exec`.
  19611. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  19612. result.index = array.index;
  19613. result.input = array.input;
  19614. }
  19615. return result;
  19616. }
  19617. /**
  19618. * Initializes an object clone.
  19619. *
  19620. * @private
  19621. * @param {Object} object The object to clone.
  19622. * @returns {Object} Returns the initialized clone.
  19623. */
  19624. function initCloneObject(object) {
  19625. return (typeof object.constructor == 'function' && !isPrototype(object))
  19626. ? baseCreate(getPrototype(object))
  19627. : {};
  19628. }
  19629. /**
  19630. * Initializes an object clone based on its `toStringTag`.
  19631. *
  19632. * **Note:** This function only supports cloning values with tags of
  19633. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  19634. *
  19635. * @private
  19636. * @param {Object} object The object to clone.
  19637. * @param {string} tag The `toStringTag` of the object to clone.
  19638. * @param {boolean} [isDeep] Specify a deep clone.
  19639. * @returns {Object} Returns the initialized clone.
  19640. */
  19641. function initCloneByTag(object, tag, isDeep) {
  19642. var Ctor = object.constructor;
  19643. switch (tag) {
  19644. case arrayBufferTag:
  19645. return cloneArrayBuffer(object);
  19646. case boolTag:
  19647. case dateTag:
  19648. return new Ctor(+object);
  19649. case dataViewTag:
  19650. return cloneDataView(object, isDeep);
  19651. case float32Tag: case float64Tag:
  19652. case int8Tag: case int16Tag: case int32Tag:
  19653. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  19654. return cloneTypedArray(object, isDeep);
  19655. case mapTag:
  19656. return new Ctor;
  19657. case numberTag:
  19658. case stringTag:
  19659. return new Ctor(object);
  19660. case regexpTag:
  19661. return cloneRegExp(object);
  19662. case setTag:
  19663. return new Ctor;
  19664. case symbolTag:
  19665. return cloneSymbol(object);
  19666. }
  19667. }
  19668. /**
  19669. * Inserts wrapper `details` in a comment at the top of the `source` body.
  19670. *
  19671. * @private
  19672. * @param {string} source The source to modify.
  19673. * @returns {Array} details The details to insert.
  19674. * @returns {string} Returns the modified source.
  19675. */
  19676. function insertWrapDetails(source, details) {
  19677. var length = details.length;
  19678. if (!length) {
  19679. return source;
  19680. }
  19681. var lastIndex = length - 1;
  19682. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  19683. details = details.join(length > 2 ? ', ' : ' ');
  19684. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  19685. }
  19686. /**
  19687. * Checks if `value` is a flattenable `arguments` object or array.
  19688. *
  19689. * @private
  19690. * @param {*} value The value to check.
  19691. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  19692. */
  19693. function isFlattenable(value) {
  19694. return isArray(value) || isArguments(value) ||
  19695. !!(spreadableSymbol && value && value[spreadableSymbol]);
  19696. }
  19697. /**
  19698. * Checks if `value` is a valid array-like index.
  19699. *
  19700. * @private
  19701. * @param {*} value The value to check.
  19702. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19703. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19704. */
  19705. function isIndex(value, length) {
  19706. var type = typeof value;
  19707. length = length == null ? MAX_SAFE_INTEGER : length;
  19708. return !!length &&
  19709. (type == 'number' ||
  19710. (type != 'symbol' && reIsUint.test(value))) &&
  19711. (value > -1 && value % 1 == 0 && value < length);
  19712. }
  19713. /**
  19714. * Checks if the given arguments are from an iteratee call.
  19715. *
  19716. * @private
  19717. * @param {*} value The potential iteratee value argument.
  19718. * @param {*} index The potential iteratee index or key argument.
  19719. * @param {*} object The potential iteratee object argument.
  19720. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  19721. * else `false`.
  19722. */
  19723. function isIterateeCall(value, index, object) {
  19724. if (!isObject(object)) {
  19725. return false;
  19726. }
  19727. var type = typeof index;
  19728. if (type == 'number'
  19729. ? (isArrayLike(object) && isIndex(index, object.length))
  19730. : (type == 'string' && index in object)
  19731. ) {
  19732. return eq(object[index], value);
  19733. }
  19734. return false;
  19735. }
  19736. /**
  19737. * Checks if `value` is a property name and not a property path.
  19738. *
  19739. * @private
  19740. * @param {*} value The value to check.
  19741. * @param {Object} [object] The object to query keys on.
  19742. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  19743. */
  19744. function isKey(value, object) {
  19745. if (isArray(value)) {
  19746. return false;
  19747. }
  19748. var type = typeof value;
  19749. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  19750. value == null || isSymbol(value)) {
  19751. return true;
  19752. }
  19753. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  19754. (object != null && value in Object(object));
  19755. }
  19756. /**
  19757. * Checks if `value` is suitable for use as unique object key.
  19758. *
  19759. * @private
  19760. * @param {*} value The value to check.
  19761. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19762. */
  19763. function isKeyable(value) {
  19764. var type = typeof value;
  19765. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19766. ? (value !== '__proto__')
  19767. : (value === null);
  19768. }
  19769. /**
  19770. * Checks if `func` has a lazy counterpart.
  19771. *
  19772. * @private
  19773. * @param {Function} func The function to check.
  19774. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  19775. * else `false`.
  19776. */
  19777. function isLaziable(func) {
  19778. var funcName = getFuncName(func),
  19779. other = lodash[funcName];
  19780. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  19781. return false;
  19782. }
  19783. if (func === other) {
  19784. return true;
  19785. }
  19786. var data = getData(other);
  19787. return !!data && func === data[0];
  19788. }
  19789. /**
  19790. * Checks if `func` has its source masked.
  19791. *
  19792. * @private
  19793. * @param {Function} func The function to check.
  19794. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19795. */
  19796. function isMasked(func) {
  19797. return !!maskSrcKey && (maskSrcKey in func);
  19798. }
  19799. /**
  19800. * Checks if `func` is capable of being masked.
  19801. *
  19802. * @private
  19803. * @param {*} value The value to check.
  19804. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  19805. */
  19806. var isMaskable = coreJsData ? isFunction : stubFalse;
  19807. /**
  19808. * Checks if `value` is likely a prototype object.
  19809. *
  19810. * @private
  19811. * @param {*} value The value to check.
  19812. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19813. */
  19814. function isPrototype(value) {
  19815. var Ctor = value && value.constructor,
  19816. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19817. return value === proto;
  19818. }
  19819. /**
  19820. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  19821. *
  19822. * @private
  19823. * @param {*} value The value to check.
  19824. * @returns {boolean} Returns `true` if `value` if suitable for strict
  19825. * equality comparisons, else `false`.
  19826. */
  19827. function isStrictComparable(value) {
  19828. return value === value && !isObject(value);
  19829. }
  19830. /**
  19831. * A specialized version of `matchesProperty` for source values suitable
  19832. * for strict equality comparisons, i.e. `===`.
  19833. *
  19834. * @private
  19835. * @param {string} key The key of the property to get.
  19836. * @param {*} srcValue The value to match.
  19837. * @returns {Function} Returns the new spec function.
  19838. */
  19839. function matchesStrictComparable(key, srcValue) {
  19840. return function(object) {
  19841. if (object == null) {
  19842. return false;
  19843. }
  19844. return object[key] === srcValue &&
  19845. (srcValue !== undefined || (key in Object(object)));
  19846. };
  19847. }
  19848. /**
  19849. * A specialized version of `_.memoize` which clears the memoized function's
  19850. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  19851. *
  19852. * @private
  19853. * @param {Function} func The function to have its output memoized.
  19854. * @returns {Function} Returns the new memoized function.
  19855. */
  19856. function memoizeCapped(func) {
  19857. var result = memoize(func, function(key) {
  19858. if (cache.size === MAX_MEMOIZE_SIZE) {
  19859. cache.clear();
  19860. }
  19861. return key;
  19862. });
  19863. var cache = result.cache;
  19864. return result;
  19865. }
  19866. /**
  19867. * Merges the function metadata of `source` into `data`.
  19868. *
  19869. * Merging metadata reduces the number of wrappers used to invoke a function.
  19870. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  19871. * may be applied regardless of execution order. Methods like `_.ary` and
  19872. * `_.rearg` modify function arguments, making the order in which they are
  19873. * executed important, preventing the merging of metadata. However, we make
  19874. * an exception for a safe combined case where curried functions have `_.ary`
  19875. * and or `_.rearg` applied.
  19876. *
  19877. * @private
  19878. * @param {Array} data The destination metadata.
  19879. * @param {Array} source The source metadata.
  19880. * @returns {Array} Returns `data`.
  19881. */
  19882. function mergeData(data, source) {
  19883. var bitmask = data[1],
  19884. srcBitmask = source[1],
  19885. newBitmask = bitmask | srcBitmask,
  19886. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  19887. var isCombo =
  19888. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  19889. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  19890. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  19891. // Exit early if metadata can't be merged.
  19892. if (!(isCommon || isCombo)) {
  19893. return data;
  19894. }
  19895. // Use source `thisArg` if available.
  19896. if (srcBitmask & WRAP_BIND_FLAG) {
  19897. data[2] = source[2];
  19898. // Set when currying a bound function.
  19899. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  19900. }
  19901. // Compose partial arguments.
  19902. var value = source[3];
  19903. if (value) {
  19904. var partials = data[3];
  19905. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  19906. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  19907. }
  19908. // Compose partial right arguments.
  19909. value = source[5];
  19910. if (value) {
  19911. partials = data[5];
  19912. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  19913. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  19914. }
  19915. // Use source `argPos` if available.
  19916. value = source[7];
  19917. if (value) {
  19918. data[7] = value;
  19919. }
  19920. // Use source `ary` if it's smaller.
  19921. if (srcBitmask & WRAP_ARY_FLAG) {
  19922. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  19923. }
  19924. // Use source `arity` if one is not provided.
  19925. if (data[9] == null) {
  19926. data[9] = source[9];
  19927. }
  19928. // Use source `func` and merge bitmasks.
  19929. data[0] = source[0];
  19930. data[1] = newBitmask;
  19931. return data;
  19932. }
  19933. /**
  19934. * This function is like
  19935. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  19936. * except that it includes inherited enumerable properties.
  19937. *
  19938. * @private
  19939. * @param {Object} object The object to query.
  19940. * @returns {Array} Returns the array of property names.
  19941. */
  19942. function nativeKeysIn(object) {
  19943. var result = [];
  19944. if (object != null) {
  19945. for (var key in Object(object)) {
  19946. result.push(key);
  19947. }
  19948. }
  19949. return result;
  19950. }
  19951. /**
  19952. * Converts `value` to a string using `Object.prototype.toString`.
  19953. *
  19954. * @private
  19955. * @param {*} value The value to convert.
  19956. * @returns {string} Returns the converted string.
  19957. */
  19958. function objectToString(value) {
  19959. return nativeObjectToString.call(value);
  19960. }
  19961. /**
  19962. * A specialized version of `baseRest` which transforms the rest array.
  19963. *
  19964. * @private
  19965. * @param {Function} func The function to apply a rest parameter to.
  19966. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19967. * @param {Function} transform The rest array transform.
  19968. * @returns {Function} Returns the new function.
  19969. */
  19970. function overRest(func, start, transform) {
  19971. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  19972. return function() {
  19973. var args = arguments,
  19974. index = -1,
  19975. length = nativeMax(args.length - start, 0),
  19976. array = Array(length);
  19977. while (++index < length) {
  19978. array[index] = args[start + index];
  19979. }
  19980. index = -1;
  19981. var otherArgs = Array(start + 1);
  19982. while (++index < start) {
  19983. otherArgs[index] = args[index];
  19984. }
  19985. otherArgs[start] = transform(array);
  19986. return apply(func, this, otherArgs);
  19987. };
  19988. }
  19989. /**
  19990. * Gets the parent value at `path` of `object`.
  19991. *
  19992. * @private
  19993. * @param {Object} object The object to query.
  19994. * @param {Array} path The path to get the parent value of.
  19995. * @returns {*} Returns the parent value.
  19996. */
  19997. function parent(object, path) {
  19998. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  19999. }
  20000. /**
  20001. * Reorder `array` according to the specified indexes where the element at
  20002. * the first index is assigned as the first element, the element at
  20003. * the second index is assigned as the second element, and so on.
  20004. *
  20005. * @private
  20006. * @param {Array} array The array to reorder.
  20007. * @param {Array} indexes The arranged array indexes.
  20008. * @returns {Array} Returns `array`.
  20009. */
  20010. function reorder(array, indexes) {
  20011. var arrLength = array.length,
  20012. length = nativeMin(indexes.length, arrLength),
  20013. oldArray = copyArray(array);
  20014. while (length--) {
  20015. var index = indexes[length];
  20016. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  20017. }
  20018. return array;
  20019. }
  20020. /**
  20021. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  20022. *
  20023. * @private
  20024. * @param {Object} object The object to query.
  20025. * @param {string} key The key of the property to get.
  20026. * @returns {*} Returns the property value.
  20027. */
  20028. function safeGet(object, key) {
  20029. if (key === 'constructor' && typeof object[key] === 'function') {
  20030. return;
  20031. }
  20032. if (key == '__proto__') {
  20033. return;
  20034. }
  20035. return object[key];
  20036. }
  20037. /**
  20038. * Sets metadata for `func`.
  20039. *
  20040. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  20041. * period of time, it will trip its breaker and transition to an identity
  20042. * function to avoid garbage collection pauses in V8. See
  20043. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  20044. * for more details.
  20045. *
  20046. * @private
  20047. * @param {Function} func The function to associate metadata with.
  20048. * @param {*} data The metadata.
  20049. * @returns {Function} Returns `func`.
  20050. */
  20051. var setData = shortOut(baseSetData);
  20052. /**
  20053. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  20054. *
  20055. * @private
  20056. * @param {Function} func The function to delay.
  20057. * @param {number} wait The number of milliseconds to delay invocation.
  20058. * @returns {number|Object} Returns the timer id or timeout object.
  20059. */
  20060. var setTimeout = ctxSetTimeout || function(func, wait) {
  20061. return root.setTimeout(func, wait);
  20062. };
  20063. /**
  20064. * Sets the `toString` method of `func` to return `string`.
  20065. *
  20066. * @private
  20067. * @param {Function} func The function to modify.
  20068. * @param {Function} string The `toString` result.
  20069. * @returns {Function} Returns `func`.
  20070. */
  20071. var setToString = shortOut(baseSetToString);
  20072. /**
  20073. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  20074. * with wrapper details in a comment at the top of the source body.
  20075. *
  20076. * @private
  20077. * @param {Function} wrapper The function to modify.
  20078. * @param {Function} reference The reference function.
  20079. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20080. * @returns {Function} Returns `wrapper`.
  20081. */
  20082. function setWrapToString(wrapper, reference, bitmask) {
  20083. var source = (reference + '');
  20084. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  20085. }
  20086. /**
  20087. * Creates a function that'll short out and invoke `identity` instead
  20088. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  20089. * milliseconds.
  20090. *
  20091. * @private
  20092. * @param {Function} func The function to restrict.
  20093. * @returns {Function} Returns the new shortable function.
  20094. */
  20095. function shortOut(func) {
  20096. var count = 0,
  20097. lastCalled = 0;
  20098. return function() {
  20099. var stamp = nativeNow(),
  20100. remaining = HOT_SPAN - (stamp - lastCalled);
  20101. lastCalled = stamp;
  20102. if (remaining > 0) {
  20103. if (++count >= HOT_COUNT) {
  20104. return arguments[0];
  20105. }
  20106. } else {
  20107. count = 0;
  20108. }
  20109. return func.apply(undefined, arguments);
  20110. };
  20111. }
  20112. /**
  20113. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  20114. *
  20115. * @private
  20116. * @param {Array} array The array to shuffle.
  20117. * @param {number} [size=array.length] The size of `array`.
  20118. * @returns {Array} Returns `array`.
  20119. */
  20120. function shuffleSelf(array, size) {
  20121. var index = -1,
  20122. length = array.length,
  20123. lastIndex = length - 1;
  20124. size = size === undefined ? length : size;
  20125. while (++index < size) {
  20126. var rand = baseRandom(index, lastIndex),
  20127. value = array[rand];
  20128. array[rand] = array[index];
  20129. array[index] = value;
  20130. }
  20131. array.length = size;
  20132. return array;
  20133. }
  20134. /**
  20135. * Converts `string` to a property path array.
  20136. *
  20137. * @private
  20138. * @param {string} string The string to convert.
  20139. * @returns {Array} Returns the property path array.
  20140. */
  20141. var stringToPath = memoizeCapped(function(string) {
  20142. var result = [];
  20143. if (string.charCodeAt(0) === 46 /* . */) {
  20144. result.push('');
  20145. }
  20146. string.replace(rePropName, function(match, number, quote, subString) {
  20147. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  20148. });
  20149. return result;
  20150. });
  20151. /**
  20152. * Converts `value` to a string key if it's not a string or symbol.
  20153. *
  20154. * @private
  20155. * @param {*} value The value to inspect.
  20156. * @returns {string|symbol} Returns the key.
  20157. */
  20158. function toKey(value) {
  20159. if (typeof value == 'string' || isSymbol(value)) {
  20160. return value;
  20161. }
  20162. var result = (value + '');
  20163. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  20164. }
  20165. /**
  20166. * Converts `func` to its source code.
  20167. *
  20168. * @private
  20169. * @param {Function} func The function to convert.
  20170. * @returns {string} Returns the source code.
  20171. */
  20172. function toSource(func) {
  20173. if (func != null) {
  20174. try {
  20175. return funcToString.call(func);
  20176. } catch (e) {}
  20177. try {
  20178. return (func + '');
  20179. } catch (e) {}
  20180. }
  20181. return '';
  20182. }
  20183. /**
  20184. * Updates wrapper `details` based on `bitmask` flags.
  20185. *
  20186. * @private
  20187. * @returns {Array} details The details to modify.
  20188. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20189. * @returns {Array} Returns `details`.
  20190. */
  20191. function updateWrapDetails(details, bitmask) {
  20192. arrayEach(wrapFlags, function(pair) {
  20193. var value = '_.' + pair[0];
  20194. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  20195. details.push(value);
  20196. }
  20197. });
  20198. return details.sort();
  20199. }
  20200. /**
  20201. * Creates a clone of `wrapper`.
  20202. *
  20203. * @private
  20204. * @param {Object} wrapper The wrapper to clone.
  20205. * @returns {Object} Returns the cloned wrapper.
  20206. */
  20207. function wrapperClone(wrapper) {
  20208. if (wrapper instanceof LazyWrapper) {
  20209. return wrapper.clone();
  20210. }
  20211. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  20212. result.__actions__ = copyArray(wrapper.__actions__);
  20213. result.__index__ = wrapper.__index__;
  20214. result.__values__ = wrapper.__values__;
  20215. return result;
  20216. }
  20217. /*------------------------------------------------------------------------*/
  20218. /**
  20219. * Creates an array of elements split into groups the length of `size`.
  20220. * If `array` can't be split evenly, the final chunk will be the remaining
  20221. * elements.
  20222. *
  20223. * @static
  20224. * @memberOf _
  20225. * @since 3.0.0
  20226. * @category Array
  20227. * @param {Array} array The array to process.
  20228. * @param {number} [size=1] The length of each chunk
  20229. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20230. * @returns {Array} Returns the new array of chunks.
  20231. * @example
  20232. *
  20233. * _.chunk(['a', 'b', 'c', 'd'], 2);
  20234. * // => [['a', 'b'], ['c', 'd']]
  20235. *
  20236. * _.chunk(['a', 'b', 'c', 'd'], 3);
  20237. * // => [['a', 'b', 'c'], ['d']]
  20238. */
  20239. function chunk(array, size, guard) {
  20240. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  20241. size = 1;
  20242. } else {
  20243. size = nativeMax(toInteger(size), 0);
  20244. }
  20245. var length = array == null ? 0 : array.length;
  20246. if (!length || size < 1) {
  20247. return [];
  20248. }
  20249. var index = 0,
  20250. resIndex = 0,
  20251. result = Array(nativeCeil(length / size));
  20252. while (index < length) {
  20253. result[resIndex++] = baseSlice(array, index, (index += size));
  20254. }
  20255. return result;
  20256. }
  20257. /**
  20258. * Creates an array with all falsey values removed. The values `false`, `null`,
  20259. * `0`, `""`, `undefined`, and `NaN` are falsey.
  20260. *
  20261. * @static
  20262. * @memberOf _
  20263. * @since 0.1.0
  20264. * @category Array
  20265. * @param {Array} array The array to compact.
  20266. * @returns {Array} Returns the new array of filtered values.
  20267. * @example
  20268. *
  20269. * _.compact([0, 1, false, 2, '', 3]);
  20270. * // => [1, 2, 3]
  20271. */
  20272. function compact(array) {
  20273. var index = -1,
  20274. length = array == null ? 0 : array.length,
  20275. resIndex = 0,
  20276. result = [];
  20277. while (++index < length) {
  20278. var value = array[index];
  20279. if (value) {
  20280. result[resIndex++] = value;
  20281. }
  20282. }
  20283. return result;
  20284. }
  20285. /**
  20286. * Creates a new array concatenating `array` with any additional arrays
  20287. * and/or values.
  20288. *
  20289. * @static
  20290. * @memberOf _
  20291. * @since 4.0.0
  20292. * @category Array
  20293. * @param {Array} array The array to concatenate.
  20294. * @param {...*} [values] The values to concatenate.
  20295. * @returns {Array} Returns the new concatenated array.
  20296. * @example
  20297. *
  20298. * var array = [1];
  20299. * var other = _.concat(array, 2, [3], [[4]]);
  20300. *
  20301. * console.log(other);
  20302. * // => [1, 2, 3, [4]]
  20303. *
  20304. * console.log(array);
  20305. * // => [1]
  20306. */
  20307. function concat() {
  20308. var length = arguments.length;
  20309. if (!length) {
  20310. return [];
  20311. }
  20312. var args = Array(length - 1),
  20313. array = arguments[0],
  20314. index = length;
  20315. while (index--) {
  20316. args[index - 1] = arguments[index];
  20317. }
  20318. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  20319. }
  20320. /**
  20321. * Creates an array of `array` values not included in the other given arrays
  20322. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20323. * for equality comparisons. The order and references of result values are
  20324. * determined by the first array.
  20325. *
  20326. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  20327. *
  20328. * @static
  20329. * @memberOf _
  20330. * @since 0.1.0
  20331. * @category Array
  20332. * @param {Array} array The array to inspect.
  20333. * @param {...Array} [values] The values to exclude.
  20334. * @returns {Array} Returns the new array of filtered values.
  20335. * @see _.without, _.xor
  20336. * @example
  20337. *
  20338. * _.difference([2, 1], [2, 3]);
  20339. * // => [1]
  20340. */
  20341. var difference = baseRest(function(array, values) {
  20342. return isArrayLikeObject(array)
  20343. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  20344. : [];
  20345. });
  20346. /**
  20347. * This method is like `_.difference` except that it accepts `iteratee` which
  20348. * is invoked for each element of `array` and `values` to generate the criterion
  20349. * by which they're compared. The order and references of result values are
  20350. * determined by the first array. The iteratee is invoked with one argument:
  20351. * (value).
  20352. *
  20353. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  20354. *
  20355. * @static
  20356. * @memberOf _
  20357. * @since 4.0.0
  20358. * @category Array
  20359. * @param {Array} array The array to inspect.
  20360. * @param {...Array} [values] The values to exclude.
  20361. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20362. * @returns {Array} Returns the new array of filtered values.
  20363. * @example
  20364. *
  20365. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20366. * // => [1.2]
  20367. *
  20368. * // The `_.property` iteratee shorthand.
  20369. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  20370. * // => [{ 'x': 2 }]
  20371. */
  20372. var differenceBy = baseRest(function(array, values) {
  20373. var iteratee = last(values);
  20374. if (isArrayLikeObject(iteratee)) {
  20375. iteratee = undefined;
  20376. }
  20377. return isArrayLikeObject(array)
  20378. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  20379. : [];
  20380. });
  20381. /**
  20382. * This method is like `_.difference` except that it accepts `comparator`
  20383. * which is invoked to compare elements of `array` to `values`. The order and
  20384. * references of result values are determined by the first array. The comparator
  20385. * is invoked with two arguments: (arrVal, othVal).
  20386. *
  20387. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  20388. *
  20389. * @static
  20390. * @memberOf _
  20391. * @since 4.0.0
  20392. * @category Array
  20393. * @param {Array} array The array to inspect.
  20394. * @param {...Array} [values] The values to exclude.
  20395. * @param {Function} [comparator] The comparator invoked per element.
  20396. * @returns {Array} Returns the new array of filtered values.
  20397. * @example
  20398. *
  20399. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20400. *
  20401. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  20402. * // => [{ 'x': 2, 'y': 1 }]
  20403. */
  20404. var differenceWith = baseRest(function(array, values) {
  20405. var comparator = last(values);
  20406. if (isArrayLikeObject(comparator)) {
  20407. comparator = undefined;
  20408. }
  20409. return isArrayLikeObject(array)
  20410. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  20411. : [];
  20412. });
  20413. /**
  20414. * Creates a slice of `array` with `n` elements dropped from the beginning.
  20415. *
  20416. * @static
  20417. * @memberOf _
  20418. * @since 0.5.0
  20419. * @category Array
  20420. * @param {Array} array The array to query.
  20421. * @param {number} [n=1] The number of elements to drop.
  20422. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20423. * @returns {Array} Returns the slice of `array`.
  20424. * @example
  20425. *
  20426. * _.drop([1, 2, 3]);
  20427. * // => [2, 3]
  20428. *
  20429. * _.drop([1, 2, 3], 2);
  20430. * // => [3]
  20431. *
  20432. * _.drop([1, 2, 3], 5);
  20433. * // => []
  20434. *
  20435. * _.drop([1, 2, 3], 0);
  20436. * // => [1, 2, 3]
  20437. */
  20438. function drop(array, n, guard) {
  20439. var length = array == null ? 0 : array.length;
  20440. if (!length) {
  20441. return [];
  20442. }
  20443. n = (guard || n === undefined) ? 1 : toInteger(n);
  20444. return baseSlice(array, n < 0 ? 0 : n, length);
  20445. }
  20446. /**
  20447. * Creates a slice of `array` with `n` elements dropped from the end.
  20448. *
  20449. * @static
  20450. * @memberOf _
  20451. * @since 3.0.0
  20452. * @category Array
  20453. * @param {Array} array The array to query.
  20454. * @param {number} [n=1] The number of elements to drop.
  20455. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20456. * @returns {Array} Returns the slice of `array`.
  20457. * @example
  20458. *
  20459. * _.dropRight([1, 2, 3]);
  20460. * // => [1, 2]
  20461. *
  20462. * _.dropRight([1, 2, 3], 2);
  20463. * // => [1]
  20464. *
  20465. * _.dropRight([1, 2, 3], 5);
  20466. * // => []
  20467. *
  20468. * _.dropRight([1, 2, 3], 0);
  20469. * // => [1, 2, 3]
  20470. */
  20471. function dropRight(array, n, guard) {
  20472. var length = array == null ? 0 : array.length;
  20473. if (!length) {
  20474. return [];
  20475. }
  20476. n = (guard || n === undefined) ? 1 : toInteger(n);
  20477. n = length - n;
  20478. return baseSlice(array, 0, n < 0 ? 0 : n);
  20479. }
  20480. /**
  20481. * Creates a slice of `array` excluding elements dropped from the end.
  20482. * Elements are dropped until `predicate` returns falsey. The predicate is
  20483. * invoked with three arguments: (value, index, array).
  20484. *
  20485. * @static
  20486. * @memberOf _
  20487. * @since 3.0.0
  20488. * @category Array
  20489. * @param {Array} array The array to query.
  20490. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20491. * @returns {Array} Returns the slice of `array`.
  20492. * @example
  20493. *
  20494. * var users = [
  20495. * { 'user': 'barney', 'active': true },
  20496. * { 'user': 'fred', 'active': false },
  20497. * { 'user': 'pebbles', 'active': false }
  20498. * ];
  20499. *
  20500. * _.dropRightWhile(users, function(o) { return !o.active; });
  20501. * // => objects for ['barney']
  20502. *
  20503. * // The `_.matches` iteratee shorthand.
  20504. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  20505. * // => objects for ['barney', 'fred']
  20506. *
  20507. * // The `_.matchesProperty` iteratee shorthand.
  20508. * _.dropRightWhile(users, ['active', false]);
  20509. * // => objects for ['barney']
  20510. *
  20511. * // The `_.property` iteratee shorthand.
  20512. * _.dropRightWhile(users, 'active');
  20513. * // => objects for ['barney', 'fred', 'pebbles']
  20514. */
  20515. function dropRightWhile(array, predicate) {
  20516. return (array && array.length)
  20517. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  20518. : [];
  20519. }
  20520. /**
  20521. * Creates a slice of `array` excluding elements dropped from the beginning.
  20522. * Elements are dropped until `predicate` returns falsey. The predicate is
  20523. * invoked with three arguments: (value, index, array).
  20524. *
  20525. * @static
  20526. * @memberOf _
  20527. * @since 3.0.0
  20528. * @category Array
  20529. * @param {Array} array The array to query.
  20530. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20531. * @returns {Array} Returns the slice of `array`.
  20532. * @example
  20533. *
  20534. * var users = [
  20535. * { 'user': 'barney', 'active': false },
  20536. * { 'user': 'fred', 'active': false },
  20537. * { 'user': 'pebbles', 'active': true }
  20538. * ];
  20539. *
  20540. * _.dropWhile(users, function(o) { return !o.active; });
  20541. * // => objects for ['pebbles']
  20542. *
  20543. * // The `_.matches` iteratee shorthand.
  20544. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  20545. * // => objects for ['fred', 'pebbles']
  20546. *
  20547. * // The `_.matchesProperty` iteratee shorthand.
  20548. * _.dropWhile(users, ['active', false]);
  20549. * // => objects for ['pebbles']
  20550. *
  20551. * // The `_.property` iteratee shorthand.
  20552. * _.dropWhile(users, 'active');
  20553. * // => objects for ['barney', 'fred', 'pebbles']
  20554. */
  20555. function dropWhile(array, predicate) {
  20556. return (array && array.length)
  20557. ? baseWhile(array, getIteratee(predicate, 3), true)
  20558. : [];
  20559. }
  20560. /**
  20561. * Fills elements of `array` with `value` from `start` up to, but not
  20562. * including, `end`.
  20563. *
  20564. * **Note:** This method mutates `array`.
  20565. *
  20566. * @static
  20567. * @memberOf _
  20568. * @since 3.2.0
  20569. * @category Array
  20570. * @param {Array} array The array to fill.
  20571. * @param {*} value The value to fill `array` with.
  20572. * @param {number} [start=0] The start position.
  20573. * @param {number} [end=array.length] The end position.
  20574. * @returns {Array} Returns `array`.
  20575. * @example
  20576. *
  20577. * var array = [1, 2, 3];
  20578. *
  20579. * _.fill(array, 'a');
  20580. * console.log(array);
  20581. * // => ['a', 'a', 'a']
  20582. *
  20583. * _.fill(Array(3), 2);
  20584. * // => [2, 2, 2]
  20585. *
  20586. * _.fill([4, 6, 8, 10], '*', 1, 3);
  20587. * // => [4, '*', '*', 10]
  20588. */
  20589. function fill(array, value, start, end) {
  20590. var length = array == null ? 0 : array.length;
  20591. if (!length) {
  20592. return [];
  20593. }
  20594. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  20595. start = 0;
  20596. end = length;
  20597. }
  20598. return baseFill(array, value, start, end);
  20599. }
  20600. /**
  20601. * This method is like `_.find` except that it returns the index of the first
  20602. * element `predicate` returns truthy for instead of the element itself.
  20603. *
  20604. * @static
  20605. * @memberOf _
  20606. * @since 1.1.0
  20607. * @category Array
  20608. * @param {Array} array The array to inspect.
  20609. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20610. * @param {number} [fromIndex=0] The index to search from.
  20611. * @returns {number} Returns the index of the found element, else `-1`.
  20612. * @example
  20613. *
  20614. * var users = [
  20615. * { 'user': 'barney', 'active': false },
  20616. * { 'user': 'fred', 'active': false },
  20617. * { 'user': 'pebbles', 'active': true }
  20618. * ];
  20619. *
  20620. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  20621. * // => 0
  20622. *
  20623. * // The `_.matches` iteratee shorthand.
  20624. * _.findIndex(users, { 'user': 'fred', 'active': false });
  20625. * // => 1
  20626. *
  20627. * // The `_.matchesProperty` iteratee shorthand.
  20628. * _.findIndex(users, ['active', false]);
  20629. * // => 0
  20630. *
  20631. * // The `_.property` iteratee shorthand.
  20632. * _.findIndex(users, 'active');
  20633. * // => 2
  20634. */
  20635. function findIndex(array, predicate, fromIndex) {
  20636. var length = array == null ? 0 : array.length;
  20637. if (!length) {
  20638. return -1;
  20639. }
  20640. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20641. if (index < 0) {
  20642. index = nativeMax(length + index, 0);
  20643. }
  20644. return baseFindIndex(array, getIteratee(predicate, 3), index);
  20645. }
  20646. /**
  20647. * This method is like `_.findIndex` except that it iterates over elements
  20648. * of `collection` from right to left.
  20649. *
  20650. * @static
  20651. * @memberOf _
  20652. * @since 2.0.0
  20653. * @category Array
  20654. * @param {Array} array The array to inspect.
  20655. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20656. * @param {number} [fromIndex=array.length-1] The index to search from.
  20657. * @returns {number} Returns the index of the found element, else `-1`.
  20658. * @example
  20659. *
  20660. * var users = [
  20661. * { 'user': 'barney', 'active': true },
  20662. * { 'user': 'fred', 'active': false },
  20663. * { 'user': 'pebbles', 'active': false }
  20664. * ];
  20665. *
  20666. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  20667. * // => 2
  20668. *
  20669. * // The `_.matches` iteratee shorthand.
  20670. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  20671. * // => 0
  20672. *
  20673. * // The `_.matchesProperty` iteratee shorthand.
  20674. * _.findLastIndex(users, ['active', false]);
  20675. * // => 2
  20676. *
  20677. * // The `_.property` iteratee shorthand.
  20678. * _.findLastIndex(users, 'active');
  20679. * // => 0
  20680. */
  20681. function findLastIndex(array, predicate, fromIndex) {
  20682. var length = array == null ? 0 : array.length;
  20683. if (!length) {
  20684. return -1;
  20685. }
  20686. var index = length - 1;
  20687. if (fromIndex !== undefined) {
  20688. index = toInteger(fromIndex);
  20689. index = fromIndex < 0
  20690. ? nativeMax(length + index, 0)
  20691. : nativeMin(index, length - 1);
  20692. }
  20693. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  20694. }
  20695. /**
  20696. * Flattens `array` a single level deep.
  20697. *
  20698. * @static
  20699. * @memberOf _
  20700. * @since 0.1.0
  20701. * @category Array
  20702. * @param {Array} array The array to flatten.
  20703. * @returns {Array} Returns the new flattened array.
  20704. * @example
  20705. *
  20706. * _.flatten([1, [2, [3, [4]], 5]]);
  20707. * // => [1, 2, [3, [4]], 5]
  20708. */
  20709. function flatten(array) {
  20710. var length = array == null ? 0 : array.length;
  20711. return length ? baseFlatten(array, 1) : [];
  20712. }
  20713. /**
  20714. * Recursively flattens `array`.
  20715. *
  20716. * @static
  20717. * @memberOf _
  20718. * @since 3.0.0
  20719. * @category Array
  20720. * @param {Array} array The array to flatten.
  20721. * @returns {Array} Returns the new flattened array.
  20722. * @example
  20723. *
  20724. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  20725. * // => [1, 2, 3, 4, 5]
  20726. */
  20727. function flattenDeep(array) {
  20728. var length = array == null ? 0 : array.length;
  20729. return length ? baseFlatten(array, INFINITY) : [];
  20730. }
  20731. /**
  20732. * Recursively flatten `array` up to `depth` times.
  20733. *
  20734. * @static
  20735. * @memberOf _
  20736. * @since 4.4.0
  20737. * @category Array
  20738. * @param {Array} array The array to flatten.
  20739. * @param {number} [depth=1] The maximum recursion depth.
  20740. * @returns {Array} Returns the new flattened array.
  20741. * @example
  20742. *
  20743. * var array = [1, [2, [3, [4]], 5]];
  20744. *
  20745. * _.flattenDepth(array, 1);
  20746. * // => [1, 2, [3, [4]], 5]
  20747. *
  20748. * _.flattenDepth(array, 2);
  20749. * // => [1, 2, 3, [4], 5]
  20750. */
  20751. function flattenDepth(array, depth) {
  20752. var length = array == null ? 0 : array.length;
  20753. if (!length) {
  20754. return [];
  20755. }
  20756. depth = depth === undefined ? 1 : toInteger(depth);
  20757. return baseFlatten(array, depth);
  20758. }
  20759. /**
  20760. * The inverse of `_.toPairs`; this method returns an object composed
  20761. * from key-value `pairs`.
  20762. *
  20763. * @static
  20764. * @memberOf _
  20765. * @since 4.0.0
  20766. * @category Array
  20767. * @param {Array} pairs The key-value pairs.
  20768. * @returns {Object} Returns the new object.
  20769. * @example
  20770. *
  20771. * _.fromPairs([['a', 1], ['b', 2]]);
  20772. * // => { 'a': 1, 'b': 2 }
  20773. */
  20774. function fromPairs(pairs) {
  20775. var index = -1,
  20776. length = pairs == null ? 0 : pairs.length,
  20777. result = {};
  20778. while (++index < length) {
  20779. var pair = pairs[index];
  20780. result[pair[0]] = pair[1];
  20781. }
  20782. return result;
  20783. }
  20784. /**
  20785. * Gets the first element of `array`.
  20786. *
  20787. * @static
  20788. * @memberOf _
  20789. * @since 0.1.0
  20790. * @alias first
  20791. * @category Array
  20792. * @param {Array} array The array to query.
  20793. * @returns {*} Returns the first element of `array`.
  20794. * @example
  20795. *
  20796. * _.head([1, 2, 3]);
  20797. * // => 1
  20798. *
  20799. * _.head([]);
  20800. * // => undefined
  20801. */
  20802. function head(array) {
  20803. return (array && array.length) ? array[0] : undefined;
  20804. }
  20805. /**
  20806. * Gets the index at which the first occurrence of `value` is found in `array`
  20807. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20808. * for equality comparisons. If `fromIndex` is negative, it's used as the
  20809. * offset from the end of `array`.
  20810. *
  20811. * @static
  20812. * @memberOf _
  20813. * @since 0.1.0
  20814. * @category Array
  20815. * @param {Array} array The array to inspect.
  20816. * @param {*} value The value to search for.
  20817. * @param {number} [fromIndex=0] The index to search from.
  20818. * @returns {number} Returns the index of the matched value, else `-1`.
  20819. * @example
  20820. *
  20821. * _.indexOf([1, 2, 1, 2], 2);
  20822. * // => 1
  20823. *
  20824. * // Search from the `fromIndex`.
  20825. * _.indexOf([1, 2, 1, 2], 2, 2);
  20826. * // => 3
  20827. */
  20828. function indexOf(array, value, fromIndex) {
  20829. var length = array == null ? 0 : array.length;
  20830. if (!length) {
  20831. return -1;
  20832. }
  20833. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20834. if (index < 0) {
  20835. index = nativeMax(length + index, 0);
  20836. }
  20837. return baseIndexOf(array, value, index);
  20838. }
  20839. /**
  20840. * Gets all but the last element of `array`.
  20841. *
  20842. * @static
  20843. * @memberOf _
  20844. * @since 0.1.0
  20845. * @category Array
  20846. * @param {Array} array The array to query.
  20847. * @returns {Array} Returns the slice of `array`.
  20848. * @example
  20849. *
  20850. * _.initial([1, 2, 3]);
  20851. * // => [1, 2]
  20852. */
  20853. function initial(array) {
  20854. var length = array == null ? 0 : array.length;
  20855. return length ? baseSlice(array, 0, -1) : [];
  20856. }
  20857. /**
  20858. * Creates an array of unique values that are included in all given arrays
  20859. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20860. * for equality comparisons. The order and references of result values are
  20861. * determined by the first array.
  20862. *
  20863. * @static
  20864. * @memberOf _
  20865. * @since 0.1.0
  20866. * @category Array
  20867. * @param {...Array} [arrays] The arrays to inspect.
  20868. * @returns {Array} Returns the new array of intersecting values.
  20869. * @example
  20870. *
  20871. * _.intersection([2, 1], [2, 3]);
  20872. * // => [2]
  20873. */
  20874. var intersection = baseRest(function(arrays) {
  20875. var mapped = arrayMap(arrays, castArrayLikeObject);
  20876. return (mapped.length && mapped[0] === arrays[0])
  20877. ? baseIntersection(mapped)
  20878. : [];
  20879. });
  20880. /**
  20881. * This method is like `_.intersection` except that it accepts `iteratee`
  20882. * which is invoked for each element of each `arrays` to generate the criterion
  20883. * by which they're compared. The order and references of result values are
  20884. * determined by the first array. The iteratee is invoked with one argument:
  20885. * (value).
  20886. *
  20887. * @static
  20888. * @memberOf _
  20889. * @since 4.0.0
  20890. * @category Array
  20891. * @param {...Array} [arrays] The arrays to inspect.
  20892. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20893. * @returns {Array} Returns the new array of intersecting values.
  20894. * @example
  20895. *
  20896. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20897. * // => [2.1]
  20898. *
  20899. * // The `_.property` iteratee shorthand.
  20900. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  20901. * // => [{ 'x': 1 }]
  20902. */
  20903. var intersectionBy = baseRest(function(arrays) {
  20904. var iteratee = last(arrays),
  20905. mapped = arrayMap(arrays, castArrayLikeObject);
  20906. if (iteratee === last(mapped)) {
  20907. iteratee = undefined;
  20908. } else {
  20909. mapped.pop();
  20910. }
  20911. return (mapped.length && mapped[0] === arrays[0])
  20912. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  20913. : [];
  20914. });
  20915. /**
  20916. * This method is like `_.intersection` except that it accepts `comparator`
  20917. * which is invoked to compare elements of `arrays`. The order and references
  20918. * of result values are determined by the first array. The comparator is
  20919. * invoked with two arguments: (arrVal, othVal).
  20920. *
  20921. * @static
  20922. * @memberOf _
  20923. * @since 4.0.0
  20924. * @category Array
  20925. * @param {...Array} [arrays] The arrays to inspect.
  20926. * @param {Function} [comparator] The comparator invoked per element.
  20927. * @returns {Array} Returns the new array of intersecting values.
  20928. * @example
  20929. *
  20930. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20931. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  20932. *
  20933. * _.intersectionWith(objects, others, _.isEqual);
  20934. * // => [{ 'x': 1, 'y': 2 }]
  20935. */
  20936. var intersectionWith = baseRest(function(arrays) {
  20937. var comparator = last(arrays),
  20938. mapped = arrayMap(arrays, castArrayLikeObject);
  20939. comparator = typeof comparator == 'function' ? comparator : undefined;
  20940. if (comparator) {
  20941. mapped.pop();
  20942. }
  20943. return (mapped.length && mapped[0] === arrays[0])
  20944. ? baseIntersection(mapped, undefined, comparator)
  20945. : [];
  20946. });
  20947. /**
  20948. * Converts all elements in `array` into a string separated by `separator`.
  20949. *
  20950. * @static
  20951. * @memberOf _
  20952. * @since 4.0.0
  20953. * @category Array
  20954. * @param {Array} array The array to convert.
  20955. * @param {string} [separator=','] The element separator.
  20956. * @returns {string} Returns the joined string.
  20957. * @example
  20958. *
  20959. * _.join(['a', 'b', 'c'], '~');
  20960. * // => 'a~b~c'
  20961. */
  20962. function join(array, separator) {
  20963. return array == null ? '' : nativeJoin.call(array, separator);
  20964. }
  20965. /**
  20966. * Gets the last element of `array`.
  20967. *
  20968. * @static
  20969. * @memberOf _
  20970. * @since 0.1.0
  20971. * @category Array
  20972. * @param {Array} array The array to query.
  20973. * @returns {*} Returns the last element of `array`.
  20974. * @example
  20975. *
  20976. * _.last([1, 2, 3]);
  20977. * // => 3
  20978. */
  20979. function last(array) {
  20980. var length = array == null ? 0 : array.length;
  20981. return length ? array[length - 1] : undefined;
  20982. }
  20983. /**
  20984. * This method is like `_.indexOf` except that it iterates over elements of
  20985. * `array` from right to left.
  20986. *
  20987. * @static
  20988. * @memberOf _
  20989. * @since 0.1.0
  20990. * @category Array
  20991. * @param {Array} array The array to inspect.
  20992. * @param {*} value The value to search for.
  20993. * @param {number} [fromIndex=array.length-1] The index to search from.
  20994. * @returns {number} Returns the index of the matched value, else `-1`.
  20995. * @example
  20996. *
  20997. * _.lastIndexOf([1, 2, 1, 2], 2);
  20998. * // => 3
  20999. *
  21000. * // Search from the `fromIndex`.
  21001. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  21002. * // => 1
  21003. */
  21004. function lastIndexOf(array, value, fromIndex) {
  21005. var length = array == null ? 0 : array.length;
  21006. if (!length) {
  21007. return -1;
  21008. }
  21009. var index = length;
  21010. if (fromIndex !== undefined) {
  21011. index = toInteger(fromIndex);
  21012. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  21013. }
  21014. return value === value
  21015. ? strictLastIndexOf(array, value, index)
  21016. : baseFindIndex(array, baseIsNaN, index, true);
  21017. }
  21018. /**
  21019. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  21020. * element from the end is returned.
  21021. *
  21022. * @static
  21023. * @memberOf _
  21024. * @since 4.11.0
  21025. * @category Array
  21026. * @param {Array} array The array to query.
  21027. * @param {number} [n=0] The index of the element to return.
  21028. * @returns {*} Returns the nth element of `array`.
  21029. * @example
  21030. *
  21031. * var array = ['a', 'b', 'c', 'd'];
  21032. *
  21033. * _.nth(array, 1);
  21034. * // => 'b'
  21035. *
  21036. * _.nth(array, -2);
  21037. * // => 'c';
  21038. */
  21039. function nth(array, n) {
  21040. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  21041. }
  21042. /**
  21043. * Removes all given values from `array` using
  21044. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21045. * for equality comparisons.
  21046. *
  21047. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  21048. * to remove elements from an array by predicate.
  21049. *
  21050. * @static
  21051. * @memberOf _
  21052. * @since 2.0.0
  21053. * @category Array
  21054. * @param {Array} array The array to modify.
  21055. * @param {...*} [values] The values to remove.
  21056. * @returns {Array} Returns `array`.
  21057. * @example
  21058. *
  21059. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  21060. *
  21061. * _.pull(array, 'a', 'c');
  21062. * console.log(array);
  21063. * // => ['b', 'b']
  21064. */
  21065. var pull = baseRest(pullAll);
  21066. /**
  21067. * This method is like `_.pull` except that it accepts an array of values to remove.
  21068. *
  21069. * **Note:** Unlike `_.difference`, this method mutates `array`.
  21070. *
  21071. * @static
  21072. * @memberOf _
  21073. * @since 4.0.0
  21074. * @category Array
  21075. * @param {Array} array The array to modify.
  21076. * @param {Array} values The values to remove.
  21077. * @returns {Array} Returns `array`.
  21078. * @example
  21079. *
  21080. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  21081. *
  21082. * _.pullAll(array, ['a', 'c']);
  21083. * console.log(array);
  21084. * // => ['b', 'b']
  21085. */
  21086. function pullAll(array, values) {
  21087. return (array && array.length && values && values.length)
  21088. ? basePullAll(array, values)
  21089. : array;
  21090. }
  21091. /**
  21092. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  21093. * invoked for each element of `array` and `values` to generate the criterion
  21094. * by which they're compared. The iteratee is invoked with one argument: (value).
  21095. *
  21096. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  21097. *
  21098. * @static
  21099. * @memberOf _
  21100. * @since 4.0.0
  21101. * @category Array
  21102. * @param {Array} array The array to modify.
  21103. * @param {Array} values The values to remove.
  21104. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21105. * @returns {Array} Returns `array`.
  21106. * @example
  21107. *
  21108. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  21109. *
  21110. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  21111. * console.log(array);
  21112. * // => [{ 'x': 2 }]
  21113. */
  21114. function pullAllBy(array, values, iteratee) {
  21115. return (array && array.length && values && values.length)
  21116. ? basePullAll(array, values, getIteratee(iteratee, 2))
  21117. : array;
  21118. }
  21119. /**
  21120. * This method is like `_.pullAll` except that it accepts `comparator` which
  21121. * is invoked to compare elements of `array` to `values`. The comparator is
  21122. * invoked with two arguments: (arrVal, othVal).
  21123. *
  21124. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  21125. *
  21126. * @static
  21127. * @memberOf _
  21128. * @since 4.6.0
  21129. * @category Array
  21130. * @param {Array} array The array to modify.
  21131. * @param {Array} values The values to remove.
  21132. * @param {Function} [comparator] The comparator invoked per element.
  21133. * @returns {Array} Returns `array`.
  21134. * @example
  21135. *
  21136. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  21137. *
  21138. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  21139. * console.log(array);
  21140. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  21141. */
  21142. function pullAllWith(array, values, comparator) {
  21143. return (array && array.length && values && values.length)
  21144. ? basePullAll(array, values, undefined, comparator)
  21145. : array;
  21146. }
  21147. /**
  21148. * Removes elements from `array` corresponding to `indexes` and returns an
  21149. * array of removed elements.
  21150. *
  21151. * **Note:** Unlike `_.at`, this method mutates `array`.
  21152. *
  21153. * @static
  21154. * @memberOf _
  21155. * @since 3.0.0
  21156. * @category Array
  21157. * @param {Array} array The array to modify.
  21158. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  21159. * @returns {Array} Returns the new array of removed elements.
  21160. * @example
  21161. *
  21162. * var array = ['a', 'b', 'c', 'd'];
  21163. * var pulled = _.pullAt(array, [1, 3]);
  21164. *
  21165. * console.log(array);
  21166. * // => ['a', 'c']
  21167. *
  21168. * console.log(pulled);
  21169. * // => ['b', 'd']
  21170. */
  21171. var pullAt = flatRest(function(array, indexes) {
  21172. var length = array == null ? 0 : array.length,
  21173. result = baseAt(array, indexes);
  21174. basePullAt(array, arrayMap(indexes, function(index) {
  21175. return isIndex(index, length) ? +index : index;
  21176. }).sort(compareAscending));
  21177. return result;
  21178. });
  21179. /**
  21180. * Removes all elements from `array` that `predicate` returns truthy for
  21181. * and returns an array of the removed elements. The predicate is invoked
  21182. * with three arguments: (value, index, array).
  21183. *
  21184. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  21185. * to pull elements from an array by value.
  21186. *
  21187. * @static
  21188. * @memberOf _
  21189. * @since 2.0.0
  21190. * @category Array
  21191. * @param {Array} array The array to modify.
  21192. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21193. * @returns {Array} Returns the new array of removed elements.
  21194. * @example
  21195. *
  21196. * var array = [1, 2, 3, 4];
  21197. * var evens = _.remove(array, function(n) {
  21198. * return n % 2 == 0;
  21199. * });
  21200. *
  21201. * console.log(array);
  21202. * // => [1, 3]
  21203. *
  21204. * console.log(evens);
  21205. * // => [2, 4]
  21206. */
  21207. function remove(array, predicate) {
  21208. var result = [];
  21209. if (!(array && array.length)) {
  21210. return result;
  21211. }
  21212. var index = -1,
  21213. indexes = [],
  21214. length = array.length;
  21215. predicate = getIteratee(predicate, 3);
  21216. while (++index < length) {
  21217. var value = array[index];
  21218. if (predicate(value, index, array)) {
  21219. result.push(value);
  21220. indexes.push(index);
  21221. }
  21222. }
  21223. basePullAt(array, indexes);
  21224. return result;
  21225. }
  21226. /**
  21227. * Reverses `array` so that the first element becomes the last, the second
  21228. * element becomes the second to last, and so on.
  21229. *
  21230. * **Note:** This method mutates `array` and is based on
  21231. * [`Array#reverse`](https://mdn.io/Array/reverse).
  21232. *
  21233. * @static
  21234. * @memberOf _
  21235. * @since 4.0.0
  21236. * @category Array
  21237. * @param {Array} array The array to modify.
  21238. * @returns {Array} Returns `array`.
  21239. * @example
  21240. *
  21241. * var array = [1, 2, 3];
  21242. *
  21243. * _.reverse(array);
  21244. * // => [3, 2, 1]
  21245. *
  21246. * console.log(array);
  21247. * // => [3, 2, 1]
  21248. */
  21249. function reverse(array) {
  21250. return array == null ? array : nativeReverse.call(array);
  21251. }
  21252. /**
  21253. * Creates a slice of `array` from `start` up to, but not including, `end`.
  21254. *
  21255. * **Note:** This method is used instead of
  21256. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  21257. * returned.
  21258. *
  21259. * @static
  21260. * @memberOf _
  21261. * @since 3.0.0
  21262. * @category Array
  21263. * @param {Array} array The array to slice.
  21264. * @param {number} [start=0] The start position.
  21265. * @param {number} [end=array.length] The end position.
  21266. * @returns {Array} Returns the slice of `array`.
  21267. */
  21268. function slice(array, start, end) {
  21269. var length = array == null ? 0 : array.length;
  21270. if (!length) {
  21271. return [];
  21272. }
  21273. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  21274. start = 0;
  21275. end = length;
  21276. }
  21277. else {
  21278. start = start == null ? 0 : toInteger(start);
  21279. end = end === undefined ? length : toInteger(end);
  21280. }
  21281. return baseSlice(array, start, end);
  21282. }
  21283. /**
  21284. * Uses a binary search to determine the lowest index at which `value`
  21285. * should be inserted into `array` in order to maintain its sort order.
  21286. *
  21287. * @static
  21288. * @memberOf _
  21289. * @since 0.1.0
  21290. * @category Array
  21291. * @param {Array} array The sorted array to inspect.
  21292. * @param {*} value The value to evaluate.
  21293. * @returns {number} Returns the index at which `value` should be inserted
  21294. * into `array`.
  21295. * @example
  21296. *
  21297. * _.sortedIndex([30, 50], 40);
  21298. * // => 1
  21299. */
  21300. function sortedIndex(array, value) {
  21301. return baseSortedIndex(array, value);
  21302. }
  21303. /**
  21304. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  21305. * which is invoked for `value` and each element of `array` to compute their
  21306. * sort ranking. The iteratee is invoked with one argument: (value).
  21307. *
  21308. * @static
  21309. * @memberOf _
  21310. * @since 4.0.0
  21311. * @category Array
  21312. * @param {Array} array The sorted array to inspect.
  21313. * @param {*} value The value to evaluate.
  21314. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21315. * @returns {number} Returns the index at which `value` should be inserted
  21316. * into `array`.
  21317. * @example
  21318. *
  21319. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21320. *
  21321. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21322. * // => 0
  21323. *
  21324. * // The `_.property` iteratee shorthand.
  21325. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  21326. * // => 0
  21327. */
  21328. function sortedIndexBy(array, value, iteratee) {
  21329. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  21330. }
  21331. /**
  21332. * This method is like `_.indexOf` except that it performs a binary
  21333. * search on a sorted `array`.
  21334. *
  21335. * @static
  21336. * @memberOf _
  21337. * @since 4.0.0
  21338. * @category Array
  21339. * @param {Array} array The array to inspect.
  21340. * @param {*} value The value to search for.
  21341. * @returns {number} Returns the index of the matched value, else `-1`.
  21342. * @example
  21343. *
  21344. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  21345. * // => 1
  21346. */
  21347. function sortedIndexOf(array, value) {
  21348. var length = array == null ? 0 : array.length;
  21349. if (length) {
  21350. var index = baseSortedIndex(array, value);
  21351. if (index < length && eq(array[index], value)) {
  21352. return index;
  21353. }
  21354. }
  21355. return -1;
  21356. }
  21357. /**
  21358. * This method is like `_.sortedIndex` except that it returns the highest
  21359. * index at which `value` should be inserted into `array` in order to
  21360. * maintain its sort order.
  21361. *
  21362. * @static
  21363. * @memberOf _
  21364. * @since 3.0.0
  21365. * @category Array
  21366. * @param {Array} array The sorted array to inspect.
  21367. * @param {*} value The value to evaluate.
  21368. * @returns {number} Returns the index at which `value` should be inserted
  21369. * into `array`.
  21370. * @example
  21371. *
  21372. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  21373. * // => 4
  21374. */
  21375. function sortedLastIndex(array, value) {
  21376. return baseSortedIndex(array, value, true);
  21377. }
  21378. /**
  21379. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  21380. * which is invoked for `value` and each element of `array` to compute their
  21381. * sort ranking. The iteratee is invoked with one argument: (value).
  21382. *
  21383. * @static
  21384. * @memberOf _
  21385. * @since 4.0.0
  21386. * @category Array
  21387. * @param {Array} array The sorted array to inspect.
  21388. * @param {*} value The value to evaluate.
  21389. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21390. * @returns {number} Returns the index at which `value` should be inserted
  21391. * into `array`.
  21392. * @example
  21393. *
  21394. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21395. *
  21396. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21397. * // => 1
  21398. *
  21399. * // The `_.property` iteratee shorthand.
  21400. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  21401. * // => 1
  21402. */
  21403. function sortedLastIndexBy(array, value, iteratee) {
  21404. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  21405. }
  21406. /**
  21407. * This method is like `_.lastIndexOf` except that it performs a binary
  21408. * search on a sorted `array`.
  21409. *
  21410. * @static
  21411. * @memberOf _
  21412. * @since 4.0.0
  21413. * @category Array
  21414. * @param {Array} array The array to inspect.
  21415. * @param {*} value The value to search for.
  21416. * @returns {number} Returns the index of the matched value, else `-1`.
  21417. * @example
  21418. *
  21419. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  21420. * // => 3
  21421. */
  21422. function sortedLastIndexOf(array, value) {
  21423. var length = array == null ? 0 : array.length;
  21424. if (length) {
  21425. var index = baseSortedIndex(array, value, true) - 1;
  21426. if (eq(array[index], value)) {
  21427. return index;
  21428. }
  21429. }
  21430. return -1;
  21431. }
  21432. /**
  21433. * This method is like `_.uniq` except that it's designed and optimized
  21434. * for sorted arrays.
  21435. *
  21436. * @static
  21437. * @memberOf _
  21438. * @since 4.0.0
  21439. * @category Array
  21440. * @param {Array} array The array to inspect.
  21441. * @returns {Array} Returns the new duplicate free array.
  21442. * @example
  21443. *
  21444. * _.sortedUniq([1, 1, 2]);
  21445. * // => [1, 2]
  21446. */
  21447. function sortedUniq(array) {
  21448. return (array && array.length)
  21449. ? baseSortedUniq(array)
  21450. : [];
  21451. }
  21452. /**
  21453. * This method is like `_.uniqBy` except that it's designed and optimized
  21454. * for sorted arrays.
  21455. *
  21456. * @static
  21457. * @memberOf _
  21458. * @since 4.0.0
  21459. * @category Array
  21460. * @param {Array} array The array to inspect.
  21461. * @param {Function} [iteratee] The iteratee invoked per element.
  21462. * @returns {Array} Returns the new duplicate free array.
  21463. * @example
  21464. *
  21465. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  21466. * // => [1.1, 2.3]
  21467. */
  21468. function sortedUniqBy(array, iteratee) {
  21469. return (array && array.length)
  21470. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  21471. : [];
  21472. }
  21473. /**
  21474. * Gets all but the first element of `array`.
  21475. *
  21476. * @static
  21477. * @memberOf _
  21478. * @since 4.0.0
  21479. * @category Array
  21480. * @param {Array} array The array to query.
  21481. * @returns {Array} Returns the slice of `array`.
  21482. * @example
  21483. *
  21484. * _.tail([1, 2, 3]);
  21485. * // => [2, 3]
  21486. */
  21487. function tail(array) {
  21488. var length = array == null ? 0 : array.length;
  21489. return length ? baseSlice(array, 1, length) : [];
  21490. }
  21491. /**
  21492. * Creates a slice of `array` with `n` elements taken from the beginning.
  21493. *
  21494. * @static
  21495. * @memberOf _
  21496. * @since 0.1.0
  21497. * @category Array
  21498. * @param {Array} array The array to query.
  21499. * @param {number} [n=1] The number of elements to take.
  21500. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21501. * @returns {Array} Returns the slice of `array`.
  21502. * @example
  21503. *
  21504. * _.take([1, 2, 3]);
  21505. * // => [1]
  21506. *
  21507. * _.take([1, 2, 3], 2);
  21508. * // => [1, 2]
  21509. *
  21510. * _.take([1, 2, 3], 5);
  21511. * // => [1, 2, 3]
  21512. *
  21513. * _.take([1, 2, 3], 0);
  21514. * // => []
  21515. */
  21516. function take(array, n, guard) {
  21517. if (!(array && array.length)) {
  21518. return [];
  21519. }
  21520. n = (guard || n === undefined) ? 1 : toInteger(n);
  21521. return baseSlice(array, 0, n < 0 ? 0 : n);
  21522. }
  21523. /**
  21524. * Creates a slice of `array` with `n` elements taken from the end.
  21525. *
  21526. * @static
  21527. * @memberOf _
  21528. * @since 3.0.0
  21529. * @category Array
  21530. * @param {Array} array The array to query.
  21531. * @param {number} [n=1] The number of elements to take.
  21532. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21533. * @returns {Array} Returns the slice of `array`.
  21534. * @example
  21535. *
  21536. * _.takeRight([1, 2, 3]);
  21537. * // => [3]
  21538. *
  21539. * _.takeRight([1, 2, 3], 2);
  21540. * // => [2, 3]
  21541. *
  21542. * _.takeRight([1, 2, 3], 5);
  21543. * // => [1, 2, 3]
  21544. *
  21545. * _.takeRight([1, 2, 3], 0);
  21546. * // => []
  21547. */
  21548. function takeRight(array, n, guard) {
  21549. var length = array == null ? 0 : array.length;
  21550. if (!length) {
  21551. return [];
  21552. }
  21553. n = (guard || n === undefined) ? 1 : toInteger(n);
  21554. n = length - n;
  21555. return baseSlice(array, n < 0 ? 0 : n, length);
  21556. }
  21557. /**
  21558. * Creates a slice of `array` with elements taken from the end. Elements are
  21559. * taken until `predicate` returns falsey. The predicate is invoked with
  21560. * three arguments: (value, index, array).
  21561. *
  21562. * @static
  21563. * @memberOf _
  21564. * @since 3.0.0
  21565. * @category Array
  21566. * @param {Array} array The array to query.
  21567. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21568. * @returns {Array} Returns the slice of `array`.
  21569. * @example
  21570. *
  21571. * var users = [
  21572. * { 'user': 'barney', 'active': true },
  21573. * { 'user': 'fred', 'active': false },
  21574. * { 'user': 'pebbles', 'active': false }
  21575. * ];
  21576. *
  21577. * _.takeRightWhile(users, function(o) { return !o.active; });
  21578. * // => objects for ['fred', 'pebbles']
  21579. *
  21580. * // The `_.matches` iteratee shorthand.
  21581. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  21582. * // => objects for ['pebbles']
  21583. *
  21584. * // The `_.matchesProperty` iteratee shorthand.
  21585. * _.takeRightWhile(users, ['active', false]);
  21586. * // => objects for ['fred', 'pebbles']
  21587. *
  21588. * // The `_.property` iteratee shorthand.
  21589. * _.takeRightWhile(users, 'active');
  21590. * // => []
  21591. */
  21592. function takeRightWhile(array, predicate) {
  21593. return (array && array.length)
  21594. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  21595. : [];
  21596. }
  21597. /**
  21598. * Creates a slice of `array` with elements taken from the beginning. Elements
  21599. * are taken until `predicate` returns falsey. The predicate is invoked with
  21600. * three arguments: (value, index, array).
  21601. *
  21602. * @static
  21603. * @memberOf _
  21604. * @since 3.0.0
  21605. * @category Array
  21606. * @param {Array} array The array to query.
  21607. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21608. * @returns {Array} Returns the slice of `array`.
  21609. * @example
  21610. *
  21611. * var users = [
  21612. * { 'user': 'barney', 'active': false },
  21613. * { 'user': 'fred', 'active': false },
  21614. * { 'user': 'pebbles', 'active': true }
  21615. * ];
  21616. *
  21617. * _.takeWhile(users, function(o) { return !o.active; });
  21618. * // => objects for ['barney', 'fred']
  21619. *
  21620. * // The `_.matches` iteratee shorthand.
  21621. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  21622. * // => objects for ['barney']
  21623. *
  21624. * // The `_.matchesProperty` iteratee shorthand.
  21625. * _.takeWhile(users, ['active', false]);
  21626. * // => objects for ['barney', 'fred']
  21627. *
  21628. * // The `_.property` iteratee shorthand.
  21629. * _.takeWhile(users, 'active');
  21630. * // => []
  21631. */
  21632. function takeWhile(array, predicate) {
  21633. return (array && array.length)
  21634. ? baseWhile(array, getIteratee(predicate, 3))
  21635. : [];
  21636. }
  21637. /**
  21638. * Creates an array of unique values, in order, from all given arrays using
  21639. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21640. * for equality comparisons.
  21641. *
  21642. * @static
  21643. * @memberOf _
  21644. * @since 0.1.0
  21645. * @category Array
  21646. * @param {...Array} [arrays] The arrays to inspect.
  21647. * @returns {Array} Returns the new array of combined values.
  21648. * @example
  21649. *
  21650. * _.union([2], [1, 2]);
  21651. * // => [2, 1]
  21652. */
  21653. var union = baseRest(function(arrays) {
  21654. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  21655. });
  21656. /**
  21657. * This method is like `_.union` except that it accepts `iteratee` which is
  21658. * invoked for each element of each `arrays` to generate the criterion by
  21659. * which uniqueness is computed. Result values are chosen from the first
  21660. * array in which the value occurs. The iteratee is invoked with one argument:
  21661. * (value).
  21662. *
  21663. * @static
  21664. * @memberOf _
  21665. * @since 4.0.0
  21666. * @category Array
  21667. * @param {...Array} [arrays] The arrays to inspect.
  21668. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21669. * @returns {Array} Returns the new array of combined values.
  21670. * @example
  21671. *
  21672. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  21673. * // => [2.1, 1.2]
  21674. *
  21675. * // The `_.property` iteratee shorthand.
  21676. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21677. * // => [{ 'x': 1 }, { 'x': 2 }]
  21678. */
  21679. var unionBy = baseRest(function(arrays) {
  21680. var iteratee = last(arrays);
  21681. if (isArrayLikeObject(iteratee)) {
  21682. iteratee = undefined;
  21683. }
  21684. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  21685. });
  21686. /**
  21687. * This method is like `_.union` except that it accepts `comparator` which
  21688. * is invoked to compare elements of `arrays`. Result values are chosen from
  21689. * the first array in which the value occurs. The comparator is invoked
  21690. * with two arguments: (arrVal, othVal).
  21691. *
  21692. * @static
  21693. * @memberOf _
  21694. * @since 4.0.0
  21695. * @category Array
  21696. * @param {...Array} [arrays] The arrays to inspect.
  21697. * @param {Function} [comparator] The comparator invoked per element.
  21698. * @returns {Array} Returns the new array of combined values.
  21699. * @example
  21700. *
  21701. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21702. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21703. *
  21704. * _.unionWith(objects, others, _.isEqual);
  21705. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21706. */
  21707. var unionWith = baseRest(function(arrays) {
  21708. var comparator = last(arrays);
  21709. comparator = typeof comparator == 'function' ? comparator : undefined;
  21710. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  21711. });
  21712. /**
  21713. * Creates a duplicate-free version of an array, using
  21714. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21715. * for equality comparisons, in which only the first occurrence of each element
  21716. * is kept. The order of result values is determined by the order they occur
  21717. * in the array.
  21718. *
  21719. * @static
  21720. * @memberOf _
  21721. * @since 0.1.0
  21722. * @category Array
  21723. * @param {Array} array The array to inspect.
  21724. * @returns {Array} Returns the new duplicate free array.
  21725. * @example
  21726. *
  21727. * _.uniq([2, 1, 2]);
  21728. * // => [2, 1]
  21729. */
  21730. function uniq(array) {
  21731. return (array && array.length) ? baseUniq(array) : [];
  21732. }
  21733. /**
  21734. * This method is like `_.uniq` except that it accepts `iteratee` which is
  21735. * invoked for each element in `array` to generate the criterion by which
  21736. * uniqueness is computed. The order of result values is determined by the
  21737. * order they occur in the array. The iteratee is invoked with one argument:
  21738. * (value).
  21739. *
  21740. * @static
  21741. * @memberOf _
  21742. * @since 4.0.0
  21743. * @category Array
  21744. * @param {Array} array The array to inspect.
  21745. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21746. * @returns {Array} Returns the new duplicate free array.
  21747. * @example
  21748. *
  21749. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  21750. * // => [2.1, 1.2]
  21751. *
  21752. * // The `_.property` iteratee shorthand.
  21753. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  21754. * // => [{ 'x': 1 }, { 'x': 2 }]
  21755. */
  21756. function uniqBy(array, iteratee) {
  21757. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  21758. }
  21759. /**
  21760. * This method is like `_.uniq` except that it accepts `comparator` which
  21761. * is invoked to compare elements of `array`. The order of result values is
  21762. * determined by the order they occur in the array.The comparator is invoked
  21763. * with two arguments: (arrVal, othVal).
  21764. *
  21765. * @static
  21766. * @memberOf _
  21767. * @since 4.0.0
  21768. * @category Array
  21769. * @param {Array} array The array to inspect.
  21770. * @param {Function} [comparator] The comparator invoked per element.
  21771. * @returns {Array} Returns the new duplicate free array.
  21772. * @example
  21773. *
  21774. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21775. *
  21776. * _.uniqWith(objects, _.isEqual);
  21777. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  21778. */
  21779. function uniqWith(array, comparator) {
  21780. comparator = typeof comparator == 'function' ? comparator : undefined;
  21781. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  21782. }
  21783. /**
  21784. * This method is like `_.zip` except that it accepts an array of grouped
  21785. * elements and creates an array regrouping the elements to their pre-zip
  21786. * configuration.
  21787. *
  21788. * @static
  21789. * @memberOf _
  21790. * @since 1.2.0
  21791. * @category Array
  21792. * @param {Array} array The array of grouped elements to process.
  21793. * @returns {Array} Returns the new array of regrouped elements.
  21794. * @example
  21795. *
  21796. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  21797. * // => [['a', 1, true], ['b', 2, false]]
  21798. *
  21799. * _.unzip(zipped);
  21800. * // => [['a', 'b'], [1, 2], [true, false]]
  21801. */
  21802. function unzip(array) {
  21803. if (!(array && array.length)) {
  21804. return [];
  21805. }
  21806. var length = 0;
  21807. array = arrayFilter(array, function(group) {
  21808. if (isArrayLikeObject(group)) {
  21809. length = nativeMax(group.length, length);
  21810. return true;
  21811. }
  21812. });
  21813. return baseTimes(length, function(index) {
  21814. return arrayMap(array, baseProperty(index));
  21815. });
  21816. }
  21817. /**
  21818. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  21819. * how regrouped values should be combined. The iteratee is invoked with the
  21820. * elements of each group: (...group).
  21821. *
  21822. * @static
  21823. * @memberOf _
  21824. * @since 3.8.0
  21825. * @category Array
  21826. * @param {Array} array The array of grouped elements to process.
  21827. * @param {Function} [iteratee=_.identity] The function to combine
  21828. * regrouped values.
  21829. * @returns {Array} Returns the new array of regrouped elements.
  21830. * @example
  21831. *
  21832. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  21833. * // => [[1, 10, 100], [2, 20, 200]]
  21834. *
  21835. * _.unzipWith(zipped, _.add);
  21836. * // => [3, 30, 300]
  21837. */
  21838. function unzipWith(array, iteratee) {
  21839. if (!(array && array.length)) {
  21840. return [];
  21841. }
  21842. var result = unzip(array);
  21843. if (iteratee == null) {
  21844. return result;
  21845. }
  21846. return arrayMap(result, function(group) {
  21847. return apply(iteratee, undefined, group);
  21848. });
  21849. }
  21850. /**
  21851. * Creates an array excluding all given values using
  21852. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21853. * for equality comparisons.
  21854. *
  21855. * **Note:** Unlike `_.pull`, this method returns a new array.
  21856. *
  21857. * @static
  21858. * @memberOf _
  21859. * @since 0.1.0
  21860. * @category Array
  21861. * @param {Array} array The array to inspect.
  21862. * @param {...*} [values] The values to exclude.
  21863. * @returns {Array} Returns the new array of filtered values.
  21864. * @see _.difference, _.xor
  21865. * @example
  21866. *
  21867. * _.without([2, 1, 2, 3], 1, 2);
  21868. * // => [3]
  21869. */
  21870. var without = baseRest(function(array, values) {
  21871. return isArrayLikeObject(array)
  21872. ? baseDifference(array, values)
  21873. : [];
  21874. });
  21875. /**
  21876. * Creates an array of unique values that is the
  21877. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  21878. * of the given arrays. The order of result values is determined by the order
  21879. * they occur in the arrays.
  21880. *
  21881. * @static
  21882. * @memberOf _
  21883. * @since 2.4.0
  21884. * @category Array
  21885. * @param {...Array} [arrays] The arrays to inspect.
  21886. * @returns {Array} Returns the new array of filtered values.
  21887. * @see _.difference, _.without
  21888. * @example
  21889. *
  21890. * _.xor([2, 1], [2, 3]);
  21891. * // => [1, 3]
  21892. */
  21893. var xor = baseRest(function(arrays) {
  21894. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  21895. });
  21896. /**
  21897. * This method is like `_.xor` except that it accepts `iteratee` which is
  21898. * invoked for each element of each `arrays` to generate the criterion by
  21899. * which by which they're compared. The order of result values is determined
  21900. * by the order they occur in the arrays. The iteratee is invoked with one
  21901. * argument: (value).
  21902. *
  21903. * @static
  21904. * @memberOf _
  21905. * @since 4.0.0
  21906. * @category Array
  21907. * @param {...Array} [arrays] The arrays to inspect.
  21908. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21909. * @returns {Array} Returns the new array of filtered values.
  21910. * @example
  21911. *
  21912. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  21913. * // => [1.2, 3.4]
  21914. *
  21915. * // The `_.property` iteratee shorthand.
  21916. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21917. * // => [{ 'x': 2 }]
  21918. */
  21919. var xorBy = baseRest(function(arrays) {
  21920. var iteratee = last(arrays);
  21921. if (isArrayLikeObject(iteratee)) {
  21922. iteratee = undefined;
  21923. }
  21924. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  21925. });
  21926. /**
  21927. * This method is like `_.xor` except that it accepts `comparator` which is
  21928. * invoked to compare elements of `arrays`. The order of result values is
  21929. * determined by the order they occur in the arrays. The comparator is invoked
  21930. * with two arguments: (arrVal, othVal).
  21931. *
  21932. * @static
  21933. * @memberOf _
  21934. * @since 4.0.0
  21935. * @category Array
  21936. * @param {...Array} [arrays] The arrays to inspect.
  21937. * @param {Function} [comparator] The comparator invoked per element.
  21938. * @returns {Array} Returns the new array of filtered values.
  21939. * @example
  21940. *
  21941. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21942. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21943. *
  21944. * _.xorWith(objects, others, _.isEqual);
  21945. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21946. */
  21947. var xorWith = baseRest(function(arrays) {
  21948. var comparator = last(arrays);
  21949. comparator = typeof comparator == 'function' ? comparator : undefined;
  21950. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  21951. });
  21952. /**
  21953. * Creates an array of grouped elements, the first of which contains the
  21954. * first elements of the given arrays, the second of which contains the
  21955. * second elements of the given arrays, and so on.
  21956. *
  21957. * @static
  21958. * @memberOf _
  21959. * @since 0.1.0
  21960. * @category Array
  21961. * @param {...Array} [arrays] The arrays to process.
  21962. * @returns {Array} Returns the new array of grouped elements.
  21963. * @example
  21964. *
  21965. * _.zip(['a', 'b'], [1, 2], [true, false]);
  21966. * // => [['a', 1, true], ['b', 2, false]]
  21967. */
  21968. var zip = baseRest(unzip);
  21969. /**
  21970. * This method is like `_.fromPairs` except that it accepts two arrays,
  21971. * one of property identifiers and one of corresponding values.
  21972. *
  21973. * @static
  21974. * @memberOf _
  21975. * @since 0.4.0
  21976. * @category Array
  21977. * @param {Array} [props=[]] The property identifiers.
  21978. * @param {Array} [values=[]] The property values.
  21979. * @returns {Object} Returns the new object.
  21980. * @example
  21981. *
  21982. * _.zipObject(['a', 'b'], [1, 2]);
  21983. * // => { 'a': 1, 'b': 2 }
  21984. */
  21985. function zipObject(props, values) {
  21986. return baseZipObject(props || [], values || [], assignValue);
  21987. }
  21988. /**
  21989. * This method is like `_.zipObject` except that it supports property paths.
  21990. *
  21991. * @static
  21992. * @memberOf _
  21993. * @since 4.1.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. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  22001. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  22002. */
  22003. function zipObjectDeep(props, values) {
  22004. return baseZipObject(props || [], values || [], baseSet);
  22005. }
  22006. /**
  22007. * This method is like `_.zip` except that it accepts `iteratee` to specify
  22008. * how grouped values should be combined. The iteratee is invoked with the
  22009. * elements of each group: (...group).
  22010. *
  22011. * @static
  22012. * @memberOf _
  22013. * @since 3.8.0
  22014. * @category Array
  22015. * @param {...Array} [arrays] The arrays to process.
  22016. * @param {Function} [iteratee=_.identity] The function to combine
  22017. * grouped values.
  22018. * @returns {Array} Returns the new array of grouped elements.
  22019. * @example
  22020. *
  22021. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  22022. * return a + b + c;
  22023. * });
  22024. * // => [111, 222]
  22025. */
  22026. var zipWith = baseRest(function(arrays) {
  22027. var length = arrays.length,
  22028. iteratee = length > 1 ? arrays[length - 1] : undefined;
  22029. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  22030. return unzipWith(arrays, iteratee);
  22031. });
  22032. /*------------------------------------------------------------------------*/
  22033. /**
  22034. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  22035. * chain sequences enabled. The result of such sequences must be unwrapped
  22036. * with `_#value`.
  22037. *
  22038. * @static
  22039. * @memberOf _
  22040. * @since 1.3.0
  22041. * @category Seq
  22042. * @param {*} value The value to wrap.
  22043. * @returns {Object} Returns the new `lodash` wrapper instance.
  22044. * @example
  22045. *
  22046. * var users = [
  22047. * { 'user': 'barney', 'age': 36 },
  22048. * { 'user': 'fred', 'age': 40 },
  22049. * { 'user': 'pebbles', 'age': 1 }
  22050. * ];
  22051. *
  22052. * var youngest = _
  22053. * .chain(users)
  22054. * .sortBy('age')
  22055. * .map(function(o) {
  22056. * return o.user + ' is ' + o.age;
  22057. * })
  22058. * .head()
  22059. * .value();
  22060. * // => 'pebbles is 1'
  22061. */
  22062. function chain(value) {
  22063. var result = lodash(value);
  22064. result.__chain__ = true;
  22065. return result;
  22066. }
  22067. /**
  22068. * This method invokes `interceptor` and returns `value`. The interceptor
  22069. * is invoked with one argument; (value). The purpose of this method is to
  22070. * "tap into" a method chain sequence in order to modify intermediate results.
  22071. *
  22072. * @static
  22073. * @memberOf _
  22074. * @since 0.1.0
  22075. * @category Seq
  22076. * @param {*} value The value to provide to `interceptor`.
  22077. * @param {Function} interceptor The function to invoke.
  22078. * @returns {*} Returns `value`.
  22079. * @example
  22080. *
  22081. * _([1, 2, 3])
  22082. * .tap(function(array) {
  22083. * // Mutate input array.
  22084. * array.pop();
  22085. * })
  22086. * .reverse()
  22087. * .value();
  22088. * // => [2, 1]
  22089. */
  22090. function tap(value, interceptor) {
  22091. interceptor(value);
  22092. return value;
  22093. }
  22094. /**
  22095. * This method is like `_.tap` except that it returns the result of `interceptor`.
  22096. * The purpose of this method is to "pass thru" values replacing intermediate
  22097. * results in a method chain sequence.
  22098. *
  22099. * @static
  22100. * @memberOf _
  22101. * @since 3.0.0
  22102. * @category Seq
  22103. * @param {*} value The value to provide to `interceptor`.
  22104. * @param {Function} interceptor The function to invoke.
  22105. * @returns {*} Returns the result of `interceptor`.
  22106. * @example
  22107. *
  22108. * _(' abc ')
  22109. * .chain()
  22110. * .trim()
  22111. * .thru(function(value) {
  22112. * return [value];
  22113. * })
  22114. * .value();
  22115. * // => ['abc']
  22116. */
  22117. function thru(value, interceptor) {
  22118. return interceptor(value);
  22119. }
  22120. /**
  22121. * This method is the wrapper version of `_.at`.
  22122. *
  22123. * @name at
  22124. * @memberOf _
  22125. * @since 1.0.0
  22126. * @category Seq
  22127. * @param {...(string|string[])} [paths] The property paths to pick.
  22128. * @returns {Object} Returns the new `lodash` wrapper instance.
  22129. * @example
  22130. *
  22131. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  22132. *
  22133. * _(object).at(['a[0].b.c', 'a[1]']).value();
  22134. * // => [3, 4]
  22135. */
  22136. var wrapperAt = flatRest(function(paths) {
  22137. var length = paths.length,
  22138. start = length ? paths[0] : 0,
  22139. value = this.__wrapped__,
  22140. interceptor = function(object) { return baseAt(object, paths); };
  22141. if (length > 1 || this.__actions__.length ||
  22142. !(value instanceof LazyWrapper) || !isIndex(start)) {
  22143. return this.thru(interceptor);
  22144. }
  22145. value = value.slice(start, +start + (length ? 1 : 0));
  22146. value.__actions__.push({
  22147. 'func': thru,
  22148. 'args': [interceptor],
  22149. 'thisArg': undefined
  22150. });
  22151. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  22152. if (length && !array.length) {
  22153. array.push(undefined);
  22154. }
  22155. return array;
  22156. });
  22157. });
  22158. /**
  22159. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  22160. *
  22161. * @name chain
  22162. * @memberOf _
  22163. * @since 0.1.0
  22164. * @category Seq
  22165. * @returns {Object} Returns the new `lodash` wrapper instance.
  22166. * @example
  22167. *
  22168. * var users = [
  22169. * { 'user': 'barney', 'age': 36 },
  22170. * { 'user': 'fred', 'age': 40 }
  22171. * ];
  22172. *
  22173. * // A sequence without explicit chaining.
  22174. * _(users).head();
  22175. * // => { 'user': 'barney', 'age': 36 }
  22176. *
  22177. * // A sequence with explicit chaining.
  22178. * _(users)
  22179. * .chain()
  22180. * .head()
  22181. * .pick('user')
  22182. * .value();
  22183. * // => { 'user': 'barney' }
  22184. */
  22185. function wrapperChain() {
  22186. return chain(this);
  22187. }
  22188. /**
  22189. * Executes the chain sequence and returns the wrapped result.
  22190. *
  22191. * @name commit
  22192. * @memberOf _
  22193. * @since 3.2.0
  22194. * @category Seq
  22195. * @returns {Object} Returns the new `lodash` wrapper instance.
  22196. * @example
  22197. *
  22198. * var array = [1, 2];
  22199. * var wrapped = _(array).push(3);
  22200. *
  22201. * console.log(array);
  22202. * // => [1, 2]
  22203. *
  22204. * wrapped = wrapped.commit();
  22205. * console.log(array);
  22206. * // => [1, 2, 3]
  22207. *
  22208. * wrapped.last();
  22209. * // => 3
  22210. *
  22211. * console.log(array);
  22212. * // => [1, 2, 3]
  22213. */
  22214. function wrapperCommit() {
  22215. return new LodashWrapper(this.value(), this.__chain__);
  22216. }
  22217. /**
  22218. * Gets the next value on a wrapped object following the
  22219. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  22220. *
  22221. * @name next
  22222. * @memberOf _
  22223. * @since 4.0.0
  22224. * @category Seq
  22225. * @returns {Object} Returns the next iterator value.
  22226. * @example
  22227. *
  22228. * var wrapped = _([1, 2]);
  22229. *
  22230. * wrapped.next();
  22231. * // => { 'done': false, 'value': 1 }
  22232. *
  22233. * wrapped.next();
  22234. * // => { 'done': false, 'value': 2 }
  22235. *
  22236. * wrapped.next();
  22237. * // => { 'done': true, 'value': undefined }
  22238. */
  22239. function wrapperNext() {
  22240. if (this.__values__ === undefined) {
  22241. this.__values__ = toArray(this.value());
  22242. }
  22243. var done = this.__index__ >= this.__values__.length,
  22244. value = done ? undefined : this.__values__[this.__index__++];
  22245. return { 'done': done, 'value': value };
  22246. }
  22247. /**
  22248. * Enables the wrapper to be iterable.
  22249. *
  22250. * @name Symbol.iterator
  22251. * @memberOf _
  22252. * @since 4.0.0
  22253. * @category Seq
  22254. * @returns {Object} Returns the wrapper object.
  22255. * @example
  22256. *
  22257. * var wrapped = _([1, 2]);
  22258. *
  22259. * wrapped[Symbol.iterator]() === wrapped;
  22260. * // => true
  22261. *
  22262. * Array.from(wrapped);
  22263. * // => [1, 2]
  22264. */
  22265. function wrapperToIterator() {
  22266. return this;
  22267. }
  22268. /**
  22269. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  22270. *
  22271. * @name plant
  22272. * @memberOf _
  22273. * @since 3.2.0
  22274. * @category Seq
  22275. * @param {*} value The value to plant.
  22276. * @returns {Object} Returns the new `lodash` wrapper instance.
  22277. * @example
  22278. *
  22279. * function square(n) {
  22280. * return n * n;
  22281. * }
  22282. *
  22283. * var wrapped = _([1, 2]).map(square);
  22284. * var other = wrapped.plant([3, 4]);
  22285. *
  22286. * other.value();
  22287. * // => [9, 16]
  22288. *
  22289. * wrapped.value();
  22290. * // => [1, 4]
  22291. */
  22292. function wrapperPlant(value) {
  22293. var result,
  22294. parent = this;
  22295. while (parent instanceof baseLodash) {
  22296. var clone = wrapperClone(parent);
  22297. clone.__index__ = 0;
  22298. clone.__values__ = undefined;
  22299. if (result) {
  22300. previous.__wrapped__ = clone;
  22301. } else {
  22302. result = clone;
  22303. }
  22304. var previous = clone;
  22305. parent = parent.__wrapped__;
  22306. }
  22307. previous.__wrapped__ = value;
  22308. return result;
  22309. }
  22310. /**
  22311. * This method is the wrapper version of `_.reverse`.
  22312. *
  22313. * **Note:** This method mutates the wrapped array.
  22314. *
  22315. * @name reverse
  22316. * @memberOf _
  22317. * @since 0.1.0
  22318. * @category Seq
  22319. * @returns {Object} Returns the new `lodash` wrapper instance.
  22320. * @example
  22321. *
  22322. * var array = [1, 2, 3];
  22323. *
  22324. * _(array).reverse().value()
  22325. * // => [3, 2, 1]
  22326. *
  22327. * console.log(array);
  22328. * // => [3, 2, 1]
  22329. */
  22330. function wrapperReverse() {
  22331. var value = this.__wrapped__;
  22332. if (value instanceof LazyWrapper) {
  22333. var wrapped = value;
  22334. if (this.__actions__.length) {
  22335. wrapped = new LazyWrapper(this);
  22336. }
  22337. wrapped = wrapped.reverse();
  22338. wrapped.__actions__.push({
  22339. 'func': thru,
  22340. 'args': [reverse],
  22341. 'thisArg': undefined
  22342. });
  22343. return new LodashWrapper(wrapped, this.__chain__);
  22344. }
  22345. return this.thru(reverse);
  22346. }
  22347. /**
  22348. * Executes the chain sequence to resolve the unwrapped value.
  22349. *
  22350. * @name value
  22351. * @memberOf _
  22352. * @since 0.1.0
  22353. * @alias toJSON, valueOf
  22354. * @category Seq
  22355. * @returns {*} Returns the resolved unwrapped value.
  22356. * @example
  22357. *
  22358. * _([1, 2, 3]).value();
  22359. * // => [1, 2, 3]
  22360. */
  22361. function wrapperValue() {
  22362. return baseWrapperValue(this.__wrapped__, this.__actions__);
  22363. }
  22364. /*------------------------------------------------------------------------*/
  22365. /**
  22366. * Creates an object composed of keys generated from the results of running
  22367. * each element of `collection` thru `iteratee`. The corresponding value of
  22368. * each key is the number of times the key was returned by `iteratee`. The
  22369. * iteratee is invoked with one argument: (value).
  22370. *
  22371. * @static
  22372. * @memberOf _
  22373. * @since 0.5.0
  22374. * @category Collection
  22375. * @param {Array|Object} collection The collection to iterate over.
  22376. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22377. * @returns {Object} Returns the composed aggregate object.
  22378. * @example
  22379. *
  22380. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  22381. * // => { '4': 1, '6': 2 }
  22382. *
  22383. * // The `_.property` iteratee shorthand.
  22384. * _.countBy(['one', 'two', 'three'], 'length');
  22385. * // => { '3': 2, '5': 1 }
  22386. */
  22387. var countBy = createAggregator(function(result, value, key) {
  22388. if (hasOwnProperty.call(result, key)) {
  22389. ++result[key];
  22390. } else {
  22391. baseAssignValue(result, key, 1);
  22392. }
  22393. });
  22394. /**
  22395. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  22396. * Iteration is stopped once `predicate` returns falsey. The predicate is
  22397. * invoked with three arguments: (value, index|key, collection).
  22398. *
  22399. * **Note:** This method returns `true` for
  22400. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  22401. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  22402. * elements of empty collections.
  22403. *
  22404. * @static
  22405. * @memberOf _
  22406. * @since 0.1.0
  22407. * @category Collection
  22408. * @param {Array|Object} collection The collection to iterate over.
  22409. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22410. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22411. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  22412. * else `false`.
  22413. * @example
  22414. *
  22415. * _.every([true, 1, null, 'yes'], Boolean);
  22416. * // => false
  22417. *
  22418. * var users = [
  22419. * { 'user': 'barney', 'age': 36, 'active': false },
  22420. * { 'user': 'fred', 'age': 40, 'active': false }
  22421. * ];
  22422. *
  22423. * // The `_.matches` iteratee shorthand.
  22424. * _.every(users, { 'user': 'barney', 'active': false });
  22425. * // => false
  22426. *
  22427. * // The `_.matchesProperty` iteratee shorthand.
  22428. * _.every(users, ['active', false]);
  22429. * // => true
  22430. *
  22431. * // The `_.property` iteratee shorthand.
  22432. * _.every(users, 'active');
  22433. * // => false
  22434. */
  22435. function every(collection, predicate, guard) {
  22436. var func = isArray(collection) ? arrayEvery : baseEvery;
  22437. if (guard && isIterateeCall(collection, predicate, guard)) {
  22438. predicate = undefined;
  22439. }
  22440. return func(collection, getIteratee(predicate, 3));
  22441. }
  22442. /**
  22443. * Iterates over elements of `collection`, returning an array of all elements
  22444. * `predicate` returns truthy for. The predicate is invoked with three
  22445. * arguments: (value, index|key, collection).
  22446. *
  22447. * **Note:** Unlike `_.remove`, this method returns a new array.
  22448. *
  22449. * @static
  22450. * @memberOf _
  22451. * @since 0.1.0
  22452. * @category Collection
  22453. * @param {Array|Object} collection The collection to iterate over.
  22454. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22455. * @returns {Array} Returns the new filtered array.
  22456. * @see _.reject
  22457. * @example
  22458. *
  22459. * var users = [
  22460. * { 'user': 'barney', 'age': 36, 'active': true },
  22461. * { 'user': 'fred', 'age': 40, 'active': false }
  22462. * ];
  22463. *
  22464. * _.filter(users, function(o) { return !o.active; });
  22465. * // => objects for ['fred']
  22466. *
  22467. * // The `_.matches` iteratee shorthand.
  22468. * _.filter(users, { 'age': 36, 'active': true });
  22469. * // => objects for ['barney']
  22470. *
  22471. * // The `_.matchesProperty` iteratee shorthand.
  22472. * _.filter(users, ['active', false]);
  22473. * // => objects for ['fred']
  22474. *
  22475. * // The `_.property` iteratee shorthand.
  22476. * _.filter(users, 'active');
  22477. * // => objects for ['barney']
  22478. *
  22479. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  22480. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  22481. * // => objects for ['fred', 'barney']
  22482. */
  22483. function filter(collection, predicate) {
  22484. var func = isArray(collection) ? arrayFilter : baseFilter;
  22485. return func(collection, getIteratee(predicate, 3));
  22486. }
  22487. /**
  22488. * Iterates over elements of `collection`, returning the first element
  22489. * `predicate` returns truthy for. The predicate is invoked with three
  22490. * arguments: (value, index|key, collection).
  22491. *
  22492. * @static
  22493. * @memberOf _
  22494. * @since 0.1.0
  22495. * @category Collection
  22496. * @param {Array|Object} collection The collection to inspect.
  22497. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22498. * @param {number} [fromIndex=0] The index to search from.
  22499. * @returns {*} Returns the matched element, else `undefined`.
  22500. * @example
  22501. *
  22502. * var users = [
  22503. * { 'user': 'barney', 'age': 36, 'active': true },
  22504. * { 'user': 'fred', 'age': 40, 'active': false },
  22505. * { 'user': 'pebbles', 'age': 1, 'active': true }
  22506. * ];
  22507. *
  22508. * _.find(users, function(o) { return o.age < 40; });
  22509. * // => object for 'barney'
  22510. *
  22511. * // The `_.matches` iteratee shorthand.
  22512. * _.find(users, { 'age': 1, 'active': true });
  22513. * // => object for 'pebbles'
  22514. *
  22515. * // The `_.matchesProperty` iteratee shorthand.
  22516. * _.find(users, ['active', false]);
  22517. * // => object for 'fred'
  22518. *
  22519. * // The `_.property` iteratee shorthand.
  22520. * _.find(users, 'active');
  22521. * // => object for 'barney'
  22522. */
  22523. var find = createFind(findIndex);
  22524. /**
  22525. * This method is like `_.find` except that it iterates over elements of
  22526. * `collection` from right to left.
  22527. *
  22528. * @static
  22529. * @memberOf _
  22530. * @since 2.0.0
  22531. * @category Collection
  22532. * @param {Array|Object} collection The collection to inspect.
  22533. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22534. * @param {number} [fromIndex=collection.length-1] The index to search from.
  22535. * @returns {*} Returns the matched element, else `undefined`.
  22536. * @example
  22537. *
  22538. * _.findLast([1, 2, 3, 4], function(n) {
  22539. * return n % 2 == 1;
  22540. * });
  22541. * // => 3
  22542. */
  22543. var findLast = createFind(findLastIndex);
  22544. /**
  22545. * Creates a flattened array of values by running each element in `collection`
  22546. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  22547. * with three arguments: (value, index|key, collection).
  22548. *
  22549. * @static
  22550. * @memberOf _
  22551. * @since 4.0.0
  22552. * @category Collection
  22553. * @param {Array|Object} collection The collection to iterate over.
  22554. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22555. * @returns {Array} Returns the new flattened array.
  22556. * @example
  22557. *
  22558. * function duplicate(n) {
  22559. * return [n, n];
  22560. * }
  22561. *
  22562. * _.flatMap([1, 2], duplicate);
  22563. * // => [1, 1, 2, 2]
  22564. */
  22565. function flatMap(collection, iteratee) {
  22566. return baseFlatten(map(collection, iteratee), 1);
  22567. }
  22568. /**
  22569. * This method is like `_.flatMap` except that it recursively flattens the
  22570. * mapped results.
  22571. *
  22572. * @static
  22573. * @memberOf _
  22574. * @since 4.7.0
  22575. * @category Collection
  22576. * @param {Array|Object} collection The collection to iterate over.
  22577. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22578. * @returns {Array} Returns the new flattened array.
  22579. * @example
  22580. *
  22581. * function duplicate(n) {
  22582. * return [[[n, n]]];
  22583. * }
  22584. *
  22585. * _.flatMapDeep([1, 2], duplicate);
  22586. * // => [1, 1, 2, 2]
  22587. */
  22588. function flatMapDeep(collection, iteratee) {
  22589. return baseFlatten(map(collection, iteratee), INFINITY);
  22590. }
  22591. /**
  22592. * This method is like `_.flatMap` except that it recursively flattens the
  22593. * mapped results up to `depth` times.
  22594. *
  22595. * @static
  22596. * @memberOf _
  22597. * @since 4.7.0
  22598. * @category Collection
  22599. * @param {Array|Object} collection The collection to iterate over.
  22600. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22601. * @param {number} [depth=1] The maximum recursion depth.
  22602. * @returns {Array} Returns the new flattened array.
  22603. * @example
  22604. *
  22605. * function duplicate(n) {
  22606. * return [[[n, n]]];
  22607. * }
  22608. *
  22609. * _.flatMapDepth([1, 2], duplicate, 2);
  22610. * // => [[1, 1], [2, 2]]
  22611. */
  22612. function flatMapDepth(collection, iteratee, depth) {
  22613. depth = depth === undefined ? 1 : toInteger(depth);
  22614. return baseFlatten(map(collection, iteratee), depth);
  22615. }
  22616. /**
  22617. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  22618. * The iteratee is invoked with three arguments: (value, index|key, collection).
  22619. * Iteratee functions may exit iteration early by explicitly returning `false`.
  22620. *
  22621. * **Note:** As with other "Collections" methods, objects with a "length"
  22622. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  22623. * or `_.forOwn` for object iteration.
  22624. *
  22625. * @static
  22626. * @memberOf _
  22627. * @since 0.1.0
  22628. * @alias each
  22629. * @category Collection
  22630. * @param {Array|Object} collection The collection to iterate over.
  22631. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22632. * @returns {Array|Object} Returns `collection`.
  22633. * @see _.forEachRight
  22634. * @example
  22635. *
  22636. * _.forEach([1, 2], function(value) {
  22637. * console.log(value);
  22638. * });
  22639. * // => Logs `1` then `2`.
  22640. *
  22641. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  22642. * console.log(key);
  22643. * });
  22644. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  22645. */
  22646. function forEach(collection, iteratee) {
  22647. var func = isArray(collection) ? arrayEach : baseEach;
  22648. return func(collection, getIteratee(iteratee, 3));
  22649. }
  22650. /**
  22651. * This method is like `_.forEach` except that it iterates over elements of
  22652. * `collection` from right to left.
  22653. *
  22654. * @static
  22655. * @memberOf _
  22656. * @since 2.0.0
  22657. * @alias eachRight
  22658. * @category Collection
  22659. * @param {Array|Object} collection The collection to iterate over.
  22660. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22661. * @returns {Array|Object} Returns `collection`.
  22662. * @see _.forEach
  22663. * @example
  22664. *
  22665. * _.forEachRight([1, 2], function(value) {
  22666. * console.log(value);
  22667. * });
  22668. * // => Logs `2` then `1`.
  22669. */
  22670. function forEachRight(collection, iteratee) {
  22671. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  22672. return func(collection, getIteratee(iteratee, 3));
  22673. }
  22674. /**
  22675. * Creates an object composed of keys generated from the results of running
  22676. * each element of `collection` thru `iteratee`. The order of grouped values
  22677. * is determined by the order they occur in `collection`. The corresponding
  22678. * value of each key is an array of elements responsible for generating the
  22679. * key. The iteratee is invoked with one argument: (value).
  22680. *
  22681. * @static
  22682. * @memberOf _
  22683. * @since 0.1.0
  22684. * @category Collection
  22685. * @param {Array|Object} collection The collection to iterate over.
  22686. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22687. * @returns {Object} Returns the composed aggregate object.
  22688. * @example
  22689. *
  22690. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  22691. * // => { '4': [4.2], '6': [6.1, 6.3] }
  22692. *
  22693. * // The `_.property` iteratee shorthand.
  22694. * _.groupBy(['one', 'two', 'three'], 'length');
  22695. * // => { '3': ['one', 'two'], '5': ['three'] }
  22696. */
  22697. var groupBy = createAggregator(function(result, value, key) {
  22698. if (hasOwnProperty.call(result, key)) {
  22699. result[key].push(value);
  22700. } else {
  22701. baseAssignValue(result, key, [value]);
  22702. }
  22703. });
  22704. /**
  22705. * Checks if `value` is in `collection`. If `collection` is a string, it's
  22706. * checked for a substring of `value`, otherwise
  22707. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22708. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  22709. * the offset from the end of `collection`.
  22710. *
  22711. * @static
  22712. * @memberOf _
  22713. * @since 0.1.0
  22714. * @category Collection
  22715. * @param {Array|Object|string} collection The collection to inspect.
  22716. * @param {*} value The value to search for.
  22717. * @param {number} [fromIndex=0] The index to search from.
  22718. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22719. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  22720. * @example
  22721. *
  22722. * _.includes([1, 2, 3], 1);
  22723. * // => true
  22724. *
  22725. * _.includes([1, 2, 3], 1, 2);
  22726. * // => false
  22727. *
  22728. * _.includes({ 'a': 1, 'b': 2 }, 1);
  22729. * // => true
  22730. *
  22731. * _.includes('abcd', 'bc');
  22732. * // => true
  22733. */
  22734. function includes(collection, value, fromIndex, guard) {
  22735. collection = isArrayLike(collection) ? collection : values(collection);
  22736. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  22737. var length = collection.length;
  22738. if (fromIndex < 0) {
  22739. fromIndex = nativeMax(length + fromIndex, 0);
  22740. }
  22741. return isString(collection)
  22742. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  22743. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  22744. }
  22745. /**
  22746. * Invokes the method at `path` of each element in `collection`, returning
  22747. * an array of the results of each invoked method. Any additional arguments
  22748. * are provided to each invoked method. If `path` is a function, it's invoked
  22749. * for, and `this` bound to, each element in `collection`.
  22750. *
  22751. * @static
  22752. * @memberOf _
  22753. * @since 4.0.0
  22754. * @category Collection
  22755. * @param {Array|Object} collection The collection to iterate over.
  22756. * @param {Array|Function|string} path The path of the method to invoke or
  22757. * the function invoked per iteration.
  22758. * @param {...*} [args] The arguments to invoke each method with.
  22759. * @returns {Array} Returns the array of results.
  22760. * @example
  22761. *
  22762. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  22763. * // => [[1, 5, 7], [1, 2, 3]]
  22764. *
  22765. * _.invokeMap([123, 456], String.prototype.split, '');
  22766. * // => [['1', '2', '3'], ['4', '5', '6']]
  22767. */
  22768. var invokeMap = baseRest(function(collection, path, args) {
  22769. var index = -1,
  22770. isFunc = typeof path == 'function',
  22771. result = isArrayLike(collection) ? Array(collection.length) : [];
  22772. baseEach(collection, function(value) {
  22773. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  22774. });
  22775. return result;
  22776. });
  22777. /**
  22778. * Creates an object composed of keys generated from the results of running
  22779. * each element of `collection` thru `iteratee`. The corresponding value of
  22780. * each key is the last element responsible for generating the key. The
  22781. * iteratee is invoked with one argument: (value).
  22782. *
  22783. * @static
  22784. * @memberOf _
  22785. * @since 4.0.0
  22786. * @category Collection
  22787. * @param {Array|Object} collection The collection to iterate over.
  22788. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22789. * @returns {Object} Returns the composed aggregate object.
  22790. * @example
  22791. *
  22792. * var array = [
  22793. * { 'dir': 'left', 'code': 97 },
  22794. * { 'dir': 'right', 'code': 100 }
  22795. * ];
  22796. *
  22797. * _.keyBy(array, function(o) {
  22798. * return String.fromCharCode(o.code);
  22799. * });
  22800. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  22801. *
  22802. * _.keyBy(array, 'dir');
  22803. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  22804. */
  22805. var keyBy = createAggregator(function(result, value, key) {
  22806. baseAssignValue(result, key, value);
  22807. });
  22808. /**
  22809. * Creates an array of values by running each element in `collection` thru
  22810. * `iteratee`. The iteratee is invoked with three arguments:
  22811. * (value, index|key, collection).
  22812. *
  22813. * Many lodash methods are guarded to work as iteratees for methods like
  22814. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  22815. *
  22816. * The guarded methods are:
  22817. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  22818. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  22819. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  22820. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  22821. *
  22822. * @static
  22823. * @memberOf _
  22824. * @since 0.1.0
  22825. * @category Collection
  22826. * @param {Array|Object} collection The collection to iterate over.
  22827. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22828. * @returns {Array} Returns the new mapped array.
  22829. * @example
  22830. *
  22831. * function square(n) {
  22832. * return n * n;
  22833. * }
  22834. *
  22835. * _.map([4, 8], square);
  22836. * // => [16, 64]
  22837. *
  22838. * _.map({ 'a': 4, 'b': 8 }, square);
  22839. * // => [16, 64] (iteration order is not guaranteed)
  22840. *
  22841. * var users = [
  22842. * { 'user': 'barney' },
  22843. * { 'user': 'fred' }
  22844. * ];
  22845. *
  22846. * // The `_.property` iteratee shorthand.
  22847. * _.map(users, 'user');
  22848. * // => ['barney', 'fred']
  22849. */
  22850. function map(collection, iteratee) {
  22851. var func = isArray(collection) ? arrayMap : baseMap;
  22852. return func(collection, getIteratee(iteratee, 3));
  22853. }
  22854. /**
  22855. * This method is like `_.sortBy` except that it allows specifying the sort
  22856. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  22857. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  22858. * descending or "asc" for ascending sort order of corresponding values.
  22859. *
  22860. * @static
  22861. * @memberOf _
  22862. * @since 4.0.0
  22863. * @category Collection
  22864. * @param {Array|Object} collection The collection to iterate over.
  22865. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  22866. * The iteratees to sort by.
  22867. * @param {string[]} [orders] The sort orders of `iteratees`.
  22868. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22869. * @returns {Array} Returns the new sorted array.
  22870. * @example
  22871. *
  22872. * var users = [
  22873. * { 'user': 'fred', 'age': 48 },
  22874. * { 'user': 'barney', 'age': 34 },
  22875. * { 'user': 'fred', 'age': 40 },
  22876. * { 'user': 'barney', 'age': 36 }
  22877. * ];
  22878. *
  22879. * // Sort by `user` in ascending order and by `age` in descending order.
  22880. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  22881. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22882. */
  22883. function orderBy(collection, iteratees, orders, guard) {
  22884. if (collection == null) {
  22885. return [];
  22886. }
  22887. if (!isArray(iteratees)) {
  22888. iteratees = iteratees == null ? [] : [iteratees];
  22889. }
  22890. orders = guard ? undefined : orders;
  22891. if (!isArray(orders)) {
  22892. orders = orders == null ? [] : [orders];
  22893. }
  22894. return baseOrderBy(collection, iteratees, orders);
  22895. }
  22896. /**
  22897. * Creates an array of elements split into two groups, the first of which
  22898. * contains elements `predicate` returns truthy for, the second of which
  22899. * contains elements `predicate` returns falsey for. The predicate is
  22900. * invoked with one argument: (value).
  22901. *
  22902. * @static
  22903. * @memberOf _
  22904. * @since 3.0.0
  22905. * @category Collection
  22906. * @param {Array|Object} collection The collection to iterate over.
  22907. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22908. * @returns {Array} Returns the array of grouped elements.
  22909. * @example
  22910. *
  22911. * var users = [
  22912. * { 'user': 'barney', 'age': 36, 'active': false },
  22913. * { 'user': 'fred', 'age': 40, 'active': true },
  22914. * { 'user': 'pebbles', 'age': 1, 'active': false }
  22915. * ];
  22916. *
  22917. * _.partition(users, function(o) { return o.active; });
  22918. * // => objects for [['fred'], ['barney', 'pebbles']]
  22919. *
  22920. * // The `_.matches` iteratee shorthand.
  22921. * _.partition(users, { 'age': 1, 'active': false });
  22922. * // => objects for [['pebbles'], ['barney', 'fred']]
  22923. *
  22924. * // The `_.matchesProperty` iteratee shorthand.
  22925. * _.partition(users, ['active', false]);
  22926. * // => objects for [['barney', 'pebbles'], ['fred']]
  22927. *
  22928. * // The `_.property` iteratee shorthand.
  22929. * _.partition(users, 'active');
  22930. * // => objects for [['fred'], ['barney', 'pebbles']]
  22931. */
  22932. var partition = createAggregator(function(result, value, key) {
  22933. result[key ? 0 : 1].push(value);
  22934. }, function() { return [[], []]; });
  22935. /**
  22936. * Reduces `collection` to a value which is the accumulated result of running
  22937. * each element in `collection` thru `iteratee`, where each successive
  22938. * invocation is supplied the return value of the previous. If `accumulator`
  22939. * is not given, the first element of `collection` is used as the initial
  22940. * value. The iteratee is invoked with four arguments:
  22941. * (accumulator, value, index|key, collection).
  22942. *
  22943. * Many lodash methods are guarded to work as iteratees for methods like
  22944. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  22945. *
  22946. * The guarded methods are:
  22947. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  22948. * and `sortBy`
  22949. *
  22950. * @static
  22951. * @memberOf _
  22952. * @since 0.1.0
  22953. * @category Collection
  22954. * @param {Array|Object} collection The collection to iterate over.
  22955. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22956. * @param {*} [accumulator] The initial value.
  22957. * @returns {*} Returns the accumulated value.
  22958. * @see _.reduceRight
  22959. * @example
  22960. *
  22961. * _.reduce([1, 2], function(sum, n) {
  22962. * return sum + n;
  22963. * }, 0);
  22964. * // => 3
  22965. *
  22966. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  22967. * (result[value] || (result[value] = [])).push(key);
  22968. * return result;
  22969. * }, {});
  22970. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  22971. */
  22972. function reduce(collection, iteratee, accumulator) {
  22973. var func = isArray(collection) ? arrayReduce : baseReduce,
  22974. initAccum = arguments.length < 3;
  22975. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  22976. }
  22977. /**
  22978. * This method is like `_.reduce` except that it iterates over elements of
  22979. * `collection` from right to left.
  22980. *
  22981. * @static
  22982. * @memberOf _
  22983. * @since 0.1.0
  22984. * @category Collection
  22985. * @param {Array|Object} collection The collection to iterate over.
  22986. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22987. * @param {*} [accumulator] The initial value.
  22988. * @returns {*} Returns the accumulated value.
  22989. * @see _.reduce
  22990. * @example
  22991. *
  22992. * var array = [[0, 1], [2, 3], [4, 5]];
  22993. *
  22994. * _.reduceRight(array, function(flattened, other) {
  22995. * return flattened.concat(other);
  22996. * }, []);
  22997. * // => [4, 5, 2, 3, 0, 1]
  22998. */
  22999. function reduceRight(collection, iteratee, accumulator) {
  23000. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  23001. initAccum = arguments.length < 3;
  23002. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  23003. }
  23004. /**
  23005. * The opposite of `_.filter`; this method returns the elements of `collection`
  23006. * that `predicate` does **not** return truthy for.
  23007. *
  23008. * @static
  23009. * @memberOf _
  23010. * @since 0.1.0
  23011. * @category Collection
  23012. * @param {Array|Object} collection The collection to iterate over.
  23013. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23014. * @returns {Array} Returns the new filtered array.
  23015. * @see _.filter
  23016. * @example
  23017. *
  23018. * var users = [
  23019. * { 'user': 'barney', 'age': 36, 'active': false },
  23020. * { 'user': 'fred', 'age': 40, 'active': true }
  23021. * ];
  23022. *
  23023. * _.reject(users, function(o) { return !o.active; });
  23024. * // => objects for ['fred']
  23025. *
  23026. * // The `_.matches` iteratee shorthand.
  23027. * _.reject(users, { 'age': 40, 'active': true });
  23028. * // => objects for ['barney']
  23029. *
  23030. * // The `_.matchesProperty` iteratee shorthand.
  23031. * _.reject(users, ['active', false]);
  23032. * // => objects for ['fred']
  23033. *
  23034. * // The `_.property` iteratee shorthand.
  23035. * _.reject(users, 'active');
  23036. * // => objects for ['barney']
  23037. */
  23038. function reject(collection, predicate) {
  23039. var func = isArray(collection) ? arrayFilter : baseFilter;
  23040. return func(collection, negate(getIteratee(predicate, 3)));
  23041. }
  23042. /**
  23043. * Gets a random element from `collection`.
  23044. *
  23045. * @static
  23046. * @memberOf _
  23047. * @since 2.0.0
  23048. * @category Collection
  23049. * @param {Array|Object} collection The collection to sample.
  23050. * @returns {*} Returns the random element.
  23051. * @example
  23052. *
  23053. * _.sample([1, 2, 3, 4]);
  23054. * // => 2
  23055. */
  23056. function sample(collection) {
  23057. var func = isArray(collection) ? arraySample : baseSample;
  23058. return func(collection);
  23059. }
  23060. /**
  23061. * Gets `n` random elements at unique keys from `collection` up to the
  23062. * size of `collection`.
  23063. *
  23064. * @static
  23065. * @memberOf _
  23066. * @since 4.0.0
  23067. * @category Collection
  23068. * @param {Array|Object} collection The collection to sample.
  23069. * @param {number} [n=1] The number of elements to sample.
  23070. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23071. * @returns {Array} Returns the random elements.
  23072. * @example
  23073. *
  23074. * _.sampleSize([1, 2, 3], 2);
  23075. * // => [3, 1]
  23076. *
  23077. * _.sampleSize([1, 2, 3], 4);
  23078. * // => [2, 3, 1]
  23079. */
  23080. function sampleSize(collection, n, guard) {
  23081. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  23082. n = 1;
  23083. } else {
  23084. n = toInteger(n);
  23085. }
  23086. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  23087. return func(collection, n);
  23088. }
  23089. /**
  23090. * Creates an array of shuffled values, using a version of the
  23091. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  23092. *
  23093. * @static
  23094. * @memberOf _
  23095. * @since 0.1.0
  23096. * @category Collection
  23097. * @param {Array|Object} collection The collection to shuffle.
  23098. * @returns {Array} Returns the new shuffled array.
  23099. * @example
  23100. *
  23101. * _.shuffle([1, 2, 3, 4]);
  23102. * // => [4, 1, 3, 2]
  23103. */
  23104. function shuffle(collection) {
  23105. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  23106. return func(collection);
  23107. }
  23108. /**
  23109. * Gets the size of `collection` by returning its length for array-like
  23110. * values or the number of own enumerable string keyed properties for objects.
  23111. *
  23112. * @static
  23113. * @memberOf _
  23114. * @since 0.1.0
  23115. * @category Collection
  23116. * @param {Array|Object|string} collection The collection to inspect.
  23117. * @returns {number} Returns the collection size.
  23118. * @example
  23119. *
  23120. * _.size([1, 2, 3]);
  23121. * // => 3
  23122. *
  23123. * _.size({ 'a': 1, 'b': 2 });
  23124. * // => 2
  23125. *
  23126. * _.size('pebbles');
  23127. * // => 7
  23128. */
  23129. function size(collection) {
  23130. if (collection == null) {
  23131. return 0;
  23132. }
  23133. if (isArrayLike(collection)) {
  23134. return isString(collection) ? stringSize(collection) : collection.length;
  23135. }
  23136. var tag = getTag(collection);
  23137. if (tag == mapTag || tag == setTag) {
  23138. return collection.size;
  23139. }
  23140. return baseKeys(collection).length;
  23141. }
  23142. /**
  23143. * Checks if `predicate` returns truthy for **any** element of `collection`.
  23144. * Iteration is stopped once `predicate` returns truthy. The predicate is
  23145. * invoked with three arguments: (value, index|key, collection).
  23146. *
  23147. * @static
  23148. * @memberOf _
  23149. * @since 0.1.0
  23150. * @category Collection
  23151. * @param {Array|Object} collection The collection to iterate over.
  23152. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23153. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23154. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23155. * else `false`.
  23156. * @example
  23157. *
  23158. * _.some([null, 0, 'yes', false], Boolean);
  23159. * // => true
  23160. *
  23161. * var users = [
  23162. * { 'user': 'barney', 'active': true },
  23163. * { 'user': 'fred', 'active': false }
  23164. * ];
  23165. *
  23166. * // The `_.matches` iteratee shorthand.
  23167. * _.some(users, { 'user': 'barney', 'active': false });
  23168. * // => false
  23169. *
  23170. * // The `_.matchesProperty` iteratee shorthand.
  23171. * _.some(users, ['active', false]);
  23172. * // => true
  23173. *
  23174. * // The `_.property` iteratee shorthand.
  23175. * _.some(users, 'active');
  23176. * // => true
  23177. */
  23178. function some(collection, predicate, guard) {
  23179. var func = isArray(collection) ? arraySome : baseSome;
  23180. if (guard && isIterateeCall(collection, predicate, guard)) {
  23181. predicate = undefined;
  23182. }
  23183. return func(collection, getIteratee(predicate, 3));
  23184. }
  23185. /**
  23186. * Creates an array of elements, sorted in ascending order by the results of
  23187. * running each element in a collection thru each iteratee. This method
  23188. * performs a stable sort, that is, it preserves the original sort order of
  23189. * equal elements. The iteratees are invoked with one argument: (value).
  23190. *
  23191. * @static
  23192. * @memberOf _
  23193. * @since 0.1.0
  23194. * @category Collection
  23195. * @param {Array|Object} collection The collection to iterate over.
  23196. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23197. * The iteratees to sort by.
  23198. * @returns {Array} Returns the new sorted array.
  23199. * @example
  23200. *
  23201. * var users = [
  23202. * { 'user': 'fred', 'age': 48 },
  23203. * { 'user': 'barney', 'age': 36 },
  23204. * { 'user': 'fred', 'age': 30 },
  23205. * { 'user': 'barney', 'age': 34 }
  23206. * ];
  23207. *
  23208. * _.sortBy(users, [function(o) { return o.user; }]);
  23209. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  23210. *
  23211. * _.sortBy(users, ['user', 'age']);
  23212. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  23213. */
  23214. var sortBy = baseRest(function(collection, iteratees) {
  23215. if (collection == null) {
  23216. return [];
  23217. }
  23218. var length = iteratees.length;
  23219. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  23220. iteratees = [];
  23221. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  23222. iteratees = [iteratees[0]];
  23223. }
  23224. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  23225. });
  23226. /*------------------------------------------------------------------------*/
  23227. /**
  23228. * Gets the timestamp of the number of milliseconds that have elapsed since
  23229. * the Unix epoch (1 January 1970 00:00:00 UTC).
  23230. *
  23231. * @static
  23232. * @memberOf _
  23233. * @since 2.4.0
  23234. * @category Date
  23235. * @returns {number} Returns the timestamp.
  23236. * @example
  23237. *
  23238. * _.defer(function(stamp) {
  23239. * console.log(_.now() - stamp);
  23240. * }, _.now());
  23241. * // => Logs the number of milliseconds it took for the deferred invocation.
  23242. */
  23243. var now = ctxNow || function() {
  23244. return root.Date.now();
  23245. };
  23246. /*------------------------------------------------------------------------*/
  23247. /**
  23248. * The opposite of `_.before`; this method creates a function that invokes
  23249. * `func` once it's called `n` or more times.
  23250. *
  23251. * @static
  23252. * @memberOf _
  23253. * @since 0.1.0
  23254. * @category Function
  23255. * @param {number} n The number of calls before `func` is invoked.
  23256. * @param {Function} func The function to restrict.
  23257. * @returns {Function} Returns the new restricted function.
  23258. * @example
  23259. *
  23260. * var saves = ['profile', 'settings'];
  23261. *
  23262. * var done = _.after(saves.length, function() {
  23263. * console.log('done saving!');
  23264. * });
  23265. *
  23266. * _.forEach(saves, function(type) {
  23267. * asyncSave({ 'type': type, 'complete': done });
  23268. * });
  23269. * // => Logs 'done saving!' after the two async saves have completed.
  23270. */
  23271. function after(n, func) {
  23272. if (typeof func != 'function') {
  23273. throw new TypeError(FUNC_ERROR_TEXT);
  23274. }
  23275. n = toInteger(n);
  23276. return function() {
  23277. if (--n < 1) {
  23278. return func.apply(this, arguments);
  23279. }
  23280. };
  23281. }
  23282. /**
  23283. * Creates a function that invokes `func`, with up to `n` arguments,
  23284. * ignoring any additional arguments.
  23285. *
  23286. * @static
  23287. * @memberOf _
  23288. * @since 3.0.0
  23289. * @category Function
  23290. * @param {Function} func The function to cap arguments for.
  23291. * @param {number} [n=func.length] The arity cap.
  23292. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23293. * @returns {Function} Returns the new capped function.
  23294. * @example
  23295. *
  23296. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  23297. * // => [6, 8, 10]
  23298. */
  23299. function ary(func, n, guard) {
  23300. n = guard ? undefined : n;
  23301. n = (func && n == null) ? func.length : n;
  23302. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  23303. }
  23304. /**
  23305. * Creates a function that invokes `func`, with the `this` binding and arguments
  23306. * of the created function, while it's called less than `n` times. Subsequent
  23307. * calls to the created function return the result of the last `func` invocation.
  23308. *
  23309. * @static
  23310. * @memberOf _
  23311. * @since 3.0.0
  23312. * @category Function
  23313. * @param {number} n The number of calls at which `func` is no longer invoked.
  23314. * @param {Function} func The function to restrict.
  23315. * @returns {Function} Returns the new restricted function.
  23316. * @example
  23317. *
  23318. * jQuery(element).on('click', _.before(5, addContactToList));
  23319. * // => Allows adding up to 4 contacts to the list.
  23320. */
  23321. function before(n, func) {
  23322. var result;
  23323. if (typeof func != 'function') {
  23324. throw new TypeError(FUNC_ERROR_TEXT);
  23325. }
  23326. n = toInteger(n);
  23327. return function() {
  23328. if (--n > 0) {
  23329. result = func.apply(this, arguments);
  23330. }
  23331. if (n <= 1) {
  23332. func = undefined;
  23333. }
  23334. return result;
  23335. };
  23336. }
  23337. /**
  23338. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  23339. * and `partials` prepended to the arguments it receives.
  23340. *
  23341. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  23342. * may be used as a placeholder for partially applied arguments.
  23343. *
  23344. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  23345. * property of bound functions.
  23346. *
  23347. * @static
  23348. * @memberOf _
  23349. * @since 0.1.0
  23350. * @category Function
  23351. * @param {Function} func The function to bind.
  23352. * @param {*} thisArg The `this` binding of `func`.
  23353. * @param {...*} [partials] The arguments to be partially applied.
  23354. * @returns {Function} Returns the new bound function.
  23355. * @example
  23356. *
  23357. * function greet(greeting, punctuation) {
  23358. * return greeting + ' ' + this.user + punctuation;
  23359. * }
  23360. *
  23361. * var object = { 'user': 'fred' };
  23362. *
  23363. * var bound = _.bind(greet, object, 'hi');
  23364. * bound('!');
  23365. * // => 'hi fred!'
  23366. *
  23367. * // Bound with placeholders.
  23368. * var bound = _.bind(greet, object, _, '!');
  23369. * bound('hi');
  23370. * // => 'hi fred!'
  23371. */
  23372. var bind = baseRest(function(func, thisArg, partials) {
  23373. var bitmask = WRAP_BIND_FLAG;
  23374. if (partials.length) {
  23375. var holders = replaceHolders(partials, getHolder(bind));
  23376. bitmask |= WRAP_PARTIAL_FLAG;
  23377. }
  23378. return createWrap(func, bitmask, thisArg, partials, holders);
  23379. });
  23380. /**
  23381. * Creates a function that invokes the method at `object[key]` with `partials`
  23382. * prepended to the arguments it receives.
  23383. *
  23384. * This method differs from `_.bind` by allowing bound functions to reference
  23385. * methods that may be redefined or don't yet exist. See
  23386. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  23387. * for more details.
  23388. *
  23389. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  23390. * builds, may be used as a placeholder for partially applied arguments.
  23391. *
  23392. * @static
  23393. * @memberOf _
  23394. * @since 0.10.0
  23395. * @category Function
  23396. * @param {Object} object The object to invoke the method on.
  23397. * @param {string} key The key of the method.
  23398. * @param {...*} [partials] The arguments to be partially applied.
  23399. * @returns {Function} Returns the new bound function.
  23400. * @example
  23401. *
  23402. * var object = {
  23403. * 'user': 'fred',
  23404. * 'greet': function(greeting, punctuation) {
  23405. * return greeting + ' ' + this.user + punctuation;
  23406. * }
  23407. * };
  23408. *
  23409. * var bound = _.bindKey(object, 'greet', 'hi');
  23410. * bound('!');
  23411. * // => 'hi fred!'
  23412. *
  23413. * object.greet = function(greeting, punctuation) {
  23414. * return greeting + 'ya ' + this.user + punctuation;
  23415. * };
  23416. *
  23417. * bound('!');
  23418. * // => 'hiya fred!'
  23419. *
  23420. * // Bound with placeholders.
  23421. * var bound = _.bindKey(object, 'greet', _, '!');
  23422. * bound('hi');
  23423. * // => 'hiya fred!'
  23424. */
  23425. var bindKey = baseRest(function(object, key, partials) {
  23426. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  23427. if (partials.length) {
  23428. var holders = replaceHolders(partials, getHolder(bindKey));
  23429. bitmask |= WRAP_PARTIAL_FLAG;
  23430. }
  23431. return createWrap(key, bitmask, object, partials, holders);
  23432. });
  23433. /**
  23434. * Creates a function that accepts arguments of `func` and either invokes
  23435. * `func` returning its result, if at least `arity` number of arguments have
  23436. * been provided, or returns a function that accepts the remaining `func`
  23437. * arguments, and so on. The arity of `func` may be specified if `func.length`
  23438. * is not sufficient.
  23439. *
  23440. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  23441. * may be used as a placeholder for provided arguments.
  23442. *
  23443. * **Note:** This method doesn't set the "length" property of curried functions.
  23444. *
  23445. * @static
  23446. * @memberOf _
  23447. * @since 2.0.0
  23448. * @category Function
  23449. * @param {Function} func The function to curry.
  23450. * @param {number} [arity=func.length] The arity of `func`.
  23451. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23452. * @returns {Function} Returns the new curried function.
  23453. * @example
  23454. *
  23455. * var abc = function(a, b, c) {
  23456. * return [a, b, c];
  23457. * };
  23458. *
  23459. * var curried = _.curry(abc);
  23460. *
  23461. * curried(1)(2)(3);
  23462. * // => [1, 2, 3]
  23463. *
  23464. * curried(1, 2)(3);
  23465. * // => [1, 2, 3]
  23466. *
  23467. * curried(1, 2, 3);
  23468. * // => [1, 2, 3]
  23469. *
  23470. * // Curried with placeholders.
  23471. * curried(1)(_, 3)(2);
  23472. * // => [1, 2, 3]
  23473. */
  23474. function curry(func, arity, guard) {
  23475. arity = guard ? undefined : arity;
  23476. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23477. result.placeholder = curry.placeholder;
  23478. return result;
  23479. }
  23480. /**
  23481. * This method is like `_.curry` except that arguments are applied to `func`
  23482. * in the manner of `_.partialRight` instead of `_.partial`.
  23483. *
  23484. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  23485. * builds, may be used as a placeholder for provided arguments.
  23486. *
  23487. * **Note:** This method doesn't set the "length" property of curried functions.
  23488. *
  23489. * @static
  23490. * @memberOf _
  23491. * @since 3.0.0
  23492. * @category Function
  23493. * @param {Function} func The function to curry.
  23494. * @param {number} [arity=func.length] The arity of `func`.
  23495. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23496. * @returns {Function} Returns the new curried function.
  23497. * @example
  23498. *
  23499. * var abc = function(a, b, c) {
  23500. * return [a, b, c];
  23501. * };
  23502. *
  23503. * var curried = _.curryRight(abc);
  23504. *
  23505. * curried(3)(2)(1);
  23506. * // => [1, 2, 3]
  23507. *
  23508. * curried(2, 3)(1);
  23509. * // => [1, 2, 3]
  23510. *
  23511. * curried(1, 2, 3);
  23512. * // => [1, 2, 3]
  23513. *
  23514. * // Curried with placeholders.
  23515. * curried(3)(1, _)(2);
  23516. * // => [1, 2, 3]
  23517. */
  23518. function curryRight(func, arity, guard) {
  23519. arity = guard ? undefined : arity;
  23520. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23521. result.placeholder = curryRight.placeholder;
  23522. return result;
  23523. }
  23524. /**
  23525. * Creates a debounced function that delays invoking `func` until after `wait`
  23526. * milliseconds have elapsed since the last time the debounced function was
  23527. * invoked. The debounced function comes with a `cancel` method to cancel
  23528. * delayed `func` invocations and a `flush` method to immediately invoke them.
  23529. * Provide `options` to indicate whether `func` should be invoked on the
  23530. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  23531. * with the last arguments provided to the debounced function. Subsequent
  23532. * calls to the debounced function return the result of the last `func`
  23533. * invocation.
  23534. *
  23535. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23536. * invoked on the trailing edge of the timeout only if the debounced function
  23537. * is invoked more than once during the `wait` timeout.
  23538. *
  23539. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23540. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23541. *
  23542. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23543. * for details over the differences between `_.debounce` and `_.throttle`.
  23544. *
  23545. * @static
  23546. * @memberOf _
  23547. * @since 0.1.0
  23548. * @category Function
  23549. * @param {Function} func The function to debounce.
  23550. * @param {number} [wait=0] The number of milliseconds to delay.
  23551. * @param {Object} [options={}] The options object.
  23552. * @param {boolean} [options.leading=false]
  23553. * Specify invoking on the leading edge of the timeout.
  23554. * @param {number} [options.maxWait]
  23555. * The maximum time `func` is allowed to be delayed before it's invoked.
  23556. * @param {boolean} [options.trailing=true]
  23557. * Specify invoking on the trailing edge of the timeout.
  23558. * @returns {Function} Returns the new debounced function.
  23559. * @example
  23560. *
  23561. * // Avoid costly calculations while the window size is in flux.
  23562. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  23563. *
  23564. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  23565. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  23566. * 'leading': true,
  23567. * 'trailing': false
  23568. * }));
  23569. *
  23570. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  23571. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  23572. * var source = new EventSource('/stream');
  23573. * jQuery(source).on('message', debounced);
  23574. *
  23575. * // Cancel the trailing debounced invocation.
  23576. * jQuery(window).on('popstate', debounced.cancel);
  23577. */
  23578. function debounce(func, wait, options) {
  23579. var lastArgs,
  23580. lastThis,
  23581. maxWait,
  23582. result,
  23583. timerId,
  23584. lastCallTime,
  23585. lastInvokeTime = 0,
  23586. leading = false,
  23587. maxing = false,
  23588. trailing = true;
  23589. if (typeof func != 'function') {
  23590. throw new TypeError(FUNC_ERROR_TEXT);
  23591. }
  23592. wait = toNumber(wait) || 0;
  23593. if (isObject(options)) {
  23594. leading = !!options.leading;
  23595. maxing = 'maxWait' in options;
  23596. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  23597. trailing = 'trailing' in options ? !!options.trailing : trailing;
  23598. }
  23599. function invokeFunc(time) {
  23600. var args = lastArgs,
  23601. thisArg = lastThis;
  23602. lastArgs = lastThis = undefined;
  23603. lastInvokeTime = time;
  23604. result = func.apply(thisArg, args);
  23605. return result;
  23606. }
  23607. function leadingEdge(time) {
  23608. // Reset any `maxWait` timer.
  23609. lastInvokeTime = time;
  23610. // Start the timer for the trailing edge.
  23611. timerId = setTimeout(timerExpired, wait);
  23612. // Invoke the leading edge.
  23613. return leading ? invokeFunc(time) : result;
  23614. }
  23615. function remainingWait(time) {
  23616. var timeSinceLastCall = time - lastCallTime,
  23617. timeSinceLastInvoke = time - lastInvokeTime,
  23618. timeWaiting = wait - timeSinceLastCall;
  23619. return maxing
  23620. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  23621. : timeWaiting;
  23622. }
  23623. function shouldInvoke(time) {
  23624. var timeSinceLastCall = time - lastCallTime,
  23625. timeSinceLastInvoke = time - lastInvokeTime;
  23626. // Either this is the first call, activity has stopped and we're at the
  23627. // trailing edge, the system time has gone backwards and we're treating
  23628. // it as the trailing edge, or we've hit the `maxWait` limit.
  23629. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  23630. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  23631. }
  23632. function timerExpired() {
  23633. var time = now();
  23634. if (shouldInvoke(time)) {
  23635. return trailingEdge(time);
  23636. }
  23637. // Restart the timer.
  23638. timerId = setTimeout(timerExpired, remainingWait(time));
  23639. }
  23640. function trailingEdge(time) {
  23641. timerId = undefined;
  23642. // Only invoke if we have `lastArgs` which means `func` has been
  23643. // debounced at least once.
  23644. if (trailing && lastArgs) {
  23645. return invokeFunc(time);
  23646. }
  23647. lastArgs = lastThis = undefined;
  23648. return result;
  23649. }
  23650. function cancel() {
  23651. if (timerId !== undefined) {
  23652. clearTimeout(timerId);
  23653. }
  23654. lastInvokeTime = 0;
  23655. lastArgs = lastCallTime = lastThis = timerId = undefined;
  23656. }
  23657. function flush() {
  23658. return timerId === undefined ? result : trailingEdge(now());
  23659. }
  23660. function debounced() {
  23661. var time = now(),
  23662. isInvoking = shouldInvoke(time);
  23663. lastArgs = arguments;
  23664. lastThis = this;
  23665. lastCallTime = time;
  23666. if (isInvoking) {
  23667. if (timerId === undefined) {
  23668. return leadingEdge(lastCallTime);
  23669. }
  23670. if (maxing) {
  23671. // Handle invocations in a tight loop.
  23672. clearTimeout(timerId);
  23673. timerId = setTimeout(timerExpired, wait);
  23674. return invokeFunc(lastCallTime);
  23675. }
  23676. }
  23677. if (timerId === undefined) {
  23678. timerId = setTimeout(timerExpired, wait);
  23679. }
  23680. return result;
  23681. }
  23682. debounced.cancel = cancel;
  23683. debounced.flush = flush;
  23684. return debounced;
  23685. }
  23686. /**
  23687. * Defers invoking the `func` until the current call stack has cleared. Any
  23688. * additional arguments are provided to `func` when it's invoked.
  23689. *
  23690. * @static
  23691. * @memberOf _
  23692. * @since 0.1.0
  23693. * @category Function
  23694. * @param {Function} func The function to defer.
  23695. * @param {...*} [args] The arguments to invoke `func` with.
  23696. * @returns {number} Returns the timer id.
  23697. * @example
  23698. *
  23699. * _.defer(function(text) {
  23700. * console.log(text);
  23701. * }, 'deferred');
  23702. * // => Logs 'deferred' after one millisecond.
  23703. */
  23704. var defer = baseRest(function(func, args) {
  23705. return baseDelay(func, 1, args);
  23706. });
  23707. /**
  23708. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  23709. * provided to `func` when it's invoked.
  23710. *
  23711. * @static
  23712. * @memberOf _
  23713. * @since 0.1.0
  23714. * @category Function
  23715. * @param {Function} func The function to delay.
  23716. * @param {number} wait The number of milliseconds to delay invocation.
  23717. * @param {...*} [args] The arguments to invoke `func` with.
  23718. * @returns {number} Returns the timer id.
  23719. * @example
  23720. *
  23721. * _.delay(function(text) {
  23722. * console.log(text);
  23723. * }, 1000, 'later');
  23724. * // => Logs 'later' after one second.
  23725. */
  23726. var delay = baseRest(function(func, wait, args) {
  23727. return baseDelay(func, toNumber(wait) || 0, args);
  23728. });
  23729. /**
  23730. * Creates a function that invokes `func` with arguments reversed.
  23731. *
  23732. * @static
  23733. * @memberOf _
  23734. * @since 4.0.0
  23735. * @category Function
  23736. * @param {Function} func The function to flip arguments for.
  23737. * @returns {Function} Returns the new flipped function.
  23738. * @example
  23739. *
  23740. * var flipped = _.flip(function() {
  23741. * return _.toArray(arguments);
  23742. * });
  23743. *
  23744. * flipped('a', 'b', 'c', 'd');
  23745. * // => ['d', 'c', 'b', 'a']
  23746. */
  23747. function flip(func) {
  23748. return createWrap(func, WRAP_FLIP_FLAG);
  23749. }
  23750. /**
  23751. * Creates a function that memoizes the result of `func`. If `resolver` is
  23752. * provided, it determines the cache key for storing the result based on the
  23753. * arguments provided to the memoized function. By default, the first argument
  23754. * provided to the memoized function is used as the map cache key. The `func`
  23755. * is invoked with the `this` binding of the memoized function.
  23756. *
  23757. * **Note:** The cache is exposed as the `cache` property on the memoized
  23758. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  23759. * constructor with one whose instances implement the
  23760. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  23761. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  23762. *
  23763. * @static
  23764. * @memberOf _
  23765. * @since 0.1.0
  23766. * @category Function
  23767. * @param {Function} func The function to have its output memoized.
  23768. * @param {Function} [resolver] The function to resolve the cache key.
  23769. * @returns {Function} Returns the new memoized function.
  23770. * @example
  23771. *
  23772. * var object = { 'a': 1, 'b': 2 };
  23773. * var other = { 'c': 3, 'd': 4 };
  23774. *
  23775. * var values = _.memoize(_.values);
  23776. * values(object);
  23777. * // => [1, 2]
  23778. *
  23779. * values(other);
  23780. * // => [3, 4]
  23781. *
  23782. * object.a = 2;
  23783. * values(object);
  23784. * // => [1, 2]
  23785. *
  23786. * // Modify the result cache.
  23787. * values.cache.set(object, ['a', 'b']);
  23788. * values(object);
  23789. * // => ['a', 'b']
  23790. *
  23791. * // Replace `_.memoize.Cache`.
  23792. * _.memoize.Cache = WeakMap;
  23793. */
  23794. function memoize(func, resolver) {
  23795. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  23796. throw new TypeError(FUNC_ERROR_TEXT);
  23797. }
  23798. var memoized = function() {
  23799. var args = arguments,
  23800. key = resolver ? resolver.apply(this, args) : args[0],
  23801. cache = memoized.cache;
  23802. if (cache.has(key)) {
  23803. return cache.get(key);
  23804. }
  23805. var result = func.apply(this, args);
  23806. memoized.cache = cache.set(key, result) || cache;
  23807. return result;
  23808. };
  23809. memoized.cache = new (memoize.Cache || MapCache);
  23810. return memoized;
  23811. }
  23812. // Expose `MapCache`.
  23813. memoize.Cache = MapCache;
  23814. /**
  23815. * Creates a function that negates the result of the predicate `func`. The
  23816. * `func` predicate is invoked with the `this` binding and arguments of the
  23817. * created function.
  23818. *
  23819. * @static
  23820. * @memberOf _
  23821. * @since 3.0.0
  23822. * @category Function
  23823. * @param {Function} predicate The predicate to negate.
  23824. * @returns {Function} Returns the new negated function.
  23825. * @example
  23826. *
  23827. * function isEven(n) {
  23828. * return n % 2 == 0;
  23829. * }
  23830. *
  23831. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  23832. * // => [1, 3, 5]
  23833. */
  23834. function negate(predicate) {
  23835. if (typeof predicate != 'function') {
  23836. throw new TypeError(FUNC_ERROR_TEXT);
  23837. }
  23838. return function() {
  23839. var args = arguments;
  23840. switch (args.length) {
  23841. case 0: return !predicate.call(this);
  23842. case 1: return !predicate.call(this, args[0]);
  23843. case 2: return !predicate.call(this, args[0], args[1]);
  23844. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  23845. }
  23846. return !predicate.apply(this, args);
  23847. };
  23848. }
  23849. /**
  23850. * Creates a function that is restricted to invoking `func` once. Repeat calls
  23851. * to the function return the value of the first invocation. The `func` is
  23852. * invoked with the `this` binding and arguments of the created function.
  23853. *
  23854. * @static
  23855. * @memberOf _
  23856. * @since 0.1.0
  23857. * @category Function
  23858. * @param {Function} func The function to restrict.
  23859. * @returns {Function} Returns the new restricted function.
  23860. * @example
  23861. *
  23862. * var initialize = _.once(createApplication);
  23863. * initialize();
  23864. * initialize();
  23865. * // => `createApplication` is invoked once
  23866. */
  23867. function once(func) {
  23868. return before(2, func);
  23869. }
  23870. /**
  23871. * Creates a function that invokes `func` with its arguments transformed.
  23872. *
  23873. * @static
  23874. * @since 4.0.0
  23875. * @memberOf _
  23876. * @category Function
  23877. * @param {Function} func The function to wrap.
  23878. * @param {...(Function|Function[])} [transforms=[_.identity]]
  23879. * The argument transforms.
  23880. * @returns {Function} Returns the new function.
  23881. * @example
  23882. *
  23883. * function doubled(n) {
  23884. * return n * 2;
  23885. * }
  23886. *
  23887. * function square(n) {
  23888. * return n * n;
  23889. * }
  23890. *
  23891. * var func = _.overArgs(function(x, y) {
  23892. * return [x, y];
  23893. * }, [square, doubled]);
  23894. *
  23895. * func(9, 3);
  23896. * // => [81, 6]
  23897. *
  23898. * func(10, 5);
  23899. * // => [100, 10]
  23900. */
  23901. var overArgs = castRest(function(func, transforms) {
  23902. transforms = (transforms.length == 1 && isArray(transforms[0]))
  23903. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  23904. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  23905. var funcsLength = transforms.length;
  23906. return baseRest(function(args) {
  23907. var index = -1,
  23908. length = nativeMin(args.length, funcsLength);
  23909. while (++index < length) {
  23910. args[index] = transforms[index].call(this, args[index]);
  23911. }
  23912. return apply(func, this, args);
  23913. });
  23914. });
  23915. /**
  23916. * Creates a function that invokes `func` with `partials` prepended to the
  23917. * arguments it receives. This method is like `_.bind` except it does **not**
  23918. * alter the `this` binding.
  23919. *
  23920. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  23921. * builds, may be used as a placeholder for partially applied arguments.
  23922. *
  23923. * **Note:** This method doesn't set the "length" property of partially
  23924. * applied functions.
  23925. *
  23926. * @static
  23927. * @memberOf _
  23928. * @since 0.2.0
  23929. * @category Function
  23930. * @param {Function} func The function to partially apply arguments to.
  23931. * @param {...*} [partials] The arguments to be partially applied.
  23932. * @returns {Function} Returns the new partially applied function.
  23933. * @example
  23934. *
  23935. * function greet(greeting, name) {
  23936. * return greeting + ' ' + name;
  23937. * }
  23938. *
  23939. * var sayHelloTo = _.partial(greet, 'hello');
  23940. * sayHelloTo('fred');
  23941. * // => 'hello fred'
  23942. *
  23943. * // Partially applied with placeholders.
  23944. * var greetFred = _.partial(greet, _, 'fred');
  23945. * greetFred('hi');
  23946. * // => 'hi fred'
  23947. */
  23948. var partial = baseRest(function(func, partials) {
  23949. var holders = replaceHolders(partials, getHolder(partial));
  23950. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  23951. });
  23952. /**
  23953. * This method is like `_.partial` except that partially applied arguments
  23954. * are appended to the arguments it receives.
  23955. *
  23956. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  23957. * builds, may be used as a placeholder for partially applied arguments.
  23958. *
  23959. * **Note:** This method doesn't set the "length" property of partially
  23960. * applied functions.
  23961. *
  23962. * @static
  23963. * @memberOf _
  23964. * @since 1.0.0
  23965. * @category Function
  23966. * @param {Function} func The function to partially apply arguments to.
  23967. * @param {...*} [partials] The arguments to be partially applied.
  23968. * @returns {Function} Returns the new partially applied function.
  23969. * @example
  23970. *
  23971. * function greet(greeting, name) {
  23972. * return greeting + ' ' + name;
  23973. * }
  23974. *
  23975. * var greetFred = _.partialRight(greet, 'fred');
  23976. * greetFred('hi');
  23977. * // => 'hi fred'
  23978. *
  23979. * // Partially applied with placeholders.
  23980. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  23981. * sayHelloTo('fred');
  23982. * // => 'hello fred'
  23983. */
  23984. var partialRight = baseRest(function(func, partials) {
  23985. var holders = replaceHolders(partials, getHolder(partialRight));
  23986. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  23987. });
  23988. /**
  23989. * Creates a function that invokes `func` with arguments arranged according
  23990. * to the specified `indexes` where the argument value at the first index is
  23991. * provided as the first argument, the argument value at the second index is
  23992. * provided as the second argument, and so on.
  23993. *
  23994. * @static
  23995. * @memberOf _
  23996. * @since 3.0.0
  23997. * @category Function
  23998. * @param {Function} func The function to rearrange arguments for.
  23999. * @param {...(number|number[])} indexes The arranged argument indexes.
  24000. * @returns {Function} Returns the new function.
  24001. * @example
  24002. *
  24003. * var rearged = _.rearg(function(a, b, c) {
  24004. * return [a, b, c];
  24005. * }, [2, 0, 1]);
  24006. *
  24007. * rearged('b', 'c', 'a')
  24008. * // => ['a', 'b', 'c']
  24009. */
  24010. var rearg = flatRest(function(func, indexes) {
  24011. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  24012. });
  24013. /**
  24014. * Creates a function that invokes `func` with the `this` binding of the
  24015. * created function and arguments from `start` and beyond provided as
  24016. * an array.
  24017. *
  24018. * **Note:** This method is based on the
  24019. * [rest parameter](https://mdn.io/rest_parameters).
  24020. *
  24021. * @static
  24022. * @memberOf _
  24023. * @since 4.0.0
  24024. * @category Function
  24025. * @param {Function} func The function to apply a rest parameter to.
  24026. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24027. * @returns {Function} Returns the new function.
  24028. * @example
  24029. *
  24030. * var say = _.rest(function(what, names) {
  24031. * return what + ' ' + _.initial(names).join(', ') +
  24032. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  24033. * });
  24034. *
  24035. * say('hello', 'fred', 'barney', 'pebbles');
  24036. * // => 'hello fred, barney, & pebbles'
  24037. */
  24038. function rest(func, start) {
  24039. if (typeof func != 'function') {
  24040. throw new TypeError(FUNC_ERROR_TEXT);
  24041. }
  24042. start = start === undefined ? start : toInteger(start);
  24043. return baseRest(func, start);
  24044. }
  24045. /**
  24046. * Creates a function that invokes `func` with the `this` binding of the
  24047. * create function and an array of arguments much like
  24048. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  24049. *
  24050. * **Note:** This method is based on the
  24051. * [spread operator](https://mdn.io/spread_operator).
  24052. *
  24053. * @static
  24054. * @memberOf _
  24055. * @since 3.2.0
  24056. * @category Function
  24057. * @param {Function} func The function to spread arguments over.
  24058. * @param {number} [start=0] The start position of the spread.
  24059. * @returns {Function} Returns the new function.
  24060. * @example
  24061. *
  24062. * var say = _.spread(function(who, what) {
  24063. * return who + ' says ' + what;
  24064. * });
  24065. *
  24066. * say(['fred', 'hello']);
  24067. * // => 'fred says hello'
  24068. *
  24069. * var numbers = Promise.all([
  24070. * Promise.resolve(40),
  24071. * Promise.resolve(36)
  24072. * ]);
  24073. *
  24074. * numbers.then(_.spread(function(x, y) {
  24075. * return x + y;
  24076. * }));
  24077. * // => a Promise of 76
  24078. */
  24079. function spread(func, start) {
  24080. if (typeof func != 'function') {
  24081. throw new TypeError(FUNC_ERROR_TEXT);
  24082. }
  24083. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  24084. return baseRest(function(args) {
  24085. var array = args[start],
  24086. otherArgs = castSlice(args, 0, start);
  24087. if (array) {
  24088. arrayPush(otherArgs, array);
  24089. }
  24090. return apply(func, this, otherArgs);
  24091. });
  24092. }
  24093. /**
  24094. * Creates a throttled function that only invokes `func` at most once per
  24095. * every `wait` milliseconds. The throttled function comes with a `cancel`
  24096. * method to cancel delayed `func` invocations and a `flush` method to
  24097. * immediately invoke them. Provide `options` to indicate whether `func`
  24098. * should be invoked on the leading and/or trailing edge of the `wait`
  24099. * timeout. The `func` is invoked with the last arguments provided to the
  24100. * throttled function. Subsequent calls to the throttled function return the
  24101. * result of the last `func` invocation.
  24102. *
  24103. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  24104. * invoked on the trailing edge of the timeout only if the throttled function
  24105. * is invoked more than once during the `wait` timeout.
  24106. *
  24107. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  24108. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  24109. *
  24110. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  24111. * for details over the differences between `_.throttle` and `_.debounce`.
  24112. *
  24113. * @static
  24114. * @memberOf _
  24115. * @since 0.1.0
  24116. * @category Function
  24117. * @param {Function} func The function to throttle.
  24118. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  24119. * @param {Object} [options={}] The options object.
  24120. * @param {boolean} [options.leading=true]
  24121. * Specify invoking on the leading edge of the timeout.
  24122. * @param {boolean} [options.trailing=true]
  24123. * Specify invoking on the trailing edge of the timeout.
  24124. * @returns {Function} Returns the new throttled function.
  24125. * @example
  24126. *
  24127. * // Avoid excessively updating the position while scrolling.
  24128. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  24129. *
  24130. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  24131. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  24132. * jQuery(element).on('click', throttled);
  24133. *
  24134. * // Cancel the trailing throttled invocation.
  24135. * jQuery(window).on('popstate', throttled.cancel);
  24136. */
  24137. function throttle(func, wait, options) {
  24138. var leading = true,
  24139. trailing = true;
  24140. if (typeof func != 'function') {
  24141. throw new TypeError(FUNC_ERROR_TEXT);
  24142. }
  24143. if (isObject(options)) {
  24144. leading = 'leading' in options ? !!options.leading : leading;
  24145. trailing = 'trailing' in options ? !!options.trailing : trailing;
  24146. }
  24147. return debounce(func, wait, {
  24148. 'leading': leading,
  24149. 'maxWait': wait,
  24150. 'trailing': trailing
  24151. });
  24152. }
  24153. /**
  24154. * Creates a function that accepts up to one argument, ignoring any
  24155. * additional arguments.
  24156. *
  24157. * @static
  24158. * @memberOf _
  24159. * @since 4.0.0
  24160. * @category Function
  24161. * @param {Function} func The function to cap arguments for.
  24162. * @returns {Function} Returns the new capped function.
  24163. * @example
  24164. *
  24165. * _.map(['6', '8', '10'], _.unary(parseInt));
  24166. * // => [6, 8, 10]
  24167. */
  24168. function unary(func) {
  24169. return ary(func, 1);
  24170. }
  24171. /**
  24172. * Creates a function that provides `value` to `wrapper` as its first
  24173. * argument. Any additional arguments provided to the function are appended
  24174. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  24175. * binding of the created function.
  24176. *
  24177. * @static
  24178. * @memberOf _
  24179. * @since 0.1.0
  24180. * @category Function
  24181. * @param {*} value The value to wrap.
  24182. * @param {Function} [wrapper=identity] The wrapper function.
  24183. * @returns {Function} Returns the new function.
  24184. * @example
  24185. *
  24186. * var p = _.wrap(_.escape, function(func, text) {
  24187. * return '<p>' + func(text) + '</p>';
  24188. * });
  24189. *
  24190. * p('fred, barney, & pebbles');
  24191. * // => '<p>fred, barney, &amp; pebbles</p>'
  24192. */
  24193. function wrap(value, wrapper) {
  24194. return partial(castFunction(wrapper), value);
  24195. }
  24196. /*------------------------------------------------------------------------*/
  24197. /**
  24198. * Casts `value` as an array if it's not one.
  24199. *
  24200. * @static
  24201. * @memberOf _
  24202. * @since 4.4.0
  24203. * @category Lang
  24204. * @param {*} value The value to inspect.
  24205. * @returns {Array} Returns the cast array.
  24206. * @example
  24207. *
  24208. * _.castArray(1);
  24209. * // => [1]
  24210. *
  24211. * _.castArray({ 'a': 1 });
  24212. * // => [{ 'a': 1 }]
  24213. *
  24214. * _.castArray('abc');
  24215. * // => ['abc']
  24216. *
  24217. * _.castArray(null);
  24218. * // => [null]
  24219. *
  24220. * _.castArray(undefined);
  24221. * // => [undefined]
  24222. *
  24223. * _.castArray();
  24224. * // => []
  24225. *
  24226. * var array = [1, 2, 3];
  24227. * console.log(_.castArray(array) === array);
  24228. * // => true
  24229. */
  24230. function castArray() {
  24231. if (!arguments.length) {
  24232. return [];
  24233. }
  24234. var value = arguments[0];
  24235. return isArray(value) ? value : [value];
  24236. }
  24237. /**
  24238. * Creates a shallow clone of `value`.
  24239. *
  24240. * **Note:** This method is loosely based on the
  24241. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  24242. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  24243. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  24244. * arrays. The own enumerable properties of `arguments` objects are cloned
  24245. * as plain objects. An empty object is returned for uncloneable values such
  24246. * as error objects, functions, DOM nodes, and WeakMaps.
  24247. *
  24248. * @static
  24249. * @memberOf _
  24250. * @since 0.1.0
  24251. * @category Lang
  24252. * @param {*} value The value to clone.
  24253. * @returns {*} Returns the cloned value.
  24254. * @see _.cloneDeep
  24255. * @example
  24256. *
  24257. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24258. *
  24259. * var shallow = _.clone(objects);
  24260. * console.log(shallow[0] === objects[0]);
  24261. * // => true
  24262. */
  24263. function clone(value) {
  24264. return baseClone(value, CLONE_SYMBOLS_FLAG);
  24265. }
  24266. /**
  24267. * This method is like `_.clone` except that it accepts `customizer` which
  24268. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  24269. * cloning is handled by the method instead. The `customizer` is invoked with
  24270. * up to four arguments; (value [, index|key, object, stack]).
  24271. *
  24272. * @static
  24273. * @memberOf _
  24274. * @since 4.0.0
  24275. * @category Lang
  24276. * @param {*} value The value to clone.
  24277. * @param {Function} [customizer] The function to customize cloning.
  24278. * @returns {*} Returns the cloned value.
  24279. * @see _.cloneDeepWith
  24280. * @example
  24281. *
  24282. * function customizer(value) {
  24283. * if (_.isElement(value)) {
  24284. * return value.cloneNode(false);
  24285. * }
  24286. * }
  24287. *
  24288. * var el = _.cloneWith(document.body, customizer);
  24289. *
  24290. * console.log(el === document.body);
  24291. * // => false
  24292. * console.log(el.nodeName);
  24293. * // => 'BODY'
  24294. * console.log(el.childNodes.length);
  24295. * // => 0
  24296. */
  24297. function cloneWith(value, customizer) {
  24298. customizer = typeof customizer == 'function' ? customizer : undefined;
  24299. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  24300. }
  24301. /**
  24302. * This method is like `_.clone` except that it recursively clones `value`.
  24303. *
  24304. * @static
  24305. * @memberOf _
  24306. * @since 1.0.0
  24307. * @category Lang
  24308. * @param {*} value The value to recursively clone.
  24309. * @returns {*} Returns the deep cloned value.
  24310. * @see _.clone
  24311. * @example
  24312. *
  24313. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24314. *
  24315. * var deep = _.cloneDeep(objects);
  24316. * console.log(deep[0] === objects[0]);
  24317. * // => false
  24318. */
  24319. function cloneDeep(value) {
  24320. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  24321. }
  24322. /**
  24323. * This method is like `_.cloneWith` except that it recursively clones `value`.
  24324. *
  24325. * @static
  24326. * @memberOf _
  24327. * @since 4.0.0
  24328. * @category Lang
  24329. * @param {*} value The value to recursively clone.
  24330. * @param {Function} [customizer] The function to customize cloning.
  24331. * @returns {*} Returns the deep cloned value.
  24332. * @see _.cloneWith
  24333. * @example
  24334. *
  24335. * function customizer(value) {
  24336. * if (_.isElement(value)) {
  24337. * return value.cloneNode(true);
  24338. * }
  24339. * }
  24340. *
  24341. * var el = _.cloneDeepWith(document.body, customizer);
  24342. *
  24343. * console.log(el === document.body);
  24344. * // => false
  24345. * console.log(el.nodeName);
  24346. * // => 'BODY'
  24347. * console.log(el.childNodes.length);
  24348. * // => 20
  24349. */
  24350. function cloneDeepWith(value, customizer) {
  24351. customizer = typeof customizer == 'function' ? customizer : undefined;
  24352. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  24353. }
  24354. /**
  24355. * Checks if `object` conforms to `source` by invoking the predicate
  24356. * properties of `source` with the corresponding property values of `object`.
  24357. *
  24358. * **Note:** This method is equivalent to `_.conforms` when `source` is
  24359. * partially applied.
  24360. *
  24361. * @static
  24362. * @memberOf _
  24363. * @since 4.14.0
  24364. * @category Lang
  24365. * @param {Object} object The object to inspect.
  24366. * @param {Object} source The object of property predicates to conform to.
  24367. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  24368. * @example
  24369. *
  24370. * var object = { 'a': 1, 'b': 2 };
  24371. *
  24372. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  24373. * // => true
  24374. *
  24375. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  24376. * // => false
  24377. */
  24378. function conformsTo(object, source) {
  24379. return source == null || baseConformsTo(object, source, keys(source));
  24380. }
  24381. /**
  24382. * Performs a
  24383. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24384. * comparison between two values to determine if they are equivalent.
  24385. *
  24386. * @static
  24387. * @memberOf _
  24388. * @since 4.0.0
  24389. * @category Lang
  24390. * @param {*} value The value to compare.
  24391. * @param {*} other The other value to compare.
  24392. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24393. * @example
  24394. *
  24395. * var object = { 'a': 1 };
  24396. * var other = { 'a': 1 };
  24397. *
  24398. * _.eq(object, object);
  24399. * // => true
  24400. *
  24401. * _.eq(object, other);
  24402. * // => false
  24403. *
  24404. * _.eq('a', 'a');
  24405. * // => true
  24406. *
  24407. * _.eq('a', Object('a'));
  24408. * // => false
  24409. *
  24410. * _.eq(NaN, NaN);
  24411. * // => true
  24412. */
  24413. function eq(value, other) {
  24414. return value === other || (value !== value && other !== other);
  24415. }
  24416. /**
  24417. * Checks if `value` is greater than `other`.
  24418. *
  24419. * @static
  24420. * @memberOf _
  24421. * @since 3.9.0
  24422. * @category Lang
  24423. * @param {*} value The value to compare.
  24424. * @param {*} other The other value to compare.
  24425. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  24426. * else `false`.
  24427. * @see _.lt
  24428. * @example
  24429. *
  24430. * _.gt(3, 1);
  24431. * // => true
  24432. *
  24433. * _.gt(3, 3);
  24434. * // => false
  24435. *
  24436. * _.gt(1, 3);
  24437. * // => false
  24438. */
  24439. var gt = createRelationalOperation(baseGt);
  24440. /**
  24441. * Checks if `value` is greater than or equal to `other`.
  24442. *
  24443. * @static
  24444. * @memberOf _
  24445. * @since 3.9.0
  24446. * @category Lang
  24447. * @param {*} value The value to compare.
  24448. * @param {*} other The other value to compare.
  24449. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  24450. * `other`, else `false`.
  24451. * @see _.lte
  24452. * @example
  24453. *
  24454. * _.gte(3, 1);
  24455. * // => true
  24456. *
  24457. * _.gte(3, 3);
  24458. * // => true
  24459. *
  24460. * _.gte(1, 3);
  24461. * // => false
  24462. */
  24463. var gte = createRelationalOperation(function(value, other) {
  24464. return value >= other;
  24465. });
  24466. /**
  24467. * Checks if `value` is likely an `arguments` object.
  24468. *
  24469. * @static
  24470. * @memberOf _
  24471. * @since 0.1.0
  24472. * @category Lang
  24473. * @param {*} value The value to check.
  24474. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  24475. * else `false`.
  24476. * @example
  24477. *
  24478. * _.isArguments(function() { return arguments; }());
  24479. * // => true
  24480. *
  24481. * _.isArguments([1, 2, 3]);
  24482. * // => false
  24483. */
  24484. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  24485. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  24486. !propertyIsEnumerable.call(value, 'callee');
  24487. };
  24488. /**
  24489. * Checks if `value` is classified as an `Array` object.
  24490. *
  24491. * @static
  24492. * @memberOf _
  24493. * @since 0.1.0
  24494. * @category Lang
  24495. * @param {*} value The value to check.
  24496. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  24497. * @example
  24498. *
  24499. * _.isArray([1, 2, 3]);
  24500. * // => true
  24501. *
  24502. * _.isArray(document.body.children);
  24503. * // => false
  24504. *
  24505. * _.isArray('abc');
  24506. * // => false
  24507. *
  24508. * _.isArray(_.noop);
  24509. * // => false
  24510. */
  24511. var isArray = Array.isArray;
  24512. /**
  24513. * Checks if `value` is classified as an `ArrayBuffer` object.
  24514. *
  24515. * @static
  24516. * @memberOf _
  24517. * @since 4.3.0
  24518. * @category Lang
  24519. * @param {*} value The value to check.
  24520. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  24521. * @example
  24522. *
  24523. * _.isArrayBuffer(new ArrayBuffer(2));
  24524. * // => true
  24525. *
  24526. * _.isArrayBuffer(new Array(2));
  24527. * // => false
  24528. */
  24529. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  24530. /**
  24531. * Checks if `value` is array-like. A value is considered array-like if it's
  24532. * not a function and has a `value.length` that's an integer greater than or
  24533. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  24534. *
  24535. * @static
  24536. * @memberOf _
  24537. * @since 4.0.0
  24538. * @category Lang
  24539. * @param {*} value The value to check.
  24540. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  24541. * @example
  24542. *
  24543. * _.isArrayLike([1, 2, 3]);
  24544. * // => true
  24545. *
  24546. * _.isArrayLike(document.body.children);
  24547. * // => true
  24548. *
  24549. * _.isArrayLike('abc');
  24550. * // => true
  24551. *
  24552. * _.isArrayLike(_.noop);
  24553. * // => false
  24554. */
  24555. function isArrayLike(value) {
  24556. return value != null && isLength(value.length) && !isFunction(value);
  24557. }
  24558. /**
  24559. * This method is like `_.isArrayLike` except that it also checks if `value`
  24560. * is an object.
  24561. *
  24562. * @static
  24563. * @memberOf _
  24564. * @since 4.0.0
  24565. * @category Lang
  24566. * @param {*} value The value to check.
  24567. * @returns {boolean} Returns `true` if `value` is an array-like object,
  24568. * else `false`.
  24569. * @example
  24570. *
  24571. * _.isArrayLikeObject([1, 2, 3]);
  24572. * // => true
  24573. *
  24574. * _.isArrayLikeObject(document.body.children);
  24575. * // => true
  24576. *
  24577. * _.isArrayLikeObject('abc');
  24578. * // => false
  24579. *
  24580. * _.isArrayLikeObject(_.noop);
  24581. * // => false
  24582. */
  24583. function isArrayLikeObject(value) {
  24584. return isObjectLike(value) && isArrayLike(value);
  24585. }
  24586. /**
  24587. * Checks if `value` is classified as a boolean primitive or object.
  24588. *
  24589. * @static
  24590. * @memberOf _
  24591. * @since 0.1.0
  24592. * @category Lang
  24593. * @param {*} value The value to check.
  24594. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  24595. * @example
  24596. *
  24597. * _.isBoolean(false);
  24598. * // => true
  24599. *
  24600. * _.isBoolean(null);
  24601. * // => false
  24602. */
  24603. function isBoolean(value) {
  24604. return value === true || value === false ||
  24605. (isObjectLike(value) && baseGetTag(value) == boolTag);
  24606. }
  24607. /**
  24608. * Checks if `value` is a buffer.
  24609. *
  24610. * @static
  24611. * @memberOf _
  24612. * @since 4.3.0
  24613. * @category Lang
  24614. * @param {*} value The value to check.
  24615. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  24616. * @example
  24617. *
  24618. * _.isBuffer(new Buffer(2));
  24619. * // => true
  24620. *
  24621. * _.isBuffer(new Uint8Array(2));
  24622. * // => false
  24623. */
  24624. var isBuffer = nativeIsBuffer || stubFalse;
  24625. /**
  24626. * Checks if `value` is classified as a `Date` object.
  24627. *
  24628. * @static
  24629. * @memberOf _
  24630. * @since 0.1.0
  24631. * @category Lang
  24632. * @param {*} value The value to check.
  24633. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24634. * @example
  24635. *
  24636. * _.isDate(new Date);
  24637. * // => true
  24638. *
  24639. * _.isDate('Mon April 23 2012');
  24640. * // => false
  24641. */
  24642. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  24643. /**
  24644. * Checks if `value` is likely a DOM element.
  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 DOM element, else `false`.
  24652. * @example
  24653. *
  24654. * _.isElement(document.body);
  24655. * // => true
  24656. *
  24657. * _.isElement('<body>');
  24658. * // => false
  24659. */
  24660. function isElement(value) {
  24661. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  24662. }
  24663. /**
  24664. * Checks if `value` is an empty object, collection, map, or set.
  24665. *
  24666. * Objects are considered empty if they have no own enumerable string keyed
  24667. * properties.
  24668. *
  24669. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  24670. * jQuery-like collections are considered empty if they have a `length` of `0`.
  24671. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  24672. *
  24673. * @static
  24674. * @memberOf _
  24675. * @since 0.1.0
  24676. * @category Lang
  24677. * @param {*} value The value to check.
  24678. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  24679. * @example
  24680. *
  24681. * _.isEmpty(null);
  24682. * // => true
  24683. *
  24684. * _.isEmpty(true);
  24685. * // => true
  24686. *
  24687. * _.isEmpty(1);
  24688. * // => true
  24689. *
  24690. * _.isEmpty([1, 2, 3]);
  24691. * // => false
  24692. *
  24693. * _.isEmpty({ 'a': 1 });
  24694. * // => false
  24695. */
  24696. function isEmpty(value) {
  24697. if (value == null) {
  24698. return true;
  24699. }
  24700. if (isArrayLike(value) &&
  24701. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  24702. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  24703. return !value.length;
  24704. }
  24705. var tag = getTag(value);
  24706. if (tag == mapTag || tag == setTag) {
  24707. return !value.size;
  24708. }
  24709. if (isPrototype(value)) {
  24710. return !baseKeys(value).length;
  24711. }
  24712. for (var key in value) {
  24713. if (hasOwnProperty.call(value, key)) {
  24714. return false;
  24715. }
  24716. }
  24717. return true;
  24718. }
  24719. /**
  24720. * Performs a deep comparison between two values to determine if they are
  24721. * equivalent.
  24722. *
  24723. * **Note:** This method supports comparing arrays, array buffers, booleans,
  24724. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  24725. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  24726. * by their own, not inherited, enumerable properties. Functions and DOM
  24727. * nodes are compared by strict equality, i.e. `===`.
  24728. *
  24729. * @static
  24730. * @memberOf _
  24731. * @since 0.1.0
  24732. * @category Lang
  24733. * @param {*} value The value to compare.
  24734. * @param {*} other The other value to compare.
  24735. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24736. * @example
  24737. *
  24738. * var object = { 'a': 1 };
  24739. * var other = { 'a': 1 };
  24740. *
  24741. * _.isEqual(object, other);
  24742. * // => true
  24743. *
  24744. * object === other;
  24745. * // => false
  24746. */
  24747. function isEqual(value, other) {
  24748. return baseIsEqual(value, other);
  24749. }
  24750. /**
  24751. * This method is like `_.isEqual` except that it accepts `customizer` which
  24752. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24753. * are handled by the method instead. The `customizer` is invoked with up to
  24754. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  24755. *
  24756. * @static
  24757. * @memberOf _
  24758. * @since 4.0.0
  24759. * @category Lang
  24760. * @param {*} value The value to compare.
  24761. * @param {*} other The other value to compare.
  24762. * @param {Function} [customizer] The function to customize comparisons.
  24763. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24764. * @example
  24765. *
  24766. * function isGreeting(value) {
  24767. * return /^h(?:i|ello)$/.test(value);
  24768. * }
  24769. *
  24770. * function customizer(objValue, othValue) {
  24771. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24772. * return true;
  24773. * }
  24774. * }
  24775. *
  24776. * var array = ['hello', 'goodbye'];
  24777. * var other = ['hi', 'goodbye'];
  24778. *
  24779. * _.isEqualWith(array, other, customizer);
  24780. * // => true
  24781. */
  24782. function isEqualWith(value, other, customizer) {
  24783. customizer = typeof customizer == 'function' ? customizer : undefined;
  24784. var result = customizer ? customizer(value, other) : undefined;
  24785. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  24786. }
  24787. /**
  24788. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  24789. * `SyntaxError`, `TypeError`, or `URIError` object.
  24790. *
  24791. * @static
  24792. * @memberOf _
  24793. * @since 3.0.0
  24794. * @category Lang
  24795. * @param {*} value The value to check.
  24796. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  24797. * @example
  24798. *
  24799. * _.isError(new Error);
  24800. * // => true
  24801. *
  24802. * _.isError(Error);
  24803. * // => false
  24804. */
  24805. function isError(value) {
  24806. if (!isObjectLike(value)) {
  24807. return false;
  24808. }
  24809. var tag = baseGetTag(value);
  24810. return tag == errorTag || tag == domExcTag ||
  24811. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  24812. }
  24813. /**
  24814. * Checks if `value` is a finite primitive number.
  24815. *
  24816. * **Note:** This method is based on
  24817. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  24818. *
  24819. * @static
  24820. * @memberOf _
  24821. * @since 0.1.0
  24822. * @category Lang
  24823. * @param {*} value The value to check.
  24824. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  24825. * @example
  24826. *
  24827. * _.isFinite(3);
  24828. * // => true
  24829. *
  24830. * _.isFinite(Number.MIN_VALUE);
  24831. * // => true
  24832. *
  24833. * _.isFinite(Infinity);
  24834. * // => false
  24835. *
  24836. * _.isFinite('3');
  24837. * // => false
  24838. */
  24839. function isFinite(value) {
  24840. return typeof value == 'number' && nativeIsFinite(value);
  24841. }
  24842. /**
  24843. * Checks if `value` is classified as a `Function` object.
  24844. *
  24845. * @static
  24846. * @memberOf _
  24847. * @since 0.1.0
  24848. * @category Lang
  24849. * @param {*} value The value to check.
  24850. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  24851. * @example
  24852. *
  24853. * _.isFunction(_);
  24854. * // => true
  24855. *
  24856. * _.isFunction(/abc/);
  24857. * // => false
  24858. */
  24859. function isFunction(value) {
  24860. if (!isObject(value)) {
  24861. return false;
  24862. }
  24863. // The use of `Object#toString` avoids issues with the `typeof` operator
  24864. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  24865. var tag = baseGetTag(value);
  24866. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  24867. }
  24868. /**
  24869. * Checks if `value` is an integer.
  24870. *
  24871. * **Note:** This method is based on
  24872. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  24873. *
  24874. * @static
  24875. * @memberOf _
  24876. * @since 4.0.0
  24877. * @category Lang
  24878. * @param {*} value The value to check.
  24879. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  24880. * @example
  24881. *
  24882. * _.isInteger(3);
  24883. * // => true
  24884. *
  24885. * _.isInteger(Number.MIN_VALUE);
  24886. * // => false
  24887. *
  24888. * _.isInteger(Infinity);
  24889. * // => false
  24890. *
  24891. * _.isInteger('3');
  24892. * // => false
  24893. */
  24894. function isInteger(value) {
  24895. return typeof value == 'number' && value == toInteger(value);
  24896. }
  24897. /**
  24898. * Checks if `value` is a valid array-like length.
  24899. *
  24900. * **Note:** This method is loosely based on
  24901. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24902. *
  24903. * @static
  24904. * @memberOf _
  24905. * @since 4.0.0
  24906. * @category Lang
  24907. * @param {*} value The value to check.
  24908. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  24909. * @example
  24910. *
  24911. * _.isLength(3);
  24912. * // => true
  24913. *
  24914. * _.isLength(Number.MIN_VALUE);
  24915. * // => false
  24916. *
  24917. * _.isLength(Infinity);
  24918. * // => false
  24919. *
  24920. * _.isLength('3');
  24921. * // => false
  24922. */
  24923. function isLength(value) {
  24924. return typeof value == 'number' &&
  24925. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  24926. }
  24927. /**
  24928. * Checks if `value` is the
  24929. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  24930. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  24931. *
  24932. * @static
  24933. * @memberOf _
  24934. * @since 0.1.0
  24935. * @category Lang
  24936. * @param {*} value The value to check.
  24937. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  24938. * @example
  24939. *
  24940. * _.isObject({});
  24941. * // => true
  24942. *
  24943. * _.isObject([1, 2, 3]);
  24944. * // => true
  24945. *
  24946. * _.isObject(_.noop);
  24947. * // => true
  24948. *
  24949. * _.isObject(null);
  24950. * // => false
  24951. */
  24952. function isObject(value) {
  24953. var type = typeof value;
  24954. return value != null && (type == 'object' || type == 'function');
  24955. }
  24956. /**
  24957. * Checks if `value` is object-like. A value is object-like if it's not `null`
  24958. * and has a `typeof` result of "object".
  24959. *
  24960. * @static
  24961. * @memberOf _
  24962. * @since 4.0.0
  24963. * @category Lang
  24964. * @param {*} value The value to check.
  24965. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  24966. * @example
  24967. *
  24968. * _.isObjectLike({});
  24969. * // => true
  24970. *
  24971. * _.isObjectLike([1, 2, 3]);
  24972. * // => true
  24973. *
  24974. * _.isObjectLike(_.noop);
  24975. * // => false
  24976. *
  24977. * _.isObjectLike(null);
  24978. * // => false
  24979. */
  24980. function isObjectLike(value) {
  24981. return value != null && typeof value == 'object';
  24982. }
  24983. /**
  24984. * Checks if `value` is classified as a `Map` object.
  24985. *
  24986. * @static
  24987. * @memberOf _
  24988. * @since 4.3.0
  24989. * @category Lang
  24990. * @param {*} value The value to check.
  24991. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  24992. * @example
  24993. *
  24994. * _.isMap(new Map);
  24995. * // => true
  24996. *
  24997. * _.isMap(new WeakMap);
  24998. * // => false
  24999. */
  25000. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  25001. /**
  25002. * Performs a partial deep comparison between `object` and `source` to
  25003. * determine if `object` contains equivalent property values.
  25004. *
  25005. * **Note:** This method is equivalent to `_.matches` when `source` is
  25006. * partially applied.
  25007. *
  25008. * Partial comparisons will match empty array and empty object `source`
  25009. * values against any array or object value, respectively. See `_.isEqual`
  25010. * for a list of supported value comparisons.
  25011. *
  25012. * @static
  25013. * @memberOf _
  25014. * @since 3.0.0
  25015. * @category Lang
  25016. * @param {Object} object The object to inspect.
  25017. * @param {Object} source The object of property values to match.
  25018. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  25019. * @example
  25020. *
  25021. * var object = { 'a': 1, 'b': 2 };
  25022. *
  25023. * _.isMatch(object, { 'b': 2 });
  25024. * // => true
  25025. *
  25026. * _.isMatch(object, { 'b': 1 });
  25027. * // => false
  25028. */
  25029. function isMatch(object, source) {
  25030. return object === source || baseIsMatch(object, source, getMatchData(source));
  25031. }
  25032. /**
  25033. * This method is like `_.isMatch` except that it accepts `customizer` which
  25034. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  25035. * are handled by the method instead. The `customizer` is invoked with five
  25036. * arguments: (objValue, srcValue, index|key, object, source).
  25037. *
  25038. * @static
  25039. * @memberOf _
  25040. * @since 4.0.0
  25041. * @category Lang
  25042. * @param {Object} object The object to inspect.
  25043. * @param {Object} source The object of property values to match.
  25044. * @param {Function} [customizer] The function to customize comparisons.
  25045. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  25046. * @example
  25047. *
  25048. * function isGreeting(value) {
  25049. * return /^h(?:i|ello)$/.test(value);
  25050. * }
  25051. *
  25052. * function customizer(objValue, srcValue) {
  25053. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  25054. * return true;
  25055. * }
  25056. * }
  25057. *
  25058. * var object = { 'greeting': 'hello' };
  25059. * var source = { 'greeting': 'hi' };
  25060. *
  25061. * _.isMatchWith(object, source, customizer);
  25062. * // => true
  25063. */
  25064. function isMatchWith(object, source, customizer) {
  25065. customizer = typeof customizer == 'function' ? customizer : undefined;
  25066. return baseIsMatch(object, source, getMatchData(source), customizer);
  25067. }
  25068. /**
  25069. * Checks if `value` is `NaN`.
  25070. *
  25071. * **Note:** This method is based on
  25072. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  25073. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  25074. * `undefined` and other non-number values.
  25075. *
  25076. * @static
  25077. * @memberOf _
  25078. * @since 0.1.0
  25079. * @category Lang
  25080. * @param {*} value The value to check.
  25081. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  25082. * @example
  25083. *
  25084. * _.isNaN(NaN);
  25085. * // => true
  25086. *
  25087. * _.isNaN(new Number(NaN));
  25088. * // => true
  25089. *
  25090. * isNaN(undefined);
  25091. * // => true
  25092. *
  25093. * _.isNaN(undefined);
  25094. * // => false
  25095. */
  25096. function isNaN(value) {
  25097. // An `NaN` primitive is the only value that is not equal to itself.
  25098. // Perform the `toStringTag` check first to avoid errors with some
  25099. // ActiveX objects in IE.
  25100. return isNumber(value) && value != +value;
  25101. }
  25102. /**
  25103. * Checks if `value` is a pristine native function.
  25104. *
  25105. * **Note:** This method can't reliably detect native functions in the presence
  25106. * of the core-js package because core-js circumvents this kind of detection.
  25107. * Despite multiple requests, the core-js maintainer has made it clear: any
  25108. * attempt to fix the detection will be obstructed. As a result, we're left
  25109. * with little choice but to throw an error. Unfortunately, this also affects
  25110. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  25111. * which rely on core-js.
  25112. *
  25113. * @static
  25114. * @memberOf _
  25115. * @since 3.0.0
  25116. * @category Lang
  25117. * @param {*} value The value to check.
  25118. * @returns {boolean} Returns `true` if `value` is a native function,
  25119. * else `false`.
  25120. * @example
  25121. *
  25122. * _.isNative(Array.prototype.push);
  25123. * // => true
  25124. *
  25125. * _.isNative(_);
  25126. * // => false
  25127. */
  25128. function isNative(value) {
  25129. if (isMaskable(value)) {
  25130. throw new Error(CORE_ERROR_TEXT);
  25131. }
  25132. return baseIsNative(value);
  25133. }
  25134. /**
  25135. * Checks if `value` is `null`.
  25136. *
  25137. * @static
  25138. * @memberOf _
  25139. * @since 0.1.0
  25140. * @category Lang
  25141. * @param {*} value The value to check.
  25142. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  25143. * @example
  25144. *
  25145. * _.isNull(null);
  25146. * // => true
  25147. *
  25148. * _.isNull(void 0);
  25149. * // => false
  25150. */
  25151. function isNull(value) {
  25152. return value === null;
  25153. }
  25154. /**
  25155. * Checks if `value` is `null` or `undefined`.
  25156. *
  25157. * @static
  25158. * @memberOf _
  25159. * @since 4.0.0
  25160. * @category Lang
  25161. * @param {*} value The value to check.
  25162. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  25163. * @example
  25164. *
  25165. * _.isNil(null);
  25166. * // => true
  25167. *
  25168. * _.isNil(void 0);
  25169. * // => true
  25170. *
  25171. * _.isNil(NaN);
  25172. * // => false
  25173. */
  25174. function isNil(value) {
  25175. return value == null;
  25176. }
  25177. /**
  25178. * Checks if `value` is classified as a `Number` primitive or object.
  25179. *
  25180. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  25181. * classified as numbers, use the `_.isFinite` method.
  25182. *
  25183. * @static
  25184. * @memberOf _
  25185. * @since 0.1.0
  25186. * @category Lang
  25187. * @param {*} value The value to check.
  25188. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  25189. * @example
  25190. *
  25191. * _.isNumber(3);
  25192. * // => true
  25193. *
  25194. * _.isNumber(Number.MIN_VALUE);
  25195. * // => true
  25196. *
  25197. * _.isNumber(Infinity);
  25198. * // => true
  25199. *
  25200. * _.isNumber('3');
  25201. * // => false
  25202. */
  25203. function isNumber(value) {
  25204. return typeof value == 'number' ||
  25205. (isObjectLike(value) && baseGetTag(value) == numberTag);
  25206. }
  25207. /**
  25208. * Checks if `value` is a plain object, that is, an object created by the
  25209. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  25210. *
  25211. * @static
  25212. * @memberOf _
  25213. * @since 0.8.0
  25214. * @category Lang
  25215. * @param {*} value The value to check.
  25216. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  25217. * @example
  25218. *
  25219. * function Foo() {
  25220. * this.a = 1;
  25221. * }
  25222. *
  25223. * _.isPlainObject(new Foo);
  25224. * // => false
  25225. *
  25226. * _.isPlainObject([1, 2, 3]);
  25227. * // => false
  25228. *
  25229. * _.isPlainObject({ 'x': 0, 'y': 0 });
  25230. * // => true
  25231. *
  25232. * _.isPlainObject(Object.create(null));
  25233. * // => true
  25234. */
  25235. function isPlainObject(value) {
  25236. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  25237. return false;
  25238. }
  25239. var proto = getPrototype(value);
  25240. if (proto === null) {
  25241. return true;
  25242. }
  25243. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  25244. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  25245. funcToString.call(Ctor) == objectCtorString;
  25246. }
  25247. /**
  25248. * Checks if `value` is classified as a `RegExp` object.
  25249. *
  25250. * @static
  25251. * @memberOf _
  25252. * @since 0.1.0
  25253. * @category Lang
  25254. * @param {*} value The value to check.
  25255. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  25256. * @example
  25257. *
  25258. * _.isRegExp(/abc/);
  25259. * // => true
  25260. *
  25261. * _.isRegExp('/abc/');
  25262. * // => false
  25263. */
  25264. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  25265. /**
  25266. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  25267. * double precision number which isn't the result of a rounded unsafe integer.
  25268. *
  25269. * **Note:** This method is based on
  25270. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  25271. *
  25272. * @static
  25273. * @memberOf _
  25274. * @since 4.0.0
  25275. * @category Lang
  25276. * @param {*} value The value to check.
  25277. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  25278. * @example
  25279. *
  25280. * _.isSafeInteger(3);
  25281. * // => true
  25282. *
  25283. * _.isSafeInteger(Number.MIN_VALUE);
  25284. * // => false
  25285. *
  25286. * _.isSafeInteger(Infinity);
  25287. * // => false
  25288. *
  25289. * _.isSafeInteger('3');
  25290. * // => false
  25291. */
  25292. function isSafeInteger(value) {
  25293. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  25294. }
  25295. /**
  25296. * Checks if `value` is classified as a `Set` object.
  25297. *
  25298. * @static
  25299. * @memberOf _
  25300. * @since 4.3.0
  25301. * @category Lang
  25302. * @param {*} value The value to check.
  25303. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  25304. * @example
  25305. *
  25306. * _.isSet(new Set);
  25307. * // => true
  25308. *
  25309. * _.isSet(new WeakSet);
  25310. * // => false
  25311. */
  25312. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  25313. /**
  25314. * Checks if `value` is classified as a `String` primitive or object.
  25315. *
  25316. * @static
  25317. * @since 0.1.0
  25318. * @memberOf _
  25319. * @category Lang
  25320. * @param {*} value The value to check.
  25321. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  25322. * @example
  25323. *
  25324. * _.isString('abc');
  25325. * // => true
  25326. *
  25327. * _.isString(1);
  25328. * // => false
  25329. */
  25330. function isString(value) {
  25331. return typeof value == 'string' ||
  25332. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  25333. }
  25334. /**
  25335. * Checks if `value` is classified as a `Symbol` primitive or object.
  25336. *
  25337. * @static
  25338. * @memberOf _
  25339. * @since 4.0.0
  25340. * @category Lang
  25341. * @param {*} value The value to check.
  25342. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  25343. * @example
  25344. *
  25345. * _.isSymbol(Symbol.iterator);
  25346. * // => true
  25347. *
  25348. * _.isSymbol('abc');
  25349. * // => false
  25350. */
  25351. function isSymbol(value) {
  25352. return typeof value == 'symbol' ||
  25353. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  25354. }
  25355. /**
  25356. * Checks if `value` is classified as a typed array.
  25357. *
  25358. * @static
  25359. * @memberOf _
  25360. * @since 3.0.0
  25361. * @category Lang
  25362. * @param {*} value The value to check.
  25363. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  25364. * @example
  25365. *
  25366. * _.isTypedArray(new Uint8Array);
  25367. * // => true
  25368. *
  25369. * _.isTypedArray([]);
  25370. * // => false
  25371. */
  25372. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  25373. /**
  25374. * Checks if `value` is `undefined`.
  25375. *
  25376. * @static
  25377. * @since 0.1.0
  25378. * @memberOf _
  25379. * @category Lang
  25380. * @param {*} value The value to check.
  25381. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  25382. * @example
  25383. *
  25384. * _.isUndefined(void 0);
  25385. * // => true
  25386. *
  25387. * _.isUndefined(null);
  25388. * // => false
  25389. */
  25390. function isUndefined(value) {
  25391. return value === undefined;
  25392. }
  25393. /**
  25394. * Checks if `value` is classified as a `WeakMap` object.
  25395. *
  25396. * @static
  25397. * @memberOf _
  25398. * @since 4.3.0
  25399. * @category Lang
  25400. * @param {*} value The value to check.
  25401. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  25402. * @example
  25403. *
  25404. * _.isWeakMap(new WeakMap);
  25405. * // => true
  25406. *
  25407. * _.isWeakMap(new Map);
  25408. * // => false
  25409. */
  25410. function isWeakMap(value) {
  25411. return isObjectLike(value) && getTag(value) == weakMapTag;
  25412. }
  25413. /**
  25414. * Checks if `value` is classified as a `WeakSet` object.
  25415. *
  25416. * @static
  25417. * @memberOf _
  25418. * @since 4.3.0
  25419. * @category Lang
  25420. * @param {*} value The value to check.
  25421. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  25422. * @example
  25423. *
  25424. * _.isWeakSet(new WeakSet);
  25425. * // => true
  25426. *
  25427. * _.isWeakSet(new Set);
  25428. * // => false
  25429. */
  25430. function isWeakSet(value) {
  25431. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  25432. }
  25433. /**
  25434. * Checks if `value` is less than `other`.
  25435. *
  25436. * @static
  25437. * @memberOf _
  25438. * @since 3.9.0
  25439. * @category Lang
  25440. * @param {*} value The value to compare.
  25441. * @param {*} other The other value to compare.
  25442. * @returns {boolean} Returns `true` if `value` is less than `other`,
  25443. * else `false`.
  25444. * @see _.gt
  25445. * @example
  25446. *
  25447. * _.lt(1, 3);
  25448. * // => true
  25449. *
  25450. * _.lt(3, 3);
  25451. * // => false
  25452. *
  25453. * _.lt(3, 1);
  25454. * // => false
  25455. */
  25456. var lt = createRelationalOperation(baseLt);
  25457. /**
  25458. * Checks if `value` is less than or equal to `other`.
  25459. *
  25460. * @static
  25461. * @memberOf _
  25462. * @since 3.9.0
  25463. * @category Lang
  25464. * @param {*} value The value to compare.
  25465. * @param {*} other The other value to compare.
  25466. * @returns {boolean} Returns `true` if `value` is less than or equal to
  25467. * `other`, else `false`.
  25468. * @see _.gte
  25469. * @example
  25470. *
  25471. * _.lte(1, 3);
  25472. * // => true
  25473. *
  25474. * _.lte(3, 3);
  25475. * // => true
  25476. *
  25477. * _.lte(3, 1);
  25478. * // => false
  25479. */
  25480. var lte = createRelationalOperation(function(value, other) {
  25481. return value <= other;
  25482. });
  25483. /**
  25484. * Converts `value` to an array.
  25485. *
  25486. * @static
  25487. * @since 0.1.0
  25488. * @memberOf _
  25489. * @category Lang
  25490. * @param {*} value The value to convert.
  25491. * @returns {Array} Returns the converted array.
  25492. * @example
  25493. *
  25494. * _.toArray({ 'a': 1, 'b': 2 });
  25495. * // => [1, 2]
  25496. *
  25497. * _.toArray('abc');
  25498. * // => ['a', 'b', 'c']
  25499. *
  25500. * _.toArray(1);
  25501. * // => []
  25502. *
  25503. * _.toArray(null);
  25504. * // => []
  25505. */
  25506. function toArray(value) {
  25507. if (!value) {
  25508. return [];
  25509. }
  25510. if (isArrayLike(value)) {
  25511. return isString(value) ? stringToArray(value) : copyArray(value);
  25512. }
  25513. if (symIterator && value[symIterator]) {
  25514. return iteratorToArray(value[symIterator]());
  25515. }
  25516. var tag = getTag(value),
  25517. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  25518. return func(value);
  25519. }
  25520. /**
  25521. * Converts `value` to a finite number.
  25522. *
  25523. * @static
  25524. * @memberOf _
  25525. * @since 4.12.0
  25526. * @category Lang
  25527. * @param {*} value The value to convert.
  25528. * @returns {number} Returns the converted number.
  25529. * @example
  25530. *
  25531. * _.toFinite(3.2);
  25532. * // => 3.2
  25533. *
  25534. * _.toFinite(Number.MIN_VALUE);
  25535. * // => 5e-324
  25536. *
  25537. * _.toFinite(Infinity);
  25538. * // => 1.7976931348623157e+308
  25539. *
  25540. * _.toFinite('3.2');
  25541. * // => 3.2
  25542. */
  25543. function toFinite(value) {
  25544. if (!value) {
  25545. return value === 0 ? value : 0;
  25546. }
  25547. value = toNumber(value);
  25548. if (value === INFINITY || value === -INFINITY) {
  25549. var sign = (value < 0 ? -1 : 1);
  25550. return sign * MAX_INTEGER;
  25551. }
  25552. return value === value ? value : 0;
  25553. }
  25554. /**
  25555. * Converts `value` to an integer.
  25556. *
  25557. * **Note:** This method is loosely based on
  25558. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  25559. *
  25560. * @static
  25561. * @memberOf _
  25562. * @since 4.0.0
  25563. * @category Lang
  25564. * @param {*} value The value to convert.
  25565. * @returns {number} Returns the converted integer.
  25566. * @example
  25567. *
  25568. * _.toInteger(3.2);
  25569. * // => 3
  25570. *
  25571. * _.toInteger(Number.MIN_VALUE);
  25572. * // => 0
  25573. *
  25574. * _.toInteger(Infinity);
  25575. * // => 1.7976931348623157e+308
  25576. *
  25577. * _.toInteger('3.2');
  25578. * // => 3
  25579. */
  25580. function toInteger(value) {
  25581. var result = toFinite(value),
  25582. remainder = result % 1;
  25583. return result === result ? (remainder ? result - remainder : result) : 0;
  25584. }
  25585. /**
  25586. * Converts `value` to an integer suitable for use as the length of an
  25587. * array-like object.
  25588. *
  25589. * **Note:** This method is based on
  25590. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  25591. *
  25592. * @static
  25593. * @memberOf _
  25594. * @since 4.0.0
  25595. * @category Lang
  25596. * @param {*} value The value to convert.
  25597. * @returns {number} Returns the converted integer.
  25598. * @example
  25599. *
  25600. * _.toLength(3.2);
  25601. * // => 3
  25602. *
  25603. * _.toLength(Number.MIN_VALUE);
  25604. * // => 0
  25605. *
  25606. * _.toLength(Infinity);
  25607. * // => 4294967295
  25608. *
  25609. * _.toLength('3.2');
  25610. * // => 3
  25611. */
  25612. function toLength(value) {
  25613. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  25614. }
  25615. /**
  25616. * Converts `value` to a number.
  25617. *
  25618. * @static
  25619. * @memberOf _
  25620. * @since 4.0.0
  25621. * @category Lang
  25622. * @param {*} value The value to process.
  25623. * @returns {number} Returns the number.
  25624. * @example
  25625. *
  25626. * _.toNumber(3.2);
  25627. * // => 3.2
  25628. *
  25629. * _.toNumber(Number.MIN_VALUE);
  25630. * // => 5e-324
  25631. *
  25632. * _.toNumber(Infinity);
  25633. * // => Infinity
  25634. *
  25635. * _.toNumber('3.2');
  25636. * // => 3.2
  25637. */
  25638. function toNumber(value) {
  25639. if (typeof value == 'number') {
  25640. return value;
  25641. }
  25642. if (isSymbol(value)) {
  25643. return NAN;
  25644. }
  25645. if (isObject(value)) {
  25646. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  25647. value = isObject(other) ? (other + '') : other;
  25648. }
  25649. if (typeof value != 'string') {
  25650. return value === 0 ? value : +value;
  25651. }
  25652. value = value.replace(reTrim, '');
  25653. var isBinary = reIsBinary.test(value);
  25654. return (isBinary || reIsOctal.test(value))
  25655. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  25656. : (reIsBadHex.test(value) ? NAN : +value);
  25657. }
  25658. /**
  25659. * Converts `value` to a plain object flattening inherited enumerable string
  25660. * keyed properties of `value` to own properties of the plain object.
  25661. *
  25662. * @static
  25663. * @memberOf _
  25664. * @since 3.0.0
  25665. * @category Lang
  25666. * @param {*} value The value to convert.
  25667. * @returns {Object} Returns the converted plain object.
  25668. * @example
  25669. *
  25670. * function Foo() {
  25671. * this.b = 2;
  25672. * }
  25673. *
  25674. * Foo.prototype.c = 3;
  25675. *
  25676. * _.assign({ 'a': 1 }, new Foo);
  25677. * // => { 'a': 1, 'b': 2 }
  25678. *
  25679. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25680. * // => { 'a': 1, 'b': 2, 'c': 3 }
  25681. */
  25682. function toPlainObject(value) {
  25683. return copyObject(value, keysIn(value));
  25684. }
  25685. /**
  25686. * Converts `value` to a safe integer. A safe integer can be compared and
  25687. * represented correctly.
  25688. *
  25689. * @static
  25690. * @memberOf _
  25691. * @since 4.0.0
  25692. * @category Lang
  25693. * @param {*} value The value to convert.
  25694. * @returns {number} Returns the converted integer.
  25695. * @example
  25696. *
  25697. * _.toSafeInteger(3.2);
  25698. * // => 3
  25699. *
  25700. * _.toSafeInteger(Number.MIN_VALUE);
  25701. * // => 0
  25702. *
  25703. * _.toSafeInteger(Infinity);
  25704. * // => 9007199254740991
  25705. *
  25706. * _.toSafeInteger('3.2');
  25707. * // => 3
  25708. */
  25709. function toSafeInteger(value) {
  25710. return value
  25711. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  25712. : (value === 0 ? value : 0);
  25713. }
  25714. /**
  25715. * Converts `value` to a string. An empty string is returned for `null`
  25716. * and `undefined` values. The sign of `-0` is preserved.
  25717. *
  25718. * @static
  25719. * @memberOf _
  25720. * @since 4.0.0
  25721. * @category Lang
  25722. * @param {*} value The value to convert.
  25723. * @returns {string} Returns the converted string.
  25724. * @example
  25725. *
  25726. * _.toString(null);
  25727. * // => ''
  25728. *
  25729. * _.toString(-0);
  25730. * // => '-0'
  25731. *
  25732. * _.toString([1, 2, 3]);
  25733. * // => '1,2,3'
  25734. */
  25735. function toString(value) {
  25736. return value == null ? '' : baseToString(value);
  25737. }
  25738. /*------------------------------------------------------------------------*/
  25739. /**
  25740. * Assigns own enumerable string keyed properties of source objects to the
  25741. * destination object. Source objects are applied from left to right.
  25742. * Subsequent sources overwrite property assignments of previous sources.
  25743. *
  25744. * **Note:** This method mutates `object` and is loosely based on
  25745. * [`Object.assign`](https://mdn.io/Object/assign).
  25746. *
  25747. * @static
  25748. * @memberOf _
  25749. * @since 0.10.0
  25750. * @category Object
  25751. * @param {Object} object The destination object.
  25752. * @param {...Object} [sources] The source objects.
  25753. * @returns {Object} Returns `object`.
  25754. * @see _.assignIn
  25755. * @example
  25756. *
  25757. * function Foo() {
  25758. * this.a = 1;
  25759. * }
  25760. *
  25761. * function Bar() {
  25762. * this.c = 3;
  25763. * }
  25764. *
  25765. * Foo.prototype.b = 2;
  25766. * Bar.prototype.d = 4;
  25767. *
  25768. * _.assign({ 'a': 0 }, new Foo, new Bar);
  25769. * // => { 'a': 1, 'c': 3 }
  25770. */
  25771. var assign = createAssigner(function(object, source) {
  25772. if (isPrototype(source) || isArrayLike(source)) {
  25773. copyObject(source, keys(source), object);
  25774. return;
  25775. }
  25776. for (var key in source) {
  25777. if (hasOwnProperty.call(source, key)) {
  25778. assignValue(object, key, source[key]);
  25779. }
  25780. }
  25781. });
  25782. /**
  25783. * This method is like `_.assign` except that it iterates over own and
  25784. * inherited source properties.
  25785. *
  25786. * **Note:** This method mutates `object`.
  25787. *
  25788. * @static
  25789. * @memberOf _
  25790. * @since 4.0.0
  25791. * @alias extend
  25792. * @category Object
  25793. * @param {Object} object The destination object.
  25794. * @param {...Object} [sources] The source objects.
  25795. * @returns {Object} Returns `object`.
  25796. * @see _.assign
  25797. * @example
  25798. *
  25799. * function Foo() {
  25800. * this.a = 1;
  25801. * }
  25802. *
  25803. * function Bar() {
  25804. * this.c = 3;
  25805. * }
  25806. *
  25807. * Foo.prototype.b = 2;
  25808. * Bar.prototype.d = 4;
  25809. *
  25810. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  25811. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  25812. */
  25813. var assignIn = createAssigner(function(object, source) {
  25814. copyObject(source, keysIn(source), object);
  25815. });
  25816. /**
  25817. * This method is like `_.assignIn` except that it accepts `customizer`
  25818. * which is invoked to produce the assigned values. If `customizer` returns
  25819. * `undefined`, assignment is handled by the method instead. The `customizer`
  25820. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25821. *
  25822. * **Note:** This method mutates `object`.
  25823. *
  25824. * @static
  25825. * @memberOf _
  25826. * @since 4.0.0
  25827. * @alias extendWith
  25828. * @category Object
  25829. * @param {Object} object The destination object.
  25830. * @param {...Object} sources The source objects.
  25831. * @param {Function} [customizer] The function to customize assigned values.
  25832. * @returns {Object} Returns `object`.
  25833. * @see _.assignWith
  25834. * @example
  25835. *
  25836. * function customizer(objValue, srcValue) {
  25837. * return _.isUndefined(objValue) ? srcValue : objValue;
  25838. * }
  25839. *
  25840. * var defaults = _.partialRight(_.assignInWith, customizer);
  25841. *
  25842. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25843. * // => { 'a': 1, 'b': 2 }
  25844. */
  25845. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  25846. copyObject(source, keysIn(source), object, customizer);
  25847. });
  25848. /**
  25849. * This method is like `_.assign` except that it accepts `customizer`
  25850. * which is invoked to produce the assigned values. If `customizer` returns
  25851. * `undefined`, assignment is handled by the method instead. The `customizer`
  25852. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25853. *
  25854. * **Note:** This method mutates `object`.
  25855. *
  25856. * @static
  25857. * @memberOf _
  25858. * @since 4.0.0
  25859. * @category Object
  25860. * @param {Object} object The destination object.
  25861. * @param {...Object} sources The source objects.
  25862. * @param {Function} [customizer] The function to customize assigned values.
  25863. * @returns {Object} Returns `object`.
  25864. * @see _.assignInWith
  25865. * @example
  25866. *
  25867. * function customizer(objValue, srcValue) {
  25868. * return _.isUndefined(objValue) ? srcValue : objValue;
  25869. * }
  25870. *
  25871. * var defaults = _.partialRight(_.assignWith, customizer);
  25872. *
  25873. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25874. * // => { 'a': 1, 'b': 2 }
  25875. */
  25876. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  25877. copyObject(source, keys(source), object, customizer);
  25878. });
  25879. /**
  25880. * Creates an array of values corresponding to `paths` of `object`.
  25881. *
  25882. * @static
  25883. * @memberOf _
  25884. * @since 1.0.0
  25885. * @category Object
  25886. * @param {Object} object The object to iterate over.
  25887. * @param {...(string|string[])} [paths] The property paths to pick.
  25888. * @returns {Array} Returns the picked values.
  25889. * @example
  25890. *
  25891. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25892. *
  25893. * _.at(object, ['a[0].b.c', 'a[1]']);
  25894. * // => [3, 4]
  25895. */
  25896. var at = flatRest(baseAt);
  25897. /**
  25898. * Creates an object that inherits from the `prototype` object. If a
  25899. * `properties` object is given, its own enumerable string keyed properties
  25900. * are assigned to the created object.
  25901. *
  25902. * @static
  25903. * @memberOf _
  25904. * @since 2.3.0
  25905. * @category Object
  25906. * @param {Object} prototype The object to inherit from.
  25907. * @param {Object} [properties] The properties to assign to the object.
  25908. * @returns {Object} Returns the new object.
  25909. * @example
  25910. *
  25911. * function Shape() {
  25912. * this.x = 0;
  25913. * this.y = 0;
  25914. * }
  25915. *
  25916. * function Circle() {
  25917. * Shape.call(this);
  25918. * }
  25919. *
  25920. * Circle.prototype = _.create(Shape.prototype, {
  25921. * 'constructor': Circle
  25922. * });
  25923. *
  25924. * var circle = new Circle;
  25925. * circle instanceof Circle;
  25926. * // => true
  25927. *
  25928. * circle instanceof Shape;
  25929. * // => true
  25930. */
  25931. function create(prototype, properties) {
  25932. var result = baseCreate(prototype);
  25933. return properties == null ? result : baseAssign(result, properties);
  25934. }
  25935. /**
  25936. * Assigns own and inherited enumerable string keyed properties of source
  25937. * objects to the destination object for all destination properties that
  25938. * resolve to `undefined`. Source objects are applied from left to right.
  25939. * Once a property is set, additional values of the same property are ignored.
  25940. *
  25941. * **Note:** This method mutates `object`.
  25942. *
  25943. * @static
  25944. * @since 0.1.0
  25945. * @memberOf _
  25946. * @category Object
  25947. * @param {Object} object The destination object.
  25948. * @param {...Object} [sources] The source objects.
  25949. * @returns {Object} Returns `object`.
  25950. * @see _.defaultsDeep
  25951. * @example
  25952. *
  25953. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25954. * // => { 'a': 1, 'b': 2 }
  25955. */
  25956. var defaults = baseRest(function(object, sources) {
  25957. object = Object(object);
  25958. var index = -1;
  25959. var length = sources.length;
  25960. var guard = length > 2 ? sources[2] : undefined;
  25961. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25962. length = 1;
  25963. }
  25964. while (++index < length) {
  25965. var source = sources[index];
  25966. var props = keysIn(source);
  25967. var propsIndex = -1;
  25968. var propsLength = props.length;
  25969. while (++propsIndex < propsLength) {
  25970. var key = props[propsIndex];
  25971. var value = object[key];
  25972. if (value === undefined ||
  25973. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  25974. object[key] = source[key];
  25975. }
  25976. }
  25977. }
  25978. return object;
  25979. });
  25980. /**
  25981. * This method is like `_.defaults` except that it recursively assigns
  25982. * default properties.
  25983. *
  25984. * **Note:** This method mutates `object`.
  25985. *
  25986. * @static
  25987. * @memberOf _
  25988. * @since 3.10.0
  25989. * @category Object
  25990. * @param {Object} object The destination object.
  25991. * @param {...Object} [sources] The source objects.
  25992. * @returns {Object} Returns `object`.
  25993. * @see _.defaults
  25994. * @example
  25995. *
  25996. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  25997. * // => { 'a': { 'b': 2, 'c': 3 } }
  25998. */
  25999. var defaultsDeep = baseRest(function(args) {
  26000. args.push(undefined, customDefaultsMerge);
  26001. return apply(mergeWith, undefined, args);
  26002. });
  26003. /**
  26004. * This method is like `_.find` except that it returns the key of the first
  26005. * element `predicate` returns truthy for instead of the element itself.
  26006. *
  26007. * @static
  26008. * @memberOf _
  26009. * @since 1.1.0
  26010. * @category Object
  26011. * @param {Object} object The object to inspect.
  26012. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26013. * @returns {string|undefined} Returns the key of the matched element,
  26014. * else `undefined`.
  26015. * @example
  26016. *
  26017. * var users = {
  26018. * 'barney': { 'age': 36, 'active': true },
  26019. * 'fred': { 'age': 40, 'active': false },
  26020. * 'pebbles': { 'age': 1, 'active': true }
  26021. * };
  26022. *
  26023. * _.findKey(users, function(o) { return o.age < 40; });
  26024. * // => 'barney' (iteration order is not guaranteed)
  26025. *
  26026. * // The `_.matches` iteratee shorthand.
  26027. * _.findKey(users, { 'age': 1, 'active': true });
  26028. * // => 'pebbles'
  26029. *
  26030. * // The `_.matchesProperty` iteratee shorthand.
  26031. * _.findKey(users, ['active', false]);
  26032. * // => 'fred'
  26033. *
  26034. * // The `_.property` iteratee shorthand.
  26035. * _.findKey(users, 'active');
  26036. * // => 'barney'
  26037. */
  26038. function findKey(object, predicate) {
  26039. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  26040. }
  26041. /**
  26042. * This method is like `_.findKey` except that it iterates over elements of
  26043. * a collection in the opposite order.
  26044. *
  26045. * @static
  26046. * @memberOf _
  26047. * @since 2.0.0
  26048. * @category Object
  26049. * @param {Object} object The object to inspect.
  26050. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26051. * @returns {string|undefined} Returns the key of the matched element,
  26052. * else `undefined`.
  26053. * @example
  26054. *
  26055. * var users = {
  26056. * 'barney': { 'age': 36, 'active': true },
  26057. * 'fred': { 'age': 40, 'active': false },
  26058. * 'pebbles': { 'age': 1, 'active': true }
  26059. * };
  26060. *
  26061. * _.findLastKey(users, function(o) { return o.age < 40; });
  26062. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  26063. *
  26064. * // The `_.matches` iteratee shorthand.
  26065. * _.findLastKey(users, { 'age': 36, 'active': true });
  26066. * // => 'barney'
  26067. *
  26068. * // The `_.matchesProperty` iteratee shorthand.
  26069. * _.findLastKey(users, ['active', false]);
  26070. * // => 'fred'
  26071. *
  26072. * // The `_.property` iteratee shorthand.
  26073. * _.findLastKey(users, 'active');
  26074. * // => 'pebbles'
  26075. */
  26076. function findLastKey(object, predicate) {
  26077. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  26078. }
  26079. /**
  26080. * Iterates over own and inherited enumerable string keyed properties of an
  26081. * object and invokes `iteratee` for each property. The iteratee is invoked
  26082. * with three arguments: (value, key, object). Iteratee functions may exit
  26083. * iteration early by explicitly returning `false`.
  26084. *
  26085. * @static
  26086. * @memberOf _
  26087. * @since 0.3.0
  26088. * @category Object
  26089. * @param {Object} object The object to iterate over.
  26090. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26091. * @returns {Object} Returns `object`.
  26092. * @see _.forInRight
  26093. * @example
  26094. *
  26095. * function Foo() {
  26096. * this.a = 1;
  26097. * this.b = 2;
  26098. * }
  26099. *
  26100. * Foo.prototype.c = 3;
  26101. *
  26102. * _.forIn(new Foo, function(value, key) {
  26103. * console.log(key);
  26104. * });
  26105. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  26106. */
  26107. function forIn(object, iteratee) {
  26108. return object == null
  26109. ? object
  26110. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  26111. }
  26112. /**
  26113. * This method is like `_.forIn` except that it iterates over properties of
  26114. * `object` in the opposite order.
  26115. *
  26116. * @static
  26117. * @memberOf _
  26118. * @since 2.0.0
  26119. * @category Object
  26120. * @param {Object} object The object to iterate over.
  26121. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26122. * @returns {Object} Returns `object`.
  26123. * @see _.forIn
  26124. * @example
  26125. *
  26126. * function Foo() {
  26127. * this.a = 1;
  26128. * this.b = 2;
  26129. * }
  26130. *
  26131. * Foo.prototype.c = 3;
  26132. *
  26133. * _.forInRight(new Foo, function(value, key) {
  26134. * console.log(key);
  26135. * });
  26136. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  26137. */
  26138. function forInRight(object, iteratee) {
  26139. return object == null
  26140. ? object
  26141. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  26142. }
  26143. /**
  26144. * Iterates over own enumerable string keyed properties of an object and
  26145. * invokes `iteratee` for each property. The iteratee is invoked with three
  26146. * arguments: (value, key, object). Iteratee functions may exit iteration
  26147. * early by explicitly returning `false`.
  26148. *
  26149. * @static
  26150. * @memberOf _
  26151. * @since 0.3.0
  26152. * @category Object
  26153. * @param {Object} object The object to iterate over.
  26154. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26155. * @returns {Object} Returns `object`.
  26156. * @see _.forOwnRight
  26157. * @example
  26158. *
  26159. * function Foo() {
  26160. * this.a = 1;
  26161. * this.b = 2;
  26162. * }
  26163. *
  26164. * Foo.prototype.c = 3;
  26165. *
  26166. * _.forOwn(new Foo, function(value, key) {
  26167. * console.log(key);
  26168. * });
  26169. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26170. */
  26171. function forOwn(object, iteratee) {
  26172. return object && baseForOwn(object, getIteratee(iteratee, 3));
  26173. }
  26174. /**
  26175. * This method is like `_.forOwn` except that it iterates over properties of
  26176. * `object` in the opposite order.
  26177. *
  26178. * @static
  26179. * @memberOf _
  26180. * @since 2.0.0
  26181. * @category Object
  26182. * @param {Object} object The object to iterate over.
  26183. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26184. * @returns {Object} Returns `object`.
  26185. * @see _.forOwn
  26186. * @example
  26187. *
  26188. * function Foo() {
  26189. * this.a = 1;
  26190. * this.b = 2;
  26191. * }
  26192. *
  26193. * Foo.prototype.c = 3;
  26194. *
  26195. * _.forOwnRight(new Foo, function(value, key) {
  26196. * console.log(key);
  26197. * });
  26198. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  26199. */
  26200. function forOwnRight(object, iteratee) {
  26201. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  26202. }
  26203. /**
  26204. * Creates an array of function property names from own enumerable properties
  26205. * of `object`.
  26206. *
  26207. * @static
  26208. * @since 0.1.0
  26209. * @memberOf _
  26210. * @category Object
  26211. * @param {Object} object The object to inspect.
  26212. * @returns {Array} Returns the function names.
  26213. * @see _.functionsIn
  26214. * @example
  26215. *
  26216. * function Foo() {
  26217. * this.a = _.constant('a');
  26218. * this.b = _.constant('b');
  26219. * }
  26220. *
  26221. * Foo.prototype.c = _.constant('c');
  26222. *
  26223. * _.functions(new Foo);
  26224. * // => ['a', 'b']
  26225. */
  26226. function functions(object) {
  26227. return object == null ? [] : baseFunctions(object, keys(object));
  26228. }
  26229. /**
  26230. * Creates an array of function property names from own and inherited
  26231. * enumerable properties of `object`.
  26232. *
  26233. * @static
  26234. * @memberOf _
  26235. * @since 4.0.0
  26236. * @category Object
  26237. * @param {Object} object The object to inspect.
  26238. * @returns {Array} Returns the function names.
  26239. * @see _.functions
  26240. * @example
  26241. *
  26242. * function Foo() {
  26243. * this.a = _.constant('a');
  26244. * this.b = _.constant('b');
  26245. * }
  26246. *
  26247. * Foo.prototype.c = _.constant('c');
  26248. *
  26249. * _.functionsIn(new Foo);
  26250. * // => ['a', 'b', 'c']
  26251. */
  26252. function functionsIn(object) {
  26253. return object == null ? [] : baseFunctions(object, keysIn(object));
  26254. }
  26255. /**
  26256. * Gets the value at `path` of `object`. If the resolved value is
  26257. * `undefined`, the `defaultValue` is returned in its place.
  26258. *
  26259. * @static
  26260. * @memberOf _
  26261. * @since 3.7.0
  26262. * @category Object
  26263. * @param {Object} object The object to query.
  26264. * @param {Array|string} path The path of the property to get.
  26265. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26266. * @returns {*} Returns the resolved value.
  26267. * @example
  26268. *
  26269. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26270. *
  26271. * _.get(object, 'a[0].b.c');
  26272. * // => 3
  26273. *
  26274. * _.get(object, ['a', '0', 'b', 'c']);
  26275. * // => 3
  26276. *
  26277. * _.get(object, 'a.b.c', 'default');
  26278. * // => 'default'
  26279. */
  26280. function get(object, path, defaultValue) {
  26281. var result = object == null ? undefined : baseGet(object, path);
  26282. return result === undefined ? defaultValue : result;
  26283. }
  26284. /**
  26285. * Checks if `path` is a direct property of `object`.
  26286. *
  26287. * @static
  26288. * @since 0.1.0
  26289. * @memberOf _
  26290. * @category Object
  26291. * @param {Object} object The object to query.
  26292. * @param {Array|string} path The path to check.
  26293. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26294. * @example
  26295. *
  26296. * var object = { 'a': { 'b': 2 } };
  26297. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  26298. *
  26299. * _.has(object, 'a');
  26300. * // => true
  26301. *
  26302. * _.has(object, 'a.b');
  26303. * // => true
  26304. *
  26305. * _.has(object, ['a', 'b']);
  26306. * // => true
  26307. *
  26308. * _.has(other, 'a');
  26309. * // => false
  26310. */
  26311. function has(object, path) {
  26312. return object != null && hasPath(object, path, baseHas);
  26313. }
  26314. /**
  26315. * Checks if `path` is a direct or inherited property of `object`.
  26316. *
  26317. * @static
  26318. * @memberOf _
  26319. * @since 4.0.0
  26320. * @category Object
  26321. * @param {Object} object The object to query.
  26322. * @param {Array|string} path The path to check.
  26323. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26324. * @example
  26325. *
  26326. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  26327. *
  26328. * _.hasIn(object, 'a');
  26329. * // => true
  26330. *
  26331. * _.hasIn(object, 'a.b');
  26332. * // => true
  26333. *
  26334. * _.hasIn(object, ['a', 'b']);
  26335. * // => true
  26336. *
  26337. * _.hasIn(object, 'b');
  26338. * // => false
  26339. */
  26340. function hasIn(object, path) {
  26341. return object != null && hasPath(object, path, baseHasIn);
  26342. }
  26343. /**
  26344. * Creates an object composed of the inverted keys and values of `object`.
  26345. * If `object` contains duplicate values, subsequent values overwrite
  26346. * property assignments of previous values.
  26347. *
  26348. * @static
  26349. * @memberOf _
  26350. * @since 0.7.0
  26351. * @category Object
  26352. * @param {Object} object The object to invert.
  26353. * @returns {Object} Returns the new inverted object.
  26354. * @example
  26355. *
  26356. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26357. *
  26358. * _.invert(object);
  26359. * // => { '1': 'c', '2': 'b' }
  26360. */
  26361. var invert = createInverter(function(result, value, key) {
  26362. if (value != null &&
  26363. typeof value.toString != 'function') {
  26364. value = nativeObjectToString.call(value);
  26365. }
  26366. result[value] = key;
  26367. }, constant(identity));
  26368. /**
  26369. * This method is like `_.invert` except that the inverted object is generated
  26370. * from the results of running each element of `object` thru `iteratee`. The
  26371. * corresponding inverted value of each inverted key is an array of keys
  26372. * responsible for generating the inverted value. The iteratee is invoked
  26373. * with one argument: (value).
  26374. *
  26375. * @static
  26376. * @memberOf _
  26377. * @since 4.1.0
  26378. * @category Object
  26379. * @param {Object} object The object to invert.
  26380. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26381. * @returns {Object} Returns the new inverted object.
  26382. * @example
  26383. *
  26384. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26385. *
  26386. * _.invertBy(object);
  26387. * // => { '1': ['a', 'c'], '2': ['b'] }
  26388. *
  26389. * _.invertBy(object, function(value) {
  26390. * return 'group' + value;
  26391. * });
  26392. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  26393. */
  26394. var invertBy = createInverter(function(result, value, key) {
  26395. if (value != null &&
  26396. typeof value.toString != 'function') {
  26397. value = nativeObjectToString.call(value);
  26398. }
  26399. if (hasOwnProperty.call(result, value)) {
  26400. result[value].push(key);
  26401. } else {
  26402. result[value] = [key];
  26403. }
  26404. }, getIteratee);
  26405. /**
  26406. * Invokes the method at `path` of `object`.
  26407. *
  26408. * @static
  26409. * @memberOf _
  26410. * @since 4.0.0
  26411. * @category Object
  26412. * @param {Object} object The object to query.
  26413. * @param {Array|string} path The path of the method to invoke.
  26414. * @param {...*} [args] The arguments to invoke the method with.
  26415. * @returns {*} Returns the result of the invoked method.
  26416. * @example
  26417. *
  26418. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  26419. *
  26420. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  26421. * // => [2, 3]
  26422. */
  26423. var invoke = baseRest(baseInvoke);
  26424. /**
  26425. * Creates an array of the own enumerable property names of `object`.
  26426. *
  26427. * **Note:** Non-object values are coerced to objects. See the
  26428. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  26429. * for more details.
  26430. *
  26431. * @static
  26432. * @since 0.1.0
  26433. * @memberOf _
  26434. * @category Object
  26435. * @param {Object} object The object to query.
  26436. * @returns {Array} Returns the array of property names.
  26437. * @example
  26438. *
  26439. * function Foo() {
  26440. * this.a = 1;
  26441. * this.b = 2;
  26442. * }
  26443. *
  26444. * Foo.prototype.c = 3;
  26445. *
  26446. * _.keys(new Foo);
  26447. * // => ['a', 'b'] (iteration order is not guaranteed)
  26448. *
  26449. * _.keys('hi');
  26450. * // => ['0', '1']
  26451. */
  26452. function keys(object) {
  26453. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  26454. }
  26455. /**
  26456. * Creates an array of the own and inherited enumerable property names of `object`.
  26457. *
  26458. * **Note:** Non-object values are coerced to objects.
  26459. *
  26460. * @static
  26461. * @memberOf _
  26462. * @since 3.0.0
  26463. * @category Object
  26464. * @param {Object} object The object to query.
  26465. * @returns {Array} Returns the array of property names.
  26466. * @example
  26467. *
  26468. * function Foo() {
  26469. * this.a = 1;
  26470. * this.b = 2;
  26471. * }
  26472. *
  26473. * Foo.prototype.c = 3;
  26474. *
  26475. * _.keysIn(new Foo);
  26476. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  26477. */
  26478. function keysIn(object) {
  26479. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  26480. }
  26481. /**
  26482. * The opposite of `_.mapValues`; this method creates an object with the
  26483. * same values as `object` and keys generated by running each own enumerable
  26484. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  26485. * with three arguments: (value, key, object).
  26486. *
  26487. * @static
  26488. * @memberOf _
  26489. * @since 3.8.0
  26490. * @category Object
  26491. * @param {Object} object The object to iterate over.
  26492. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26493. * @returns {Object} Returns the new mapped object.
  26494. * @see _.mapValues
  26495. * @example
  26496. *
  26497. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  26498. * return key + value;
  26499. * });
  26500. * // => { 'a1': 1, 'b2': 2 }
  26501. */
  26502. function mapKeys(object, iteratee) {
  26503. var result = {};
  26504. iteratee = getIteratee(iteratee, 3);
  26505. baseForOwn(object, function(value, key, object) {
  26506. baseAssignValue(result, iteratee(value, key, object), value);
  26507. });
  26508. return result;
  26509. }
  26510. /**
  26511. * Creates an object with the same keys as `object` and values generated
  26512. * by running each own enumerable string keyed property of `object` thru
  26513. * `iteratee`. The iteratee is invoked with three arguments:
  26514. * (value, key, object).
  26515. *
  26516. * @static
  26517. * @memberOf _
  26518. * @since 2.4.0
  26519. * @category Object
  26520. * @param {Object} object The object to iterate over.
  26521. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26522. * @returns {Object} Returns the new mapped object.
  26523. * @see _.mapKeys
  26524. * @example
  26525. *
  26526. * var users = {
  26527. * 'fred': { 'user': 'fred', 'age': 40 },
  26528. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  26529. * };
  26530. *
  26531. * _.mapValues(users, function(o) { return o.age; });
  26532. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26533. *
  26534. * // The `_.property` iteratee shorthand.
  26535. * _.mapValues(users, 'age');
  26536. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26537. */
  26538. function mapValues(object, iteratee) {
  26539. var result = {};
  26540. iteratee = getIteratee(iteratee, 3);
  26541. baseForOwn(object, function(value, key, object) {
  26542. baseAssignValue(result, key, iteratee(value, key, object));
  26543. });
  26544. return result;
  26545. }
  26546. /**
  26547. * This method is like `_.assign` except that it recursively merges own and
  26548. * inherited enumerable string keyed properties of source objects into the
  26549. * destination object. Source properties that resolve to `undefined` are
  26550. * skipped if a destination value exists. Array and plain object properties
  26551. * are merged recursively. Other objects and value types are overridden by
  26552. * assignment. Source objects are applied from left to right. Subsequent
  26553. * sources overwrite property assignments of previous sources.
  26554. *
  26555. * **Note:** This method mutates `object`.
  26556. *
  26557. * @static
  26558. * @memberOf _
  26559. * @since 0.5.0
  26560. * @category Object
  26561. * @param {Object} object The destination object.
  26562. * @param {...Object} [sources] The source objects.
  26563. * @returns {Object} Returns `object`.
  26564. * @example
  26565. *
  26566. * var object = {
  26567. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  26568. * };
  26569. *
  26570. * var other = {
  26571. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  26572. * };
  26573. *
  26574. * _.merge(object, other);
  26575. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  26576. */
  26577. var merge = createAssigner(function(object, source, srcIndex) {
  26578. baseMerge(object, source, srcIndex);
  26579. });
  26580. /**
  26581. * This method is like `_.merge` except that it accepts `customizer` which
  26582. * is invoked to produce the merged values of the destination and source
  26583. * properties. If `customizer` returns `undefined`, merging is handled by the
  26584. * method instead. The `customizer` is invoked with six arguments:
  26585. * (objValue, srcValue, key, object, source, stack).
  26586. *
  26587. * **Note:** This method mutates `object`.
  26588. *
  26589. * @static
  26590. * @memberOf _
  26591. * @since 4.0.0
  26592. * @category Object
  26593. * @param {Object} object The destination object.
  26594. * @param {...Object} sources The source objects.
  26595. * @param {Function} customizer The function to customize assigned values.
  26596. * @returns {Object} Returns `object`.
  26597. * @example
  26598. *
  26599. * function customizer(objValue, srcValue) {
  26600. * if (_.isArray(objValue)) {
  26601. * return objValue.concat(srcValue);
  26602. * }
  26603. * }
  26604. *
  26605. * var object = { 'a': [1], 'b': [2] };
  26606. * var other = { 'a': [3], 'b': [4] };
  26607. *
  26608. * _.mergeWith(object, other, customizer);
  26609. * // => { 'a': [1, 3], 'b': [2, 4] }
  26610. */
  26611. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  26612. baseMerge(object, source, srcIndex, customizer);
  26613. });
  26614. /**
  26615. * The opposite of `_.pick`; this method creates an object composed of the
  26616. * own and inherited enumerable property paths of `object` that are not omitted.
  26617. *
  26618. * **Note:** This method is considerably slower than `_.pick`.
  26619. *
  26620. * @static
  26621. * @since 0.1.0
  26622. * @memberOf _
  26623. * @category Object
  26624. * @param {Object} object The source object.
  26625. * @param {...(string|string[])} [paths] The property paths to omit.
  26626. * @returns {Object} Returns the new object.
  26627. * @example
  26628. *
  26629. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26630. *
  26631. * _.omit(object, ['a', 'c']);
  26632. * // => { 'b': '2' }
  26633. */
  26634. var omit = flatRest(function(object, paths) {
  26635. var result = {};
  26636. if (object == null) {
  26637. return result;
  26638. }
  26639. var isDeep = false;
  26640. paths = arrayMap(paths, function(path) {
  26641. path = castPath(path, object);
  26642. isDeep || (isDeep = path.length > 1);
  26643. return path;
  26644. });
  26645. copyObject(object, getAllKeysIn(object), result);
  26646. if (isDeep) {
  26647. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  26648. }
  26649. var length = paths.length;
  26650. while (length--) {
  26651. baseUnset(result, paths[length]);
  26652. }
  26653. return result;
  26654. });
  26655. /**
  26656. * The opposite of `_.pickBy`; this method creates an object composed of
  26657. * the own and inherited enumerable string keyed properties of `object` that
  26658. * `predicate` doesn't return truthy for. The predicate is invoked with two
  26659. * arguments: (value, key).
  26660. *
  26661. * @static
  26662. * @memberOf _
  26663. * @since 4.0.0
  26664. * @category Object
  26665. * @param {Object} object The source object.
  26666. * @param {Function} [predicate=_.identity] The function invoked per property.
  26667. * @returns {Object} Returns the new object.
  26668. * @example
  26669. *
  26670. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26671. *
  26672. * _.omitBy(object, _.isNumber);
  26673. * // => { 'b': '2' }
  26674. */
  26675. function omitBy(object, predicate) {
  26676. return pickBy(object, negate(getIteratee(predicate)));
  26677. }
  26678. /**
  26679. * Creates an object composed of the picked `object` properties.
  26680. *
  26681. * @static
  26682. * @since 0.1.0
  26683. * @memberOf _
  26684. * @category Object
  26685. * @param {Object} object The source object.
  26686. * @param {...(string|string[])} [paths] The property paths to pick.
  26687. * @returns {Object} Returns the new object.
  26688. * @example
  26689. *
  26690. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26691. *
  26692. * _.pick(object, ['a', 'c']);
  26693. * // => { 'a': 1, 'c': 3 }
  26694. */
  26695. var pick = flatRest(function(object, paths) {
  26696. return object == null ? {} : basePick(object, paths);
  26697. });
  26698. /**
  26699. * Creates an object composed of the `object` properties `predicate` returns
  26700. * truthy for. The predicate is invoked with two arguments: (value, key).
  26701. *
  26702. * @static
  26703. * @memberOf _
  26704. * @since 4.0.0
  26705. * @category Object
  26706. * @param {Object} object The source object.
  26707. * @param {Function} [predicate=_.identity] The function invoked per property.
  26708. * @returns {Object} Returns the new object.
  26709. * @example
  26710. *
  26711. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26712. *
  26713. * _.pickBy(object, _.isNumber);
  26714. * // => { 'a': 1, 'c': 3 }
  26715. */
  26716. function pickBy(object, predicate) {
  26717. if (object == null) {
  26718. return {};
  26719. }
  26720. var props = arrayMap(getAllKeysIn(object), function(prop) {
  26721. return [prop];
  26722. });
  26723. predicate = getIteratee(predicate);
  26724. return basePickBy(object, props, function(value, path) {
  26725. return predicate(value, path[0]);
  26726. });
  26727. }
  26728. /**
  26729. * This method is like `_.get` except that if the resolved value is a
  26730. * function it's invoked with the `this` binding of its parent object and
  26731. * its result is returned.
  26732. *
  26733. * @static
  26734. * @since 0.1.0
  26735. * @memberOf _
  26736. * @category Object
  26737. * @param {Object} object The object to query.
  26738. * @param {Array|string} path The path of the property to resolve.
  26739. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26740. * @returns {*} Returns the resolved value.
  26741. * @example
  26742. *
  26743. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  26744. *
  26745. * _.result(object, 'a[0].b.c1');
  26746. * // => 3
  26747. *
  26748. * _.result(object, 'a[0].b.c2');
  26749. * // => 4
  26750. *
  26751. * _.result(object, 'a[0].b.c3', 'default');
  26752. * // => 'default'
  26753. *
  26754. * _.result(object, 'a[0].b.c3', _.constant('default'));
  26755. * // => 'default'
  26756. */
  26757. function result(object, path, defaultValue) {
  26758. path = castPath(path, object);
  26759. var index = -1,
  26760. length = path.length;
  26761. // Ensure the loop is entered when path is empty.
  26762. if (!length) {
  26763. length = 1;
  26764. object = undefined;
  26765. }
  26766. while (++index < length) {
  26767. var value = object == null ? undefined : object[toKey(path[index])];
  26768. if (value === undefined) {
  26769. index = length;
  26770. value = defaultValue;
  26771. }
  26772. object = isFunction(value) ? value.call(object) : value;
  26773. }
  26774. return object;
  26775. }
  26776. /**
  26777. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  26778. * it's created. Arrays are created for missing index properties while objects
  26779. * are created for all other missing properties. Use `_.setWith` to customize
  26780. * `path` creation.
  26781. *
  26782. * **Note:** This method mutates `object`.
  26783. *
  26784. * @static
  26785. * @memberOf _
  26786. * @since 3.7.0
  26787. * @category Object
  26788. * @param {Object} object The object to modify.
  26789. * @param {Array|string} path The path of the property to set.
  26790. * @param {*} value The value to set.
  26791. * @returns {Object} Returns `object`.
  26792. * @example
  26793. *
  26794. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26795. *
  26796. * _.set(object, 'a[0].b.c', 4);
  26797. * console.log(object.a[0].b.c);
  26798. * // => 4
  26799. *
  26800. * _.set(object, ['x', '0', 'y', 'z'], 5);
  26801. * console.log(object.x[0].y.z);
  26802. * // => 5
  26803. */
  26804. function set(object, path, value) {
  26805. return object == null ? object : baseSet(object, path, value);
  26806. }
  26807. /**
  26808. * This method is like `_.set` except that it accepts `customizer` which is
  26809. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26810. * path creation is handled by the method instead. The `customizer` is invoked
  26811. * with three arguments: (nsValue, key, nsObject).
  26812. *
  26813. * **Note:** This method mutates `object`.
  26814. *
  26815. * @static
  26816. * @memberOf _
  26817. * @since 4.0.0
  26818. * @category Object
  26819. * @param {Object} object The object to modify.
  26820. * @param {Array|string} path The path of the property to set.
  26821. * @param {*} value The value to set.
  26822. * @param {Function} [customizer] The function to customize assigned values.
  26823. * @returns {Object} Returns `object`.
  26824. * @example
  26825. *
  26826. * var object = {};
  26827. *
  26828. * _.setWith(object, '[0][1]', 'a', Object);
  26829. * // => { '0': { '1': 'a' } }
  26830. */
  26831. function setWith(object, path, value, customizer) {
  26832. customizer = typeof customizer == 'function' ? customizer : undefined;
  26833. return object == null ? object : baseSet(object, path, value, customizer);
  26834. }
  26835. /**
  26836. * Creates an array of own enumerable string keyed-value pairs for `object`
  26837. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  26838. * entries are returned.
  26839. *
  26840. * @static
  26841. * @memberOf _
  26842. * @since 4.0.0
  26843. * @alias entries
  26844. * @category Object
  26845. * @param {Object} object The object to query.
  26846. * @returns {Array} Returns the key-value pairs.
  26847. * @example
  26848. *
  26849. * function Foo() {
  26850. * this.a = 1;
  26851. * this.b = 2;
  26852. * }
  26853. *
  26854. * Foo.prototype.c = 3;
  26855. *
  26856. * _.toPairs(new Foo);
  26857. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26858. */
  26859. var toPairs = createToPairs(keys);
  26860. /**
  26861. * Creates an array of own and inherited enumerable string keyed-value pairs
  26862. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  26863. * or set, its entries are returned.
  26864. *
  26865. * @static
  26866. * @memberOf _
  26867. * @since 4.0.0
  26868. * @alias entriesIn
  26869. * @category Object
  26870. * @param {Object} object The object to query.
  26871. * @returns {Array} Returns the key-value pairs.
  26872. * @example
  26873. *
  26874. * function Foo() {
  26875. * this.a = 1;
  26876. * this.b = 2;
  26877. * }
  26878. *
  26879. * Foo.prototype.c = 3;
  26880. *
  26881. * _.toPairsIn(new Foo);
  26882. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  26883. */
  26884. var toPairsIn = createToPairs(keysIn);
  26885. /**
  26886. * An alternative to `_.reduce`; this method transforms `object` to a new
  26887. * `accumulator` object which is the result of running each of its own
  26888. * enumerable string keyed properties thru `iteratee`, with each invocation
  26889. * potentially mutating the `accumulator` object. If `accumulator` is not
  26890. * provided, a new object with the same `[[Prototype]]` will be used. The
  26891. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  26892. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26893. *
  26894. * @static
  26895. * @memberOf _
  26896. * @since 1.3.0
  26897. * @category Object
  26898. * @param {Object} object The object to iterate over.
  26899. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26900. * @param {*} [accumulator] The custom accumulator value.
  26901. * @returns {*} Returns the accumulated value.
  26902. * @example
  26903. *
  26904. * _.transform([2, 3, 4], function(result, n) {
  26905. * result.push(n *= n);
  26906. * return n % 2 == 0;
  26907. * }, []);
  26908. * // => [4, 9]
  26909. *
  26910. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26911. * (result[value] || (result[value] = [])).push(key);
  26912. * }, {});
  26913. * // => { '1': ['a', 'c'], '2': ['b'] }
  26914. */
  26915. function transform(object, iteratee, accumulator) {
  26916. var isArr = isArray(object),
  26917. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  26918. iteratee = getIteratee(iteratee, 4);
  26919. if (accumulator == null) {
  26920. var Ctor = object && object.constructor;
  26921. if (isArrLike) {
  26922. accumulator = isArr ? new Ctor : [];
  26923. }
  26924. else if (isObject(object)) {
  26925. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  26926. }
  26927. else {
  26928. accumulator = {};
  26929. }
  26930. }
  26931. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  26932. return iteratee(accumulator, value, index, object);
  26933. });
  26934. return accumulator;
  26935. }
  26936. /**
  26937. * Removes the property at `path` of `object`.
  26938. *
  26939. * **Note:** This method mutates `object`.
  26940. *
  26941. * @static
  26942. * @memberOf _
  26943. * @since 4.0.0
  26944. * @category Object
  26945. * @param {Object} object The object to modify.
  26946. * @param {Array|string} path The path of the property to unset.
  26947. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  26948. * @example
  26949. *
  26950. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  26951. * _.unset(object, 'a[0].b.c');
  26952. * // => true
  26953. *
  26954. * console.log(object);
  26955. * // => { 'a': [{ 'b': {} }] };
  26956. *
  26957. * _.unset(object, ['a', '0', 'b', 'c']);
  26958. * // => true
  26959. *
  26960. * console.log(object);
  26961. * // => { 'a': [{ 'b': {} }] };
  26962. */
  26963. function unset(object, path) {
  26964. return object == null ? true : baseUnset(object, path);
  26965. }
  26966. /**
  26967. * This method is like `_.set` except that accepts `updater` to produce the
  26968. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  26969. * is invoked with one argument: (value).
  26970. *
  26971. * **Note:** This method mutates `object`.
  26972. *
  26973. * @static
  26974. * @memberOf _
  26975. * @since 4.6.0
  26976. * @category Object
  26977. * @param {Object} object The object to modify.
  26978. * @param {Array|string} path The path of the property to set.
  26979. * @param {Function} updater The function to produce the updated value.
  26980. * @returns {Object} Returns `object`.
  26981. * @example
  26982. *
  26983. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26984. *
  26985. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  26986. * console.log(object.a[0].b.c);
  26987. * // => 9
  26988. *
  26989. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  26990. * console.log(object.x[0].y.z);
  26991. * // => 0
  26992. */
  26993. function update(object, path, updater) {
  26994. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  26995. }
  26996. /**
  26997. * This method is like `_.update` except that it accepts `customizer` which is
  26998. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26999. * path creation is handled by the method instead. The `customizer` is invoked
  27000. * with three arguments: (nsValue, key, nsObject).
  27001. *
  27002. * **Note:** This method mutates `object`.
  27003. *
  27004. * @static
  27005. * @memberOf _
  27006. * @since 4.6.0
  27007. * @category Object
  27008. * @param {Object} object The object to modify.
  27009. * @param {Array|string} path The path of the property to set.
  27010. * @param {Function} updater The function to produce the updated value.
  27011. * @param {Function} [customizer] The function to customize assigned values.
  27012. * @returns {Object} Returns `object`.
  27013. * @example
  27014. *
  27015. * var object = {};
  27016. *
  27017. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  27018. * // => { '0': { '1': 'a' } }
  27019. */
  27020. function updateWith(object, path, updater, customizer) {
  27021. customizer = typeof customizer == 'function' ? customizer : undefined;
  27022. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  27023. }
  27024. /**
  27025. * Creates an array of the own enumerable string keyed property values of `object`.
  27026. *
  27027. * **Note:** Non-object values are coerced to objects.
  27028. *
  27029. * @static
  27030. * @since 0.1.0
  27031. * @memberOf _
  27032. * @category Object
  27033. * @param {Object} object The object to query.
  27034. * @returns {Array} Returns the array of property values.
  27035. * @example
  27036. *
  27037. * function Foo() {
  27038. * this.a = 1;
  27039. * this.b = 2;
  27040. * }
  27041. *
  27042. * Foo.prototype.c = 3;
  27043. *
  27044. * _.values(new Foo);
  27045. * // => [1, 2] (iteration order is not guaranteed)
  27046. *
  27047. * _.values('hi');
  27048. * // => ['h', 'i']
  27049. */
  27050. function values(object) {
  27051. return object == null ? [] : baseValues(object, keys(object));
  27052. }
  27053. /**
  27054. * Creates an array of the own and inherited enumerable string keyed property
  27055. * values of `object`.
  27056. *
  27057. * **Note:** Non-object values are coerced to objects.
  27058. *
  27059. * @static
  27060. * @memberOf _
  27061. * @since 3.0.0
  27062. * @category Object
  27063. * @param {Object} object The object to query.
  27064. * @returns {Array} Returns the array of property values.
  27065. * @example
  27066. *
  27067. * function Foo() {
  27068. * this.a = 1;
  27069. * this.b = 2;
  27070. * }
  27071. *
  27072. * Foo.prototype.c = 3;
  27073. *
  27074. * _.valuesIn(new Foo);
  27075. * // => [1, 2, 3] (iteration order is not guaranteed)
  27076. */
  27077. function valuesIn(object) {
  27078. return object == null ? [] : baseValues(object, keysIn(object));
  27079. }
  27080. /*------------------------------------------------------------------------*/
  27081. /**
  27082. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  27083. *
  27084. * @static
  27085. * @memberOf _
  27086. * @since 4.0.0
  27087. * @category Number
  27088. * @param {number} number The number to clamp.
  27089. * @param {number} [lower] The lower bound.
  27090. * @param {number} upper The upper bound.
  27091. * @returns {number} Returns the clamped number.
  27092. * @example
  27093. *
  27094. * _.clamp(-10, -5, 5);
  27095. * // => -5
  27096. *
  27097. * _.clamp(10, -5, 5);
  27098. * // => 5
  27099. */
  27100. function clamp(number, lower, upper) {
  27101. if (upper === undefined) {
  27102. upper = lower;
  27103. lower = undefined;
  27104. }
  27105. if (upper !== undefined) {
  27106. upper = toNumber(upper);
  27107. upper = upper === upper ? upper : 0;
  27108. }
  27109. if (lower !== undefined) {
  27110. lower = toNumber(lower);
  27111. lower = lower === lower ? lower : 0;
  27112. }
  27113. return baseClamp(toNumber(number), lower, upper);
  27114. }
  27115. /**
  27116. * Checks if `n` is between `start` and up to, but not including, `end`. If
  27117. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  27118. * If `start` is greater than `end` the params are swapped to support
  27119. * negative ranges.
  27120. *
  27121. * @static
  27122. * @memberOf _
  27123. * @since 3.3.0
  27124. * @category Number
  27125. * @param {number} number The number to check.
  27126. * @param {number} [start=0] The start of the range.
  27127. * @param {number} end The end of the range.
  27128. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  27129. * @see _.range, _.rangeRight
  27130. * @example
  27131. *
  27132. * _.inRange(3, 2, 4);
  27133. * // => true
  27134. *
  27135. * _.inRange(4, 8);
  27136. * // => true
  27137. *
  27138. * _.inRange(4, 2);
  27139. * // => false
  27140. *
  27141. * _.inRange(2, 2);
  27142. * // => false
  27143. *
  27144. * _.inRange(1.2, 2);
  27145. * // => true
  27146. *
  27147. * _.inRange(5.2, 4);
  27148. * // => false
  27149. *
  27150. * _.inRange(-3, -2, -6);
  27151. * // => true
  27152. */
  27153. function inRange(number, start, end) {
  27154. start = toFinite(start);
  27155. if (end === undefined) {
  27156. end = start;
  27157. start = 0;
  27158. } else {
  27159. end = toFinite(end);
  27160. }
  27161. number = toNumber(number);
  27162. return baseInRange(number, start, end);
  27163. }
  27164. /**
  27165. * Produces a random number between the inclusive `lower` and `upper` bounds.
  27166. * If only one argument is provided a number between `0` and the given number
  27167. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  27168. * floats, a floating-point number is returned instead of an integer.
  27169. *
  27170. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  27171. * floating-point values which can produce unexpected results.
  27172. *
  27173. * @static
  27174. * @memberOf _
  27175. * @since 0.7.0
  27176. * @category Number
  27177. * @param {number} [lower=0] The lower bound.
  27178. * @param {number} [upper=1] The upper bound.
  27179. * @param {boolean} [floating] Specify returning a floating-point number.
  27180. * @returns {number} Returns the random number.
  27181. * @example
  27182. *
  27183. * _.random(0, 5);
  27184. * // => an integer between 0 and 5
  27185. *
  27186. * _.random(5);
  27187. * // => also an integer between 0 and 5
  27188. *
  27189. * _.random(5, true);
  27190. * // => a floating-point number between 0 and 5
  27191. *
  27192. * _.random(1.2, 5.2);
  27193. * // => a floating-point number between 1.2 and 5.2
  27194. */
  27195. function random(lower, upper, floating) {
  27196. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  27197. upper = floating = undefined;
  27198. }
  27199. if (floating === undefined) {
  27200. if (typeof upper == 'boolean') {
  27201. floating = upper;
  27202. upper = undefined;
  27203. }
  27204. else if (typeof lower == 'boolean') {
  27205. floating = lower;
  27206. lower = undefined;
  27207. }
  27208. }
  27209. if (lower === undefined && upper === undefined) {
  27210. lower = 0;
  27211. upper = 1;
  27212. }
  27213. else {
  27214. lower = toFinite(lower);
  27215. if (upper === undefined) {
  27216. upper = lower;
  27217. lower = 0;
  27218. } else {
  27219. upper = toFinite(upper);
  27220. }
  27221. }
  27222. if (lower > upper) {
  27223. var temp = lower;
  27224. lower = upper;
  27225. upper = temp;
  27226. }
  27227. if (floating || lower % 1 || upper % 1) {
  27228. var rand = nativeRandom();
  27229. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  27230. }
  27231. return baseRandom(lower, upper);
  27232. }
  27233. /*------------------------------------------------------------------------*/
  27234. /**
  27235. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  27236. *
  27237. * @static
  27238. * @memberOf _
  27239. * @since 3.0.0
  27240. * @category String
  27241. * @param {string} [string=''] The string to convert.
  27242. * @returns {string} Returns the camel cased string.
  27243. * @example
  27244. *
  27245. * _.camelCase('Foo Bar');
  27246. * // => 'fooBar'
  27247. *
  27248. * _.camelCase('--foo-bar--');
  27249. * // => 'fooBar'
  27250. *
  27251. * _.camelCase('__FOO_BAR__');
  27252. * // => 'fooBar'
  27253. */
  27254. var camelCase = createCompounder(function(result, word, index) {
  27255. word = word.toLowerCase();
  27256. return result + (index ? capitalize(word) : word);
  27257. });
  27258. /**
  27259. * Converts the first character of `string` to upper case and the remaining
  27260. * to lower case.
  27261. *
  27262. * @static
  27263. * @memberOf _
  27264. * @since 3.0.0
  27265. * @category String
  27266. * @param {string} [string=''] The string to capitalize.
  27267. * @returns {string} Returns the capitalized string.
  27268. * @example
  27269. *
  27270. * _.capitalize('FRED');
  27271. * // => 'Fred'
  27272. */
  27273. function capitalize(string) {
  27274. return upperFirst(toString(string).toLowerCase());
  27275. }
  27276. /**
  27277. * Deburrs `string` by converting
  27278. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  27279. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  27280. * letters to basic Latin letters and removing
  27281. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  27282. *
  27283. * @static
  27284. * @memberOf _
  27285. * @since 3.0.0
  27286. * @category String
  27287. * @param {string} [string=''] The string to deburr.
  27288. * @returns {string} Returns the deburred string.
  27289. * @example
  27290. *
  27291. * _.deburr('déjà vu');
  27292. * // => 'deja vu'
  27293. */
  27294. function deburr(string) {
  27295. string = toString(string);
  27296. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  27297. }
  27298. /**
  27299. * Checks if `string` ends with the given target string.
  27300. *
  27301. * @static
  27302. * @memberOf _
  27303. * @since 3.0.0
  27304. * @category String
  27305. * @param {string} [string=''] The string to inspect.
  27306. * @param {string} [target] The string to search for.
  27307. * @param {number} [position=string.length] The position to search up to.
  27308. * @returns {boolean} Returns `true` if `string` ends with `target`,
  27309. * else `false`.
  27310. * @example
  27311. *
  27312. * _.endsWith('abc', 'c');
  27313. * // => true
  27314. *
  27315. * _.endsWith('abc', 'b');
  27316. * // => false
  27317. *
  27318. * _.endsWith('abc', 'b', 2);
  27319. * // => true
  27320. */
  27321. function endsWith(string, target, position) {
  27322. string = toString(string);
  27323. target = baseToString(target);
  27324. var length = string.length;
  27325. position = position === undefined
  27326. ? length
  27327. : baseClamp(toInteger(position), 0, length);
  27328. var end = position;
  27329. position -= target.length;
  27330. return position >= 0 && string.slice(position, end) == target;
  27331. }
  27332. /**
  27333. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  27334. * corresponding HTML entities.
  27335. *
  27336. * **Note:** No other characters are escaped. To escape additional
  27337. * characters use a third-party library like [_he_](https://mths.be/he).
  27338. *
  27339. * Though the ">" character is escaped for symmetry, characters like
  27340. * ">" and "/" don't need escaping in HTML and have no special meaning
  27341. * unless they're part of a tag or unquoted attribute value. See
  27342. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  27343. * (under "semi-related fun fact") for more details.
  27344. *
  27345. * When working with HTML you should always
  27346. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  27347. * XSS vectors.
  27348. *
  27349. * @static
  27350. * @since 0.1.0
  27351. * @memberOf _
  27352. * @category String
  27353. * @param {string} [string=''] The string to escape.
  27354. * @returns {string} Returns the escaped string.
  27355. * @example
  27356. *
  27357. * _.escape('fred, barney, & pebbles');
  27358. * // => 'fred, barney, &amp; pebbles'
  27359. */
  27360. function escape(string) {
  27361. string = toString(string);
  27362. return (string && reHasUnescapedHtml.test(string))
  27363. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  27364. : string;
  27365. }
  27366. /**
  27367. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  27368. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  27369. *
  27370. * @static
  27371. * @memberOf _
  27372. * @since 3.0.0
  27373. * @category String
  27374. * @param {string} [string=''] The string to escape.
  27375. * @returns {string} Returns the escaped string.
  27376. * @example
  27377. *
  27378. * _.escapeRegExp('[lodash](https://lodash.com/)');
  27379. * // => '\[lodash\]\(https://lodash\.com/\)'
  27380. */
  27381. function escapeRegExp(string) {
  27382. string = toString(string);
  27383. return (string && reHasRegExpChar.test(string))
  27384. ? string.replace(reRegExpChar, '\\$&')
  27385. : string;
  27386. }
  27387. /**
  27388. * Converts `string` to
  27389. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  27390. *
  27391. * @static
  27392. * @memberOf _
  27393. * @since 3.0.0
  27394. * @category String
  27395. * @param {string} [string=''] The string to convert.
  27396. * @returns {string} Returns the kebab cased string.
  27397. * @example
  27398. *
  27399. * _.kebabCase('Foo Bar');
  27400. * // => 'foo-bar'
  27401. *
  27402. * _.kebabCase('fooBar');
  27403. * // => 'foo-bar'
  27404. *
  27405. * _.kebabCase('__FOO_BAR__');
  27406. * // => 'foo-bar'
  27407. */
  27408. var kebabCase = createCompounder(function(result, word, index) {
  27409. return result + (index ? '-' : '') + word.toLowerCase();
  27410. });
  27411. /**
  27412. * Converts `string`, as space separated words, to lower case.
  27413. *
  27414. * @static
  27415. * @memberOf _
  27416. * @since 4.0.0
  27417. * @category String
  27418. * @param {string} [string=''] The string to convert.
  27419. * @returns {string} Returns the lower cased string.
  27420. * @example
  27421. *
  27422. * _.lowerCase('--Foo-Bar--');
  27423. * // => 'foo bar'
  27424. *
  27425. * _.lowerCase('fooBar');
  27426. * // => 'foo bar'
  27427. *
  27428. * _.lowerCase('__FOO_BAR__');
  27429. * // => 'foo bar'
  27430. */
  27431. var lowerCase = createCompounder(function(result, word, index) {
  27432. return result + (index ? ' ' : '') + word.toLowerCase();
  27433. });
  27434. /**
  27435. * Converts the first character of `string` to lower case.
  27436. *
  27437. * @static
  27438. * @memberOf _
  27439. * @since 4.0.0
  27440. * @category String
  27441. * @param {string} [string=''] The string to convert.
  27442. * @returns {string} Returns the converted string.
  27443. * @example
  27444. *
  27445. * _.lowerFirst('Fred');
  27446. * // => 'fred'
  27447. *
  27448. * _.lowerFirst('FRED');
  27449. * // => 'fRED'
  27450. */
  27451. var lowerFirst = createCaseFirst('toLowerCase');
  27452. /**
  27453. * Pads `string` on the left and right sides if it's shorter than `length`.
  27454. * Padding characters are truncated if they can't be evenly divided by `length`.
  27455. *
  27456. * @static
  27457. * @memberOf _
  27458. * @since 3.0.0
  27459. * @category String
  27460. * @param {string} [string=''] The string to pad.
  27461. * @param {number} [length=0] The padding length.
  27462. * @param {string} [chars=' '] The string used as padding.
  27463. * @returns {string} Returns the padded string.
  27464. * @example
  27465. *
  27466. * _.pad('abc', 8);
  27467. * // => ' abc '
  27468. *
  27469. * _.pad('abc', 8, '_-');
  27470. * // => '_-abc_-_'
  27471. *
  27472. * _.pad('abc', 3);
  27473. * // => 'abc'
  27474. */
  27475. function pad(string, length, chars) {
  27476. string = toString(string);
  27477. length = toInteger(length);
  27478. var strLength = length ? stringSize(string) : 0;
  27479. if (!length || strLength >= length) {
  27480. return string;
  27481. }
  27482. var mid = (length - strLength) / 2;
  27483. return (
  27484. createPadding(nativeFloor(mid), chars) +
  27485. string +
  27486. createPadding(nativeCeil(mid), chars)
  27487. );
  27488. }
  27489. /**
  27490. * Pads `string` on the right side if it's shorter than `length`. Padding
  27491. * characters are truncated if they exceed `length`.
  27492. *
  27493. * @static
  27494. * @memberOf _
  27495. * @since 4.0.0
  27496. * @category String
  27497. * @param {string} [string=''] The string to pad.
  27498. * @param {number} [length=0] The padding length.
  27499. * @param {string} [chars=' '] The string used as padding.
  27500. * @returns {string} Returns the padded string.
  27501. * @example
  27502. *
  27503. * _.padEnd('abc', 6);
  27504. * // => 'abc '
  27505. *
  27506. * _.padEnd('abc', 6, '_-');
  27507. * // => 'abc_-_'
  27508. *
  27509. * _.padEnd('abc', 3);
  27510. * // => 'abc'
  27511. */
  27512. function padEnd(string, length, chars) {
  27513. string = toString(string);
  27514. length = toInteger(length);
  27515. var strLength = length ? stringSize(string) : 0;
  27516. return (length && strLength < length)
  27517. ? (string + createPadding(length - strLength, chars))
  27518. : string;
  27519. }
  27520. /**
  27521. * Pads `string` on the left side if it's shorter than `length`. Padding
  27522. * characters are truncated if they exceed `length`.
  27523. *
  27524. * @static
  27525. * @memberOf _
  27526. * @since 4.0.0
  27527. * @category String
  27528. * @param {string} [string=''] The string to pad.
  27529. * @param {number} [length=0] The padding length.
  27530. * @param {string} [chars=' '] The string used as padding.
  27531. * @returns {string} Returns the padded string.
  27532. * @example
  27533. *
  27534. * _.padStart('abc', 6);
  27535. * // => ' abc'
  27536. *
  27537. * _.padStart('abc', 6, '_-');
  27538. * // => '_-_abc'
  27539. *
  27540. * _.padStart('abc', 3);
  27541. * // => 'abc'
  27542. */
  27543. function padStart(string, length, chars) {
  27544. string = toString(string);
  27545. length = toInteger(length);
  27546. var strLength = length ? stringSize(string) : 0;
  27547. return (length && strLength < length)
  27548. ? (createPadding(length - strLength, chars) + string)
  27549. : string;
  27550. }
  27551. /**
  27552. * Converts `string` to an integer of the specified radix. If `radix` is
  27553. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  27554. * hexadecimal, in which case a `radix` of `16` is used.
  27555. *
  27556. * **Note:** This method aligns with the
  27557. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  27558. *
  27559. * @static
  27560. * @memberOf _
  27561. * @since 1.1.0
  27562. * @category String
  27563. * @param {string} string The string to convert.
  27564. * @param {number} [radix=10] The radix to interpret `value` by.
  27565. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27566. * @returns {number} Returns the converted integer.
  27567. * @example
  27568. *
  27569. * _.parseInt('08');
  27570. * // => 8
  27571. *
  27572. * _.map(['6', '08', '10'], _.parseInt);
  27573. * // => [6, 8, 10]
  27574. */
  27575. function parseInt(string, radix, guard) {
  27576. if (guard || radix == null) {
  27577. radix = 0;
  27578. } else if (radix) {
  27579. radix = +radix;
  27580. }
  27581. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  27582. }
  27583. /**
  27584. * Repeats the given string `n` times.
  27585. *
  27586. * @static
  27587. * @memberOf _
  27588. * @since 3.0.0
  27589. * @category String
  27590. * @param {string} [string=''] The string to repeat.
  27591. * @param {number} [n=1] The number of times to repeat the string.
  27592. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27593. * @returns {string} Returns the repeated string.
  27594. * @example
  27595. *
  27596. * _.repeat('*', 3);
  27597. * // => '***'
  27598. *
  27599. * _.repeat('abc', 2);
  27600. * // => 'abcabc'
  27601. *
  27602. * _.repeat('abc', 0);
  27603. * // => ''
  27604. */
  27605. function repeat(string, n, guard) {
  27606. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  27607. n = 1;
  27608. } else {
  27609. n = toInteger(n);
  27610. }
  27611. return baseRepeat(toString(string), n);
  27612. }
  27613. /**
  27614. * Replaces matches for `pattern` in `string` with `replacement`.
  27615. *
  27616. * **Note:** This method is based on
  27617. * [`String#replace`](https://mdn.io/String/replace).
  27618. *
  27619. * @static
  27620. * @memberOf _
  27621. * @since 4.0.0
  27622. * @category String
  27623. * @param {string} [string=''] The string to modify.
  27624. * @param {RegExp|string} pattern The pattern to replace.
  27625. * @param {Function|string} replacement The match replacement.
  27626. * @returns {string} Returns the modified string.
  27627. * @example
  27628. *
  27629. * _.replace('Hi Fred', 'Fred', 'Barney');
  27630. * // => 'Hi Barney'
  27631. */
  27632. function replace() {
  27633. var args = arguments,
  27634. string = toString(args[0]);
  27635. return args.length < 3 ? string : string.replace(args[1], args[2]);
  27636. }
  27637. /**
  27638. * Converts `string` to
  27639. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  27640. *
  27641. * @static
  27642. * @memberOf _
  27643. * @since 3.0.0
  27644. * @category String
  27645. * @param {string} [string=''] The string to convert.
  27646. * @returns {string} Returns the snake cased string.
  27647. * @example
  27648. *
  27649. * _.snakeCase('Foo Bar');
  27650. * // => 'foo_bar'
  27651. *
  27652. * _.snakeCase('fooBar');
  27653. * // => 'foo_bar'
  27654. *
  27655. * _.snakeCase('--FOO-BAR--');
  27656. * // => 'foo_bar'
  27657. */
  27658. var snakeCase = createCompounder(function(result, word, index) {
  27659. return result + (index ? '_' : '') + word.toLowerCase();
  27660. });
  27661. /**
  27662. * Splits `string` by `separator`.
  27663. *
  27664. * **Note:** This method is based on
  27665. * [`String#split`](https://mdn.io/String/split).
  27666. *
  27667. * @static
  27668. * @memberOf _
  27669. * @since 4.0.0
  27670. * @category String
  27671. * @param {string} [string=''] The string to split.
  27672. * @param {RegExp|string} separator The separator pattern to split by.
  27673. * @param {number} [limit] The length to truncate results to.
  27674. * @returns {Array} Returns the string segments.
  27675. * @example
  27676. *
  27677. * _.split('a-b-c', '-', 2);
  27678. * // => ['a', 'b']
  27679. */
  27680. function split(string, separator, limit) {
  27681. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  27682. separator = limit = undefined;
  27683. }
  27684. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  27685. if (!limit) {
  27686. return [];
  27687. }
  27688. string = toString(string);
  27689. if (string && (
  27690. typeof separator == 'string' ||
  27691. (separator != null && !isRegExp(separator))
  27692. )) {
  27693. separator = baseToString(separator);
  27694. if (!separator && hasUnicode(string)) {
  27695. return castSlice(stringToArray(string), 0, limit);
  27696. }
  27697. }
  27698. return string.split(separator, limit);
  27699. }
  27700. /**
  27701. * Converts `string` to
  27702. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  27703. *
  27704. * @static
  27705. * @memberOf _
  27706. * @since 3.1.0
  27707. * @category String
  27708. * @param {string} [string=''] The string to convert.
  27709. * @returns {string} Returns the start cased string.
  27710. * @example
  27711. *
  27712. * _.startCase('--foo-bar--');
  27713. * // => 'Foo Bar'
  27714. *
  27715. * _.startCase('fooBar');
  27716. * // => 'Foo Bar'
  27717. *
  27718. * _.startCase('__FOO_BAR__');
  27719. * // => 'FOO BAR'
  27720. */
  27721. var startCase = createCompounder(function(result, word, index) {
  27722. return result + (index ? ' ' : '') + upperFirst(word);
  27723. });
  27724. /**
  27725. * Checks if `string` starts with the given target string.
  27726. *
  27727. * @static
  27728. * @memberOf _
  27729. * @since 3.0.0
  27730. * @category String
  27731. * @param {string} [string=''] The string to inspect.
  27732. * @param {string} [target] The string to search for.
  27733. * @param {number} [position=0] The position to search from.
  27734. * @returns {boolean} Returns `true` if `string` starts with `target`,
  27735. * else `false`.
  27736. * @example
  27737. *
  27738. * _.startsWith('abc', 'a');
  27739. * // => true
  27740. *
  27741. * _.startsWith('abc', 'b');
  27742. * // => false
  27743. *
  27744. * _.startsWith('abc', 'b', 1);
  27745. * // => true
  27746. */
  27747. function startsWith(string, target, position) {
  27748. string = toString(string);
  27749. position = position == null
  27750. ? 0
  27751. : baseClamp(toInteger(position), 0, string.length);
  27752. target = baseToString(target);
  27753. return string.slice(position, position + target.length) == target;
  27754. }
  27755. /**
  27756. * Creates a compiled template function that can interpolate data properties
  27757. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  27758. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  27759. * properties may be accessed as free variables in the template. If a setting
  27760. * object is given, it takes precedence over `_.templateSettings` values.
  27761. *
  27762. * **Note:** In the development build `_.template` utilizes
  27763. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  27764. * for easier debugging.
  27765. *
  27766. * For more information on precompiling templates see
  27767. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  27768. *
  27769. * For more information on Chrome extension sandboxes see
  27770. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  27771. *
  27772. * @static
  27773. * @since 0.1.0
  27774. * @memberOf _
  27775. * @category String
  27776. * @param {string} [string=''] The template string.
  27777. * @param {Object} [options={}] The options object.
  27778. * @param {RegExp} [options.escape=_.templateSettings.escape]
  27779. * The HTML "escape" delimiter.
  27780. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  27781. * The "evaluate" delimiter.
  27782. * @param {Object} [options.imports=_.templateSettings.imports]
  27783. * An object to import into the template as free variables.
  27784. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  27785. * The "interpolate" delimiter.
  27786. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  27787. * The sourceURL of the compiled template.
  27788. * @param {string} [options.variable='obj']
  27789. * The data object variable name.
  27790. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27791. * @returns {Function} Returns the compiled template function.
  27792. * @example
  27793. *
  27794. * // Use the "interpolate" delimiter to create a compiled template.
  27795. * var compiled = _.template('hello <%= user %>!');
  27796. * compiled({ 'user': 'fred' });
  27797. * // => 'hello fred!'
  27798. *
  27799. * // Use the HTML "escape" delimiter to escape data property values.
  27800. * var compiled = _.template('<b><%- value %></b>');
  27801. * compiled({ 'value': '<script>' });
  27802. * // => '<b>&lt;script&gt;</b>'
  27803. *
  27804. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  27805. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  27806. * compiled({ 'users': ['fred', 'barney'] });
  27807. * // => '<li>fred</li><li>barney</li>'
  27808. *
  27809. * // Use the internal `print` function in "evaluate" delimiters.
  27810. * var compiled = _.template('<% print("hello " + user); %>!');
  27811. * compiled({ 'user': 'barney' });
  27812. * // => 'hello barney!'
  27813. *
  27814. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  27815. * // Disable support by replacing the "interpolate" delimiter.
  27816. * var compiled = _.template('hello ${ user }!');
  27817. * compiled({ 'user': 'pebbles' });
  27818. * // => 'hello pebbles!'
  27819. *
  27820. * // Use backslashes to treat delimiters as plain text.
  27821. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  27822. * compiled({ 'value': 'ignored' });
  27823. * // => '<%- value %>'
  27824. *
  27825. * // Use the `imports` option to import `jQuery` as `jq`.
  27826. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  27827. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  27828. * compiled({ 'users': ['fred', 'barney'] });
  27829. * // => '<li>fred</li><li>barney</li>'
  27830. *
  27831. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  27832. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  27833. * compiled(data);
  27834. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  27835. *
  27836. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  27837. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  27838. * compiled.source;
  27839. * // => function(data) {
  27840. * // var __t, __p = '';
  27841. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  27842. * // return __p;
  27843. * // }
  27844. *
  27845. * // Use custom template delimiters.
  27846. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  27847. * var compiled = _.template('hello {{ user }}!');
  27848. * compiled({ 'user': 'mustache' });
  27849. * // => 'hello mustache!'
  27850. *
  27851. * // Use the `source` property to inline compiled templates for meaningful
  27852. * // line numbers in error messages and stack traces.
  27853. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  27854. * var JST = {\
  27855. * "main": ' + _.template(mainText).source + '\
  27856. * };\
  27857. * ');
  27858. */
  27859. function template(string, options, guard) {
  27860. // Based on John Resig's `tmpl` implementation
  27861. // (http://ejohn.org/blog/javascript-micro-templating/)
  27862. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  27863. var settings = lodash.templateSettings;
  27864. if (guard && isIterateeCall(string, options, guard)) {
  27865. options = undefined;
  27866. }
  27867. string = toString(string);
  27868. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  27869. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  27870. importsKeys = keys(imports),
  27871. importsValues = baseValues(imports, importsKeys);
  27872. var isEscaping,
  27873. isEvaluating,
  27874. index = 0,
  27875. interpolate = options.interpolate || reNoMatch,
  27876. source = "__p += '";
  27877. // Compile the regexp to match each delimiter.
  27878. var reDelimiters = RegExp(
  27879. (options.escape || reNoMatch).source + '|' +
  27880. interpolate.source + '|' +
  27881. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  27882. (options.evaluate || reNoMatch).source + '|$'
  27883. , 'g');
  27884. // Use a sourceURL for easier debugging.
  27885. // The sourceURL gets injected into the source that's eval-ed, so be careful
  27886. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  27887. // and escape the comment, thus injecting code that gets evaled.
  27888. var sourceURL = '//# sourceURL=' +
  27889. (hasOwnProperty.call(options, 'sourceURL')
  27890. ? (options.sourceURL + '').replace(/\s/g, ' ')
  27891. : ('lodash.templateSources[' + (++templateCounter) + ']')
  27892. ) + '\n';
  27893. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  27894. interpolateValue || (interpolateValue = esTemplateValue);
  27895. // Escape characters that can't be included in string literals.
  27896. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  27897. // Replace delimiters with snippets.
  27898. if (escapeValue) {
  27899. isEscaping = true;
  27900. source += "' +\n__e(" + escapeValue + ") +\n'";
  27901. }
  27902. if (evaluateValue) {
  27903. isEvaluating = true;
  27904. source += "';\n" + evaluateValue + ";\n__p += '";
  27905. }
  27906. if (interpolateValue) {
  27907. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  27908. }
  27909. index = offset + match.length;
  27910. // The JS engine embedded in Adobe products needs `match` returned in
  27911. // order to produce the correct `offset` value.
  27912. return match;
  27913. });
  27914. source += "';\n";
  27915. // If `variable` is not specified wrap a with-statement around the generated
  27916. // code to add the data object to the top of the scope chain.
  27917. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  27918. if (!variable) {
  27919. source = 'with (obj) {\n' + source + '\n}\n';
  27920. }
  27921. // Cleanup code by stripping empty strings.
  27922. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  27923. .replace(reEmptyStringMiddle, '$1')
  27924. .replace(reEmptyStringTrailing, '$1;');
  27925. // Frame code as the function body.
  27926. source = 'function(' + (variable || 'obj') + ') {\n' +
  27927. (variable
  27928. ? ''
  27929. : 'obj || (obj = {});\n'
  27930. ) +
  27931. "var __t, __p = ''" +
  27932. (isEscaping
  27933. ? ', __e = _.escape'
  27934. : ''
  27935. ) +
  27936. (isEvaluating
  27937. ? ', __j = Array.prototype.join;\n' +
  27938. "function print() { __p += __j.call(arguments, '') }\n"
  27939. : ';\n'
  27940. ) +
  27941. source +
  27942. 'return __p\n}';
  27943. var result = attempt(function() {
  27944. return Function(importsKeys, sourceURL + 'return ' + source)
  27945. .apply(undefined, importsValues);
  27946. });
  27947. // Provide the compiled function's source by its `toString` method or
  27948. // the `source` property as a convenience for inlining compiled templates.
  27949. result.source = source;
  27950. if (isError(result)) {
  27951. throw result;
  27952. }
  27953. return result;
  27954. }
  27955. /**
  27956. * Converts `string`, as a whole, to lower case just like
  27957. * [String#toLowerCase](https://mdn.io/toLowerCase).
  27958. *
  27959. * @static
  27960. * @memberOf _
  27961. * @since 4.0.0
  27962. * @category String
  27963. * @param {string} [string=''] The string to convert.
  27964. * @returns {string} Returns the lower cased string.
  27965. * @example
  27966. *
  27967. * _.toLower('--Foo-Bar--');
  27968. * // => '--foo-bar--'
  27969. *
  27970. * _.toLower('fooBar');
  27971. * // => 'foobar'
  27972. *
  27973. * _.toLower('__FOO_BAR__');
  27974. * // => '__foo_bar__'
  27975. */
  27976. function toLower(value) {
  27977. return toString(value).toLowerCase();
  27978. }
  27979. /**
  27980. * Converts `string`, as a whole, to upper case just like
  27981. * [String#toUpperCase](https://mdn.io/toUpperCase).
  27982. *
  27983. * @static
  27984. * @memberOf _
  27985. * @since 4.0.0
  27986. * @category String
  27987. * @param {string} [string=''] The string to convert.
  27988. * @returns {string} Returns the upper cased string.
  27989. * @example
  27990. *
  27991. * _.toUpper('--foo-bar--');
  27992. * // => '--FOO-BAR--'
  27993. *
  27994. * _.toUpper('fooBar');
  27995. * // => 'FOOBAR'
  27996. *
  27997. * _.toUpper('__foo_bar__');
  27998. * // => '__FOO_BAR__'
  27999. */
  28000. function toUpper(value) {
  28001. return toString(value).toUpperCase();
  28002. }
  28003. /**
  28004. * Removes leading and trailing whitespace or specified characters from `string`.
  28005. *
  28006. * @static
  28007. * @memberOf _
  28008. * @since 3.0.0
  28009. * @category String
  28010. * @param {string} [string=''] The string to trim.
  28011. * @param {string} [chars=whitespace] The characters to trim.
  28012. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28013. * @returns {string} Returns the trimmed string.
  28014. * @example
  28015. *
  28016. * _.trim(' abc ');
  28017. * // => 'abc'
  28018. *
  28019. * _.trim('-_-abc-_-', '_-');
  28020. * // => 'abc'
  28021. *
  28022. * _.map([' foo ', ' bar '], _.trim);
  28023. * // => ['foo', 'bar']
  28024. */
  28025. function trim(string, chars, guard) {
  28026. string = toString(string);
  28027. if (string && (guard || chars === undefined)) {
  28028. return string.replace(reTrim, '');
  28029. }
  28030. if (!string || !(chars = baseToString(chars))) {
  28031. return string;
  28032. }
  28033. var strSymbols = stringToArray(string),
  28034. chrSymbols = stringToArray(chars),
  28035. start = charsStartIndex(strSymbols, chrSymbols),
  28036. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  28037. return castSlice(strSymbols, start, end).join('');
  28038. }
  28039. /**
  28040. * Removes trailing whitespace or specified characters from `string`.
  28041. *
  28042. * @static
  28043. * @memberOf _
  28044. * @since 4.0.0
  28045. * @category String
  28046. * @param {string} [string=''] The string to trim.
  28047. * @param {string} [chars=whitespace] The characters to trim.
  28048. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28049. * @returns {string} Returns the trimmed string.
  28050. * @example
  28051. *
  28052. * _.trimEnd(' abc ');
  28053. * // => ' abc'
  28054. *
  28055. * _.trimEnd('-_-abc-_-', '_-');
  28056. * // => '-_-abc'
  28057. */
  28058. function trimEnd(string, chars, guard) {
  28059. string = toString(string);
  28060. if (string && (guard || chars === undefined)) {
  28061. return string.replace(reTrimEnd, '');
  28062. }
  28063. if (!string || !(chars = baseToString(chars))) {
  28064. return string;
  28065. }
  28066. var strSymbols = stringToArray(string),
  28067. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  28068. return castSlice(strSymbols, 0, end).join('');
  28069. }
  28070. /**
  28071. * Removes leading whitespace or specified characters from `string`.
  28072. *
  28073. * @static
  28074. * @memberOf _
  28075. * @since 4.0.0
  28076. * @category String
  28077. * @param {string} [string=''] The string to trim.
  28078. * @param {string} [chars=whitespace] The characters to trim.
  28079. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28080. * @returns {string} Returns the trimmed string.
  28081. * @example
  28082. *
  28083. * _.trimStart(' abc ');
  28084. * // => 'abc '
  28085. *
  28086. * _.trimStart('-_-abc-_-', '_-');
  28087. * // => 'abc-_-'
  28088. */
  28089. function trimStart(string, chars, guard) {
  28090. string = toString(string);
  28091. if (string && (guard || chars === undefined)) {
  28092. return string.replace(reTrimStart, '');
  28093. }
  28094. if (!string || !(chars = baseToString(chars))) {
  28095. return string;
  28096. }
  28097. var strSymbols = stringToArray(string),
  28098. start = charsStartIndex(strSymbols, stringToArray(chars));
  28099. return castSlice(strSymbols, start).join('');
  28100. }
  28101. /**
  28102. * Truncates `string` if it's longer than the given maximum string length.
  28103. * The last characters of the truncated string are replaced with the omission
  28104. * string which defaults to "...".
  28105. *
  28106. * @static
  28107. * @memberOf _
  28108. * @since 4.0.0
  28109. * @category String
  28110. * @param {string} [string=''] The string to truncate.
  28111. * @param {Object} [options={}] The options object.
  28112. * @param {number} [options.length=30] The maximum string length.
  28113. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  28114. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  28115. * @returns {string} Returns the truncated string.
  28116. * @example
  28117. *
  28118. * _.truncate('hi-diddly-ho there, neighborino');
  28119. * // => 'hi-diddly-ho there, neighbo...'
  28120. *
  28121. * _.truncate('hi-diddly-ho there, neighborino', {
  28122. * 'length': 24,
  28123. * 'separator': ' '
  28124. * });
  28125. * // => 'hi-diddly-ho there,...'
  28126. *
  28127. * _.truncate('hi-diddly-ho there, neighborino', {
  28128. * 'length': 24,
  28129. * 'separator': /,? +/
  28130. * });
  28131. * // => 'hi-diddly-ho there...'
  28132. *
  28133. * _.truncate('hi-diddly-ho there, neighborino', {
  28134. * 'omission': ' [...]'
  28135. * });
  28136. * // => 'hi-diddly-ho there, neig [...]'
  28137. */
  28138. function truncate(string, options) {
  28139. var length = DEFAULT_TRUNC_LENGTH,
  28140. omission = DEFAULT_TRUNC_OMISSION;
  28141. if (isObject(options)) {
  28142. var separator = 'separator' in options ? options.separator : separator;
  28143. length = 'length' in options ? toInteger(options.length) : length;
  28144. omission = 'omission' in options ? baseToString(options.omission) : omission;
  28145. }
  28146. string = toString(string);
  28147. var strLength = string.length;
  28148. if (hasUnicode(string)) {
  28149. var strSymbols = stringToArray(string);
  28150. strLength = strSymbols.length;
  28151. }
  28152. if (length >= strLength) {
  28153. return string;
  28154. }
  28155. var end = length - stringSize(omission);
  28156. if (end < 1) {
  28157. return omission;
  28158. }
  28159. var result = strSymbols
  28160. ? castSlice(strSymbols, 0, end).join('')
  28161. : string.slice(0, end);
  28162. if (separator === undefined) {
  28163. return result + omission;
  28164. }
  28165. if (strSymbols) {
  28166. end += (result.length - end);
  28167. }
  28168. if (isRegExp(separator)) {
  28169. if (string.slice(end).search(separator)) {
  28170. var match,
  28171. substring = result;
  28172. if (!separator.global) {
  28173. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  28174. }
  28175. separator.lastIndex = 0;
  28176. while ((match = separator.exec(substring))) {
  28177. var newEnd = match.index;
  28178. }
  28179. result = result.slice(0, newEnd === undefined ? end : newEnd);
  28180. }
  28181. } else if (string.indexOf(baseToString(separator), end) != end) {
  28182. var index = result.lastIndexOf(separator);
  28183. if (index > -1) {
  28184. result = result.slice(0, index);
  28185. }
  28186. }
  28187. return result + omission;
  28188. }
  28189. /**
  28190. * The inverse of `_.escape`; this method converts the HTML entities
  28191. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  28192. * their corresponding characters.
  28193. *
  28194. * **Note:** No other HTML entities are unescaped. To unescape additional
  28195. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  28196. *
  28197. * @static
  28198. * @memberOf _
  28199. * @since 0.6.0
  28200. * @category String
  28201. * @param {string} [string=''] The string to unescape.
  28202. * @returns {string} Returns the unescaped string.
  28203. * @example
  28204. *
  28205. * _.unescape('fred, barney, &amp; pebbles');
  28206. * // => 'fred, barney, & pebbles'
  28207. */
  28208. function unescape(string) {
  28209. string = toString(string);
  28210. return (string && reHasEscapedHtml.test(string))
  28211. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  28212. : string;
  28213. }
  28214. /**
  28215. * Converts `string`, as space separated words, to upper case.
  28216. *
  28217. * @static
  28218. * @memberOf _
  28219. * @since 4.0.0
  28220. * @category String
  28221. * @param {string} [string=''] The string to convert.
  28222. * @returns {string} Returns the upper cased string.
  28223. * @example
  28224. *
  28225. * _.upperCase('--foo-bar');
  28226. * // => 'FOO BAR'
  28227. *
  28228. * _.upperCase('fooBar');
  28229. * // => 'FOO BAR'
  28230. *
  28231. * _.upperCase('__foo_bar__');
  28232. * // => 'FOO BAR'
  28233. */
  28234. var upperCase = createCompounder(function(result, word, index) {
  28235. return result + (index ? ' ' : '') + word.toUpperCase();
  28236. });
  28237. /**
  28238. * Converts the first character of `string` to upper case.
  28239. *
  28240. * @static
  28241. * @memberOf _
  28242. * @since 4.0.0
  28243. * @category String
  28244. * @param {string} [string=''] The string to convert.
  28245. * @returns {string} Returns the converted string.
  28246. * @example
  28247. *
  28248. * _.upperFirst('fred');
  28249. * // => 'Fred'
  28250. *
  28251. * _.upperFirst('FRED');
  28252. * // => 'FRED'
  28253. */
  28254. var upperFirst = createCaseFirst('toUpperCase');
  28255. /**
  28256. * Splits `string` into an array of its words.
  28257. *
  28258. * @static
  28259. * @memberOf _
  28260. * @since 3.0.0
  28261. * @category String
  28262. * @param {string} [string=''] The string to inspect.
  28263. * @param {RegExp|string} [pattern] The pattern to match words.
  28264. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28265. * @returns {Array} Returns the words of `string`.
  28266. * @example
  28267. *
  28268. * _.words('fred, barney, & pebbles');
  28269. * // => ['fred', 'barney', 'pebbles']
  28270. *
  28271. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  28272. * // => ['fred', 'barney', '&', 'pebbles']
  28273. */
  28274. function words(string, pattern, guard) {
  28275. string = toString(string);
  28276. pattern = guard ? undefined : pattern;
  28277. if (pattern === undefined) {
  28278. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  28279. }
  28280. return string.match(pattern) || [];
  28281. }
  28282. /*------------------------------------------------------------------------*/
  28283. /**
  28284. * Attempts to invoke `func`, returning either the result or the caught error
  28285. * object. Any additional arguments are provided to `func` when it's invoked.
  28286. *
  28287. * @static
  28288. * @memberOf _
  28289. * @since 3.0.0
  28290. * @category Util
  28291. * @param {Function} func The function to attempt.
  28292. * @param {...*} [args] The arguments to invoke `func` with.
  28293. * @returns {*} Returns the `func` result or error object.
  28294. * @example
  28295. *
  28296. * // Avoid throwing errors for invalid selectors.
  28297. * var elements = _.attempt(function(selector) {
  28298. * return document.querySelectorAll(selector);
  28299. * }, '>_>');
  28300. *
  28301. * if (_.isError(elements)) {
  28302. * elements = [];
  28303. * }
  28304. */
  28305. var attempt = baseRest(function(func, args) {
  28306. try {
  28307. return apply(func, undefined, args);
  28308. } catch (e) {
  28309. return isError(e) ? e : new Error(e);
  28310. }
  28311. });
  28312. /**
  28313. * Binds methods of an object to the object itself, overwriting the existing
  28314. * method.
  28315. *
  28316. * **Note:** This method doesn't set the "length" property of bound functions.
  28317. *
  28318. * @static
  28319. * @since 0.1.0
  28320. * @memberOf _
  28321. * @category Util
  28322. * @param {Object} object The object to bind and assign the bound methods to.
  28323. * @param {...(string|string[])} methodNames The object method names to bind.
  28324. * @returns {Object} Returns `object`.
  28325. * @example
  28326. *
  28327. * var view = {
  28328. * 'label': 'docs',
  28329. * 'click': function() {
  28330. * console.log('clicked ' + this.label);
  28331. * }
  28332. * };
  28333. *
  28334. * _.bindAll(view, ['click']);
  28335. * jQuery(element).on('click', view.click);
  28336. * // => Logs 'clicked docs' when clicked.
  28337. */
  28338. var bindAll = flatRest(function(object, methodNames) {
  28339. arrayEach(methodNames, function(key) {
  28340. key = toKey(key);
  28341. baseAssignValue(object, key, bind(object[key], object));
  28342. });
  28343. return object;
  28344. });
  28345. /**
  28346. * Creates a function that iterates over `pairs` and invokes the corresponding
  28347. * function of the first predicate to return truthy. The predicate-function
  28348. * pairs are invoked with the `this` binding and arguments of the created
  28349. * function.
  28350. *
  28351. * @static
  28352. * @memberOf _
  28353. * @since 4.0.0
  28354. * @category Util
  28355. * @param {Array} pairs The predicate-function pairs.
  28356. * @returns {Function} Returns the new composite function.
  28357. * @example
  28358. *
  28359. * var func = _.cond([
  28360. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  28361. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  28362. * [_.stubTrue, _.constant('no match')]
  28363. * ]);
  28364. *
  28365. * func({ 'a': 1, 'b': 2 });
  28366. * // => 'matches A'
  28367. *
  28368. * func({ 'a': 0, 'b': 1 });
  28369. * // => 'matches B'
  28370. *
  28371. * func({ 'a': '1', 'b': '2' });
  28372. * // => 'no match'
  28373. */
  28374. function cond(pairs) {
  28375. var length = pairs == null ? 0 : pairs.length,
  28376. toIteratee = getIteratee();
  28377. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  28378. if (typeof pair[1] != 'function') {
  28379. throw new TypeError(FUNC_ERROR_TEXT);
  28380. }
  28381. return [toIteratee(pair[0]), pair[1]];
  28382. });
  28383. return baseRest(function(args) {
  28384. var index = -1;
  28385. while (++index < length) {
  28386. var pair = pairs[index];
  28387. if (apply(pair[0], this, args)) {
  28388. return apply(pair[1], this, args);
  28389. }
  28390. }
  28391. });
  28392. }
  28393. /**
  28394. * Creates a function that invokes the predicate properties of `source` with
  28395. * the corresponding property values of a given object, returning `true` if
  28396. * all predicates return truthy, else `false`.
  28397. *
  28398. * **Note:** The created function is equivalent to `_.conformsTo` with
  28399. * `source` partially applied.
  28400. *
  28401. * @static
  28402. * @memberOf _
  28403. * @since 4.0.0
  28404. * @category Util
  28405. * @param {Object} source The object of property predicates to conform to.
  28406. * @returns {Function} Returns the new spec function.
  28407. * @example
  28408. *
  28409. * var objects = [
  28410. * { 'a': 2, 'b': 1 },
  28411. * { 'a': 1, 'b': 2 }
  28412. * ];
  28413. *
  28414. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  28415. * // => [{ 'a': 1, 'b': 2 }]
  28416. */
  28417. function conforms(source) {
  28418. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  28419. }
  28420. /**
  28421. * Creates a function that returns `value`.
  28422. *
  28423. * @static
  28424. * @memberOf _
  28425. * @since 2.4.0
  28426. * @category Util
  28427. * @param {*} value The value to return from the new function.
  28428. * @returns {Function} Returns the new constant function.
  28429. * @example
  28430. *
  28431. * var objects = _.times(2, _.constant({ 'a': 1 }));
  28432. *
  28433. * console.log(objects);
  28434. * // => [{ 'a': 1 }, { 'a': 1 }]
  28435. *
  28436. * console.log(objects[0] === objects[1]);
  28437. * // => true
  28438. */
  28439. function constant(value) {
  28440. return function() {
  28441. return value;
  28442. };
  28443. }
  28444. /**
  28445. * Checks `value` to determine whether a default value should be returned in
  28446. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  28447. * or `undefined`.
  28448. *
  28449. * @static
  28450. * @memberOf _
  28451. * @since 4.14.0
  28452. * @category Util
  28453. * @param {*} value The value to check.
  28454. * @param {*} defaultValue The default value.
  28455. * @returns {*} Returns the resolved value.
  28456. * @example
  28457. *
  28458. * _.defaultTo(1, 10);
  28459. * // => 1
  28460. *
  28461. * _.defaultTo(undefined, 10);
  28462. * // => 10
  28463. */
  28464. function defaultTo(value, defaultValue) {
  28465. return (value == null || value !== value) ? defaultValue : value;
  28466. }
  28467. /**
  28468. * Creates a function that returns the result of invoking the given functions
  28469. * with the `this` binding of the created function, where each successive
  28470. * invocation is supplied the return value of the previous.
  28471. *
  28472. * @static
  28473. * @memberOf _
  28474. * @since 3.0.0
  28475. * @category Util
  28476. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28477. * @returns {Function} Returns the new composite function.
  28478. * @see _.flowRight
  28479. * @example
  28480. *
  28481. * function square(n) {
  28482. * return n * n;
  28483. * }
  28484. *
  28485. * var addSquare = _.flow([_.add, square]);
  28486. * addSquare(1, 2);
  28487. * // => 9
  28488. */
  28489. var flow = createFlow();
  28490. /**
  28491. * This method is like `_.flow` except that it creates a function that
  28492. * invokes the given functions from right to left.
  28493. *
  28494. * @static
  28495. * @since 3.0.0
  28496. * @memberOf _
  28497. * @category Util
  28498. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28499. * @returns {Function} Returns the new composite function.
  28500. * @see _.flow
  28501. * @example
  28502. *
  28503. * function square(n) {
  28504. * return n * n;
  28505. * }
  28506. *
  28507. * var addSquare = _.flowRight([square, _.add]);
  28508. * addSquare(1, 2);
  28509. * // => 9
  28510. */
  28511. var flowRight = createFlow(true);
  28512. /**
  28513. * This method returns the first argument it receives.
  28514. *
  28515. * @static
  28516. * @since 0.1.0
  28517. * @memberOf _
  28518. * @category Util
  28519. * @param {*} value Any value.
  28520. * @returns {*} Returns `value`.
  28521. * @example
  28522. *
  28523. * var object = { 'a': 1 };
  28524. *
  28525. * console.log(_.identity(object) === object);
  28526. * // => true
  28527. */
  28528. function identity(value) {
  28529. return value;
  28530. }
  28531. /**
  28532. * Creates a function that invokes `func` with the arguments of the created
  28533. * function. If `func` is a property name, the created function returns the
  28534. * property value for a given element. If `func` is an array or object, the
  28535. * created function returns `true` for elements that contain the equivalent
  28536. * source properties, otherwise it returns `false`.
  28537. *
  28538. * @static
  28539. * @since 4.0.0
  28540. * @memberOf _
  28541. * @category Util
  28542. * @param {*} [func=_.identity] The value to convert to a callback.
  28543. * @returns {Function} Returns the callback.
  28544. * @example
  28545. *
  28546. * var users = [
  28547. * { 'user': 'barney', 'age': 36, 'active': true },
  28548. * { 'user': 'fred', 'age': 40, 'active': false }
  28549. * ];
  28550. *
  28551. * // The `_.matches` iteratee shorthand.
  28552. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  28553. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  28554. *
  28555. * // The `_.matchesProperty` iteratee shorthand.
  28556. * _.filter(users, _.iteratee(['user', 'fred']));
  28557. * // => [{ 'user': 'fred', 'age': 40 }]
  28558. *
  28559. * // The `_.property` iteratee shorthand.
  28560. * _.map(users, _.iteratee('user'));
  28561. * // => ['barney', 'fred']
  28562. *
  28563. * // Create custom iteratee shorthands.
  28564. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  28565. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  28566. * return func.test(string);
  28567. * };
  28568. * });
  28569. *
  28570. * _.filter(['abc', 'def'], /ef/);
  28571. * // => ['def']
  28572. */
  28573. function iteratee(func) {
  28574. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  28575. }
  28576. /**
  28577. * Creates a function that performs a partial deep comparison between a given
  28578. * object and `source`, returning `true` if the given object has equivalent
  28579. * property values, else `false`.
  28580. *
  28581. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  28582. * partially applied.
  28583. *
  28584. * Partial comparisons will match empty array and empty object `source`
  28585. * values against any array or object value, respectively. See `_.isEqual`
  28586. * for a list of supported value comparisons.
  28587. *
  28588. * **Note:** Multiple values can be checked by combining several matchers
  28589. * using `_.overSome`
  28590. *
  28591. * @static
  28592. * @memberOf _
  28593. * @since 3.0.0
  28594. * @category Util
  28595. * @param {Object} source The object of property values to match.
  28596. * @returns {Function} Returns the new spec function.
  28597. * @example
  28598. *
  28599. * var objects = [
  28600. * { 'a': 1, 'b': 2, 'c': 3 },
  28601. * { 'a': 4, 'b': 5, 'c': 6 }
  28602. * ];
  28603. *
  28604. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  28605. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  28606. *
  28607. * // Checking for several possible values
  28608. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  28609. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  28610. */
  28611. function matches(source) {
  28612. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  28613. }
  28614. /**
  28615. * Creates a function that performs a partial deep comparison between the
  28616. * value at `path` of a given object to `srcValue`, returning `true` if the
  28617. * object value is equivalent, else `false`.
  28618. *
  28619. * **Note:** Partial comparisons will match empty array and empty object
  28620. * `srcValue` values against any array or object value, respectively. See
  28621. * `_.isEqual` for a list of supported value comparisons.
  28622. *
  28623. * **Note:** Multiple values can be checked by combining several matchers
  28624. * using `_.overSome`
  28625. *
  28626. * @static
  28627. * @memberOf _
  28628. * @since 3.2.0
  28629. * @category Util
  28630. * @param {Array|string} path The path of the property to get.
  28631. * @param {*} srcValue The value to match.
  28632. * @returns {Function} Returns the new spec function.
  28633. * @example
  28634. *
  28635. * var objects = [
  28636. * { 'a': 1, 'b': 2, 'c': 3 },
  28637. * { 'a': 4, 'b': 5, 'c': 6 }
  28638. * ];
  28639. *
  28640. * _.find(objects, _.matchesProperty('a', 4));
  28641. * // => { 'a': 4, 'b': 5, 'c': 6 }
  28642. *
  28643. * // Checking for several possible values
  28644. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  28645. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  28646. */
  28647. function matchesProperty(path, srcValue) {
  28648. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  28649. }
  28650. /**
  28651. * Creates a function that invokes the method at `path` of a given object.
  28652. * Any additional arguments are provided to the invoked method.
  28653. *
  28654. * @static
  28655. * @memberOf _
  28656. * @since 3.7.0
  28657. * @category Util
  28658. * @param {Array|string} path The path of the method to invoke.
  28659. * @param {...*} [args] The arguments to invoke the method with.
  28660. * @returns {Function} Returns the new invoker function.
  28661. * @example
  28662. *
  28663. * var objects = [
  28664. * { 'a': { 'b': _.constant(2) } },
  28665. * { 'a': { 'b': _.constant(1) } }
  28666. * ];
  28667. *
  28668. * _.map(objects, _.method('a.b'));
  28669. * // => [2, 1]
  28670. *
  28671. * _.map(objects, _.method(['a', 'b']));
  28672. * // => [2, 1]
  28673. */
  28674. var method = baseRest(function(path, args) {
  28675. return function(object) {
  28676. return baseInvoke(object, path, args);
  28677. };
  28678. });
  28679. /**
  28680. * The opposite of `_.method`; this method creates a function that invokes
  28681. * the method at a given path of `object`. Any additional arguments are
  28682. * provided to the invoked method.
  28683. *
  28684. * @static
  28685. * @memberOf _
  28686. * @since 3.7.0
  28687. * @category Util
  28688. * @param {Object} object The object to query.
  28689. * @param {...*} [args] The arguments to invoke the method with.
  28690. * @returns {Function} Returns the new invoker function.
  28691. * @example
  28692. *
  28693. * var array = _.times(3, _.constant),
  28694. * object = { 'a': array, 'b': array, 'c': array };
  28695. *
  28696. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  28697. * // => [2, 0]
  28698. *
  28699. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  28700. * // => [2, 0]
  28701. */
  28702. var methodOf = baseRest(function(object, args) {
  28703. return function(path) {
  28704. return baseInvoke(object, path, args);
  28705. };
  28706. });
  28707. /**
  28708. * Adds all own enumerable string keyed function properties of a source
  28709. * object to the destination object. If `object` is a function, then methods
  28710. * are added to its prototype as well.
  28711. *
  28712. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  28713. * avoid conflicts caused by modifying the original.
  28714. *
  28715. * @static
  28716. * @since 0.1.0
  28717. * @memberOf _
  28718. * @category Util
  28719. * @param {Function|Object} [object=lodash] The destination object.
  28720. * @param {Object} source The object of functions to add.
  28721. * @param {Object} [options={}] The options object.
  28722. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  28723. * @returns {Function|Object} Returns `object`.
  28724. * @example
  28725. *
  28726. * function vowels(string) {
  28727. * return _.filter(string, function(v) {
  28728. * return /[aeiou]/i.test(v);
  28729. * });
  28730. * }
  28731. *
  28732. * _.mixin({ 'vowels': vowels });
  28733. * _.vowels('fred');
  28734. * // => ['e']
  28735. *
  28736. * _('fred').vowels().value();
  28737. * // => ['e']
  28738. *
  28739. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  28740. * _('fred').vowels();
  28741. * // => ['e']
  28742. */
  28743. function mixin(object, source, options) {
  28744. var props = keys(source),
  28745. methodNames = baseFunctions(source, props);
  28746. if (options == null &&
  28747. !(isObject(source) && (methodNames.length || !props.length))) {
  28748. options = source;
  28749. source = object;
  28750. object = this;
  28751. methodNames = baseFunctions(source, keys(source));
  28752. }
  28753. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  28754. isFunc = isFunction(object);
  28755. arrayEach(methodNames, function(methodName) {
  28756. var func = source[methodName];
  28757. object[methodName] = func;
  28758. if (isFunc) {
  28759. object.prototype[methodName] = function() {
  28760. var chainAll = this.__chain__;
  28761. if (chain || chainAll) {
  28762. var result = object(this.__wrapped__),
  28763. actions = result.__actions__ = copyArray(this.__actions__);
  28764. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  28765. result.__chain__ = chainAll;
  28766. return result;
  28767. }
  28768. return func.apply(object, arrayPush([this.value()], arguments));
  28769. };
  28770. }
  28771. });
  28772. return object;
  28773. }
  28774. /**
  28775. * Reverts the `_` variable to its previous value and returns a reference to
  28776. * the `lodash` function.
  28777. *
  28778. * @static
  28779. * @since 0.1.0
  28780. * @memberOf _
  28781. * @category Util
  28782. * @returns {Function} Returns the `lodash` function.
  28783. * @example
  28784. *
  28785. * var lodash = _.noConflict();
  28786. */
  28787. function noConflict() {
  28788. if (root._ === this) {
  28789. root._ = oldDash;
  28790. }
  28791. return this;
  28792. }
  28793. /**
  28794. * This method returns `undefined`.
  28795. *
  28796. * @static
  28797. * @memberOf _
  28798. * @since 2.3.0
  28799. * @category Util
  28800. * @example
  28801. *
  28802. * _.times(2, _.noop);
  28803. * // => [undefined, undefined]
  28804. */
  28805. function noop() {
  28806. // No operation performed.
  28807. }
  28808. /**
  28809. * Creates a function that gets the argument at index `n`. If `n` is negative,
  28810. * the nth argument from the end is returned.
  28811. *
  28812. * @static
  28813. * @memberOf _
  28814. * @since 4.0.0
  28815. * @category Util
  28816. * @param {number} [n=0] The index of the argument to return.
  28817. * @returns {Function} Returns the new pass-thru function.
  28818. * @example
  28819. *
  28820. * var func = _.nthArg(1);
  28821. * func('a', 'b', 'c', 'd');
  28822. * // => 'b'
  28823. *
  28824. * var func = _.nthArg(-2);
  28825. * func('a', 'b', 'c', 'd');
  28826. * // => 'c'
  28827. */
  28828. function nthArg(n) {
  28829. n = toInteger(n);
  28830. return baseRest(function(args) {
  28831. return baseNth(args, n);
  28832. });
  28833. }
  28834. /**
  28835. * Creates a function that invokes `iteratees` with the arguments it receives
  28836. * and returns their results.
  28837. *
  28838. * @static
  28839. * @memberOf _
  28840. * @since 4.0.0
  28841. * @category Util
  28842. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28843. * The iteratees to invoke.
  28844. * @returns {Function} Returns the new function.
  28845. * @example
  28846. *
  28847. * var func = _.over([Math.max, Math.min]);
  28848. *
  28849. * func(1, 2, 3, 4);
  28850. * // => [4, 1]
  28851. */
  28852. var over = createOver(arrayMap);
  28853. /**
  28854. * Creates a function that checks if **all** of the `predicates` return
  28855. * truthy when invoked with the arguments it receives.
  28856. *
  28857. * Following shorthands are possible for providing predicates.
  28858. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  28859. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  28860. *
  28861. * @static
  28862. * @memberOf _
  28863. * @since 4.0.0
  28864. * @category Util
  28865. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28866. * The predicates to check.
  28867. * @returns {Function} Returns the new function.
  28868. * @example
  28869. *
  28870. * var func = _.overEvery([Boolean, isFinite]);
  28871. *
  28872. * func('1');
  28873. * // => true
  28874. *
  28875. * func(null);
  28876. * // => false
  28877. *
  28878. * func(NaN);
  28879. * // => false
  28880. */
  28881. var overEvery = createOver(arrayEvery);
  28882. /**
  28883. * Creates a function that checks if **any** of the `predicates` return
  28884. * truthy when invoked with the arguments it receives.
  28885. *
  28886. * Following shorthands are possible for providing predicates.
  28887. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  28888. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  28889. *
  28890. * @static
  28891. * @memberOf _
  28892. * @since 4.0.0
  28893. * @category Util
  28894. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28895. * The predicates to check.
  28896. * @returns {Function} Returns the new function.
  28897. * @example
  28898. *
  28899. * var func = _.overSome([Boolean, isFinite]);
  28900. *
  28901. * func('1');
  28902. * // => true
  28903. *
  28904. * func(null);
  28905. * // => true
  28906. *
  28907. * func(NaN);
  28908. * // => false
  28909. *
  28910. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  28911. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  28912. */
  28913. var overSome = createOver(arraySome);
  28914. /**
  28915. * Creates a function that returns the value at `path` of a given object.
  28916. *
  28917. * @static
  28918. * @memberOf _
  28919. * @since 2.4.0
  28920. * @category Util
  28921. * @param {Array|string} path The path of the property to get.
  28922. * @returns {Function} Returns the new accessor function.
  28923. * @example
  28924. *
  28925. * var objects = [
  28926. * { 'a': { 'b': 2 } },
  28927. * { 'a': { 'b': 1 } }
  28928. * ];
  28929. *
  28930. * _.map(objects, _.property('a.b'));
  28931. * // => [2, 1]
  28932. *
  28933. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  28934. * // => [1, 2]
  28935. */
  28936. function property(path) {
  28937. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  28938. }
  28939. /**
  28940. * The opposite of `_.property`; this method creates a function that returns
  28941. * the value at a given path of `object`.
  28942. *
  28943. * @static
  28944. * @memberOf _
  28945. * @since 3.0.0
  28946. * @category Util
  28947. * @param {Object} object The object to query.
  28948. * @returns {Function} Returns the new accessor function.
  28949. * @example
  28950. *
  28951. * var array = [0, 1, 2],
  28952. * object = { 'a': array, 'b': array, 'c': array };
  28953. *
  28954. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  28955. * // => [2, 0]
  28956. *
  28957. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  28958. * // => [2, 0]
  28959. */
  28960. function propertyOf(object) {
  28961. return function(path) {
  28962. return object == null ? undefined : baseGet(object, path);
  28963. };
  28964. }
  28965. /**
  28966. * Creates an array of numbers (positive and/or negative) progressing from
  28967. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  28968. * `start` is specified without an `end` or `step`. If `end` is not specified,
  28969. * it's set to `start` with `start` then set to `0`.
  28970. *
  28971. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  28972. * floating-point values which can produce unexpected results.
  28973. *
  28974. * @static
  28975. * @since 0.1.0
  28976. * @memberOf _
  28977. * @category Util
  28978. * @param {number} [start=0] The start of the range.
  28979. * @param {number} end The end of the range.
  28980. * @param {number} [step=1] The value to increment or decrement by.
  28981. * @returns {Array} Returns the range of numbers.
  28982. * @see _.inRange, _.rangeRight
  28983. * @example
  28984. *
  28985. * _.range(4);
  28986. * // => [0, 1, 2, 3]
  28987. *
  28988. * _.range(-4);
  28989. * // => [0, -1, -2, -3]
  28990. *
  28991. * _.range(1, 5);
  28992. * // => [1, 2, 3, 4]
  28993. *
  28994. * _.range(0, 20, 5);
  28995. * // => [0, 5, 10, 15]
  28996. *
  28997. * _.range(0, -4, -1);
  28998. * // => [0, -1, -2, -3]
  28999. *
  29000. * _.range(1, 4, 0);
  29001. * // => [1, 1, 1]
  29002. *
  29003. * _.range(0);
  29004. * // => []
  29005. */
  29006. var range = createRange();
  29007. /**
  29008. * This method is like `_.range` except that it populates values in
  29009. * descending order.
  29010. *
  29011. * @static
  29012. * @memberOf _
  29013. * @since 4.0.0
  29014. * @category Util
  29015. * @param {number} [start=0] The start of the range.
  29016. * @param {number} end The end of the range.
  29017. * @param {number} [step=1] The value to increment or decrement by.
  29018. * @returns {Array} Returns the range of numbers.
  29019. * @see _.inRange, _.range
  29020. * @example
  29021. *
  29022. * _.rangeRight(4);
  29023. * // => [3, 2, 1, 0]
  29024. *
  29025. * _.rangeRight(-4);
  29026. * // => [-3, -2, -1, 0]
  29027. *
  29028. * _.rangeRight(1, 5);
  29029. * // => [4, 3, 2, 1]
  29030. *
  29031. * _.rangeRight(0, 20, 5);
  29032. * // => [15, 10, 5, 0]
  29033. *
  29034. * _.rangeRight(0, -4, -1);
  29035. * // => [-3, -2, -1, 0]
  29036. *
  29037. * _.rangeRight(1, 4, 0);
  29038. * // => [1, 1, 1]
  29039. *
  29040. * _.rangeRight(0);
  29041. * // => []
  29042. */
  29043. var rangeRight = createRange(true);
  29044. /**
  29045. * This method returns a new empty array.
  29046. *
  29047. * @static
  29048. * @memberOf _
  29049. * @since 4.13.0
  29050. * @category Util
  29051. * @returns {Array} Returns the new empty array.
  29052. * @example
  29053. *
  29054. * var arrays = _.times(2, _.stubArray);
  29055. *
  29056. * console.log(arrays);
  29057. * // => [[], []]
  29058. *
  29059. * console.log(arrays[0] === arrays[1]);
  29060. * // => false
  29061. */
  29062. function stubArray() {
  29063. return [];
  29064. }
  29065. /**
  29066. * This method returns `false`.
  29067. *
  29068. * @static
  29069. * @memberOf _
  29070. * @since 4.13.0
  29071. * @category Util
  29072. * @returns {boolean} Returns `false`.
  29073. * @example
  29074. *
  29075. * _.times(2, _.stubFalse);
  29076. * // => [false, false]
  29077. */
  29078. function stubFalse() {
  29079. return false;
  29080. }
  29081. /**
  29082. * This method returns a new empty object.
  29083. *
  29084. * @static
  29085. * @memberOf _
  29086. * @since 4.13.0
  29087. * @category Util
  29088. * @returns {Object} Returns the new empty object.
  29089. * @example
  29090. *
  29091. * var objects = _.times(2, _.stubObject);
  29092. *
  29093. * console.log(objects);
  29094. * // => [{}, {}]
  29095. *
  29096. * console.log(objects[0] === objects[1]);
  29097. * // => false
  29098. */
  29099. function stubObject() {
  29100. return {};
  29101. }
  29102. /**
  29103. * This method returns an empty string.
  29104. *
  29105. * @static
  29106. * @memberOf _
  29107. * @since 4.13.0
  29108. * @category Util
  29109. * @returns {string} Returns the empty string.
  29110. * @example
  29111. *
  29112. * _.times(2, _.stubString);
  29113. * // => ['', '']
  29114. */
  29115. function stubString() {
  29116. return '';
  29117. }
  29118. /**
  29119. * This method returns `true`.
  29120. *
  29121. * @static
  29122. * @memberOf _
  29123. * @since 4.13.0
  29124. * @category Util
  29125. * @returns {boolean} Returns `true`.
  29126. * @example
  29127. *
  29128. * _.times(2, _.stubTrue);
  29129. * // => [true, true]
  29130. */
  29131. function stubTrue() {
  29132. return true;
  29133. }
  29134. /**
  29135. * Invokes the iteratee `n` times, returning an array of the results of
  29136. * each invocation. The iteratee is invoked with one argument; (index).
  29137. *
  29138. * @static
  29139. * @since 0.1.0
  29140. * @memberOf _
  29141. * @category Util
  29142. * @param {number} n The number of times to invoke `iteratee`.
  29143. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29144. * @returns {Array} Returns the array of results.
  29145. * @example
  29146. *
  29147. * _.times(3, String);
  29148. * // => ['0', '1', '2']
  29149. *
  29150. * _.times(4, _.constant(0));
  29151. * // => [0, 0, 0, 0]
  29152. */
  29153. function times(n, iteratee) {
  29154. n = toInteger(n);
  29155. if (n < 1 || n > MAX_SAFE_INTEGER) {
  29156. return [];
  29157. }
  29158. var index = MAX_ARRAY_LENGTH,
  29159. length = nativeMin(n, MAX_ARRAY_LENGTH);
  29160. iteratee = getIteratee(iteratee);
  29161. n -= MAX_ARRAY_LENGTH;
  29162. var result = baseTimes(length, iteratee);
  29163. while (++index < n) {
  29164. iteratee(index);
  29165. }
  29166. return result;
  29167. }
  29168. /**
  29169. * Converts `value` to a property path array.
  29170. *
  29171. * @static
  29172. * @memberOf _
  29173. * @since 4.0.0
  29174. * @category Util
  29175. * @param {*} value The value to convert.
  29176. * @returns {Array} Returns the new property path array.
  29177. * @example
  29178. *
  29179. * _.toPath('a.b.c');
  29180. * // => ['a', 'b', 'c']
  29181. *
  29182. * _.toPath('a[0].b.c');
  29183. * // => ['a', '0', 'b', 'c']
  29184. */
  29185. function toPath(value) {
  29186. if (isArray(value)) {
  29187. return arrayMap(value, toKey);
  29188. }
  29189. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  29190. }
  29191. /**
  29192. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  29193. *
  29194. * @static
  29195. * @since 0.1.0
  29196. * @memberOf _
  29197. * @category Util
  29198. * @param {string} [prefix=''] The value to prefix the ID with.
  29199. * @returns {string} Returns the unique ID.
  29200. * @example
  29201. *
  29202. * _.uniqueId('contact_');
  29203. * // => 'contact_104'
  29204. *
  29205. * _.uniqueId();
  29206. * // => '105'
  29207. */
  29208. function uniqueId(prefix) {
  29209. var id = ++idCounter;
  29210. return toString(prefix) + id;
  29211. }
  29212. /*------------------------------------------------------------------------*/
  29213. /**
  29214. * Adds two numbers.
  29215. *
  29216. * @static
  29217. * @memberOf _
  29218. * @since 3.4.0
  29219. * @category Math
  29220. * @param {number} augend The first number in an addition.
  29221. * @param {number} addend The second number in an addition.
  29222. * @returns {number} Returns the total.
  29223. * @example
  29224. *
  29225. * _.add(6, 4);
  29226. * // => 10
  29227. */
  29228. var add = createMathOperation(function(augend, addend) {
  29229. return augend + addend;
  29230. }, 0);
  29231. /**
  29232. * Computes `number` rounded up to `precision`.
  29233. *
  29234. * @static
  29235. * @memberOf _
  29236. * @since 3.10.0
  29237. * @category Math
  29238. * @param {number} number The number to round up.
  29239. * @param {number} [precision=0] The precision to round up to.
  29240. * @returns {number} Returns the rounded up number.
  29241. * @example
  29242. *
  29243. * _.ceil(4.006);
  29244. * // => 5
  29245. *
  29246. * _.ceil(6.004, 2);
  29247. * // => 6.01
  29248. *
  29249. * _.ceil(6040, -2);
  29250. * // => 6100
  29251. */
  29252. var ceil = createRound('ceil');
  29253. /**
  29254. * Divide two numbers.
  29255. *
  29256. * @static
  29257. * @memberOf _
  29258. * @since 4.7.0
  29259. * @category Math
  29260. * @param {number} dividend The first number in a division.
  29261. * @param {number} divisor The second number in a division.
  29262. * @returns {number} Returns the quotient.
  29263. * @example
  29264. *
  29265. * _.divide(6, 4);
  29266. * // => 1.5
  29267. */
  29268. var divide = createMathOperation(function(dividend, divisor) {
  29269. return dividend / divisor;
  29270. }, 1);
  29271. /**
  29272. * Computes `number` rounded down to `precision`.
  29273. *
  29274. * @static
  29275. * @memberOf _
  29276. * @since 3.10.0
  29277. * @category Math
  29278. * @param {number} number The number to round down.
  29279. * @param {number} [precision=0] The precision to round down to.
  29280. * @returns {number} Returns the rounded down number.
  29281. * @example
  29282. *
  29283. * _.floor(4.006);
  29284. * // => 4
  29285. *
  29286. * _.floor(0.046, 2);
  29287. * // => 0.04
  29288. *
  29289. * _.floor(4060, -2);
  29290. * // => 4000
  29291. */
  29292. var floor = createRound('floor');
  29293. /**
  29294. * Computes the maximum value of `array`. If `array` is empty or falsey,
  29295. * `undefined` is returned.
  29296. *
  29297. * @static
  29298. * @since 0.1.0
  29299. * @memberOf _
  29300. * @category Math
  29301. * @param {Array} array The array to iterate over.
  29302. * @returns {*} Returns the maximum value.
  29303. * @example
  29304. *
  29305. * _.max([4, 2, 8, 6]);
  29306. * // => 8
  29307. *
  29308. * _.max([]);
  29309. * // => undefined
  29310. */
  29311. function max(array) {
  29312. return (array && array.length)
  29313. ? baseExtremum(array, identity, baseGt)
  29314. : undefined;
  29315. }
  29316. /**
  29317. * This method is like `_.max` except that it accepts `iteratee` which is
  29318. * invoked for each element in `array` to generate the criterion by which
  29319. * the value is ranked. The iteratee is invoked with one argument: (value).
  29320. *
  29321. * @static
  29322. * @memberOf _
  29323. * @since 4.0.0
  29324. * @category Math
  29325. * @param {Array} array The array to iterate over.
  29326. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29327. * @returns {*} Returns the maximum value.
  29328. * @example
  29329. *
  29330. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29331. *
  29332. * _.maxBy(objects, function(o) { return o.n; });
  29333. * // => { 'n': 2 }
  29334. *
  29335. * // The `_.property` iteratee shorthand.
  29336. * _.maxBy(objects, 'n');
  29337. * // => { 'n': 2 }
  29338. */
  29339. function maxBy(array, iteratee) {
  29340. return (array && array.length)
  29341. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  29342. : undefined;
  29343. }
  29344. /**
  29345. * Computes the mean of the values in `array`.
  29346. *
  29347. * @static
  29348. * @memberOf _
  29349. * @since 4.0.0
  29350. * @category Math
  29351. * @param {Array} array The array to iterate over.
  29352. * @returns {number} Returns the mean.
  29353. * @example
  29354. *
  29355. * _.mean([4, 2, 8, 6]);
  29356. * // => 5
  29357. */
  29358. function mean(array) {
  29359. return baseMean(array, identity);
  29360. }
  29361. /**
  29362. * This method is like `_.mean` except that it accepts `iteratee` which is
  29363. * invoked for each element in `array` to generate the value to be averaged.
  29364. * The iteratee is invoked with one argument: (value).
  29365. *
  29366. * @static
  29367. * @memberOf _
  29368. * @since 4.7.0
  29369. * @category Math
  29370. * @param {Array} array The array to iterate over.
  29371. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29372. * @returns {number} Returns the mean.
  29373. * @example
  29374. *
  29375. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29376. *
  29377. * _.meanBy(objects, function(o) { return o.n; });
  29378. * // => 5
  29379. *
  29380. * // The `_.property` iteratee shorthand.
  29381. * _.meanBy(objects, 'n');
  29382. * // => 5
  29383. */
  29384. function meanBy(array, iteratee) {
  29385. return baseMean(array, getIteratee(iteratee, 2));
  29386. }
  29387. /**
  29388. * Computes the minimum value of `array`. If `array` is empty or falsey,
  29389. * `undefined` is returned.
  29390. *
  29391. * @static
  29392. * @since 0.1.0
  29393. * @memberOf _
  29394. * @category Math
  29395. * @param {Array} array The array to iterate over.
  29396. * @returns {*} Returns the minimum value.
  29397. * @example
  29398. *
  29399. * _.min([4, 2, 8, 6]);
  29400. * // => 2
  29401. *
  29402. * _.min([]);
  29403. * // => undefined
  29404. */
  29405. function min(array) {
  29406. return (array && array.length)
  29407. ? baseExtremum(array, identity, baseLt)
  29408. : undefined;
  29409. }
  29410. /**
  29411. * This method is like `_.min` except that it accepts `iteratee` which is
  29412. * invoked for each element in `array` to generate the criterion by which
  29413. * the value is ranked. The iteratee is invoked with one argument: (value).
  29414. *
  29415. * @static
  29416. * @memberOf _
  29417. * @since 4.0.0
  29418. * @category Math
  29419. * @param {Array} array The array to iterate over.
  29420. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29421. * @returns {*} Returns the minimum value.
  29422. * @example
  29423. *
  29424. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29425. *
  29426. * _.minBy(objects, function(o) { return o.n; });
  29427. * // => { 'n': 1 }
  29428. *
  29429. * // The `_.property` iteratee shorthand.
  29430. * _.minBy(objects, 'n');
  29431. * // => { 'n': 1 }
  29432. */
  29433. function minBy(array, iteratee) {
  29434. return (array && array.length)
  29435. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  29436. : undefined;
  29437. }
  29438. /**
  29439. * Multiply two numbers.
  29440. *
  29441. * @static
  29442. * @memberOf _
  29443. * @since 4.7.0
  29444. * @category Math
  29445. * @param {number} multiplier The first number in a multiplication.
  29446. * @param {number} multiplicand The second number in a multiplication.
  29447. * @returns {number} Returns the product.
  29448. * @example
  29449. *
  29450. * _.multiply(6, 4);
  29451. * // => 24
  29452. */
  29453. var multiply = createMathOperation(function(multiplier, multiplicand) {
  29454. return multiplier * multiplicand;
  29455. }, 1);
  29456. /**
  29457. * Computes `number` rounded to `precision`.
  29458. *
  29459. * @static
  29460. * @memberOf _
  29461. * @since 3.10.0
  29462. * @category Math
  29463. * @param {number} number The number to round.
  29464. * @param {number} [precision=0] The precision to round to.
  29465. * @returns {number} Returns the rounded number.
  29466. * @example
  29467. *
  29468. * _.round(4.006);
  29469. * // => 4
  29470. *
  29471. * _.round(4.006, 2);
  29472. * // => 4.01
  29473. *
  29474. * _.round(4060, -2);
  29475. * // => 4100
  29476. */
  29477. var round = createRound('round');
  29478. /**
  29479. * Subtract two numbers.
  29480. *
  29481. * @static
  29482. * @memberOf _
  29483. * @since 4.0.0
  29484. * @category Math
  29485. * @param {number} minuend The first number in a subtraction.
  29486. * @param {number} subtrahend The second number in a subtraction.
  29487. * @returns {number} Returns the difference.
  29488. * @example
  29489. *
  29490. * _.subtract(6, 4);
  29491. * // => 2
  29492. */
  29493. var subtract = createMathOperation(function(minuend, subtrahend) {
  29494. return minuend - subtrahend;
  29495. }, 0);
  29496. /**
  29497. * Computes the sum of the values in `array`.
  29498. *
  29499. * @static
  29500. * @memberOf _
  29501. * @since 3.4.0
  29502. * @category Math
  29503. * @param {Array} array The array to iterate over.
  29504. * @returns {number} Returns the sum.
  29505. * @example
  29506. *
  29507. * _.sum([4, 2, 8, 6]);
  29508. * // => 20
  29509. */
  29510. function sum(array) {
  29511. return (array && array.length)
  29512. ? baseSum(array, identity)
  29513. : 0;
  29514. }
  29515. /**
  29516. * This method is like `_.sum` except that it accepts `iteratee` which is
  29517. * invoked for each element in `array` to generate the value to be summed.
  29518. * The iteratee is invoked with one argument: (value).
  29519. *
  29520. * @static
  29521. * @memberOf _
  29522. * @since 4.0.0
  29523. * @category Math
  29524. * @param {Array} array The array to iterate over.
  29525. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29526. * @returns {number} Returns the sum.
  29527. * @example
  29528. *
  29529. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29530. *
  29531. * _.sumBy(objects, function(o) { return o.n; });
  29532. * // => 20
  29533. *
  29534. * // The `_.property` iteratee shorthand.
  29535. * _.sumBy(objects, 'n');
  29536. * // => 20
  29537. */
  29538. function sumBy(array, iteratee) {
  29539. return (array && array.length)
  29540. ? baseSum(array, getIteratee(iteratee, 2))
  29541. : 0;
  29542. }
  29543. /*------------------------------------------------------------------------*/
  29544. // Add methods that return wrapped values in chain sequences.
  29545. lodash.after = after;
  29546. lodash.ary = ary;
  29547. lodash.assign = assign;
  29548. lodash.assignIn = assignIn;
  29549. lodash.assignInWith = assignInWith;
  29550. lodash.assignWith = assignWith;
  29551. lodash.at = at;
  29552. lodash.before = before;
  29553. lodash.bind = bind;
  29554. lodash.bindAll = bindAll;
  29555. lodash.bindKey = bindKey;
  29556. lodash.castArray = castArray;
  29557. lodash.chain = chain;
  29558. lodash.chunk = chunk;
  29559. lodash.compact = compact;
  29560. lodash.concat = concat;
  29561. lodash.cond = cond;
  29562. lodash.conforms = conforms;
  29563. lodash.constant = constant;
  29564. lodash.countBy = countBy;
  29565. lodash.create = create;
  29566. lodash.curry = curry;
  29567. lodash.curryRight = curryRight;
  29568. lodash.debounce = debounce;
  29569. lodash.defaults = defaults;
  29570. lodash.defaultsDeep = defaultsDeep;
  29571. lodash.defer = defer;
  29572. lodash.delay = delay;
  29573. lodash.difference = difference;
  29574. lodash.differenceBy = differenceBy;
  29575. lodash.differenceWith = differenceWith;
  29576. lodash.drop = drop;
  29577. lodash.dropRight = dropRight;
  29578. lodash.dropRightWhile = dropRightWhile;
  29579. lodash.dropWhile = dropWhile;
  29580. lodash.fill = fill;
  29581. lodash.filter = filter;
  29582. lodash.flatMap = flatMap;
  29583. lodash.flatMapDeep = flatMapDeep;
  29584. lodash.flatMapDepth = flatMapDepth;
  29585. lodash.flatten = flatten;
  29586. lodash.flattenDeep = flattenDeep;
  29587. lodash.flattenDepth = flattenDepth;
  29588. lodash.flip = flip;
  29589. lodash.flow = flow;
  29590. lodash.flowRight = flowRight;
  29591. lodash.fromPairs = fromPairs;
  29592. lodash.functions = functions;
  29593. lodash.functionsIn = functionsIn;
  29594. lodash.groupBy = groupBy;
  29595. lodash.initial = initial;
  29596. lodash.intersection = intersection;
  29597. lodash.intersectionBy = intersectionBy;
  29598. lodash.intersectionWith = intersectionWith;
  29599. lodash.invert = invert;
  29600. lodash.invertBy = invertBy;
  29601. lodash.invokeMap = invokeMap;
  29602. lodash.iteratee = iteratee;
  29603. lodash.keyBy = keyBy;
  29604. lodash.keys = keys;
  29605. lodash.keysIn = keysIn;
  29606. lodash.map = map;
  29607. lodash.mapKeys = mapKeys;
  29608. lodash.mapValues = mapValues;
  29609. lodash.matches = matches;
  29610. lodash.matchesProperty = matchesProperty;
  29611. lodash.memoize = memoize;
  29612. lodash.merge = merge;
  29613. lodash.mergeWith = mergeWith;
  29614. lodash.method = method;
  29615. lodash.methodOf = methodOf;
  29616. lodash.mixin = mixin;
  29617. lodash.negate = negate;
  29618. lodash.nthArg = nthArg;
  29619. lodash.omit = omit;
  29620. lodash.omitBy = omitBy;
  29621. lodash.once = once;
  29622. lodash.orderBy = orderBy;
  29623. lodash.over = over;
  29624. lodash.overArgs = overArgs;
  29625. lodash.overEvery = overEvery;
  29626. lodash.overSome = overSome;
  29627. lodash.partial = partial;
  29628. lodash.partialRight = partialRight;
  29629. lodash.partition = partition;
  29630. lodash.pick = pick;
  29631. lodash.pickBy = pickBy;
  29632. lodash.property = property;
  29633. lodash.propertyOf = propertyOf;
  29634. lodash.pull = pull;
  29635. lodash.pullAll = pullAll;
  29636. lodash.pullAllBy = pullAllBy;
  29637. lodash.pullAllWith = pullAllWith;
  29638. lodash.pullAt = pullAt;
  29639. lodash.range = range;
  29640. lodash.rangeRight = rangeRight;
  29641. lodash.rearg = rearg;
  29642. lodash.reject = reject;
  29643. lodash.remove = remove;
  29644. lodash.rest = rest;
  29645. lodash.reverse = reverse;
  29646. lodash.sampleSize = sampleSize;
  29647. lodash.set = set;
  29648. lodash.setWith = setWith;
  29649. lodash.shuffle = shuffle;
  29650. lodash.slice = slice;
  29651. lodash.sortBy = sortBy;
  29652. lodash.sortedUniq = sortedUniq;
  29653. lodash.sortedUniqBy = sortedUniqBy;
  29654. lodash.split = split;
  29655. lodash.spread = spread;
  29656. lodash.tail = tail;
  29657. lodash.take = take;
  29658. lodash.takeRight = takeRight;
  29659. lodash.takeRightWhile = takeRightWhile;
  29660. lodash.takeWhile = takeWhile;
  29661. lodash.tap = tap;
  29662. lodash.throttle = throttle;
  29663. lodash.thru = thru;
  29664. lodash.toArray = toArray;
  29665. lodash.toPairs = toPairs;
  29666. lodash.toPairsIn = toPairsIn;
  29667. lodash.toPath = toPath;
  29668. lodash.toPlainObject = toPlainObject;
  29669. lodash.transform = transform;
  29670. lodash.unary = unary;
  29671. lodash.union = union;
  29672. lodash.unionBy = unionBy;
  29673. lodash.unionWith = unionWith;
  29674. lodash.uniq = uniq;
  29675. lodash.uniqBy = uniqBy;
  29676. lodash.uniqWith = uniqWith;
  29677. lodash.unset = unset;
  29678. lodash.unzip = unzip;
  29679. lodash.unzipWith = unzipWith;
  29680. lodash.update = update;
  29681. lodash.updateWith = updateWith;
  29682. lodash.values = values;
  29683. lodash.valuesIn = valuesIn;
  29684. lodash.without = without;
  29685. lodash.words = words;
  29686. lodash.wrap = wrap;
  29687. lodash.xor = xor;
  29688. lodash.xorBy = xorBy;
  29689. lodash.xorWith = xorWith;
  29690. lodash.zip = zip;
  29691. lodash.zipObject = zipObject;
  29692. lodash.zipObjectDeep = zipObjectDeep;
  29693. lodash.zipWith = zipWith;
  29694. // Add aliases.
  29695. lodash.entries = toPairs;
  29696. lodash.entriesIn = toPairsIn;
  29697. lodash.extend = assignIn;
  29698. lodash.extendWith = assignInWith;
  29699. // Add methods to `lodash.prototype`.
  29700. mixin(lodash, lodash);
  29701. /*------------------------------------------------------------------------*/
  29702. // Add methods that return unwrapped values in chain sequences.
  29703. lodash.add = add;
  29704. lodash.attempt = attempt;
  29705. lodash.camelCase = camelCase;
  29706. lodash.capitalize = capitalize;
  29707. lodash.ceil = ceil;
  29708. lodash.clamp = clamp;
  29709. lodash.clone = clone;
  29710. lodash.cloneDeep = cloneDeep;
  29711. lodash.cloneDeepWith = cloneDeepWith;
  29712. lodash.cloneWith = cloneWith;
  29713. lodash.conformsTo = conformsTo;
  29714. lodash.deburr = deburr;
  29715. lodash.defaultTo = defaultTo;
  29716. lodash.divide = divide;
  29717. lodash.endsWith = endsWith;
  29718. lodash.eq = eq;
  29719. lodash.escape = escape;
  29720. lodash.escapeRegExp = escapeRegExp;
  29721. lodash.every = every;
  29722. lodash.find = find;
  29723. lodash.findIndex = findIndex;
  29724. lodash.findKey = findKey;
  29725. lodash.findLast = findLast;
  29726. lodash.findLastIndex = findLastIndex;
  29727. lodash.findLastKey = findLastKey;
  29728. lodash.floor = floor;
  29729. lodash.forEach = forEach;
  29730. lodash.forEachRight = forEachRight;
  29731. lodash.forIn = forIn;
  29732. lodash.forInRight = forInRight;
  29733. lodash.forOwn = forOwn;
  29734. lodash.forOwnRight = forOwnRight;
  29735. lodash.get = get;
  29736. lodash.gt = gt;
  29737. lodash.gte = gte;
  29738. lodash.has = has;
  29739. lodash.hasIn = hasIn;
  29740. lodash.head = head;
  29741. lodash.identity = identity;
  29742. lodash.includes = includes;
  29743. lodash.indexOf = indexOf;
  29744. lodash.inRange = inRange;
  29745. lodash.invoke = invoke;
  29746. lodash.isArguments = isArguments;
  29747. lodash.isArray = isArray;
  29748. lodash.isArrayBuffer = isArrayBuffer;
  29749. lodash.isArrayLike = isArrayLike;
  29750. lodash.isArrayLikeObject = isArrayLikeObject;
  29751. lodash.isBoolean = isBoolean;
  29752. lodash.isBuffer = isBuffer;
  29753. lodash.isDate = isDate;
  29754. lodash.isElement = isElement;
  29755. lodash.isEmpty = isEmpty;
  29756. lodash.isEqual = isEqual;
  29757. lodash.isEqualWith = isEqualWith;
  29758. lodash.isError = isError;
  29759. lodash.isFinite = isFinite;
  29760. lodash.isFunction = isFunction;
  29761. lodash.isInteger = isInteger;
  29762. lodash.isLength = isLength;
  29763. lodash.isMap = isMap;
  29764. lodash.isMatch = isMatch;
  29765. lodash.isMatchWith = isMatchWith;
  29766. lodash.isNaN = isNaN;
  29767. lodash.isNative = isNative;
  29768. lodash.isNil = isNil;
  29769. lodash.isNull = isNull;
  29770. lodash.isNumber = isNumber;
  29771. lodash.isObject = isObject;
  29772. lodash.isObjectLike = isObjectLike;
  29773. lodash.isPlainObject = isPlainObject;
  29774. lodash.isRegExp = isRegExp;
  29775. lodash.isSafeInteger = isSafeInteger;
  29776. lodash.isSet = isSet;
  29777. lodash.isString = isString;
  29778. lodash.isSymbol = isSymbol;
  29779. lodash.isTypedArray = isTypedArray;
  29780. lodash.isUndefined = isUndefined;
  29781. lodash.isWeakMap = isWeakMap;
  29782. lodash.isWeakSet = isWeakSet;
  29783. lodash.join = join;
  29784. lodash.kebabCase = kebabCase;
  29785. lodash.last = last;
  29786. lodash.lastIndexOf = lastIndexOf;
  29787. lodash.lowerCase = lowerCase;
  29788. lodash.lowerFirst = lowerFirst;
  29789. lodash.lt = lt;
  29790. lodash.lte = lte;
  29791. lodash.max = max;
  29792. lodash.maxBy = maxBy;
  29793. lodash.mean = mean;
  29794. lodash.meanBy = meanBy;
  29795. lodash.min = min;
  29796. lodash.minBy = minBy;
  29797. lodash.stubArray = stubArray;
  29798. lodash.stubFalse = stubFalse;
  29799. lodash.stubObject = stubObject;
  29800. lodash.stubString = stubString;
  29801. lodash.stubTrue = stubTrue;
  29802. lodash.multiply = multiply;
  29803. lodash.nth = nth;
  29804. lodash.noConflict = noConflict;
  29805. lodash.noop = noop;
  29806. lodash.now = now;
  29807. lodash.pad = pad;
  29808. lodash.padEnd = padEnd;
  29809. lodash.padStart = padStart;
  29810. lodash.parseInt = parseInt;
  29811. lodash.random = random;
  29812. lodash.reduce = reduce;
  29813. lodash.reduceRight = reduceRight;
  29814. lodash.repeat = repeat;
  29815. lodash.replace = replace;
  29816. lodash.result = result;
  29817. lodash.round = round;
  29818. lodash.runInContext = runInContext;
  29819. lodash.sample = sample;
  29820. lodash.size = size;
  29821. lodash.snakeCase = snakeCase;
  29822. lodash.some = some;
  29823. lodash.sortedIndex = sortedIndex;
  29824. lodash.sortedIndexBy = sortedIndexBy;
  29825. lodash.sortedIndexOf = sortedIndexOf;
  29826. lodash.sortedLastIndex = sortedLastIndex;
  29827. lodash.sortedLastIndexBy = sortedLastIndexBy;
  29828. lodash.sortedLastIndexOf = sortedLastIndexOf;
  29829. lodash.startCase = startCase;
  29830. lodash.startsWith = startsWith;
  29831. lodash.subtract = subtract;
  29832. lodash.sum = sum;
  29833. lodash.sumBy = sumBy;
  29834. lodash.template = template;
  29835. lodash.times = times;
  29836. lodash.toFinite = toFinite;
  29837. lodash.toInteger = toInteger;
  29838. lodash.toLength = toLength;
  29839. lodash.toLower = toLower;
  29840. lodash.toNumber = toNumber;
  29841. lodash.toSafeInteger = toSafeInteger;
  29842. lodash.toString = toString;
  29843. lodash.toUpper = toUpper;
  29844. lodash.trim = trim;
  29845. lodash.trimEnd = trimEnd;
  29846. lodash.trimStart = trimStart;
  29847. lodash.truncate = truncate;
  29848. lodash.unescape = unescape;
  29849. lodash.uniqueId = uniqueId;
  29850. lodash.upperCase = upperCase;
  29851. lodash.upperFirst = upperFirst;
  29852. // Add aliases.
  29853. lodash.each = forEach;
  29854. lodash.eachRight = forEachRight;
  29855. lodash.first = head;
  29856. mixin(lodash, (function() {
  29857. var source = {};
  29858. baseForOwn(lodash, function(func, methodName) {
  29859. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  29860. source[methodName] = func;
  29861. }
  29862. });
  29863. return source;
  29864. }()), { 'chain': false });
  29865. /*------------------------------------------------------------------------*/
  29866. /**
  29867. * The semantic version number.
  29868. *
  29869. * @static
  29870. * @memberOf _
  29871. * @type {string}
  29872. */
  29873. lodash.VERSION = VERSION;
  29874. // Assign default placeholders.
  29875. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  29876. lodash[methodName].placeholder = lodash;
  29877. });
  29878. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  29879. arrayEach(['drop', 'take'], function(methodName, index) {
  29880. LazyWrapper.prototype[methodName] = function(n) {
  29881. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  29882. var result = (this.__filtered__ && !index)
  29883. ? new LazyWrapper(this)
  29884. : this.clone();
  29885. if (result.__filtered__) {
  29886. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  29887. } else {
  29888. result.__views__.push({
  29889. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  29890. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  29891. });
  29892. }
  29893. return result;
  29894. };
  29895. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  29896. return this.reverse()[methodName](n).reverse();
  29897. };
  29898. });
  29899. // Add `LazyWrapper` methods that accept an `iteratee` value.
  29900. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  29901. var type = index + 1,
  29902. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  29903. LazyWrapper.prototype[methodName] = function(iteratee) {
  29904. var result = this.clone();
  29905. result.__iteratees__.push({
  29906. 'iteratee': getIteratee(iteratee, 3),
  29907. 'type': type
  29908. });
  29909. result.__filtered__ = result.__filtered__ || isFilter;
  29910. return result;
  29911. };
  29912. });
  29913. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  29914. arrayEach(['head', 'last'], function(methodName, index) {
  29915. var takeName = 'take' + (index ? 'Right' : '');
  29916. LazyWrapper.prototype[methodName] = function() {
  29917. return this[takeName](1).value()[0];
  29918. };
  29919. });
  29920. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  29921. arrayEach(['initial', 'tail'], function(methodName, index) {
  29922. var dropName = 'drop' + (index ? '' : 'Right');
  29923. LazyWrapper.prototype[methodName] = function() {
  29924. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  29925. };
  29926. });
  29927. LazyWrapper.prototype.compact = function() {
  29928. return this.filter(identity);
  29929. };
  29930. LazyWrapper.prototype.find = function(predicate) {
  29931. return this.filter(predicate).head();
  29932. };
  29933. LazyWrapper.prototype.findLast = function(predicate) {
  29934. return this.reverse().find(predicate);
  29935. };
  29936. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  29937. if (typeof path == 'function') {
  29938. return new LazyWrapper(this);
  29939. }
  29940. return this.map(function(value) {
  29941. return baseInvoke(value, path, args);
  29942. });
  29943. });
  29944. LazyWrapper.prototype.reject = function(predicate) {
  29945. return this.filter(negate(getIteratee(predicate)));
  29946. };
  29947. LazyWrapper.prototype.slice = function(start, end) {
  29948. start = toInteger(start);
  29949. var result = this;
  29950. if (result.__filtered__ && (start > 0 || end < 0)) {
  29951. return new LazyWrapper(result);
  29952. }
  29953. if (start < 0) {
  29954. result = result.takeRight(-start);
  29955. } else if (start) {
  29956. result = result.drop(start);
  29957. }
  29958. if (end !== undefined) {
  29959. end = toInteger(end);
  29960. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  29961. }
  29962. return result;
  29963. };
  29964. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  29965. return this.reverse().takeWhile(predicate).reverse();
  29966. };
  29967. LazyWrapper.prototype.toArray = function() {
  29968. return this.take(MAX_ARRAY_LENGTH);
  29969. };
  29970. // Add `LazyWrapper` methods to `lodash.prototype`.
  29971. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29972. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  29973. isTaker = /^(?:head|last)$/.test(methodName),
  29974. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  29975. retUnwrapped = isTaker || /^find/.test(methodName);
  29976. if (!lodashFunc) {
  29977. return;
  29978. }
  29979. lodash.prototype[methodName] = function() {
  29980. var value = this.__wrapped__,
  29981. args = isTaker ? [1] : arguments,
  29982. isLazy = value instanceof LazyWrapper,
  29983. iteratee = args[0],
  29984. useLazy = isLazy || isArray(value);
  29985. var interceptor = function(value) {
  29986. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  29987. return (isTaker && chainAll) ? result[0] : result;
  29988. };
  29989. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  29990. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  29991. isLazy = useLazy = false;
  29992. }
  29993. var chainAll = this.__chain__,
  29994. isHybrid = !!this.__actions__.length,
  29995. isUnwrapped = retUnwrapped && !chainAll,
  29996. onlyLazy = isLazy && !isHybrid;
  29997. if (!retUnwrapped && useLazy) {
  29998. value = onlyLazy ? value : new LazyWrapper(this);
  29999. var result = func.apply(value, args);
  30000. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  30001. return new LodashWrapper(result, chainAll);
  30002. }
  30003. if (isUnwrapped && onlyLazy) {
  30004. return func.apply(this, args);
  30005. }
  30006. result = this.thru(interceptor);
  30007. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  30008. };
  30009. });
  30010. // Add `Array` methods to `lodash.prototype`.
  30011. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  30012. var func = arrayProto[methodName],
  30013. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  30014. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  30015. lodash.prototype[methodName] = function() {
  30016. var args = arguments;
  30017. if (retUnwrapped && !this.__chain__) {
  30018. var value = this.value();
  30019. return func.apply(isArray(value) ? value : [], args);
  30020. }
  30021. return this[chainName](function(value) {
  30022. return func.apply(isArray(value) ? value : [], args);
  30023. });
  30024. };
  30025. });
  30026. // Map minified method names to their real names.
  30027. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  30028. var lodashFunc = lodash[methodName];
  30029. if (lodashFunc) {
  30030. var key = lodashFunc.name + '';
  30031. if (!hasOwnProperty.call(realNames, key)) {
  30032. realNames[key] = [];
  30033. }
  30034. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  30035. }
  30036. });
  30037. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  30038. 'name': 'wrapper',
  30039. 'func': undefined
  30040. }];
  30041. // Add methods to `LazyWrapper`.
  30042. LazyWrapper.prototype.clone = lazyClone;
  30043. LazyWrapper.prototype.reverse = lazyReverse;
  30044. LazyWrapper.prototype.value = lazyValue;
  30045. // Add chain sequence methods to the `lodash` wrapper.
  30046. lodash.prototype.at = wrapperAt;
  30047. lodash.prototype.chain = wrapperChain;
  30048. lodash.prototype.commit = wrapperCommit;
  30049. lodash.prototype.next = wrapperNext;
  30050. lodash.prototype.plant = wrapperPlant;
  30051. lodash.prototype.reverse = wrapperReverse;
  30052. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  30053. // Add lazy aliases.
  30054. lodash.prototype.first = lodash.prototype.head;
  30055. if (symIterator) {
  30056. lodash.prototype[symIterator] = wrapperToIterator;
  30057. }
  30058. return lodash;
  30059. });
  30060. /*--------------------------------------------------------------------------*/
  30061. // Export lodash.
  30062. var _ = runInContext();
  30063. // Some AMD build optimizers, like r.js, check for condition patterns like:
  30064. if (true) {
  30065. // Expose Lodash on the global object to prevent errors when Lodash is
  30066. // loaded by a script tag in the presence of an AMD loader.
  30067. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  30068. // Use `_.noConflict` to remove Lodash from the global object.
  30069. root._ = _;
  30070. // Define as an anonymous module so, through path mapping, it can be
  30071. // referenced as the "underscore" module.
  30072. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  30073. return _;
  30074. }).call(exports, __webpack_require__, exports, module),
  30075. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  30076. }
  30077. // Check for `exports` after `define` in case a build optimizer adds it.
  30078. else {}
  30079. }.call(this));
  30080. /* 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)))
  30081. /***/ }),
  30082. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  30083. /*!***************************************************!*\
  30084. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  30085. \***************************************************/
  30086. /*! exports provided: default */
  30087. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  30088. "use strict";
  30089. __webpack_require__.r(__webpack_exports__);
  30090. /* WEBPACK VAR INJECTION */(function(global) {/**!
  30091. * @fileOverview Kickass library to create and place poppers near their reference elements.
  30092. * @version 1.16.1
  30093. * @license
  30094. * Copyright (c) 2016 Federico Zivolo and contributors
  30095. *
  30096. * Permission is hereby granted, free of charge, to any person obtaining a copy
  30097. * of this software and associated documentation files (the "Software"), to deal
  30098. * in the Software without restriction, including without limitation the rights
  30099. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30100. * copies of the Software, and to permit persons to whom the Software is
  30101. * furnished to do so, subject to the following conditions:
  30102. *
  30103. * The above copyright notice and this permission notice shall be included in all
  30104. * copies or substantial portions of the Software.
  30105. *
  30106. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  30107. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30108. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  30109. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30110. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  30111. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30112. * SOFTWARE.
  30113. */
  30114. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  30115. var timeoutDuration = function () {
  30116. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  30117. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  30118. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  30119. return 1;
  30120. }
  30121. }
  30122. return 0;
  30123. }();
  30124. function microtaskDebounce(fn) {
  30125. var called = false;
  30126. return function () {
  30127. if (called) {
  30128. return;
  30129. }
  30130. called = true;
  30131. window.Promise.resolve().then(function () {
  30132. called = false;
  30133. fn();
  30134. });
  30135. };
  30136. }
  30137. function taskDebounce(fn) {
  30138. var scheduled = false;
  30139. return function () {
  30140. if (!scheduled) {
  30141. scheduled = true;
  30142. setTimeout(function () {
  30143. scheduled = false;
  30144. fn();
  30145. }, timeoutDuration);
  30146. }
  30147. };
  30148. }
  30149. var supportsMicroTasks = isBrowser && window.Promise;
  30150. /**
  30151. * Create a debounced version of a method, that's asynchronously deferred
  30152. * but called in the minimum time possible.
  30153. *
  30154. * @method
  30155. * @memberof Popper.Utils
  30156. * @argument {Function} fn
  30157. * @returns {Function}
  30158. */
  30159. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  30160. /**
  30161. * Check if the given variable is a function
  30162. * @method
  30163. * @memberof Popper.Utils
  30164. * @argument {Any} functionToCheck - variable to check
  30165. * @returns {Boolean} answer to: is a function?
  30166. */
  30167. function isFunction(functionToCheck) {
  30168. var getType = {};
  30169. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  30170. }
  30171. /**
  30172. * Get CSS computed property of the given element
  30173. * @method
  30174. * @memberof Popper.Utils
  30175. * @argument {Eement} element
  30176. * @argument {String} property
  30177. */
  30178. function getStyleComputedProperty(element, property) {
  30179. if (element.nodeType !== 1) {
  30180. return [];
  30181. }
  30182. // NOTE: 1 DOM access here
  30183. var window = element.ownerDocument.defaultView;
  30184. var css = window.getComputedStyle(element, null);
  30185. return property ? css[property] : css;
  30186. }
  30187. /**
  30188. * Returns the parentNode or the host of the element
  30189. * @method
  30190. * @memberof Popper.Utils
  30191. * @argument {Element} element
  30192. * @returns {Element} parent
  30193. */
  30194. function getParentNode(element) {
  30195. if (element.nodeName === 'HTML') {
  30196. return element;
  30197. }
  30198. return element.parentNode || element.host;
  30199. }
  30200. /**
  30201. * Returns the scrolling parent of the given element
  30202. * @method
  30203. * @memberof Popper.Utils
  30204. * @argument {Element} element
  30205. * @returns {Element} scroll parent
  30206. */
  30207. function getScrollParent(element) {
  30208. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  30209. if (!element) {
  30210. return document.body;
  30211. }
  30212. switch (element.nodeName) {
  30213. case 'HTML':
  30214. case 'BODY':
  30215. return element.ownerDocument.body;
  30216. case '#document':
  30217. return element.body;
  30218. }
  30219. // Firefox want us to check `-x` and `-y` variations as well
  30220. var _getStyleComputedProp = getStyleComputedProperty(element),
  30221. overflow = _getStyleComputedProp.overflow,
  30222. overflowX = _getStyleComputedProp.overflowX,
  30223. overflowY = _getStyleComputedProp.overflowY;
  30224. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  30225. return element;
  30226. }
  30227. return getScrollParent(getParentNode(element));
  30228. }
  30229. /**
  30230. * Returns the reference node of the reference object, or the reference object itself.
  30231. * @method
  30232. * @memberof Popper.Utils
  30233. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  30234. * @returns {Element} parent
  30235. */
  30236. function getReferenceNode(reference) {
  30237. return reference && reference.referenceNode ? reference.referenceNode : reference;
  30238. }
  30239. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  30240. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  30241. /**
  30242. * Determines if the browser is Internet Explorer
  30243. * @method
  30244. * @memberof Popper.Utils
  30245. * @param {Number} version to check
  30246. * @returns {Boolean} isIE
  30247. */
  30248. function isIE(version) {
  30249. if (version === 11) {
  30250. return isIE11;
  30251. }
  30252. if (version === 10) {
  30253. return isIE10;
  30254. }
  30255. return isIE11 || isIE10;
  30256. }
  30257. /**
  30258. * Returns the offset parent of the given element
  30259. * @method
  30260. * @memberof Popper.Utils
  30261. * @argument {Element} element
  30262. * @returns {Element} offset parent
  30263. */
  30264. function getOffsetParent(element) {
  30265. if (!element) {
  30266. return document.documentElement;
  30267. }
  30268. var noOffsetParent = isIE(10) ? document.body : null;
  30269. // NOTE: 1 DOM access here
  30270. var offsetParent = element.offsetParent || null;
  30271. // Skip hidden elements which don't have an offsetParent
  30272. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  30273. offsetParent = (element = element.nextElementSibling).offsetParent;
  30274. }
  30275. var nodeName = offsetParent && offsetParent.nodeName;
  30276. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  30277. return element ? element.ownerDocument.documentElement : document.documentElement;
  30278. }
  30279. // .offsetParent will return the closest TH, TD or TABLE in case
  30280. // no offsetParent is present, I hate this job...
  30281. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  30282. return getOffsetParent(offsetParent);
  30283. }
  30284. return offsetParent;
  30285. }
  30286. function isOffsetContainer(element) {
  30287. var nodeName = element.nodeName;
  30288. if (nodeName === 'BODY') {
  30289. return false;
  30290. }
  30291. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  30292. }
  30293. /**
  30294. * Finds the root node (document, shadowDOM root) of the given element
  30295. * @method
  30296. * @memberof Popper.Utils
  30297. * @argument {Element} node
  30298. * @returns {Element} root node
  30299. */
  30300. function getRoot(node) {
  30301. if (node.parentNode !== null) {
  30302. return getRoot(node.parentNode);
  30303. }
  30304. return node;
  30305. }
  30306. /**
  30307. * Finds the offset parent common to the two provided nodes
  30308. * @method
  30309. * @memberof Popper.Utils
  30310. * @argument {Element} element1
  30311. * @argument {Element} element2
  30312. * @returns {Element} common offset parent
  30313. */
  30314. function findCommonOffsetParent(element1, element2) {
  30315. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30316. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  30317. return document.documentElement;
  30318. }
  30319. // Here we make sure to give as "start" the element that comes first in the DOM
  30320. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  30321. var start = order ? element1 : element2;
  30322. var end = order ? element2 : element1;
  30323. // Get common ancestor container
  30324. var range = document.createRange();
  30325. range.setStart(start, 0);
  30326. range.setEnd(end, 0);
  30327. var commonAncestorContainer = range.commonAncestorContainer;
  30328. // Both nodes are inside #document
  30329. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  30330. if (isOffsetContainer(commonAncestorContainer)) {
  30331. return commonAncestorContainer;
  30332. }
  30333. return getOffsetParent(commonAncestorContainer);
  30334. }
  30335. // one of the nodes is inside shadowDOM, find which one
  30336. var element1root = getRoot(element1);
  30337. if (element1root.host) {
  30338. return findCommonOffsetParent(element1root.host, element2);
  30339. } else {
  30340. return findCommonOffsetParent(element1, getRoot(element2).host);
  30341. }
  30342. }
  30343. /**
  30344. * Gets the scroll value of the given element in the given side (top and left)
  30345. * @method
  30346. * @memberof Popper.Utils
  30347. * @argument {Element} element
  30348. * @argument {String} side `top` or `left`
  30349. * @returns {number} amount of scrolled pixels
  30350. */
  30351. function getScroll(element) {
  30352. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  30353. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  30354. var nodeName = element.nodeName;
  30355. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30356. var html = element.ownerDocument.documentElement;
  30357. var scrollingElement = element.ownerDocument.scrollingElement || html;
  30358. return scrollingElement[upperSide];
  30359. }
  30360. return element[upperSide];
  30361. }
  30362. /*
  30363. * Sum or subtract the element scroll values (left and top) from a given rect object
  30364. * @method
  30365. * @memberof Popper.Utils
  30366. * @param {Object} rect - Rect object you want to change
  30367. * @param {HTMLElement} element - The element from the function reads the scroll values
  30368. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  30369. * @return {Object} rect - The modifier rect object
  30370. */
  30371. function includeScroll(rect, element) {
  30372. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30373. var scrollTop = getScroll(element, 'top');
  30374. var scrollLeft = getScroll(element, 'left');
  30375. var modifier = subtract ? -1 : 1;
  30376. rect.top += scrollTop * modifier;
  30377. rect.bottom += scrollTop * modifier;
  30378. rect.left += scrollLeft * modifier;
  30379. rect.right += scrollLeft * modifier;
  30380. return rect;
  30381. }
  30382. /*
  30383. * Helper to detect borders of a given element
  30384. * @method
  30385. * @memberof Popper.Utils
  30386. * @param {CSSStyleDeclaration} styles
  30387. * Result of `getStyleComputedProperty` on the given element
  30388. * @param {String} axis - `x` or `y`
  30389. * @return {number} borders - The borders size of the given axis
  30390. */
  30391. function getBordersSize(styles, axis) {
  30392. var sideA = axis === 'x' ? 'Left' : 'Top';
  30393. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  30394. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  30395. }
  30396. function getSize(axis, body, html, computedStyle) {
  30397. 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);
  30398. }
  30399. function getWindowSizes(document) {
  30400. var body = document.body;
  30401. var html = document.documentElement;
  30402. var computedStyle = isIE(10) && getComputedStyle(html);
  30403. return {
  30404. height: getSize('Height', body, html, computedStyle),
  30405. width: getSize('Width', body, html, computedStyle)
  30406. };
  30407. }
  30408. var classCallCheck = function (instance, Constructor) {
  30409. if (!(instance instanceof Constructor)) {
  30410. throw new TypeError("Cannot call a class as a function");
  30411. }
  30412. };
  30413. var createClass = function () {
  30414. function defineProperties(target, props) {
  30415. for (var i = 0; i < props.length; i++) {
  30416. var descriptor = props[i];
  30417. descriptor.enumerable = descriptor.enumerable || false;
  30418. descriptor.configurable = true;
  30419. if ("value" in descriptor) descriptor.writable = true;
  30420. Object.defineProperty(target, descriptor.key, descriptor);
  30421. }
  30422. }
  30423. return function (Constructor, protoProps, staticProps) {
  30424. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  30425. if (staticProps) defineProperties(Constructor, staticProps);
  30426. return Constructor;
  30427. };
  30428. }();
  30429. var defineProperty = function (obj, key, value) {
  30430. if (key in obj) {
  30431. Object.defineProperty(obj, key, {
  30432. value: value,
  30433. enumerable: true,
  30434. configurable: true,
  30435. writable: true
  30436. });
  30437. } else {
  30438. obj[key] = value;
  30439. }
  30440. return obj;
  30441. };
  30442. var _extends = Object.assign || function (target) {
  30443. for (var i = 1; i < arguments.length; i++) {
  30444. var source = arguments[i];
  30445. for (var key in source) {
  30446. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30447. target[key] = source[key];
  30448. }
  30449. }
  30450. }
  30451. return target;
  30452. };
  30453. /**
  30454. * Given element offsets, generate an output similar to getBoundingClientRect
  30455. * @method
  30456. * @memberof Popper.Utils
  30457. * @argument {Object} offsets
  30458. * @returns {Object} ClientRect like output
  30459. */
  30460. function getClientRect(offsets) {
  30461. return _extends({}, offsets, {
  30462. right: offsets.left + offsets.width,
  30463. bottom: offsets.top + offsets.height
  30464. });
  30465. }
  30466. /**
  30467. * Get bounding client rect of given element
  30468. * @method
  30469. * @memberof Popper.Utils
  30470. * @param {HTMLElement} element
  30471. * @return {Object} client rect
  30472. */
  30473. function getBoundingClientRect(element) {
  30474. var rect = {};
  30475. // IE10 10 FIX: Please, don't ask, the element isn't
  30476. // considered in DOM in some circumstances...
  30477. // This isn't reproducible in IE10 compatibility mode of IE11
  30478. try {
  30479. if (isIE(10)) {
  30480. rect = element.getBoundingClientRect();
  30481. var scrollTop = getScroll(element, 'top');
  30482. var scrollLeft = getScroll(element, 'left');
  30483. rect.top += scrollTop;
  30484. rect.left += scrollLeft;
  30485. rect.bottom += scrollTop;
  30486. rect.right += scrollLeft;
  30487. } else {
  30488. rect = element.getBoundingClientRect();
  30489. }
  30490. } catch (e) {}
  30491. var result = {
  30492. left: rect.left,
  30493. top: rect.top,
  30494. width: rect.right - rect.left,
  30495. height: rect.bottom - rect.top
  30496. };
  30497. // subtract scrollbar size from sizes
  30498. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  30499. var width = sizes.width || element.clientWidth || result.width;
  30500. var height = sizes.height || element.clientHeight || result.height;
  30501. var horizScrollbar = element.offsetWidth - width;
  30502. var vertScrollbar = element.offsetHeight - height;
  30503. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  30504. // we make this check conditional for performance reasons
  30505. if (horizScrollbar || vertScrollbar) {
  30506. var styles = getStyleComputedProperty(element);
  30507. horizScrollbar -= getBordersSize(styles, 'x');
  30508. vertScrollbar -= getBordersSize(styles, 'y');
  30509. result.width -= horizScrollbar;
  30510. result.height -= vertScrollbar;
  30511. }
  30512. return getClientRect(result);
  30513. }
  30514. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  30515. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30516. var isIE10 = isIE(10);
  30517. var isHTML = parent.nodeName === 'HTML';
  30518. var childrenRect = getBoundingClientRect(children);
  30519. var parentRect = getBoundingClientRect(parent);
  30520. var scrollParent = getScrollParent(children);
  30521. var styles = getStyleComputedProperty(parent);
  30522. var borderTopWidth = parseFloat(styles.borderTopWidth);
  30523. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  30524. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  30525. if (fixedPosition && isHTML) {
  30526. parentRect.top = Math.max(parentRect.top, 0);
  30527. parentRect.left = Math.max(parentRect.left, 0);
  30528. }
  30529. var offsets = getClientRect({
  30530. top: childrenRect.top - parentRect.top - borderTopWidth,
  30531. left: childrenRect.left - parentRect.left - borderLeftWidth,
  30532. width: childrenRect.width,
  30533. height: childrenRect.height
  30534. });
  30535. offsets.marginTop = 0;
  30536. offsets.marginLeft = 0;
  30537. // Subtract margins of documentElement in case it's being used as parent
  30538. // we do this only on HTML because it's the only element that behaves
  30539. // differently when margins are applied to it. The margins are included in
  30540. // the box of the documentElement, in the other cases not.
  30541. if (!isIE10 && isHTML) {
  30542. var marginTop = parseFloat(styles.marginTop);
  30543. var marginLeft = parseFloat(styles.marginLeft);
  30544. offsets.top -= borderTopWidth - marginTop;
  30545. offsets.bottom -= borderTopWidth - marginTop;
  30546. offsets.left -= borderLeftWidth - marginLeft;
  30547. offsets.right -= borderLeftWidth - marginLeft;
  30548. // Attach marginTop and marginLeft because in some circumstances we may need them
  30549. offsets.marginTop = marginTop;
  30550. offsets.marginLeft = marginLeft;
  30551. }
  30552. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  30553. offsets = includeScroll(offsets, parent);
  30554. }
  30555. return offsets;
  30556. }
  30557. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  30558. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  30559. var html = element.ownerDocument.documentElement;
  30560. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  30561. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  30562. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  30563. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  30564. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  30565. var offset = {
  30566. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  30567. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  30568. width: width,
  30569. height: height
  30570. };
  30571. return getClientRect(offset);
  30572. }
  30573. /**
  30574. * Check if the given element is fixed or is inside a fixed parent
  30575. * @method
  30576. * @memberof Popper.Utils
  30577. * @argument {Element} element
  30578. * @argument {Element} customContainer
  30579. * @returns {Boolean} answer to "isFixed?"
  30580. */
  30581. function isFixed(element) {
  30582. var nodeName = element.nodeName;
  30583. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30584. return false;
  30585. }
  30586. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  30587. return true;
  30588. }
  30589. var parentNode = getParentNode(element);
  30590. if (!parentNode) {
  30591. return false;
  30592. }
  30593. return isFixed(parentNode);
  30594. }
  30595. /**
  30596. * Finds the first parent of an element that has a transformed property defined
  30597. * @method
  30598. * @memberof Popper.Utils
  30599. * @argument {Element} element
  30600. * @returns {Element} first transformed parent or documentElement
  30601. */
  30602. function getFixedPositionOffsetParent(element) {
  30603. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30604. if (!element || !element.parentElement || isIE()) {
  30605. return document.documentElement;
  30606. }
  30607. var el = element.parentElement;
  30608. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  30609. el = el.parentElement;
  30610. }
  30611. return el || document.documentElement;
  30612. }
  30613. /**
  30614. * Computed the boundaries limits and return them
  30615. * @method
  30616. * @memberof Popper.Utils
  30617. * @param {HTMLElement} popper
  30618. * @param {HTMLElement} reference
  30619. * @param {number} padding
  30620. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  30621. * @param {Boolean} fixedPosition - Is in fixed position mode
  30622. * @returns {Object} Coordinates of the boundaries
  30623. */
  30624. function getBoundaries(popper, reference, padding, boundariesElement) {
  30625. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  30626. // NOTE: 1 DOM access here
  30627. var boundaries = { top: 0, left: 0 };
  30628. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30629. // Handle viewport case
  30630. if (boundariesElement === 'viewport') {
  30631. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  30632. } else {
  30633. // Handle other cases based on DOM element used as boundaries
  30634. var boundariesNode = void 0;
  30635. if (boundariesElement === 'scrollParent') {
  30636. boundariesNode = getScrollParent(getParentNode(reference));
  30637. if (boundariesNode.nodeName === 'BODY') {
  30638. boundariesNode = popper.ownerDocument.documentElement;
  30639. }
  30640. } else if (boundariesElement === 'window') {
  30641. boundariesNode = popper.ownerDocument.documentElement;
  30642. } else {
  30643. boundariesNode = boundariesElement;
  30644. }
  30645. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  30646. // In case of HTML, we need a different computation
  30647. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  30648. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  30649. height = _getWindowSizes.height,
  30650. width = _getWindowSizes.width;
  30651. boundaries.top += offsets.top - offsets.marginTop;
  30652. boundaries.bottom = height + offsets.top;
  30653. boundaries.left += offsets.left - offsets.marginLeft;
  30654. boundaries.right = width + offsets.left;
  30655. } else {
  30656. // for all the other DOM elements, this one is good
  30657. boundaries = offsets;
  30658. }
  30659. }
  30660. // Add paddings
  30661. padding = padding || 0;
  30662. var isPaddingNumber = typeof padding === 'number';
  30663. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  30664. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  30665. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  30666. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  30667. return boundaries;
  30668. }
  30669. function getArea(_ref) {
  30670. var width = _ref.width,
  30671. height = _ref.height;
  30672. return width * height;
  30673. }
  30674. /**
  30675. * Utility used to transform the `auto` placement to the placement with more
  30676. * available space.
  30677. * @method
  30678. * @memberof Popper.Utils
  30679. * @argument {Object} data - The data object generated by update method
  30680. * @argument {Object} options - Modifiers configuration and options
  30681. * @returns {Object} The data object, properly modified
  30682. */
  30683. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  30684. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  30685. if (placement.indexOf('auto') === -1) {
  30686. return placement;
  30687. }
  30688. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  30689. var rects = {
  30690. top: {
  30691. width: boundaries.width,
  30692. height: refRect.top - boundaries.top
  30693. },
  30694. right: {
  30695. width: boundaries.right - refRect.right,
  30696. height: boundaries.height
  30697. },
  30698. bottom: {
  30699. width: boundaries.width,
  30700. height: boundaries.bottom - refRect.bottom
  30701. },
  30702. left: {
  30703. width: refRect.left - boundaries.left,
  30704. height: boundaries.height
  30705. }
  30706. };
  30707. var sortedAreas = Object.keys(rects).map(function (key) {
  30708. return _extends({
  30709. key: key
  30710. }, rects[key], {
  30711. area: getArea(rects[key])
  30712. });
  30713. }).sort(function (a, b) {
  30714. return b.area - a.area;
  30715. });
  30716. var filteredAreas = sortedAreas.filter(function (_ref2) {
  30717. var width = _ref2.width,
  30718. height = _ref2.height;
  30719. return width >= popper.clientWidth && height >= popper.clientHeight;
  30720. });
  30721. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  30722. var variation = placement.split('-')[1];
  30723. return computedPlacement + (variation ? '-' + variation : '');
  30724. }
  30725. /**
  30726. * Get offsets to the reference element
  30727. * @method
  30728. * @memberof Popper.Utils
  30729. * @param {Object} state
  30730. * @param {Element} popper - the popper element
  30731. * @param {Element} reference - the reference element (the popper will be relative to this)
  30732. * @param {Element} fixedPosition - is in fixed position mode
  30733. * @returns {Object} An object containing the offsets which will be applied to the popper
  30734. */
  30735. function getReferenceOffsets(state, popper, reference) {
  30736. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  30737. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30738. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  30739. }
  30740. /**
  30741. * Get the outer sizes of the given element (offset size + margins)
  30742. * @method
  30743. * @memberof Popper.Utils
  30744. * @argument {Element} element
  30745. * @returns {Object} object containing width and height properties
  30746. */
  30747. function getOuterSizes(element) {
  30748. var window = element.ownerDocument.defaultView;
  30749. var styles = window.getComputedStyle(element);
  30750. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  30751. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  30752. var result = {
  30753. width: element.offsetWidth + y,
  30754. height: element.offsetHeight + x
  30755. };
  30756. return result;
  30757. }
  30758. /**
  30759. * Get the opposite placement of the given one
  30760. * @method
  30761. * @memberof Popper.Utils
  30762. * @argument {String} placement
  30763. * @returns {String} flipped placement
  30764. */
  30765. function getOppositePlacement(placement) {
  30766. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  30767. return placement.replace(/left|right|bottom|top/g, function (matched) {
  30768. return hash[matched];
  30769. });
  30770. }
  30771. /**
  30772. * Get offsets to the popper
  30773. * @method
  30774. * @memberof Popper.Utils
  30775. * @param {Object} position - CSS position the Popper will get applied
  30776. * @param {HTMLElement} popper - the popper element
  30777. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  30778. * @param {String} placement - one of the valid placement options
  30779. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  30780. */
  30781. function getPopperOffsets(popper, referenceOffsets, placement) {
  30782. placement = placement.split('-')[0];
  30783. // Get popper node sizes
  30784. var popperRect = getOuterSizes(popper);
  30785. // Add position, width and height to our offsets object
  30786. var popperOffsets = {
  30787. width: popperRect.width,
  30788. height: popperRect.height
  30789. };
  30790. // depending by the popper placement we have to compute its offsets slightly differently
  30791. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  30792. var mainSide = isHoriz ? 'top' : 'left';
  30793. var secondarySide = isHoriz ? 'left' : 'top';
  30794. var measurement = isHoriz ? 'height' : 'width';
  30795. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  30796. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  30797. if (placement === secondarySide) {
  30798. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  30799. } else {
  30800. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  30801. }
  30802. return popperOffsets;
  30803. }
  30804. /**
  30805. * Mimics the `find` method of Array
  30806. * @method
  30807. * @memberof Popper.Utils
  30808. * @argument {Array} arr
  30809. * @argument prop
  30810. * @argument value
  30811. * @returns index or -1
  30812. */
  30813. function find(arr, check) {
  30814. // use native find if supported
  30815. if (Array.prototype.find) {
  30816. return arr.find(check);
  30817. }
  30818. // use `filter` to obtain the same behavior of `find`
  30819. return arr.filter(check)[0];
  30820. }
  30821. /**
  30822. * Return the index of the matching object
  30823. * @method
  30824. * @memberof Popper.Utils
  30825. * @argument {Array} arr
  30826. * @argument prop
  30827. * @argument value
  30828. * @returns index or -1
  30829. */
  30830. function findIndex(arr, prop, value) {
  30831. // use native findIndex if supported
  30832. if (Array.prototype.findIndex) {
  30833. return arr.findIndex(function (cur) {
  30834. return cur[prop] === value;
  30835. });
  30836. }
  30837. // use `find` + `indexOf` if `findIndex` isn't supported
  30838. var match = find(arr, function (obj) {
  30839. return obj[prop] === value;
  30840. });
  30841. return arr.indexOf(match);
  30842. }
  30843. /**
  30844. * Loop trough the list of modifiers and run them in order,
  30845. * each of them will then edit the data object.
  30846. * @method
  30847. * @memberof Popper.Utils
  30848. * @param {dataObject} data
  30849. * @param {Array} modifiers
  30850. * @param {String} ends - Optional modifier name used as stopper
  30851. * @returns {dataObject}
  30852. */
  30853. function runModifiers(modifiers, data, ends) {
  30854. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  30855. modifiersToRun.forEach(function (modifier) {
  30856. if (modifier['function']) {
  30857. // eslint-disable-line dot-notation
  30858. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  30859. }
  30860. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  30861. if (modifier.enabled && isFunction(fn)) {
  30862. // Add properties to offsets to make them a complete clientRect object
  30863. // we do this before each modifier to make sure the previous one doesn't
  30864. // mess with these values
  30865. data.offsets.popper = getClientRect(data.offsets.popper);
  30866. data.offsets.reference = getClientRect(data.offsets.reference);
  30867. data = fn(data, modifier);
  30868. }
  30869. });
  30870. return data;
  30871. }
  30872. /**
  30873. * Updates the position of the popper, computing the new offsets and applying
  30874. * the new style.<br />
  30875. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  30876. * @method
  30877. * @memberof Popper
  30878. */
  30879. function update() {
  30880. // if popper is destroyed, don't perform any further update
  30881. if (this.state.isDestroyed) {
  30882. return;
  30883. }
  30884. var data = {
  30885. instance: this,
  30886. styles: {},
  30887. arrowStyles: {},
  30888. attributes: {},
  30889. flipped: false,
  30890. offsets: {}
  30891. };
  30892. // compute reference element offsets
  30893. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  30894. // compute auto placement, store placement inside the data object,
  30895. // modifiers will be able to edit `placement` if needed
  30896. // and refer to originalPlacement to know the original value
  30897. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  30898. // store the computed placement inside `originalPlacement`
  30899. data.originalPlacement = data.placement;
  30900. data.positionFixed = this.options.positionFixed;
  30901. // compute the popper offsets
  30902. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  30903. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  30904. // run the modifiers
  30905. data = runModifiers(this.modifiers, data);
  30906. // the first `update` will call `onCreate` callback
  30907. // the other ones will call `onUpdate` callback
  30908. if (!this.state.isCreated) {
  30909. this.state.isCreated = true;
  30910. this.options.onCreate(data);
  30911. } else {
  30912. this.options.onUpdate(data);
  30913. }
  30914. }
  30915. /**
  30916. * Helper used to know if the given modifier is enabled.
  30917. * @method
  30918. * @memberof Popper.Utils
  30919. * @returns {Boolean}
  30920. */
  30921. function isModifierEnabled(modifiers, modifierName) {
  30922. return modifiers.some(function (_ref) {
  30923. var name = _ref.name,
  30924. enabled = _ref.enabled;
  30925. return enabled && name === modifierName;
  30926. });
  30927. }
  30928. /**
  30929. * Get the prefixed supported property name
  30930. * @method
  30931. * @memberof Popper.Utils
  30932. * @argument {String} property (camelCase)
  30933. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  30934. */
  30935. function getSupportedPropertyName(property) {
  30936. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  30937. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  30938. for (var i = 0; i < prefixes.length; i++) {
  30939. var prefix = prefixes[i];
  30940. var toCheck = prefix ? '' + prefix + upperProp : property;
  30941. if (typeof document.body.style[toCheck] !== 'undefined') {
  30942. return toCheck;
  30943. }
  30944. }
  30945. return null;
  30946. }
  30947. /**
  30948. * Destroys the popper.
  30949. * @method
  30950. * @memberof Popper
  30951. */
  30952. function destroy() {
  30953. this.state.isDestroyed = true;
  30954. // touch DOM only if `applyStyle` modifier is enabled
  30955. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  30956. this.popper.removeAttribute('x-placement');
  30957. this.popper.style.position = '';
  30958. this.popper.style.top = '';
  30959. this.popper.style.left = '';
  30960. this.popper.style.right = '';
  30961. this.popper.style.bottom = '';
  30962. this.popper.style.willChange = '';
  30963. this.popper.style[getSupportedPropertyName('transform')] = '';
  30964. }
  30965. this.disableEventListeners();
  30966. // remove the popper if user explicitly asked for the deletion on destroy
  30967. // do not use `remove` because IE11 doesn't support it
  30968. if (this.options.removeOnDestroy) {
  30969. this.popper.parentNode.removeChild(this.popper);
  30970. }
  30971. return this;
  30972. }
  30973. /**
  30974. * Get the window associated with the element
  30975. * @argument {Element} element
  30976. * @returns {Window}
  30977. */
  30978. function getWindow(element) {
  30979. var ownerDocument = element.ownerDocument;
  30980. return ownerDocument ? ownerDocument.defaultView : window;
  30981. }
  30982. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  30983. var isBody = scrollParent.nodeName === 'BODY';
  30984. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  30985. target.addEventListener(event, callback, { passive: true });
  30986. if (!isBody) {
  30987. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  30988. }
  30989. scrollParents.push(target);
  30990. }
  30991. /**
  30992. * Setup needed event listeners used to update the popper position
  30993. * @method
  30994. * @memberof Popper.Utils
  30995. * @private
  30996. */
  30997. function setupEventListeners(reference, options, state, updateBound) {
  30998. // Resize event listener on window
  30999. state.updateBound = updateBound;
  31000. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  31001. // Scroll event listener on scroll parents
  31002. var scrollElement = getScrollParent(reference);
  31003. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  31004. state.scrollElement = scrollElement;
  31005. state.eventsEnabled = true;
  31006. return state;
  31007. }
  31008. /**
  31009. * It will add resize/scroll events and start recalculating
  31010. * position of the popper element when they are triggered.
  31011. * @method
  31012. * @memberof Popper
  31013. */
  31014. function enableEventListeners() {
  31015. if (!this.state.eventsEnabled) {
  31016. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  31017. }
  31018. }
  31019. /**
  31020. * Remove event listeners used to update the popper position
  31021. * @method
  31022. * @memberof Popper.Utils
  31023. * @private
  31024. */
  31025. function removeEventListeners(reference, state) {
  31026. // Remove resize event listener on window
  31027. getWindow(reference).removeEventListener('resize', state.updateBound);
  31028. // Remove scroll event listener on scroll parents
  31029. state.scrollParents.forEach(function (target) {
  31030. target.removeEventListener('scroll', state.updateBound);
  31031. });
  31032. // Reset state
  31033. state.updateBound = null;
  31034. state.scrollParents = [];
  31035. state.scrollElement = null;
  31036. state.eventsEnabled = false;
  31037. return state;
  31038. }
  31039. /**
  31040. * It will remove resize/scroll events and won't recalculate popper position
  31041. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  31042. * unless you call `update` method manually.
  31043. * @method
  31044. * @memberof Popper
  31045. */
  31046. function disableEventListeners() {
  31047. if (this.state.eventsEnabled) {
  31048. cancelAnimationFrame(this.scheduleUpdate);
  31049. this.state = removeEventListeners(this.reference, this.state);
  31050. }
  31051. }
  31052. /**
  31053. * Tells if a given input is a number
  31054. * @method
  31055. * @memberof Popper.Utils
  31056. * @param {*} input to check
  31057. * @return {Boolean}
  31058. */
  31059. function isNumeric(n) {
  31060. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  31061. }
  31062. /**
  31063. * Set the style to the given popper
  31064. * @method
  31065. * @memberof Popper.Utils
  31066. * @argument {Element} element - Element to apply the style to
  31067. * @argument {Object} styles
  31068. * Object with a list of properties and values which will be applied to the element
  31069. */
  31070. function setStyles(element, styles) {
  31071. Object.keys(styles).forEach(function (prop) {
  31072. var unit = '';
  31073. // add unit if the value is numeric and is one of the following
  31074. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  31075. unit = 'px';
  31076. }
  31077. element.style[prop] = styles[prop] + unit;
  31078. });
  31079. }
  31080. /**
  31081. * Set the attributes to the given popper
  31082. * @method
  31083. * @memberof Popper.Utils
  31084. * @argument {Element} element - Element to apply the attributes to
  31085. * @argument {Object} styles
  31086. * Object with a list of properties and values which will be applied to the element
  31087. */
  31088. function setAttributes(element, attributes) {
  31089. Object.keys(attributes).forEach(function (prop) {
  31090. var value = attributes[prop];
  31091. if (value !== false) {
  31092. element.setAttribute(prop, attributes[prop]);
  31093. } else {
  31094. element.removeAttribute(prop);
  31095. }
  31096. });
  31097. }
  31098. /**
  31099. * @function
  31100. * @memberof Modifiers
  31101. * @argument {Object} data - The data object generated by `update` method
  31102. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  31103. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  31104. * @argument {Object} options - Modifiers configuration and options
  31105. * @returns {Object} The same data object
  31106. */
  31107. function applyStyle(data) {
  31108. // any property present in `data.styles` will be applied to the popper,
  31109. // in this way we can make the 3rd party modifiers add custom styles to it
  31110. // Be aware, modifiers could override the properties defined in the previous
  31111. // lines of this modifier!
  31112. setStyles(data.instance.popper, data.styles);
  31113. // any property present in `data.attributes` will be applied to the popper,
  31114. // they will be set as HTML attributes of the element
  31115. setAttributes(data.instance.popper, data.attributes);
  31116. // if arrowElement is defined and arrowStyles has some properties
  31117. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  31118. setStyles(data.arrowElement, data.arrowStyles);
  31119. }
  31120. return data;
  31121. }
  31122. /**
  31123. * Set the x-placement attribute before everything else because it could be used
  31124. * to add margins to the popper margins needs to be calculated to get the
  31125. * correct popper offsets.
  31126. * @method
  31127. * @memberof Popper.modifiers
  31128. * @param {HTMLElement} reference - The reference element used to position the popper
  31129. * @param {HTMLElement} popper - The HTML element used as popper
  31130. * @param {Object} options - Popper.js options
  31131. */
  31132. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  31133. // compute reference element offsets
  31134. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  31135. // compute auto placement, store placement inside the data object,
  31136. // modifiers will be able to edit `placement` if needed
  31137. // and refer to originalPlacement to know the original value
  31138. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  31139. popper.setAttribute('x-placement', placement);
  31140. // Apply `position` to popper before anything else because
  31141. // without the position applied we can't guarantee correct computations
  31142. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  31143. return options;
  31144. }
  31145. /**
  31146. * @function
  31147. * @memberof Popper.Utils
  31148. * @argument {Object} data - The data object generated by `update` method
  31149. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  31150. * @returns {Object} The popper's position offsets rounded
  31151. *
  31152. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  31153. * good as it can be within reason.
  31154. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  31155. *
  31156. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  31157. * as well on High DPI screens).
  31158. *
  31159. * Firefox prefers no rounding for positioning and does not have blurriness on
  31160. * high DPI screens.
  31161. *
  31162. * Only horizontal placement and left/right values need to be considered.
  31163. */
  31164. function getRoundedOffsets(data, shouldRound) {
  31165. var _data$offsets = data.offsets,
  31166. popper = _data$offsets.popper,
  31167. reference = _data$offsets.reference;
  31168. var round = Math.round,
  31169. floor = Math.floor;
  31170. var noRound = function noRound(v) {
  31171. return v;
  31172. };
  31173. var referenceWidth = round(reference.width);
  31174. var popperWidth = round(popper.width);
  31175. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  31176. var isVariation = data.placement.indexOf('-') !== -1;
  31177. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  31178. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  31179. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  31180. var verticalToInteger = !shouldRound ? noRound : round;
  31181. return {
  31182. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  31183. top: verticalToInteger(popper.top),
  31184. bottom: verticalToInteger(popper.bottom),
  31185. right: horizontalToInteger(popper.right)
  31186. };
  31187. }
  31188. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  31189. /**
  31190. * @function
  31191. * @memberof Modifiers
  31192. * @argument {Object} data - The data object generated by `update` method
  31193. * @argument {Object} options - Modifiers configuration and options
  31194. * @returns {Object} The data object, properly modified
  31195. */
  31196. function computeStyle(data, options) {
  31197. var x = options.x,
  31198. y = options.y;
  31199. var popper = data.offsets.popper;
  31200. // Remove this legacy support in Popper.js v2
  31201. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  31202. return modifier.name === 'applyStyle';
  31203. }).gpuAcceleration;
  31204. if (legacyGpuAccelerationOption !== undefined) {
  31205. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  31206. }
  31207. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  31208. var offsetParent = getOffsetParent(data.instance.popper);
  31209. var offsetParentRect = getBoundingClientRect(offsetParent);
  31210. // Styles
  31211. var styles = {
  31212. position: popper.position
  31213. };
  31214. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  31215. var sideA = x === 'bottom' ? 'top' : 'bottom';
  31216. var sideB = y === 'right' ? 'left' : 'right';
  31217. // if gpuAcceleration is set to `true` and transform is supported,
  31218. // we use `translate3d` to apply the position to the popper we
  31219. // automatically use the supported prefixed version if needed
  31220. var prefixedProperty = getSupportedPropertyName('transform');
  31221. // now, let's make a step back and look at this code closely (wtf?)
  31222. // If the content of the popper grows once it's been positioned, it
  31223. // may happen that the popper gets misplaced because of the new content
  31224. // overflowing its reference element
  31225. // To avoid this problem, we provide two options (x and y), which allow
  31226. // the consumer to define the offset origin.
  31227. // If we position a popper on top of a reference element, we can set
  31228. // `x` to `top` to make the popper grow towards its top instead of
  31229. // its bottom.
  31230. var left = void 0,
  31231. top = void 0;
  31232. if (sideA === 'bottom') {
  31233. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  31234. // and not the bottom of the html element
  31235. if (offsetParent.nodeName === 'HTML') {
  31236. top = -offsetParent.clientHeight + offsets.bottom;
  31237. } else {
  31238. top = -offsetParentRect.height + offsets.bottom;
  31239. }
  31240. } else {
  31241. top = offsets.top;
  31242. }
  31243. if (sideB === 'right') {
  31244. if (offsetParent.nodeName === 'HTML') {
  31245. left = -offsetParent.clientWidth + offsets.right;
  31246. } else {
  31247. left = -offsetParentRect.width + offsets.right;
  31248. }
  31249. } else {
  31250. left = offsets.left;
  31251. }
  31252. if (gpuAcceleration && prefixedProperty) {
  31253. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  31254. styles[sideA] = 0;
  31255. styles[sideB] = 0;
  31256. styles.willChange = 'transform';
  31257. } else {
  31258. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  31259. var invertTop = sideA === 'bottom' ? -1 : 1;
  31260. var invertLeft = sideB === 'right' ? -1 : 1;
  31261. styles[sideA] = top * invertTop;
  31262. styles[sideB] = left * invertLeft;
  31263. styles.willChange = sideA + ', ' + sideB;
  31264. }
  31265. // Attributes
  31266. var attributes = {
  31267. 'x-placement': data.placement
  31268. };
  31269. // Update `data` attributes, styles and arrowStyles
  31270. data.attributes = _extends({}, attributes, data.attributes);
  31271. data.styles = _extends({}, styles, data.styles);
  31272. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  31273. return data;
  31274. }
  31275. /**
  31276. * Helper used to know if the given modifier depends from another one.<br />
  31277. * It checks if the needed modifier is listed and enabled.
  31278. * @method
  31279. * @memberof Popper.Utils
  31280. * @param {Array} modifiers - list of modifiers
  31281. * @param {String} requestingName - name of requesting modifier
  31282. * @param {String} requestedName - name of requested modifier
  31283. * @returns {Boolean}
  31284. */
  31285. function isModifierRequired(modifiers, requestingName, requestedName) {
  31286. var requesting = find(modifiers, function (_ref) {
  31287. var name = _ref.name;
  31288. return name === requestingName;
  31289. });
  31290. var isRequired = !!requesting && modifiers.some(function (modifier) {
  31291. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  31292. });
  31293. if (!isRequired) {
  31294. var _requesting = '`' + requestingName + '`';
  31295. var requested = '`' + requestedName + '`';
  31296. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  31297. }
  31298. return isRequired;
  31299. }
  31300. /**
  31301. * @function
  31302. * @memberof Modifiers
  31303. * @argument {Object} data - The data object generated by update method
  31304. * @argument {Object} options - Modifiers configuration and options
  31305. * @returns {Object} The data object, properly modified
  31306. */
  31307. function arrow(data, options) {
  31308. var _data$offsets$arrow;
  31309. // arrow depends on keepTogether in order to work
  31310. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  31311. return data;
  31312. }
  31313. var arrowElement = options.element;
  31314. // if arrowElement is a string, suppose it's a CSS selector
  31315. if (typeof arrowElement === 'string') {
  31316. arrowElement = data.instance.popper.querySelector(arrowElement);
  31317. // if arrowElement is not found, don't run the modifier
  31318. if (!arrowElement) {
  31319. return data;
  31320. }
  31321. } else {
  31322. // if the arrowElement isn't a query selector we must check that the
  31323. // provided DOM node is child of its popper node
  31324. if (!data.instance.popper.contains(arrowElement)) {
  31325. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  31326. return data;
  31327. }
  31328. }
  31329. var placement = data.placement.split('-')[0];
  31330. var _data$offsets = data.offsets,
  31331. popper = _data$offsets.popper,
  31332. reference = _data$offsets.reference;
  31333. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  31334. var len = isVertical ? 'height' : 'width';
  31335. var sideCapitalized = isVertical ? 'Top' : 'Left';
  31336. var side = sideCapitalized.toLowerCase();
  31337. var altSide = isVertical ? 'left' : 'top';
  31338. var opSide = isVertical ? 'bottom' : 'right';
  31339. var arrowElementSize = getOuterSizes(arrowElement)[len];
  31340. //
  31341. // extends keepTogether behavior making sure the popper and its
  31342. // reference have enough pixels in conjunction
  31343. //
  31344. // top/left side
  31345. if (reference[opSide] - arrowElementSize < popper[side]) {
  31346. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  31347. }
  31348. // bottom/right side
  31349. if (reference[side] + arrowElementSize > popper[opSide]) {
  31350. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  31351. }
  31352. data.offsets.popper = getClientRect(data.offsets.popper);
  31353. // compute center of the popper
  31354. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  31355. // Compute the sideValue using the updated popper offsets
  31356. // take popper margin in account because we don't have this info available
  31357. var css = getStyleComputedProperty(data.instance.popper);
  31358. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  31359. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  31360. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  31361. // prevent arrowElement from being placed not contiguously to its popper
  31362. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  31363. data.arrowElement = arrowElement;
  31364. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  31365. return data;
  31366. }
  31367. /**
  31368. * Get the opposite placement variation of the given one
  31369. * @method
  31370. * @memberof Popper.Utils
  31371. * @argument {String} placement variation
  31372. * @returns {String} flipped placement variation
  31373. */
  31374. function getOppositeVariation(variation) {
  31375. if (variation === 'end') {
  31376. return 'start';
  31377. } else if (variation === 'start') {
  31378. return 'end';
  31379. }
  31380. return variation;
  31381. }
  31382. /**
  31383. * List of accepted placements to use as values of the `placement` option.<br />
  31384. * Valid placements are:
  31385. * - `auto`
  31386. * - `top`
  31387. * - `right`
  31388. * - `bottom`
  31389. * - `left`
  31390. *
  31391. * Each placement can have a variation from this list:
  31392. * - `-start`
  31393. * - `-end`
  31394. *
  31395. * Variations are interpreted easily if you think of them as the left to right
  31396. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  31397. * is right.<br />
  31398. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  31399. *
  31400. * Some valid examples are:
  31401. * - `top-end` (on top of reference, right aligned)
  31402. * - `right-start` (on right of reference, top aligned)
  31403. * - `bottom` (on bottom, centered)
  31404. * - `auto-end` (on the side with more space available, alignment depends by placement)
  31405. *
  31406. * @static
  31407. * @type {Array}
  31408. * @enum {String}
  31409. * @readonly
  31410. * @method placements
  31411. * @memberof Popper
  31412. */
  31413. 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'];
  31414. // Get rid of `auto` `auto-start` and `auto-end`
  31415. var validPlacements = placements.slice(3);
  31416. /**
  31417. * Given an initial placement, returns all the subsequent placements
  31418. * clockwise (or counter-clockwise).
  31419. *
  31420. * @method
  31421. * @memberof Popper.Utils
  31422. * @argument {String} placement - A valid placement (it accepts variations)
  31423. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  31424. * @returns {Array} placements including their variations
  31425. */
  31426. function clockwise(placement) {
  31427. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  31428. var index = validPlacements.indexOf(placement);
  31429. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  31430. return counter ? arr.reverse() : arr;
  31431. }
  31432. var BEHAVIORS = {
  31433. FLIP: 'flip',
  31434. CLOCKWISE: 'clockwise',
  31435. COUNTERCLOCKWISE: 'counterclockwise'
  31436. };
  31437. /**
  31438. * @function
  31439. * @memberof Modifiers
  31440. * @argument {Object} data - The data object generated by update method
  31441. * @argument {Object} options - Modifiers configuration and options
  31442. * @returns {Object} The data object, properly modified
  31443. */
  31444. function flip(data, options) {
  31445. // if `inner` modifier is enabled, we can't use the `flip` modifier
  31446. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  31447. return data;
  31448. }
  31449. if (data.flipped && data.placement === data.originalPlacement) {
  31450. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  31451. return data;
  31452. }
  31453. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  31454. var placement = data.placement.split('-')[0];
  31455. var placementOpposite = getOppositePlacement(placement);
  31456. var variation = data.placement.split('-')[1] || '';
  31457. var flipOrder = [];
  31458. switch (options.behavior) {
  31459. case BEHAVIORS.FLIP:
  31460. flipOrder = [placement, placementOpposite];
  31461. break;
  31462. case BEHAVIORS.CLOCKWISE:
  31463. flipOrder = clockwise(placement);
  31464. break;
  31465. case BEHAVIORS.COUNTERCLOCKWISE:
  31466. flipOrder = clockwise(placement, true);
  31467. break;
  31468. default:
  31469. flipOrder = options.behavior;
  31470. }
  31471. flipOrder.forEach(function (step, index) {
  31472. if (placement !== step || flipOrder.length === index + 1) {
  31473. return data;
  31474. }
  31475. placement = data.placement.split('-')[0];
  31476. placementOpposite = getOppositePlacement(placement);
  31477. var popperOffsets = data.offsets.popper;
  31478. var refOffsets = data.offsets.reference;
  31479. // using floor because the reference offsets may contain decimals we are not going to consider here
  31480. var floor = Math.floor;
  31481. 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);
  31482. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  31483. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  31484. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  31485. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  31486. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  31487. // flip the variation if required
  31488. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31489. // flips variation if reference element overflows boundaries
  31490. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  31491. // flips variation if popper content overflows boundaries
  31492. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  31493. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  31494. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  31495. // this boolean to detect any flip loop
  31496. data.flipped = true;
  31497. if (overlapsRef || overflowsBoundaries) {
  31498. placement = flipOrder[index + 1];
  31499. }
  31500. if (flippedVariation) {
  31501. variation = getOppositeVariation(variation);
  31502. }
  31503. data.placement = placement + (variation ? '-' + variation : '');
  31504. // this object contains `position`, we want to preserve it along with
  31505. // any additional property we may add in the future
  31506. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  31507. data = runModifiers(data.instance.modifiers, data, 'flip');
  31508. }
  31509. });
  31510. return data;
  31511. }
  31512. /**
  31513. * @function
  31514. * @memberof Modifiers
  31515. * @argument {Object} data - The data object generated by update method
  31516. * @argument {Object} options - Modifiers configuration and options
  31517. * @returns {Object} The data object, properly modified
  31518. */
  31519. function keepTogether(data) {
  31520. var _data$offsets = data.offsets,
  31521. popper = _data$offsets.popper,
  31522. reference = _data$offsets.reference;
  31523. var placement = data.placement.split('-')[0];
  31524. var floor = Math.floor;
  31525. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31526. var side = isVertical ? 'right' : 'bottom';
  31527. var opSide = isVertical ? 'left' : 'top';
  31528. var measurement = isVertical ? 'width' : 'height';
  31529. if (popper[side] < floor(reference[opSide])) {
  31530. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  31531. }
  31532. if (popper[opSide] > floor(reference[side])) {
  31533. data.offsets.popper[opSide] = floor(reference[side]);
  31534. }
  31535. return data;
  31536. }
  31537. /**
  31538. * Converts a string containing value + unit into a px value number
  31539. * @function
  31540. * @memberof {modifiers~offset}
  31541. * @private
  31542. * @argument {String} str - Value + unit string
  31543. * @argument {String} measurement - `height` or `width`
  31544. * @argument {Object} popperOffsets
  31545. * @argument {Object} referenceOffsets
  31546. * @returns {Number|String}
  31547. * Value in pixels, or original string if no values were extracted
  31548. */
  31549. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  31550. // separate value from unit
  31551. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  31552. var value = +split[1];
  31553. var unit = split[2];
  31554. // If it's not a number it's an operator, I guess
  31555. if (!value) {
  31556. return str;
  31557. }
  31558. if (unit.indexOf('%') === 0) {
  31559. var element = void 0;
  31560. switch (unit) {
  31561. case '%p':
  31562. element = popperOffsets;
  31563. break;
  31564. case '%':
  31565. case '%r':
  31566. default:
  31567. element = referenceOffsets;
  31568. }
  31569. var rect = getClientRect(element);
  31570. return rect[measurement] / 100 * value;
  31571. } else if (unit === 'vh' || unit === 'vw') {
  31572. // if is a vh or vw, we calculate the size based on the viewport
  31573. var size = void 0;
  31574. if (unit === 'vh') {
  31575. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  31576. } else {
  31577. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  31578. }
  31579. return size / 100 * value;
  31580. } else {
  31581. // if is an explicit pixel unit, we get rid of the unit and keep the value
  31582. // if is an implicit unit, it's px, and we return just the value
  31583. return value;
  31584. }
  31585. }
  31586. /**
  31587. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  31588. * @function
  31589. * @memberof {modifiers~offset}
  31590. * @private
  31591. * @argument {String} offset
  31592. * @argument {Object} popperOffsets
  31593. * @argument {Object} referenceOffsets
  31594. * @argument {String} basePlacement
  31595. * @returns {Array} a two cells array with x and y offsets in numbers
  31596. */
  31597. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  31598. var offsets = [0, 0];
  31599. // Use height if placement is left or right and index is 0 otherwise use width
  31600. // in this way the first offset will use an axis and the second one
  31601. // will use the other one
  31602. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  31603. // Split the offset string to obtain a list of values and operands
  31604. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  31605. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  31606. return frag.trim();
  31607. });
  31608. // Detect if the offset string contains a pair of values or a single one
  31609. // they could be separated by comma or space
  31610. var divider = fragments.indexOf(find(fragments, function (frag) {
  31611. return frag.search(/,|\s/) !== -1;
  31612. }));
  31613. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  31614. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  31615. }
  31616. // If divider is found, we divide the list of values and operands to divide
  31617. // them by ofset X and Y.
  31618. var splitRegex = /\s*,\s*|\s+/;
  31619. 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];
  31620. // Convert the values with units to absolute pixels to allow our computations
  31621. ops = ops.map(function (op, index) {
  31622. // Most of the units rely on the orientation of the popper
  31623. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  31624. var mergeWithPrevious = false;
  31625. return op
  31626. // This aggregates any `+` or `-` sign that aren't considered operators
  31627. // e.g.: 10 + +5 => [10, +, +5]
  31628. .reduce(function (a, b) {
  31629. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  31630. a[a.length - 1] = b;
  31631. mergeWithPrevious = true;
  31632. return a;
  31633. } else if (mergeWithPrevious) {
  31634. a[a.length - 1] += b;
  31635. mergeWithPrevious = false;
  31636. return a;
  31637. } else {
  31638. return a.concat(b);
  31639. }
  31640. }, [])
  31641. // Here we convert the string values into number values (in px)
  31642. .map(function (str) {
  31643. return toValue(str, measurement, popperOffsets, referenceOffsets);
  31644. });
  31645. });
  31646. // Loop trough the offsets arrays and execute the operations
  31647. ops.forEach(function (op, index) {
  31648. op.forEach(function (frag, index2) {
  31649. if (isNumeric(frag)) {
  31650. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  31651. }
  31652. });
  31653. });
  31654. return offsets;
  31655. }
  31656. /**
  31657. * @function
  31658. * @memberof Modifiers
  31659. * @argument {Object} data - The data object generated by update method
  31660. * @argument {Object} options - Modifiers configuration and options
  31661. * @argument {Number|String} options.offset=0
  31662. * The offset value as described in the modifier description
  31663. * @returns {Object} The data object, properly modified
  31664. */
  31665. function offset(data, _ref) {
  31666. var offset = _ref.offset;
  31667. var placement = data.placement,
  31668. _data$offsets = data.offsets,
  31669. popper = _data$offsets.popper,
  31670. reference = _data$offsets.reference;
  31671. var basePlacement = placement.split('-')[0];
  31672. var offsets = void 0;
  31673. if (isNumeric(+offset)) {
  31674. offsets = [+offset, 0];
  31675. } else {
  31676. offsets = parseOffset(offset, popper, reference, basePlacement);
  31677. }
  31678. if (basePlacement === 'left') {
  31679. popper.top += offsets[0];
  31680. popper.left -= offsets[1];
  31681. } else if (basePlacement === 'right') {
  31682. popper.top += offsets[0];
  31683. popper.left += offsets[1];
  31684. } else if (basePlacement === 'top') {
  31685. popper.left += offsets[0];
  31686. popper.top -= offsets[1];
  31687. } else if (basePlacement === 'bottom') {
  31688. popper.left += offsets[0];
  31689. popper.top += offsets[1];
  31690. }
  31691. data.popper = popper;
  31692. return data;
  31693. }
  31694. /**
  31695. * @function
  31696. * @memberof Modifiers
  31697. * @argument {Object} data - The data object generated by `update` method
  31698. * @argument {Object} options - Modifiers configuration and options
  31699. * @returns {Object} The data object, properly modified
  31700. */
  31701. function preventOverflow(data, options) {
  31702. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  31703. // If offsetParent is the reference element, we really want to
  31704. // go one step up and use the next offsetParent as reference to
  31705. // avoid to make this modifier completely useless and look like broken
  31706. if (data.instance.reference === boundariesElement) {
  31707. boundariesElement = getOffsetParent(boundariesElement);
  31708. }
  31709. // NOTE: DOM access here
  31710. // resets the popper's position so that the document size can be calculated excluding
  31711. // the size of the popper element itself
  31712. var transformProp = getSupportedPropertyName('transform');
  31713. var popperStyles = data.instance.popper.style; // assignment to help minification
  31714. var top = popperStyles.top,
  31715. left = popperStyles.left,
  31716. transform = popperStyles[transformProp];
  31717. popperStyles.top = '';
  31718. popperStyles.left = '';
  31719. popperStyles[transformProp] = '';
  31720. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  31721. // NOTE: DOM access here
  31722. // restores the original style properties after the offsets have been computed
  31723. popperStyles.top = top;
  31724. popperStyles.left = left;
  31725. popperStyles[transformProp] = transform;
  31726. options.boundaries = boundaries;
  31727. var order = options.priority;
  31728. var popper = data.offsets.popper;
  31729. var check = {
  31730. primary: function primary(placement) {
  31731. var value = popper[placement];
  31732. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  31733. value = Math.max(popper[placement], boundaries[placement]);
  31734. }
  31735. return defineProperty({}, placement, value);
  31736. },
  31737. secondary: function secondary(placement) {
  31738. var mainSide = placement === 'right' ? 'left' : 'top';
  31739. var value = popper[mainSide];
  31740. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  31741. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  31742. }
  31743. return defineProperty({}, mainSide, value);
  31744. }
  31745. };
  31746. order.forEach(function (placement) {
  31747. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  31748. popper = _extends({}, popper, check[side](placement));
  31749. });
  31750. data.offsets.popper = popper;
  31751. return data;
  31752. }
  31753. /**
  31754. * @function
  31755. * @memberof Modifiers
  31756. * @argument {Object} data - The data object generated by `update` method
  31757. * @argument {Object} options - Modifiers configuration and options
  31758. * @returns {Object} The data object, properly modified
  31759. */
  31760. function shift(data) {
  31761. var placement = data.placement;
  31762. var basePlacement = placement.split('-')[0];
  31763. var shiftvariation = placement.split('-')[1];
  31764. // if shift shiftvariation is specified, run the modifier
  31765. if (shiftvariation) {
  31766. var _data$offsets = data.offsets,
  31767. reference = _data$offsets.reference,
  31768. popper = _data$offsets.popper;
  31769. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  31770. var side = isVertical ? 'left' : 'top';
  31771. var measurement = isVertical ? 'width' : 'height';
  31772. var shiftOffsets = {
  31773. start: defineProperty({}, side, reference[side]),
  31774. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  31775. };
  31776. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  31777. }
  31778. return data;
  31779. }
  31780. /**
  31781. * @function
  31782. * @memberof Modifiers
  31783. * @argument {Object} data - The data object generated by update method
  31784. * @argument {Object} options - Modifiers configuration and options
  31785. * @returns {Object} The data object, properly modified
  31786. */
  31787. function hide(data) {
  31788. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  31789. return data;
  31790. }
  31791. var refRect = data.offsets.reference;
  31792. var bound = find(data.instance.modifiers, function (modifier) {
  31793. return modifier.name === 'preventOverflow';
  31794. }).boundaries;
  31795. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  31796. // Avoid unnecessary DOM access if visibility hasn't changed
  31797. if (data.hide === true) {
  31798. return data;
  31799. }
  31800. data.hide = true;
  31801. data.attributes['x-out-of-boundaries'] = '';
  31802. } else {
  31803. // Avoid unnecessary DOM access if visibility hasn't changed
  31804. if (data.hide === false) {
  31805. return data;
  31806. }
  31807. data.hide = false;
  31808. data.attributes['x-out-of-boundaries'] = false;
  31809. }
  31810. return data;
  31811. }
  31812. /**
  31813. * @function
  31814. * @memberof Modifiers
  31815. * @argument {Object} data - The data object generated by `update` method
  31816. * @argument {Object} options - Modifiers configuration and options
  31817. * @returns {Object} The data object, properly modified
  31818. */
  31819. function inner(data) {
  31820. var placement = data.placement;
  31821. var basePlacement = placement.split('-')[0];
  31822. var _data$offsets = data.offsets,
  31823. popper = _data$offsets.popper,
  31824. reference = _data$offsets.reference;
  31825. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  31826. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  31827. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  31828. data.placement = getOppositePlacement(placement);
  31829. data.offsets.popper = getClientRect(popper);
  31830. return data;
  31831. }
  31832. /**
  31833. * Modifier function, each modifier can have a function of this type assigned
  31834. * to its `fn` property.<br />
  31835. * These functions will be called on each update, this means that you must
  31836. * make sure they are performant enough to avoid performance bottlenecks.
  31837. *
  31838. * @function ModifierFn
  31839. * @argument {dataObject} data - The data object generated by `update` method
  31840. * @argument {Object} options - Modifiers configuration and options
  31841. * @returns {dataObject} The data object, properly modified
  31842. */
  31843. /**
  31844. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  31845. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  31846. * needed by the library.
  31847. *
  31848. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  31849. * All the other properties are configurations that could be tweaked.
  31850. * @namespace modifiers
  31851. */
  31852. var modifiers = {
  31853. /**
  31854. * Modifier used to shift the popper on the start or end of its reference
  31855. * element.<br />
  31856. * It will read the variation of the `placement` property.<br />
  31857. * It can be one either `-end` or `-start`.
  31858. * @memberof modifiers
  31859. * @inner
  31860. */
  31861. shift: {
  31862. /** @prop {number} order=100 - Index used to define the order of execution */
  31863. order: 100,
  31864. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31865. enabled: true,
  31866. /** @prop {ModifierFn} */
  31867. fn: shift
  31868. },
  31869. /**
  31870. * The `offset` modifier can shift your popper on both its axis.
  31871. *
  31872. * It accepts the following units:
  31873. * - `px` or unit-less, interpreted as pixels
  31874. * - `%` or `%r`, percentage relative to the length of the reference element
  31875. * - `%p`, percentage relative to the length of the popper element
  31876. * - `vw`, CSS viewport width unit
  31877. * - `vh`, CSS viewport height unit
  31878. *
  31879. * For length is intended the main axis relative to the placement of the popper.<br />
  31880. * This means that if the placement is `top` or `bottom`, the length will be the
  31881. * `width`. In case of `left` or `right`, it will be the `height`.
  31882. *
  31883. * You can provide a single value (as `Number` or `String`), or a pair of values
  31884. * as `String` divided by a comma or one (or more) white spaces.<br />
  31885. * The latter is a deprecated method because it leads to confusion and will be
  31886. * removed in v2.<br />
  31887. * Additionally, it accepts additions and subtractions between different units.
  31888. * Note that multiplications and divisions aren't supported.
  31889. *
  31890. * Valid examples are:
  31891. * ```
  31892. * 10
  31893. * '10%'
  31894. * '10, 10'
  31895. * '10%, 10'
  31896. * '10 + 10%'
  31897. * '10 - 5vh + 3%'
  31898. * '-10px + 5vh, 5px - 6%'
  31899. * ```
  31900. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  31901. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  31902. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  31903. *
  31904. * @memberof modifiers
  31905. * @inner
  31906. */
  31907. offset: {
  31908. /** @prop {number} order=200 - Index used to define the order of execution */
  31909. order: 200,
  31910. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31911. enabled: true,
  31912. /** @prop {ModifierFn} */
  31913. fn: offset,
  31914. /** @prop {Number|String} offset=0
  31915. * The offset value as described in the modifier description
  31916. */
  31917. offset: 0
  31918. },
  31919. /**
  31920. * Modifier used to prevent the popper from being positioned outside the boundary.
  31921. *
  31922. * A scenario exists where the reference itself is not within the boundaries.<br />
  31923. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  31924. * In this case we need to decide whether the popper should either:
  31925. *
  31926. * - detach from the reference and remain "trapped" in the boundaries, or
  31927. * - if it should ignore the boundary and "escape with its reference"
  31928. *
  31929. * When `escapeWithReference` is set to`true` and reference is completely
  31930. * outside its boundaries, the popper will overflow (or completely leave)
  31931. * the boundaries in order to remain attached to the edge of the reference.
  31932. *
  31933. * @memberof modifiers
  31934. * @inner
  31935. */
  31936. preventOverflow: {
  31937. /** @prop {number} order=300 - Index used to define the order of execution */
  31938. order: 300,
  31939. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31940. enabled: true,
  31941. /** @prop {ModifierFn} */
  31942. fn: preventOverflow,
  31943. /**
  31944. * @prop {Array} [priority=['left','right','top','bottom']]
  31945. * Popper will try to prevent overflow following these priorities by default,
  31946. * then, it could overflow on the left and on top of the `boundariesElement`
  31947. */
  31948. priority: ['left', 'right', 'top', 'bottom'],
  31949. /**
  31950. * @prop {number} padding=5
  31951. * Amount of pixel used to define a minimum distance between the boundaries
  31952. * and the popper. This makes sure the popper always has a little padding
  31953. * between the edges of its container
  31954. */
  31955. padding: 5,
  31956. /**
  31957. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  31958. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  31959. * `viewport` or any DOM element.
  31960. */
  31961. boundariesElement: 'scrollParent'
  31962. },
  31963. /**
  31964. * Modifier used to make sure the reference and its popper stay near each other
  31965. * without leaving any gap between the two. Especially useful when the arrow is
  31966. * enabled and you want to ensure that it points to its reference element.
  31967. * It cares only about the first axis. You can still have poppers with margin
  31968. * between the popper and its reference element.
  31969. * @memberof modifiers
  31970. * @inner
  31971. */
  31972. keepTogether: {
  31973. /** @prop {number} order=400 - Index used to define the order of execution */
  31974. order: 400,
  31975. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31976. enabled: true,
  31977. /** @prop {ModifierFn} */
  31978. fn: keepTogether
  31979. },
  31980. /**
  31981. * This modifier is used to move the `arrowElement` of the popper to make
  31982. * sure it is positioned between the reference element and its popper element.
  31983. * It will read the outer size of the `arrowElement` node to detect how many
  31984. * pixels of conjunction are needed.
  31985. *
  31986. * It has no effect if no `arrowElement` is provided.
  31987. * @memberof modifiers
  31988. * @inner
  31989. */
  31990. arrow: {
  31991. /** @prop {number} order=500 - Index used to define the order of execution */
  31992. order: 500,
  31993. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31994. enabled: true,
  31995. /** @prop {ModifierFn} */
  31996. fn: arrow,
  31997. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  31998. element: '[x-arrow]'
  31999. },
  32000. /**
  32001. * Modifier used to flip the popper's placement when it starts to overlap its
  32002. * reference element.
  32003. *
  32004. * Requires the `preventOverflow` modifier before it in order to work.
  32005. *
  32006. * **NOTE:** this modifier will interrupt the current update cycle and will
  32007. * restart it if it detects the need to flip the placement.
  32008. * @memberof modifiers
  32009. * @inner
  32010. */
  32011. flip: {
  32012. /** @prop {number} order=600 - Index used to define the order of execution */
  32013. order: 600,
  32014. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32015. enabled: true,
  32016. /** @prop {ModifierFn} */
  32017. fn: flip,
  32018. /**
  32019. * @prop {String|Array} behavior='flip'
  32020. * The behavior used to change the popper's placement. It can be one of
  32021. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  32022. * placements (with optional variations)
  32023. */
  32024. behavior: 'flip',
  32025. /**
  32026. * @prop {number} padding=5
  32027. * The popper will flip if it hits the edges of the `boundariesElement`
  32028. */
  32029. padding: 5,
  32030. /**
  32031. * @prop {String|HTMLElement} boundariesElement='viewport'
  32032. * The element which will define the boundaries of the popper position.
  32033. * The popper will never be placed outside of the defined boundaries
  32034. * (except if `keepTogether` is enabled)
  32035. */
  32036. boundariesElement: 'viewport',
  32037. /**
  32038. * @prop {Boolean} flipVariations=false
  32039. * The popper will switch placement variation between `-start` and `-end` when
  32040. * the reference element overlaps its boundaries.
  32041. *
  32042. * The original placement should have a set variation.
  32043. */
  32044. flipVariations: false,
  32045. /**
  32046. * @prop {Boolean} flipVariationsByContent=false
  32047. * The popper will switch placement variation between `-start` and `-end` when
  32048. * the popper element overlaps its reference boundaries.
  32049. *
  32050. * The original placement should have a set variation.
  32051. */
  32052. flipVariationsByContent: false
  32053. },
  32054. /**
  32055. * Modifier used to make the popper flow toward the inner of the reference element.
  32056. * By default, when this modifier is disabled, the popper will be placed outside
  32057. * the reference element.
  32058. * @memberof modifiers
  32059. * @inner
  32060. */
  32061. inner: {
  32062. /** @prop {number} order=700 - Index used to define the order of execution */
  32063. order: 700,
  32064. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  32065. enabled: false,
  32066. /** @prop {ModifierFn} */
  32067. fn: inner
  32068. },
  32069. /**
  32070. * Modifier used to hide the popper when its reference element is outside of the
  32071. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  32072. * be used to hide with a CSS selector the popper when its reference is
  32073. * out of boundaries.
  32074. *
  32075. * Requires the `preventOverflow` modifier before it in order to work.
  32076. * @memberof modifiers
  32077. * @inner
  32078. */
  32079. hide: {
  32080. /** @prop {number} order=800 - Index used to define the order of execution */
  32081. order: 800,
  32082. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32083. enabled: true,
  32084. /** @prop {ModifierFn} */
  32085. fn: hide
  32086. },
  32087. /**
  32088. * Computes the style that will be applied to the popper element to gets
  32089. * properly positioned.
  32090. *
  32091. * Note that this modifier will not touch the DOM, it just prepares the styles
  32092. * so that `applyStyle` modifier can apply it. This separation is useful
  32093. * in case you need to replace `applyStyle` with a custom implementation.
  32094. *
  32095. * This modifier has `850` as `order` value to maintain backward compatibility
  32096. * with previous versions of Popper.js. Expect the modifiers ordering method
  32097. * to change in future major versions of the library.
  32098. *
  32099. * @memberof modifiers
  32100. * @inner
  32101. */
  32102. computeStyle: {
  32103. /** @prop {number} order=850 - Index used to define the order of execution */
  32104. order: 850,
  32105. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32106. enabled: true,
  32107. /** @prop {ModifierFn} */
  32108. fn: computeStyle,
  32109. /**
  32110. * @prop {Boolean} gpuAcceleration=true
  32111. * If true, it uses the CSS 3D transformation to position the popper.
  32112. * Otherwise, it will use the `top` and `left` properties
  32113. */
  32114. gpuAcceleration: true,
  32115. /**
  32116. * @prop {string} [x='bottom']
  32117. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  32118. * Change this if your popper should grow in a direction different from `bottom`
  32119. */
  32120. x: 'bottom',
  32121. /**
  32122. * @prop {string} [x='left']
  32123. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  32124. * Change this if your popper should grow in a direction different from `right`
  32125. */
  32126. y: 'right'
  32127. },
  32128. /**
  32129. * Applies the computed styles to the popper element.
  32130. *
  32131. * All the DOM manipulations are limited to this modifier. This is useful in case
  32132. * you want to integrate Popper.js inside a framework or view library and you
  32133. * want to delegate all the DOM manipulations to it.
  32134. *
  32135. * Note that if you disable this modifier, you must make sure the popper element
  32136. * has its position set to `absolute` before Popper.js can do its work!
  32137. *
  32138. * Just disable this modifier and define your own to achieve the desired effect.
  32139. *
  32140. * @memberof modifiers
  32141. * @inner
  32142. */
  32143. applyStyle: {
  32144. /** @prop {number} order=900 - Index used to define the order of execution */
  32145. order: 900,
  32146. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32147. enabled: true,
  32148. /** @prop {ModifierFn} */
  32149. fn: applyStyle,
  32150. /** @prop {Function} */
  32151. onLoad: applyStyleOnLoad,
  32152. /**
  32153. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  32154. * @prop {Boolean} gpuAcceleration=true
  32155. * If true, it uses the CSS 3D transformation to position the popper.
  32156. * Otherwise, it will use the `top` and `left` properties
  32157. */
  32158. gpuAcceleration: undefined
  32159. }
  32160. };
  32161. /**
  32162. * The `dataObject` is an object containing all the information used by Popper.js.
  32163. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  32164. * @name dataObject
  32165. * @property {Object} data.instance The Popper.js instance
  32166. * @property {String} data.placement Placement applied to popper
  32167. * @property {String} data.originalPlacement Placement originally defined on init
  32168. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  32169. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  32170. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  32171. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32172. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32173. * @property {Object} data.boundaries Offsets of the popper boundaries
  32174. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  32175. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  32176. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  32177. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  32178. */
  32179. /**
  32180. * Default options provided to Popper.js constructor.<br />
  32181. * These can be overridden using the `options` argument of Popper.js.<br />
  32182. * To override an option, simply pass an object with the same
  32183. * structure of the `options` object, as the 3rd argument. For example:
  32184. * ```
  32185. * new Popper(ref, pop, {
  32186. * modifiers: {
  32187. * preventOverflow: { enabled: false }
  32188. * }
  32189. * })
  32190. * ```
  32191. * @type {Object}
  32192. * @static
  32193. * @memberof Popper
  32194. */
  32195. var Defaults = {
  32196. /**
  32197. * Popper's placement.
  32198. * @prop {Popper.placements} placement='bottom'
  32199. */
  32200. placement: 'bottom',
  32201. /**
  32202. * Set this to true if you want popper to position it self in 'fixed' mode
  32203. * @prop {Boolean} positionFixed=false
  32204. */
  32205. positionFixed: false,
  32206. /**
  32207. * Whether events (resize, scroll) are initially enabled.
  32208. * @prop {Boolean} eventsEnabled=true
  32209. */
  32210. eventsEnabled: true,
  32211. /**
  32212. * Set to true if you want to automatically remove the popper when
  32213. * you call the `destroy` method.
  32214. * @prop {Boolean} removeOnDestroy=false
  32215. */
  32216. removeOnDestroy: false,
  32217. /**
  32218. * Callback called when the popper is created.<br />
  32219. * By default, it is set to no-op.<br />
  32220. * Access Popper.js instance with `data.instance`.
  32221. * @prop {onCreate}
  32222. */
  32223. onCreate: function onCreate() {},
  32224. /**
  32225. * Callback called when the popper is updated. This callback is not called
  32226. * on the initialization/creation of the popper, but only on subsequent
  32227. * updates.<br />
  32228. * By default, it is set to no-op.<br />
  32229. * Access Popper.js instance with `data.instance`.
  32230. * @prop {onUpdate}
  32231. */
  32232. onUpdate: function onUpdate() {},
  32233. /**
  32234. * List of modifiers used to modify the offsets before they are applied to the popper.
  32235. * They provide most of the functionalities of Popper.js.
  32236. * @prop {modifiers}
  32237. */
  32238. modifiers: modifiers
  32239. };
  32240. /**
  32241. * @callback onCreate
  32242. * @param {dataObject} data
  32243. */
  32244. /**
  32245. * @callback onUpdate
  32246. * @param {dataObject} data
  32247. */
  32248. // Utils
  32249. // Methods
  32250. var Popper = function () {
  32251. /**
  32252. * Creates a new Popper.js instance.
  32253. * @class Popper
  32254. * @param {Element|referenceObject} reference - The reference element used to position the popper
  32255. * @param {Element} popper - The HTML / XML element used as the popper
  32256. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  32257. * @return {Object} instance - The generated Popper.js instance
  32258. */
  32259. function Popper(reference, popper) {
  32260. var _this = this;
  32261. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  32262. classCallCheck(this, Popper);
  32263. this.scheduleUpdate = function () {
  32264. return requestAnimationFrame(_this.update);
  32265. };
  32266. // make update() debounced, so that it only runs at most once-per-tick
  32267. this.update = debounce(this.update.bind(this));
  32268. // with {} we create a new object with the options inside it
  32269. this.options = _extends({}, Popper.Defaults, options);
  32270. // init state
  32271. this.state = {
  32272. isDestroyed: false,
  32273. isCreated: false,
  32274. scrollParents: []
  32275. };
  32276. // get reference and popper elements (allow jQuery wrappers)
  32277. this.reference = reference && reference.jquery ? reference[0] : reference;
  32278. this.popper = popper && popper.jquery ? popper[0] : popper;
  32279. // Deep merge modifiers options
  32280. this.options.modifiers = {};
  32281. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  32282. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  32283. });
  32284. // Refactoring modifiers' list (Object => Array)
  32285. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  32286. return _extends({
  32287. name: name
  32288. }, _this.options.modifiers[name]);
  32289. })
  32290. // sort the modifiers by order
  32291. .sort(function (a, b) {
  32292. return a.order - b.order;
  32293. });
  32294. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  32295. // such code is executed in the same order of its modifier
  32296. // they could add new properties to their options configuration
  32297. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  32298. this.modifiers.forEach(function (modifierOptions) {
  32299. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  32300. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  32301. }
  32302. });
  32303. // fire the first update to position the popper in the right place
  32304. this.update();
  32305. var eventsEnabled = this.options.eventsEnabled;
  32306. if (eventsEnabled) {
  32307. // setup event listeners, they will take care of update the position in specific situations
  32308. this.enableEventListeners();
  32309. }
  32310. this.state.eventsEnabled = eventsEnabled;
  32311. }
  32312. // We can't use class properties because they don't get listed in the
  32313. // class prototype and break stuff like Sinon stubs
  32314. createClass(Popper, [{
  32315. key: 'update',
  32316. value: function update$$1() {
  32317. return update.call(this);
  32318. }
  32319. }, {
  32320. key: 'destroy',
  32321. value: function destroy$$1() {
  32322. return destroy.call(this);
  32323. }
  32324. }, {
  32325. key: 'enableEventListeners',
  32326. value: function enableEventListeners$$1() {
  32327. return enableEventListeners.call(this);
  32328. }
  32329. }, {
  32330. key: 'disableEventListeners',
  32331. value: function disableEventListeners$$1() {
  32332. return disableEventListeners.call(this);
  32333. }
  32334. /**
  32335. * Schedules an update. It will run on the next UI update available.
  32336. * @method scheduleUpdate
  32337. * @memberof Popper
  32338. */
  32339. /**
  32340. * Collection of utilities useful when writing custom modifiers.
  32341. * Starting from version 1.7, this method is available only if you
  32342. * include `popper-utils.js` before `popper.js`.
  32343. *
  32344. * **DEPRECATION**: This way to access PopperUtils is deprecated
  32345. * and will be removed in v2! Use the PopperUtils module directly instead.
  32346. * Due to the high instability of the methods contained in Utils, we can't
  32347. * guarantee them to follow semver. Use them at your own risk!
  32348. * @static
  32349. * @private
  32350. * @type {Object}
  32351. * @deprecated since version 1.8
  32352. * @member Utils
  32353. * @memberof Popper
  32354. */
  32355. }]);
  32356. return Popper;
  32357. }();
  32358. /**
  32359. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  32360. * and lets you use it as replacement of a real DOM node.<br />
  32361. * You can use this method to position a popper relatively to a set of coordinates
  32362. * in case you don't have a DOM node to use as reference.
  32363. *
  32364. * ```
  32365. * new Popper(referenceObject, popperNode);
  32366. * ```
  32367. *
  32368. * NB: This feature isn't supported in Internet Explorer 10.
  32369. * @name referenceObject
  32370. * @property {Function} data.getBoundingClientRect
  32371. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  32372. * @property {number} data.clientWidth
  32373. * An ES6 getter that will return the width of the virtual reference element.
  32374. * @property {number} data.clientHeight
  32375. * An ES6 getter that will return the height of the virtual reference element.
  32376. */
  32377. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  32378. Popper.placements = placements;
  32379. Popper.Defaults = Defaults;
  32380. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  32381. //# sourceMappingURL=popper.js.map
  32382. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32383. /***/ }),
  32384. /***/ "./node_modules/process/browser.js":
  32385. /*!*****************************************!*\
  32386. !*** ./node_modules/process/browser.js ***!
  32387. \*****************************************/
  32388. /*! no static exports found */
  32389. /***/ (function(module, exports) {
  32390. // shim for using process in browser
  32391. var process = module.exports = {};
  32392. // cached from whatever global is present so that test runners that stub it
  32393. // don't break things. But we need to wrap it in a try catch in case it is
  32394. // wrapped in strict mode code which doesn't define any globals. It's inside a
  32395. // function because try/catches deoptimize in certain engines.
  32396. var cachedSetTimeout;
  32397. var cachedClearTimeout;
  32398. function defaultSetTimout() {
  32399. throw new Error('setTimeout has not been defined');
  32400. }
  32401. function defaultClearTimeout () {
  32402. throw new Error('clearTimeout has not been defined');
  32403. }
  32404. (function () {
  32405. try {
  32406. if (typeof setTimeout === 'function') {
  32407. cachedSetTimeout = setTimeout;
  32408. } else {
  32409. cachedSetTimeout = defaultSetTimout;
  32410. }
  32411. } catch (e) {
  32412. cachedSetTimeout = defaultSetTimout;
  32413. }
  32414. try {
  32415. if (typeof clearTimeout === 'function') {
  32416. cachedClearTimeout = clearTimeout;
  32417. } else {
  32418. cachedClearTimeout = defaultClearTimeout;
  32419. }
  32420. } catch (e) {
  32421. cachedClearTimeout = defaultClearTimeout;
  32422. }
  32423. } ())
  32424. function runTimeout(fun) {
  32425. if (cachedSetTimeout === setTimeout) {
  32426. //normal enviroments in sane situations
  32427. return setTimeout(fun, 0);
  32428. }
  32429. // if setTimeout wasn't available but was latter defined
  32430. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  32431. cachedSetTimeout = setTimeout;
  32432. return setTimeout(fun, 0);
  32433. }
  32434. try {
  32435. // when when somebody has screwed with setTimeout but no I.E. maddness
  32436. return cachedSetTimeout(fun, 0);
  32437. } catch(e){
  32438. try {
  32439. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32440. return cachedSetTimeout.call(null, fun, 0);
  32441. } catch(e){
  32442. // 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
  32443. return cachedSetTimeout.call(this, fun, 0);
  32444. }
  32445. }
  32446. }
  32447. function runClearTimeout(marker) {
  32448. if (cachedClearTimeout === clearTimeout) {
  32449. //normal enviroments in sane situations
  32450. return clearTimeout(marker);
  32451. }
  32452. // if clearTimeout wasn't available but was latter defined
  32453. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  32454. cachedClearTimeout = clearTimeout;
  32455. return clearTimeout(marker);
  32456. }
  32457. try {
  32458. // when when somebody has screwed with setTimeout but no I.E. maddness
  32459. return cachedClearTimeout(marker);
  32460. } catch (e){
  32461. try {
  32462. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32463. return cachedClearTimeout.call(null, marker);
  32464. } catch (e){
  32465. // 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.
  32466. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  32467. return cachedClearTimeout.call(this, marker);
  32468. }
  32469. }
  32470. }
  32471. var queue = [];
  32472. var draining = false;
  32473. var currentQueue;
  32474. var queueIndex = -1;
  32475. function cleanUpNextTick() {
  32476. if (!draining || !currentQueue) {
  32477. return;
  32478. }
  32479. draining = false;
  32480. if (currentQueue.length) {
  32481. queue = currentQueue.concat(queue);
  32482. } else {
  32483. queueIndex = -1;
  32484. }
  32485. if (queue.length) {
  32486. drainQueue();
  32487. }
  32488. }
  32489. function drainQueue() {
  32490. if (draining) {
  32491. return;
  32492. }
  32493. var timeout = runTimeout(cleanUpNextTick);
  32494. draining = true;
  32495. var len = queue.length;
  32496. while(len) {
  32497. currentQueue = queue;
  32498. queue = [];
  32499. while (++queueIndex < len) {
  32500. if (currentQueue) {
  32501. currentQueue[queueIndex].run();
  32502. }
  32503. }
  32504. queueIndex = -1;
  32505. len = queue.length;
  32506. }
  32507. currentQueue = null;
  32508. draining = false;
  32509. runClearTimeout(timeout);
  32510. }
  32511. process.nextTick = function (fun) {
  32512. var args = new Array(arguments.length - 1);
  32513. if (arguments.length > 1) {
  32514. for (var i = 1; i < arguments.length; i++) {
  32515. args[i - 1] = arguments[i];
  32516. }
  32517. }
  32518. queue.push(new Item(fun, args));
  32519. if (queue.length === 1 && !draining) {
  32520. runTimeout(drainQueue);
  32521. }
  32522. };
  32523. // v8 likes predictible objects
  32524. function Item(fun, array) {
  32525. this.fun = fun;
  32526. this.array = array;
  32527. }
  32528. Item.prototype.run = function () {
  32529. this.fun.apply(null, this.array);
  32530. };
  32531. process.title = 'browser';
  32532. process.browser = true;
  32533. process.env = {};
  32534. process.argv = [];
  32535. process.version = ''; // empty string to avoid regexp issues
  32536. process.versions = {};
  32537. function noop() {}
  32538. process.on = noop;
  32539. process.addListener = noop;
  32540. process.once = noop;
  32541. process.off = noop;
  32542. process.removeListener = noop;
  32543. process.removeAllListeners = noop;
  32544. process.emit = noop;
  32545. process.prependListener = noop;
  32546. process.prependOnceListener = noop;
  32547. process.listeners = function (name) { return [] }
  32548. process.binding = function (name) {
  32549. throw new Error('process.binding is not supported');
  32550. };
  32551. process.cwd = function () { return '/' };
  32552. process.chdir = function (dir) {
  32553. throw new Error('process.chdir is not supported');
  32554. };
  32555. process.umask = function() { return 0; };
  32556. /***/ }),
  32557. /***/ "./node_modules/setimmediate/setImmediate.js":
  32558. /*!***************************************************!*\
  32559. !*** ./node_modules/setimmediate/setImmediate.js ***!
  32560. \***************************************************/
  32561. /*! no static exports found */
  32562. /***/ (function(module, exports, __webpack_require__) {
  32563. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  32564. "use strict";
  32565. if (global.setImmediate) {
  32566. return;
  32567. }
  32568. var nextHandle = 1; // Spec says greater than zero
  32569. var tasksByHandle = {};
  32570. var currentlyRunningATask = false;
  32571. var doc = global.document;
  32572. var registerImmediate;
  32573. function setImmediate(callback) {
  32574. // Callback can either be a function or a string
  32575. if (typeof callback !== "function") {
  32576. callback = new Function("" + callback);
  32577. }
  32578. // Copy function arguments
  32579. var args = new Array(arguments.length - 1);
  32580. for (var i = 0; i < args.length; i++) {
  32581. args[i] = arguments[i + 1];
  32582. }
  32583. // Store and register the task
  32584. var task = { callback: callback, args: args };
  32585. tasksByHandle[nextHandle] = task;
  32586. registerImmediate(nextHandle);
  32587. return nextHandle++;
  32588. }
  32589. function clearImmediate(handle) {
  32590. delete tasksByHandle[handle];
  32591. }
  32592. function run(task) {
  32593. var callback = task.callback;
  32594. var args = task.args;
  32595. switch (args.length) {
  32596. case 0:
  32597. callback();
  32598. break;
  32599. case 1:
  32600. callback(args[0]);
  32601. break;
  32602. case 2:
  32603. callback(args[0], args[1]);
  32604. break;
  32605. case 3:
  32606. callback(args[0], args[1], args[2]);
  32607. break;
  32608. default:
  32609. callback.apply(undefined, args);
  32610. break;
  32611. }
  32612. }
  32613. function runIfPresent(handle) {
  32614. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  32615. // So if we're currently running a task, we'll need to delay this invocation.
  32616. if (currentlyRunningATask) {
  32617. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  32618. // "too much recursion" error.
  32619. setTimeout(runIfPresent, 0, handle);
  32620. } else {
  32621. var task = tasksByHandle[handle];
  32622. if (task) {
  32623. currentlyRunningATask = true;
  32624. try {
  32625. run(task);
  32626. } finally {
  32627. clearImmediate(handle);
  32628. currentlyRunningATask = false;
  32629. }
  32630. }
  32631. }
  32632. }
  32633. function installNextTickImplementation() {
  32634. registerImmediate = function(handle) {
  32635. process.nextTick(function () { runIfPresent(handle); });
  32636. };
  32637. }
  32638. function canUsePostMessage() {
  32639. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  32640. // where `global.postMessage` means something completely different and can't be used for this purpose.
  32641. if (global.postMessage && !global.importScripts) {
  32642. var postMessageIsAsynchronous = true;
  32643. var oldOnMessage = global.onmessage;
  32644. global.onmessage = function() {
  32645. postMessageIsAsynchronous = false;
  32646. };
  32647. global.postMessage("", "*");
  32648. global.onmessage = oldOnMessage;
  32649. return postMessageIsAsynchronous;
  32650. }
  32651. }
  32652. function installPostMessageImplementation() {
  32653. // Installs an event handler on `global` for the `message` event: see
  32654. // * https://developer.mozilla.org/en/DOM/window.postMessage
  32655. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  32656. var messagePrefix = "setImmediate$" + Math.random() + "$";
  32657. var onGlobalMessage = function(event) {
  32658. if (event.source === global &&
  32659. typeof event.data === "string" &&
  32660. event.data.indexOf(messagePrefix) === 0) {
  32661. runIfPresent(+event.data.slice(messagePrefix.length));
  32662. }
  32663. };
  32664. if (global.addEventListener) {
  32665. global.addEventListener("message", onGlobalMessage, false);
  32666. } else {
  32667. global.attachEvent("onmessage", onGlobalMessage);
  32668. }
  32669. registerImmediate = function(handle) {
  32670. global.postMessage(messagePrefix + handle, "*");
  32671. };
  32672. }
  32673. function installMessageChannelImplementation() {
  32674. var channel = new MessageChannel();
  32675. channel.port1.onmessage = function(event) {
  32676. var handle = event.data;
  32677. runIfPresent(handle);
  32678. };
  32679. registerImmediate = function(handle) {
  32680. channel.port2.postMessage(handle);
  32681. };
  32682. }
  32683. function installReadyStateChangeImplementation() {
  32684. var html = doc.documentElement;
  32685. registerImmediate = function(handle) {
  32686. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  32687. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  32688. var script = doc.createElement("script");
  32689. script.onreadystatechange = function () {
  32690. runIfPresent(handle);
  32691. script.onreadystatechange = null;
  32692. html.removeChild(script);
  32693. script = null;
  32694. };
  32695. html.appendChild(script);
  32696. };
  32697. }
  32698. function installSetTimeoutImplementation() {
  32699. registerImmediate = function(handle) {
  32700. setTimeout(runIfPresent, 0, handle);
  32701. };
  32702. }
  32703. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  32704. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  32705. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  32706. // Don't get fooled by e.g. browserify environments.
  32707. if ({}.toString.call(global.process) === "[object process]") {
  32708. // For Node.js before 0.9
  32709. installNextTickImplementation();
  32710. } else if (canUsePostMessage()) {
  32711. // For non-IE10 modern browsers
  32712. installPostMessageImplementation();
  32713. } else if (global.MessageChannel) {
  32714. // For web workers, where supported
  32715. installMessageChannelImplementation();
  32716. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  32717. // For IE 6–8
  32718. installReadyStateChangeImplementation();
  32719. } else {
  32720. // For older browsers
  32721. installSetTimeoutImplementation();
  32722. }
  32723. attachTo.setImmediate = setImmediate;
  32724. attachTo.clearImmediate = clearImmediate;
  32725. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  32726. /* 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")))
  32727. /***/ }),
  32728. /***/ "./node_modules/timers-browserify/main.js":
  32729. /*!************************************************!*\
  32730. !*** ./node_modules/timers-browserify/main.js ***!
  32731. \************************************************/
  32732. /*! no static exports found */
  32733. /***/ (function(module, exports, __webpack_require__) {
  32734. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  32735. (typeof self !== "undefined" && self) ||
  32736. window;
  32737. var apply = Function.prototype.apply;
  32738. // DOM APIs, for completeness
  32739. exports.setTimeout = function() {
  32740. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  32741. };
  32742. exports.setInterval = function() {
  32743. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  32744. };
  32745. exports.clearTimeout =
  32746. exports.clearInterval = function(timeout) {
  32747. if (timeout) {
  32748. timeout.close();
  32749. }
  32750. };
  32751. function Timeout(id, clearFn) {
  32752. this._id = id;
  32753. this._clearFn = clearFn;
  32754. }
  32755. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  32756. Timeout.prototype.close = function() {
  32757. this._clearFn.call(scope, this._id);
  32758. };
  32759. // Does not start the time, just sets up the members needed.
  32760. exports.enroll = function(item, msecs) {
  32761. clearTimeout(item._idleTimeoutId);
  32762. item._idleTimeout = msecs;
  32763. };
  32764. exports.unenroll = function(item) {
  32765. clearTimeout(item._idleTimeoutId);
  32766. item._idleTimeout = -1;
  32767. };
  32768. exports._unrefActive = exports.active = function(item) {
  32769. clearTimeout(item._idleTimeoutId);
  32770. var msecs = item._idleTimeout;
  32771. if (msecs >= 0) {
  32772. item._idleTimeoutId = setTimeout(function onTimeout() {
  32773. if (item._onTimeout)
  32774. item._onTimeout();
  32775. }, msecs);
  32776. }
  32777. };
  32778. // setimmediate attaches itself to the global object
  32779. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  32780. // On some exotic environments, it's not clear which object `setimmediate` was
  32781. // able to install onto. Search each possibility in the same order as the
  32782. // `setimmediate` library.
  32783. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  32784. (typeof global !== "undefined" && global.setImmediate) ||
  32785. (this && this.setImmediate);
  32786. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  32787. (typeof global !== "undefined" && global.clearImmediate) ||
  32788. (this && this.clearImmediate);
  32789. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32790. /***/ }),
  32791. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  32792. /*!*******************************************************************************************************************************************************************************************************************!*\
  32793. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  32794. \*******************************************************************************************************************************************************************************************************************/
  32795. /*! exports provided: render, staticRenderFns */
  32796. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32797. "use strict";
  32798. __webpack_require__.r(__webpack_exports__);
  32799. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  32800. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  32801. var render = function() {
  32802. var _vm = this
  32803. var _h = _vm.$createElement
  32804. var _c = _vm._self._c || _h
  32805. return _vm._m(0)
  32806. }
  32807. var staticRenderFns = [
  32808. function() {
  32809. var _vm = this
  32810. var _h = _vm.$createElement
  32811. var _c = _vm._self._c || _h
  32812. return _c("div", { staticClass: "container" }, [
  32813. _c("div", { staticClass: "row justify-content-center" }, [
  32814. _c("div", { staticClass: "col-md-8" }, [
  32815. _c("div", { staticClass: "card" }, [
  32816. _c("div", { staticClass: "card-header" }, [
  32817. _vm._v("Example Component")
  32818. ]),
  32819. _vm._v(" "),
  32820. _c("div", { staticClass: "card-body" }, [
  32821. _vm._v(
  32822. "\n I'm an example component.\n "
  32823. )
  32824. ])
  32825. ])
  32826. ])
  32827. ])
  32828. ])
  32829. }
  32830. ]
  32831. render._withStripped = true
  32832. /***/ }),
  32833. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  32834. /*!********************************************************************!*\
  32835. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  32836. \********************************************************************/
  32837. /*! exports provided: default */
  32838. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32839. "use strict";
  32840. __webpack_require__.r(__webpack_exports__);
  32841. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  32842. /* globals __VUE_SSR_CONTEXT__ */
  32843. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  32844. // This module is a runtime utility for cleaner component module output and will
  32845. // be included in the final webpack user bundle.
  32846. function normalizeComponent (
  32847. scriptExports,
  32848. render,
  32849. staticRenderFns,
  32850. functionalTemplate,
  32851. injectStyles,
  32852. scopeId,
  32853. moduleIdentifier, /* server only */
  32854. shadowMode /* vue-cli only */
  32855. ) {
  32856. // Vue.extend constructor export interop
  32857. var options = typeof scriptExports === 'function'
  32858. ? scriptExports.options
  32859. : scriptExports
  32860. // render functions
  32861. if (render) {
  32862. options.render = render
  32863. options.staticRenderFns = staticRenderFns
  32864. options._compiled = true
  32865. }
  32866. // functional template
  32867. if (functionalTemplate) {
  32868. options.functional = true
  32869. }
  32870. // scopedId
  32871. if (scopeId) {
  32872. options._scopeId = 'data-v-' + scopeId
  32873. }
  32874. var hook
  32875. if (moduleIdentifier) { // server build
  32876. hook = function (context) {
  32877. // 2.3 injection
  32878. context =
  32879. context || // cached call
  32880. (this.$vnode && this.$vnode.ssrContext) || // stateful
  32881. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  32882. // 2.2 with runInNewContext: true
  32883. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  32884. context = __VUE_SSR_CONTEXT__
  32885. }
  32886. // inject component styles
  32887. if (injectStyles) {
  32888. injectStyles.call(this, context)
  32889. }
  32890. // register component module identifier for async chunk inferrence
  32891. if (context && context._registeredComponents) {
  32892. context._registeredComponents.add(moduleIdentifier)
  32893. }
  32894. }
  32895. // used by ssr in case component is cached and beforeCreate
  32896. // never gets called
  32897. options._ssrRegister = hook
  32898. } else if (injectStyles) {
  32899. hook = shadowMode
  32900. ? function () {
  32901. injectStyles.call(
  32902. this,
  32903. (options.functional ? this.parent : this).$root.$options.shadowRoot
  32904. )
  32905. }
  32906. : injectStyles
  32907. }
  32908. if (hook) {
  32909. if (options.functional) {
  32910. // for template-only hot-reload because in that case the render fn doesn't
  32911. // go through the normalizer
  32912. options._injectStyles = hook
  32913. // register for functional component in vue file
  32914. var originalRender = options.render
  32915. options.render = function renderWithStyleInjection (h, context) {
  32916. hook.call(context)
  32917. return originalRender(h, context)
  32918. }
  32919. } else {
  32920. // inject component registration as beforeCreate hook
  32921. var existing = options.beforeCreate
  32922. options.beforeCreate = existing
  32923. ? [].concat(existing, hook)
  32924. : [hook]
  32925. }
  32926. }
  32927. return {
  32928. exports: scriptExports,
  32929. options: options
  32930. }
  32931. }
  32932. /***/ }),
  32933. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  32934. /*!*************************************************!*\
  32935. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  32936. \*************************************************/
  32937. /*! no static exports found */
  32938. /***/ (function(module, exports, __webpack_require__) {
  32939. "use strict";
  32940. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  32941. * Vue.js v2.6.12
  32942. * (c) 2014-2020 Evan You
  32943. * Released under the MIT License.
  32944. */
  32945. /* */
  32946. var emptyObject = Object.freeze({});
  32947. // These helpers produce better VM code in JS engines due to their
  32948. // explicitness and function inlining.
  32949. function isUndef (v) {
  32950. return v === undefined || v === null
  32951. }
  32952. function isDef (v) {
  32953. return v !== undefined && v !== null
  32954. }
  32955. function isTrue (v) {
  32956. return v === true
  32957. }
  32958. function isFalse (v) {
  32959. return v === false
  32960. }
  32961. /**
  32962. * Check if value is primitive.
  32963. */
  32964. function isPrimitive (value) {
  32965. return (
  32966. typeof value === 'string' ||
  32967. typeof value === 'number' ||
  32968. // $flow-disable-line
  32969. typeof value === 'symbol' ||
  32970. typeof value === 'boolean'
  32971. )
  32972. }
  32973. /**
  32974. * Quick object check - this is primarily used to tell
  32975. * Objects from primitive values when we know the value
  32976. * is a JSON-compliant type.
  32977. */
  32978. function isObject (obj) {
  32979. return obj !== null && typeof obj === 'object'
  32980. }
  32981. /**
  32982. * Get the raw type string of a value, e.g., [object Object].
  32983. */
  32984. var _toString = Object.prototype.toString;
  32985. function toRawType (value) {
  32986. return _toString.call(value).slice(8, -1)
  32987. }
  32988. /**
  32989. * Strict object type check. Only returns true
  32990. * for plain JavaScript objects.
  32991. */
  32992. function isPlainObject (obj) {
  32993. return _toString.call(obj) === '[object Object]'
  32994. }
  32995. function isRegExp (v) {
  32996. return _toString.call(v) === '[object RegExp]'
  32997. }
  32998. /**
  32999. * Check if val is a valid array index.
  33000. */
  33001. function isValidArrayIndex (val) {
  33002. var n = parseFloat(String(val));
  33003. return n >= 0 && Math.floor(n) === n && isFinite(val)
  33004. }
  33005. function isPromise (val) {
  33006. return (
  33007. isDef(val) &&
  33008. typeof val.then === 'function' &&
  33009. typeof val.catch === 'function'
  33010. )
  33011. }
  33012. /**
  33013. * Convert a value to a string that is actually rendered.
  33014. */
  33015. function toString (val) {
  33016. return val == null
  33017. ? ''
  33018. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  33019. ? JSON.stringify(val, null, 2)
  33020. : String(val)
  33021. }
  33022. /**
  33023. * Convert an input value to a number for persistence.
  33024. * If the conversion fails, return original string.
  33025. */
  33026. function toNumber (val) {
  33027. var n = parseFloat(val);
  33028. return isNaN(n) ? val : n
  33029. }
  33030. /**
  33031. * Make a map and return a function for checking if a key
  33032. * is in that map.
  33033. */
  33034. function makeMap (
  33035. str,
  33036. expectsLowerCase
  33037. ) {
  33038. var map = Object.create(null);
  33039. var list = str.split(',');
  33040. for (var i = 0; i < list.length; i++) {
  33041. map[list[i]] = true;
  33042. }
  33043. return expectsLowerCase
  33044. ? function (val) { return map[val.toLowerCase()]; }
  33045. : function (val) { return map[val]; }
  33046. }
  33047. /**
  33048. * Check if a tag is a built-in tag.
  33049. */
  33050. var isBuiltInTag = makeMap('slot,component', true);
  33051. /**
  33052. * Check if an attribute is a reserved attribute.
  33053. */
  33054. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  33055. /**
  33056. * Remove an item from an array.
  33057. */
  33058. function remove (arr, item) {
  33059. if (arr.length) {
  33060. var index = arr.indexOf(item);
  33061. if (index > -1) {
  33062. return arr.splice(index, 1)
  33063. }
  33064. }
  33065. }
  33066. /**
  33067. * Check whether an object has the property.
  33068. */
  33069. var hasOwnProperty = Object.prototype.hasOwnProperty;
  33070. function hasOwn (obj, key) {
  33071. return hasOwnProperty.call(obj, key)
  33072. }
  33073. /**
  33074. * Create a cached version of a pure function.
  33075. */
  33076. function cached (fn) {
  33077. var cache = Object.create(null);
  33078. return (function cachedFn (str) {
  33079. var hit = cache[str];
  33080. return hit || (cache[str] = fn(str))
  33081. })
  33082. }
  33083. /**
  33084. * Camelize a hyphen-delimited string.
  33085. */
  33086. var camelizeRE = /-(\w)/g;
  33087. var camelize = cached(function (str) {
  33088. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  33089. });
  33090. /**
  33091. * Capitalize a string.
  33092. */
  33093. var capitalize = cached(function (str) {
  33094. return str.charAt(0).toUpperCase() + str.slice(1)
  33095. });
  33096. /**
  33097. * Hyphenate a camelCase string.
  33098. */
  33099. var hyphenateRE = /\B([A-Z])/g;
  33100. var hyphenate = cached(function (str) {
  33101. return str.replace(hyphenateRE, '-$1').toLowerCase()
  33102. });
  33103. /**
  33104. * Simple bind polyfill for environments that do not support it,
  33105. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  33106. * since native bind is now performant enough in most browsers.
  33107. * But removing it would mean breaking code that was able to run in
  33108. * PhantomJS 1.x, so this must be kept for backward compatibility.
  33109. */
  33110. /* istanbul ignore next */
  33111. function polyfillBind (fn, ctx) {
  33112. function boundFn (a) {
  33113. var l = arguments.length;
  33114. return l
  33115. ? l > 1
  33116. ? fn.apply(ctx, arguments)
  33117. : fn.call(ctx, a)
  33118. : fn.call(ctx)
  33119. }
  33120. boundFn._length = fn.length;
  33121. return boundFn
  33122. }
  33123. function nativeBind (fn, ctx) {
  33124. return fn.bind(ctx)
  33125. }
  33126. var bind = Function.prototype.bind
  33127. ? nativeBind
  33128. : polyfillBind;
  33129. /**
  33130. * Convert an Array-like object to a real Array.
  33131. */
  33132. function toArray (list, start) {
  33133. start = start || 0;
  33134. var i = list.length - start;
  33135. var ret = new Array(i);
  33136. while (i--) {
  33137. ret[i] = list[i + start];
  33138. }
  33139. return ret
  33140. }
  33141. /**
  33142. * Mix properties into target object.
  33143. */
  33144. function extend (to, _from) {
  33145. for (var key in _from) {
  33146. to[key] = _from[key];
  33147. }
  33148. return to
  33149. }
  33150. /**
  33151. * Merge an Array of Objects into a single Object.
  33152. */
  33153. function toObject (arr) {
  33154. var res = {};
  33155. for (var i = 0; i < arr.length; i++) {
  33156. if (arr[i]) {
  33157. extend(res, arr[i]);
  33158. }
  33159. }
  33160. return res
  33161. }
  33162. /* eslint-disable no-unused-vars */
  33163. /**
  33164. * Perform no operation.
  33165. * Stubbing args to make Flow happy without leaving useless transpiled code
  33166. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  33167. */
  33168. function noop (a, b, c) {}
  33169. /**
  33170. * Always return false.
  33171. */
  33172. var no = function (a, b, c) { return false; };
  33173. /* eslint-enable no-unused-vars */
  33174. /**
  33175. * Return the same value.
  33176. */
  33177. var identity = function (_) { return _; };
  33178. /**
  33179. * Generate a string containing static keys from compiler modules.
  33180. */
  33181. function genStaticKeys (modules) {
  33182. return modules.reduce(function (keys, m) {
  33183. return keys.concat(m.staticKeys || [])
  33184. }, []).join(',')
  33185. }
  33186. /**
  33187. * Check if two values are loosely equal - that is,
  33188. * if they are plain objects, do they have the same shape?
  33189. */
  33190. function looseEqual (a, b) {
  33191. if (a === b) { return true }
  33192. var isObjectA = isObject(a);
  33193. var isObjectB = isObject(b);
  33194. if (isObjectA && isObjectB) {
  33195. try {
  33196. var isArrayA = Array.isArray(a);
  33197. var isArrayB = Array.isArray(b);
  33198. if (isArrayA && isArrayB) {
  33199. return a.length === b.length && a.every(function (e, i) {
  33200. return looseEqual(e, b[i])
  33201. })
  33202. } else if (a instanceof Date && b instanceof Date) {
  33203. return a.getTime() === b.getTime()
  33204. } else if (!isArrayA && !isArrayB) {
  33205. var keysA = Object.keys(a);
  33206. var keysB = Object.keys(b);
  33207. return keysA.length === keysB.length && keysA.every(function (key) {
  33208. return looseEqual(a[key], b[key])
  33209. })
  33210. } else {
  33211. /* istanbul ignore next */
  33212. return false
  33213. }
  33214. } catch (e) {
  33215. /* istanbul ignore next */
  33216. return false
  33217. }
  33218. } else if (!isObjectA && !isObjectB) {
  33219. return String(a) === String(b)
  33220. } else {
  33221. return false
  33222. }
  33223. }
  33224. /**
  33225. * Return the first index at which a loosely equal value can be
  33226. * found in the array (if value is a plain object, the array must
  33227. * contain an object of the same shape), or -1 if it is not present.
  33228. */
  33229. function looseIndexOf (arr, val) {
  33230. for (var i = 0; i < arr.length; i++) {
  33231. if (looseEqual(arr[i], val)) { return i }
  33232. }
  33233. return -1
  33234. }
  33235. /**
  33236. * Ensure a function is called only once.
  33237. */
  33238. function once (fn) {
  33239. var called = false;
  33240. return function () {
  33241. if (!called) {
  33242. called = true;
  33243. fn.apply(this, arguments);
  33244. }
  33245. }
  33246. }
  33247. var SSR_ATTR = 'data-server-rendered';
  33248. var ASSET_TYPES = [
  33249. 'component',
  33250. 'directive',
  33251. 'filter'
  33252. ];
  33253. var LIFECYCLE_HOOKS = [
  33254. 'beforeCreate',
  33255. 'created',
  33256. 'beforeMount',
  33257. 'mounted',
  33258. 'beforeUpdate',
  33259. 'updated',
  33260. 'beforeDestroy',
  33261. 'destroyed',
  33262. 'activated',
  33263. 'deactivated',
  33264. 'errorCaptured',
  33265. 'serverPrefetch'
  33266. ];
  33267. /* */
  33268. var config = ({
  33269. /**
  33270. * Option merge strategies (used in core/util/options)
  33271. */
  33272. // $flow-disable-line
  33273. optionMergeStrategies: Object.create(null),
  33274. /**
  33275. * Whether to suppress warnings.
  33276. */
  33277. silent: false,
  33278. /**
  33279. * Show production mode tip message on boot?
  33280. */
  33281. productionTip: "development" !== 'production',
  33282. /**
  33283. * Whether to enable devtools
  33284. */
  33285. devtools: "development" !== 'production',
  33286. /**
  33287. * Whether to record perf
  33288. */
  33289. performance: false,
  33290. /**
  33291. * Error handler for watcher errors
  33292. */
  33293. errorHandler: null,
  33294. /**
  33295. * Warn handler for watcher warns
  33296. */
  33297. warnHandler: null,
  33298. /**
  33299. * Ignore certain custom elements
  33300. */
  33301. ignoredElements: [],
  33302. /**
  33303. * Custom user key aliases for v-on
  33304. */
  33305. // $flow-disable-line
  33306. keyCodes: Object.create(null),
  33307. /**
  33308. * Check if a tag is reserved so that it cannot be registered as a
  33309. * component. This is platform-dependent and may be overwritten.
  33310. */
  33311. isReservedTag: no,
  33312. /**
  33313. * Check if an attribute is reserved so that it cannot be used as a component
  33314. * prop. This is platform-dependent and may be overwritten.
  33315. */
  33316. isReservedAttr: no,
  33317. /**
  33318. * Check if a tag is an unknown element.
  33319. * Platform-dependent.
  33320. */
  33321. isUnknownElement: no,
  33322. /**
  33323. * Get the namespace of an element
  33324. */
  33325. getTagNamespace: noop,
  33326. /**
  33327. * Parse the real tag name for the specific platform.
  33328. */
  33329. parsePlatformTagName: identity,
  33330. /**
  33331. * Check if an attribute must be bound using property, e.g. value
  33332. * Platform-dependent.
  33333. */
  33334. mustUseProp: no,
  33335. /**
  33336. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  33337. * This will significantly reduce performance if set to false.
  33338. */
  33339. async: true,
  33340. /**
  33341. * Exposed for legacy reasons
  33342. */
  33343. _lifecycleHooks: LIFECYCLE_HOOKS
  33344. });
  33345. /* */
  33346. /**
  33347. * unicode letters used for parsing html tags, component names and property paths.
  33348. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  33349. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  33350. */
  33351. 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/;
  33352. /**
  33353. * Check if a string starts with $ or _
  33354. */
  33355. function isReserved (str) {
  33356. var c = (str + '').charCodeAt(0);
  33357. return c === 0x24 || c === 0x5F
  33358. }
  33359. /**
  33360. * Define a property.
  33361. */
  33362. function def (obj, key, val, enumerable) {
  33363. Object.defineProperty(obj, key, {
  33364. value: val,
  33365. enumerable: !!enumerable,
  33366. writable: true,
  33367. configurable: true
  33368. });
  33369. }
  33370. /**
  33371. * Parse simple path.
  33372. */
  33373. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  33374. function parsePath (path) {
  33375. if (bailRE.test(path)) {
  33376. return
  33377. }
  33378. var segments = path.split('.');
  33379. return function (obj) {
  33380. for (var i = 0; i < segments.length; i++) {
  33381. if (!obj) { return }
  33382. obj = obj[segments[i]];
  33383. }
  33384. return obj
  33385. }
  33386. }
  33387. /* */
  33388. // can we use __proto__?
  33389. var hasProto = '__proto__' in {};
  33390. // Browser environment sniffing
  33391. var inBrowser = typeof window !== 'undefined';
  33392. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  33393. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  33394. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  33395. var isIE = UA && /msie|trident/.test(UA);
  33396. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  33397. var isEdge = UA && UA.indexOf('edge/') > 0;
  33398. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  33399. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  33400. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  33401. var isPhantomJS = UA && /phantomjs/.test(UA);
  33402. var isFF = UA && UA.match(/firefox\/(\d+)/);
  33403. // Firefox has a "watch" function on Object.prototype...
  33404. var nativeWatch = ({}).watch;
  33405. var supportsPassive = false;
  33406. if (inBrowser) {
  33407. try {
  33408. var opts = {};
  33409. Object.defineProperty(opts, 'passive', ({
  33410. get: function get () {
  33411. /* istanbul ignore next */
  33412. supportsPassive = true;
  33413. }
  33414. })); // https://github.com/facebook/flow/issues/285
  33415. window.addEventListener('test-passive', null, opts);
  33416. } catch (e) {}
  33417. }
  33418. // this needs to be lazy-evaled because vue may be required before
  33419. // vue-server-renderer can set VUE_ENV
  33420. var _isServer;
  33421. var isServerRendering = function () {
  33422. if (_isServer === undefined) {
  33423. /* istanbul ignore if */
  33424. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  33425. // detect presence of vue-server-renderer and avoid
  33426. // Webpack shimming the process
  33427. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  33428. } else {
  33429. _isServer = false;
  33430. }
  33431. }
  33432. return _isServer
  33433. };
  33434. // detect devtools
  33435. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  33436. /* istanbul ignore next */
  33437. function isNative (Ctor) {
  33438. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  33439. }
  33440. var hasSymbol =
  33441. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  33442. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  33443. var _Set;
  33444. /* istanbul ignore if */ // $flow-disable-line
  33445. if (typeof Set !== 'undefined' && isNative(Set)) {
  33446. // use native Set when available.
  33447. _Set = Set;
  33448. } else {
  33449. // a non-standard Set polyfill that only works with primitive keys.
  33450. _Set = /*@__PURE__*/(function () {
  33451. function Set () {
  33452. this.set = Object.create(null);
  33453. }
  33454. Set.prototype.has = function has (key) {
  33455. return this.set[key] === true
  33456. };
  33457. Set.prototype.add = function add (key) {
  33458. this.set[key] = true;
  33459. };
  33460. Set.prototype.clear = function clear () {
  33461. this.set = Object.create(null);
  33462. };
  33463. return Set;
  33464. }());
  33465. }
  33466. /* */
  33467. var warn = noop;
  33468. var tip = noop;
  33469. var generateComponentTrace = (noop); // work around flow check
  33470. var formatComponentName = (noop);
  33471. {
  33472. var hasConsole = typeof console !== 'undefined';
  33473. var classifyRE = /(?:^|[-_])(\w)/g;
  33474. var classify = function (str) { return str
  33475. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  33476. .replace(/[-_]/g, ''); };
  33477. warn = function (msg, vm) {
  33478. var trace = vm ? generateComponentTrace(vm) : '';
  33479. if (config.warnHandler) {
  33480. config.warnHandler.call(null, msg, vm, trace);
  33481. } else if (hasConsole && (!config.silent)) {
  33482. console.error(("[Vue warn]: " + msg + trace));
  33483. }
  33484. };
  33485. tip = function (msg, vm) {
  33486. if (hasConsole && (!config.silent)) {
  33487. console.warn("[Vue tip]: " + msg + (
  33488. vm ? generateComponentTrace(vm) : ''
  33489. ));
  33490. }
  33491. };
  33492. formatComponentName = function (vm, includeFile) {
  33493. if (vm.$root === vm) {
  33494. return '<Root>'
  33495. }
  33496. var options = typeof vm === 'function' && vm.cid != null
  33497. ? vm.options
  33498. : vm._isVue
  33499. ? vm.$options || vm.constructor.options
  33500. : vm;
  33501. var name = options.name || options._componentTag;
  33502. var file = options.__file;
  33503. if (!name && file) {
  33504. var match = file.match(/([^/\\]+)\.vue$/);
  33505. name = match && match[1];
  33506. }
  33507. return (
  33508. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  33509. (file && includeFile !== false ? (" at " + file) : '')
  33510. )
  33511. };
  33512. var repeat = function (str, n) {
  33513. var res = '';
  33514. while (n) {
  33515. if (n % 2 === 1) { res += str; }
  33516. if (n > 1) { str += str; }
  33517. n >>= 1;
  33518. }
  33519. return res
  33520. };
  33521. generateComponentTrace = function (vm) {
  33522. if (vm._isVue && vm.$parent) {
  33523. var tree = [];
  33524. var currentRecursiveSequence = 0;
  33525. while (vm) {
  33526. if (tree.length > 0) {
  33527. var last = tree[tree.length - 1];
  33528. if (last.constructor === vm.constructor) {
  33529. currentRecursiveSequence++;
  33530. vm = vm.$parent;
  33531. continue
  33532. } else if (currentRecursiveSequence > 0) {
  33533. tree[tree.length - 1] = [last, currentRecursiveSequence];
  33534. currentRecursiveSequence = 0;
  33535. }
  33536. }
  33537. tree.push(vm);
  33538. vm = vm.$parent;
  33539. }
  33540. return '\n\nfound in\n\n' + tree
  33541. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  33542. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  33543. : formatComponentName(vm))); })
  33544. .join('\n')
  33545. } else {
  33546. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  33547. }
  33548. };
  33549. }
  33550. /* */
  33551. var uid = 0;
  33552. /**
  33553. * A dep is an observable that can have multiple
  33554. * directives subscribing to it.
  33555. */
  33556. var Dep = function Dep () {
  33557. this.id = uid++;
  33558. this.subs = [];
  33559. };
  33560. Dep.prototype.addSub = function addSub (sub) {
  33561. this.subs.push(sub);
  33562. };
  33563. Dep.prototype.removeSub = function removeSub (sub) {
  33564. remove(this.subs, sub);
  33565. };
  33566. Dep.prototype.depend = function depend () {
  33567. if (Dep.target) {
  33568. Dep.target.addDep(this);
  33569. }
  33570. };
  33571. Dep.prototype.notify = function notify () {
  33572. // stabilize the subscriber list first
  33573. var subs = this.subs.slice();
  33574. if (!config.async) {
  33575. // subs aren't sorted in scheduler if not running async
  33576. // we need to sort them now to make sure they fire in correct
  33577. // order
  33578. subs.sort(function (a, b) { return a.id - b.id; });
  33579. }
  33580. for (var i = 0, l = subs.length; i < l; i++) {
  33581. subs[i].update();
  33582. }
  33583. };
  33584. // The current target watcher being evaluated.
  33585. // This is globally unique because only one watcher
  33586. // can be evaluated at a time.
  33587. Dep.target = null;
  33588. var targetStack = [];
  33589. function pushTarget (target) {
  33590. targetStack.push(target);
  33591. Dep.target = target;
  33592. }
  33593. function popTarget () {
  33594. targetStack.pop();
  33595. Dep.target = targetStack[targetStack.length - 1];
  33596. }
  33597. /* */
  33598. var VNode = function VNode (
  33599. tag,
  33600. data,
  33601. children,
  33602. text,
  33603. elm,
  33604. context,
  33605. componentOptions,
  33606. asyncFactory
  33607. ) {
  33608. this.tag = tag;
  33609. this.data = data;
  33610. this.children = children;
  33611. this.text = text;
  33612. this.elm = elm;
  33613. this.ns = undefined;
  33614. this.context = context;
  33615. this.fnContext = undefined;
  33616. this.fnOptions = undefined;
  33617. this.fnScopeId = undefined;
  33618. this.key = data && data.key;
  33619. this.componentOptions = componentOptions;
  33620. this.componentInstance = undefined;
  33621. this.parent = undefined;
  33622. this.raw = false;
  33623. this.isStatic = false;
  33624. this.isRootInsert = true;
  33625. this.isComment = false;
  33626. this.isCloned = false;
  33627. this.isOnce = false;
  33628. this.asyncFactory = asyncFactory;
  33629. this.asyncMeta = undefined;
  33630. this.isAsyncPlaceholder = false;
  33631. };
  33632. var prototypeAccessors = { child: { configurable: true } };
  33633. // DEPRECATED: alias for componentInstance for backwards compat.
  33634. /* istanbul ignore next */
  33635. prototypeAccessors.child.get = function () {
  33636. return this.componentInstance
  33637. };
  33638. Object.defineProperties( VNode.prototype, prototypeAccessors );
  33639. var createEmptyVNode = function (text) {
  33640. if ( text === void 0 ) text = '';
  33641. var node = new VNode();
  33642. node.text = text;
  33643. node.isComment = true;
  33644. return node
  33645. };
  33646. function createTextVNode (val) {
  33647. return new VNode(undefined, undefined, undefined, String(val))
  33648. }
  33649. // optimized shallow clone
  33650. // used for static nodes and slot nodes because they may be reused across
  33651. // multiple renders, cloning them avoids errors when DOM manipulations rely
  33652. // on their elm reference.
  33653. function cloneVNode (vnode) {
  33654. var cloned = new VNode(
  33655. vnode.tag,
  33656. vnode.data,
  33657. // #7975
  33658. // clone children array to avoid mutating original in case of cloning
  33659. // a child.
  33660. vnode.children && vnode.children.slice(),
  33661. vnode.text,
  33662. vnode.elm,
  33663. vnode.context,
  33664. vnode.componentOptions,
  33665. vnode.asyncFactory
  33666. );
  33667. cloned.ns = vnode.ns;
  33668. cloned.isStatic = vnode.isStatic;
  33669. cloned.key = vnode.key;
  33670. cloned.isComment = vnode.isComment;
  33671. cloned.fnContext = vnode.fnContext;
  33672. cloned.fnOptions = vnode.fnOptions;
  33673. cloned.fnScopeId = vnode.fnScopeId;
  33674. cloned.asyncMeta = vnode.asyncMeta;
  33675. cloned.isCloned = true;
  33676. return cloned
  33677. }
  33678. /*
  33679. * not type checking this file because flow doesn't play well with
  33680. * dynamically accessing methods on Array prototype
  33681. */
  33682. var arrayProto = Array.prototype;
  33683. var arrayMethods = Object.create(arrayProto);
  33684. var methodsToPatch = [
  33685. 'push',
  33686. 'pop',
  33687. 'shift',
  33688. 'unshift',
  33689. 'splice',
  33690. 'sort',
  33691. 'reverse'
  33692. ];
  33693. /**
  33694. * Intercept mutating methods and emit events
  33695. */
  33696. methodsToPatch.forEach(function (method) {
  33697. // cache original method
  33698. var original = arrayProto[method];
  33699. def(arrayMethods, method, function mutator () {
  33700. var args = [], len = arguments.length;
  33701. while ( len-- ) args[ len ] = arguments[ len ];
  33702. var result = original.apply(this, args);
  33703. var ob = this.__ob__;
  33704. var inserted;
  33705. switch (method) {
  33706. case 'push':
  33707. case 'unshift':
  33708. inserted = args;
  33709. break
  33710. case 'splice':
  33711. inserted = args.slice(2);
  33712. break
  33713. }
  33714. if (inserted) { ob.observeArray(inserted); }
  33715. // notify change
  33716. ob.dep.notify();
  33717. return result
  33718. });
  33719. });
  33720. /* */
  33721. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  33722. /**
  33723. * In some cases we may want to disable observation inside a component's
  33724. * update computation.
  33725. */
  33726. var shouldObserve = true;
  33727. function toggleObserving (value) {
  33728. shouldObserve = value;
  33729. }
  33730. /**
  33731. * Observer class that is attached to each observed
  33732. * object. Once attached, the observer converts the target
  33733. * object's property keys into getter/setters that
  33734. * collect dependencies and dispatch updates.
  33735. */
  33736. var Observer = function Observer (value) {
  33737. this.value = value;
  33738. this.dep = new Dep();
  33739. this.vmCount = 0;
  33740. def(value, '__ob__', this);
  33741. if (Array.isArray(value)) {
  33742. if (hasProto) {
  33743. protoAugment(value, arrayMethods);
  33744. } else {
  33745. copyAugment(value, arrayMethods, arrayKeys);
  33746. }
  33747. this.observeArray(value);
  33748. } else {
  33749. this.walk(value);
  33750. }
  33751. };
  33752. /**
  33753. * Walk through all properties and convert them into
  33754. * getter/setters. This method should only be called when
  33755. * value type is Object.
  33756. */
  33757. Observer.prototype.walk = function walk (obj) {
  33758. var keys = Object.keys(obj);
  33759. for (var i = 0; i < keys.length; i++) {
  33760. defineReactive$$1(obj, keys[i]);
  33761. }
  33762. };
  33763. /**
  33764. * Observe a list of Array items.
  33765. */
  33766. Observer.prototype.observeArray = function observeArray (items) {
  33767. for (var i = 0, l = items.length; i < l; i++) {
  33768. observe(items[i]);
  33769. }
  33770. };
  33771. // helpers
  33772. /**
  33773. * Augment a target Object or Array by intercepting
  33774. * the prototype chain using __proto__
  33775. */
  33776. function protoAugment (target, src) {
  33777. /* eslint-disable no-proto */
  33778. target.__proto__ = src;
  33779. /* eslint-enable no-proto */
  33780. }
  33781. /**
  33782. * Augment a target Object or Array by defining
  33783. * hidden properties.
  33784. */
  33785. /* istanbul ignore next */
  33786. function copyAugment (target, src, keys) {
  33787. for (var i = 0, l = keys.length; i < l; i++) {
  33788. var key = keys[i];
  33789. def(target, key, src[key]);
  33790. }
  33791. }
  33792. /**
  33793. * Attempt to create an observer instance for a value,
  33794. * returns the new observer if successfully observed,
  33795. * or the existing observer if the value already has one.
  33796. */
  33797. function observe (value, asRootData) {
  33798. if (!isObject(value) || value instanceof VNode) {
  33799. return
  33800. }
  33801. var ob;
  33802. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  33803. ob = value.__ob__;
  33804. } else if (
  33805. shouldObserve &&
  33806. !isServerRendering() &&
  33807. (Array.isArray(value) || isPlainObject(value)) &&
  33808. Object.isExtensible(value) &&
  33809. !value._isVue
  33810. ) {
  33811. ob = new Observer(value);
  33812. }
  33813. if (asRootData && ob) {
  33814. ob.vmCount++;
  33815. }
  33816. return ob
  33817. }
  33818. /**
  33819. * Define a reactive property on an Object.
  33820. */
  33821. function defineReactive$$1 (
  33822. obj,
  33823. key,
  33824. val,
  33825. customSetter,
  33826. shallow
  33827. ) {
  33828. var dep = new Dep();
  33829. var property = Object.getOwnPropertyDescriptor(obj, key);
  33830. if (property && property.configurable === false) {
  33831. return
  33832. }
  33833. // cater for pre-defined getter/setters
  33834. var getter = property && property.get;
  33835. var setter = property && property.set;
  33836. if ((!getter || setter) && arguments.length === 2) {
  33837. val = obj[key];
  33838. }
  33839. var childOb = !shallow && observe(val);
  33840. Object.defineProperty(obj, key, {
  33841. enumerable: true,
  33842. configurable: true,
  33843. get: function reactiveGetter () {
  33844. var value = getter ? getter.call(obj) : val;
  33845. if (Dep.target) {
  33846. dep.depend();
  33847. if (childOb) {
  33848. childOb.dep.depend();
  33849. if (Array.isArray(value)) {
  33850. dependArray(value);
  33851. }
  33852. }
  33853. }
  33854. return value
  33855. },
  33856. set: function reactiveSetter (newVal) {
  33857. var value = getter ? getter.call(obj) : val;
  33858. /* eslint-disable no-self-compare */
  33859. if (newVal === value || (newVal !== newVal && value !== value)) {
  33860. return
  33861. }
  33862. /* eslint-enable no-self-compare */
  33863. if (customSetter) {
  33864. customSetter();
  33865. }
  33866. // #7981: for accessor properties without setter
  33867. if (getter && !setter) { return }
  33868. if (setter) {
  33869. setter.call(obj, newVal);
  33870. } else {
  33871. val = newVal;
  33872. }
  33873. childOb = !shallow && observe(newVal);
  33874. dep.notify();
  33875. }
  33876. });
  33877. }
  33878. /**
  33879. * Set a property on an object. Adds the new property and
  33880. * triggers change notification if the property doesn't
  33881. * already exist.
  33882. */
  33883. function set (target, key, val) {
  33884. if (isUndef(target) || isPrimitive(target)
  33885. ) {
  33886. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  33887. }
  33888. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33889. target.length = Math.max(target.length, key);
  33890. target.splice(key, 1, val);
  33891. return val
  33892. }
  33893. if (key in target && !(key in Object.prototype)) {
  33894. target[key] = val;
  33895. return val
  33896. }
  33897. var ob = (target).__ob__;
  33898. if (target._isVue || (ob && ob.vmCount)) {
  33899. warn(
  33900. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  33901. 'at runtime - declare it upfront in the data option.'
  33902. );
  33903. return val
  33904. }
  33905. if (!ob) {
  33906. target[key] = val;
  33907. return val
  33908. }
  33909. defineReactive$$1(ob.value, key, val);
  33910. ob.dep.notify();
  33911. return val
  33912. }
  33913. /**
  33914. * Delete a property and trigger change if necessary.
  33915. */
  33916. function del (target, key) {
  33917. if (isUndef(target) || isPrimitive(target)
  33918. ) {
  33919. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  33920. }
  33921. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33922. target.splice(key, 1);
  33923. return
  33924. }
  33925. var ob = (target).__ob__;
  33926. if (target._isVue || (ob && ob.vmCount)) {
  33927. warn(
  33928. 'Avoid deleting properties on a Vue instance or its root $data ' +
  33929. '- just set it to null.'
  33930. );
  33931. return
  33932. }
  33933. if (!hasOwn(target, key)) {
  33934. return
  33935. }
  33936. delete target[key];
  33937. if (!ob) {
  33938. return
  33939. }
  33940. ob.dep.notify();
  33941. }
  33942. /**
  33943. * Collect dependencies on array elements when the array is touched, since
  33944. * we cannot intercept array element access like property getters.
  33945. */
  33946. function dependArray (value) {
  33947. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  33948. e = value[i];
  33949. e && e.__ob__ && e.__ob__.dep.depend();
  33950. if (Array.isArray(e)) {
  33951. dependArray(e);
  33952. }
  33953. }
  33954. }
  33955. /* */
  33956. /**
  33957. * Option overwriting strategies are functions that handle
  33958. * how to merge a parent option value and a child option
  33959. * value into the final value.
  33960. */
  33961. var strats = config.optionMergeStrategies;
  33962. /**
  33963. * Options with restrictions
  33964. */
  33965. {
  33966. strats.el = strats.propsData = function (parent, child, vm, key) {
  33967. if (!vm) {
  33968. warn(
  33969. "option \"" + key + "\" can only be used during instance " +
  33970. 'creation with the `new` keyword.'
  33971. );
  33972. }
  33973. return defaultStrat(parent, child)
  33974. };
  33975. }
  33976. /**
  33977. * Helper that recursively merges two data objects together.
  33978. */
  33979. function mergeData (to, from) {
  33980. if (!from) { return to }
  33981. var key, toVal, fromVal;
  33982. var keys = hasSymbol
  33983. ? Reflect.ownKeys(from)
  33984. : Object.keys(from);
  33985. for (var i = 0; i < keys.length; i++) {
  33986. key = keys[i];
  33987. // in case the object is already observed...
  33988. if (key === '__ob__') { continue }
  33989. toVal = to[key];
  33990. fromVal = from[key];
  33991. if (!hasOwn(to, key)) {
  33992. set(to, key, fromVal);
  33993. } else if (
  33994. toVal !== fromVal &&
  33995. isPlainObject(toVal) &&
  33996. isPlainObject(fromVal)
  33997. ) {
  33998. mergeData(toVal, fromVal);
  33999. }
  34000. }
  34001. return to
  34002. }
  34003. /**
  34004. * Data
  34005. */
  34006. function mergeDataOrFn (
  34007. parentVal,
  34008. childVal,
  34009. vm
  34010. ) {
  34011. if (!vm) {
  34012. // in a Vue.extend merge, both should be functions
  34013. if (!childVal) {
  34014. return parentVal
  34015. }
  34016. if (!parentVal) {
  34017. return childVal
  34018. }
  34019. // when parentVal & childVal are both present,
  34020. // we need to return a function that returns the
  34021. // merged result of both functions... no need to
  34022. // check if parentVal is a function here because
  34023. // it has to be a function to pass previous merges.
  34024. return function mergedDataFn () {
  34025. return mergeData(
  34026. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  34027. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  34028. )
  34029. }
  34030. } else {
  34031. return function mergedInstanceDataFn () {
  34032. // instance merge
  34033. var instanceData = typeof childVal === 'function'
  34034. ? childVal.call(vm, vm)
  34035. : childVal;
  34036. var defaultData = typeof parentVal === 'function'
  34037. ? parentVal.call(vm, vm)
  34038. : parentVal;
  34039. if (instanceData) {
  34040. return mergeData(instanceData, defaultData)
  34041. } else {
  34042. return defaultData
  34043. }
  34044. }
  34045. }
  34046. }
  34047. strats.data = function (
  34048. parentVal,
  34049. childVal,
  34050. vm
  34051. ) {
  34052. if (!vm) {
  34053. if (childVal && typeof childVal !== 'function') {
  34054. warn(
  34055. 'The "data" option should be a function ' +
  34056. 'that returns a per-instance value in component ' +
  34057. 'definitions.',
  34058. vm
  34059. );
  34060. return parentVal
  34061. }
  34062. return mergeDataOrFn(parentVal, childVal)
  34063. }
  34064. return mergeDataOrFn(parentVal, childVal, vm)
  34065. };
  34066. /**
  34067. * Hooks and props are merged as arrays.
  34068. */
  34069. function mergeHook (
  34070. parentVal,
  34071. childVal
  34072. ) {
  34073. var res = childVal
  34074. ? parentVal
  34075. ? parentVal.concat(childVal)
  34076. : Array.isArray(childVal)
  34077. ? childVal
  34078. : [childVal]
  34079. : parentVal;
  34080. return res
  34081. ? dedupeHooks(res)
  34082. : res
  34083. }
  34084. function dedupeHooks (hooks) {
  34085. var res = [];
  34086. for (var i = 0; i < hooks.length; i++) {
  34087. if (res.indexOf(hooks[i]) === -1) {
  34088. res.push(hooks[i]);
  34089. }
  34090. }
  34091. return res
  34092. }
  34093. LIFECYCLE_HOOKS.forEach(function (hook) {
  34094. strats[hook] = mergeHook;
  34095. });
  34096. /**
  34097. * Assets
  34098. *
  34099. * When a vm is present (instance creation), we need to do
  34100. * a three-way merge between constructor options, instance
  34101. * options and parent options.
  34102. */
  34103. function mergeAssets (
  34104. parentVal,
  34105. childVal,
  34106. vm,
  34107. key
  34108. ) {
  34109. var res = Object.create(parentVal || null);
  34110. if (childVal) {
  34111. assertObjectType(key, childVal, vm);
  34112. return extend(res, childVal)
  34113. } else {
  34114. return res
  34115. }
  34116. }
  34117. ASSET_TYPES.forEach(function (type) {
  34118. strats[type + 's'] = mergeAssets;
  34119. });
  34120. /**
  34121. * Watchers.
  34122. *
  34123. * Watchers hashes should not overwrite one
  34124. * another, so we merge them as arrays.
  34125. */
  34126. strats.watch = function (
  34127. parentVal,
  34128. childVal,
  34129. vm,
  34130. key
  34131. ) {
  34132. // work around Firefox's Object.prototype.watch...
  34133. if (parentVal === nativeWatch) { parentVal = undefined; }
  34134. if (childVal === nativeWatch) { childVal = undefined; }
  34135. /* istanbul ignore if */
  34136. if (!childVal) { return Object.create(parentVal || null) }
  34137. {
  34138. assertObjectType(key, childVal, vm);
  34139. }
  34140. if (!parentVal) { return childVal }
  34141. var ret = {};
  34142. extend(ret, parentVal);
  34143. for (var key$1 in childVal) {
  34144. var parent = ret[key$1];
  34145. var child = childVal[key$1];
  34146. if (parent && !Array.isArray(parent)) {
  34147. parent = [parent];
  34148. }
  34149. ret[key$1] = parent
  34150. ? parent.concat(child)
  34151. : Array.isArray(child) ? child : [child];
  34152. }
  34153. return ret
  34154. };
  34155. /**
  34156. * Other object hashes.
  34157. */
  34158. strats.props =
  34159. strats.methods =
  34160. strats.inject =
  34161. strats.computed = function (
  34162. parentVal,
  34163. childVal,
  34164. vm,
  34165. key
  34166. ) {
  34167. if (childVal && "development" !== 'production') {
  34168. assertObjectType(key, childVal, vm);
  34169. }
  34170. if (!parentVal) { return childVal }
  34171. var ret = Object.create(null);
  34172. extend(ret, parentVal);
  34173. if (childVal) { extend(ret, childVal); }
  34174. return ret
  34175. };
  34176. strats.provide = mergeDataOrFn;
  34177. /**
  34178. * Default strategy.
  34179. */
  34180. var defaultStrat = function (parentVal, childVal) {
  34181. return childVal === undefined
  34182. ? parentVal
  34183. : childVal
  34184. };
  34185. /**
  34186. * Validate component names
  34187. */
  34188. function checkComponents (options) {
  34189. for (var key in options.components) {
  34190. validateComponentName(key);
  34191. }
  34192. }
  34193. function validateComponentName (name) {
  34194. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  34195. warn(
  34196. 'Invalid component name: "' + name + '". Component names ' +
  34197. 'should conform to valid custom element name in html5 specification.'
  34198. );
  34199. }
  34200. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  34201. warn(
  34202. 'Do not use built-in or reserved HTML elements as component ' +
  34203. 'id: ' + name
  34204. );
  34205. }
  34206. }
  34207. /**
  34208. * Ensure all props option syntax are normalized into the
  34209. * Object-based format.
  34210. */
  34211. function normalizeProps (options, vm) {
  34212. var props = options.props;
  34213. if (!props) { return }
  34214. var res = {};
  34215. var i, val, name;
  34216. if (Array.isArray(props)) {
  34217. i = props.length;
  34218. while (i--) {
  34219. val = props[i];
  34220. if (typeof val === 'string') {
  34221. name = camelize(val);
  34222. res[name] = { type: null };
  34223. } else {
  34224. warn('props must be strings when using array syntax.');
  34225. }
  34226. }
  34227. } else if (isPlainObject(props)) {
  34228. for (var key in props) {
  34229. val = props[key];
  34230. name = camelize(key);
  34231. res[name] = isPlainObject(val)
  34232. ? val
  34233. : { type: val };
  34234. }
  34235. } else {
  34236. warn(
  34237. "Invalid value for option \"props\": expected an Array or an Object, " +
  34238. "but got " + (toRawType(props)) + ".",
  34239. vm
  34240. );
  34241. }
  34242. options.props = res;
  34243. }
  34244. /**
  34245. * Normalize all injections into Object-based format
  34246. */
  34247. function normalizeInject (options, vm) {
  34248. var inject = options.inject;
  34249. if (!inject) { return }
  34250. var normalized = options.inject = {};
  34251. if (Array.isArray(inject)) {
  34252. for (var i = 0; i < inject.length; i++) {
  34253. normalized[inject[i]] = { from: inject[i] };
  34254. }
  34255. } else if (isPlainObject(inject)) {
  34256. for (var key in inject) {
  34257. var val = inject[key];
  34258. normalized[key] = isPlainObject(val)
  34259. ? extend({ from: key }, val)
  34260. : { from: val };
  34261. }
  34262. } else {
  34263. warn(
  34264. "Invalid value for option \"inject\": expected an Array or an Object, " +
  34265. "but got " + (toRawType(inject)) + ".",
  34266. vm
  34267. );
  34268. }
  34269. }
  34270. /**
  34271. * Normalize raw function directives into object format.
  34272. */
  34273. function normalizeDirectives (options) {
  34274. var dirs = options.directives;
  34275. if (dirs) {
  34276. for (var key in dirs) {
  34277. var def$$1 = dirs[key];
  34278. if (typeof def$$1 === 'function') {
  34279. dirs[key] = { bind: def$$1, update: def$$1 };
  34280. }
  34281. }
  34282. }
  34283. }
  34284. function assertObjectType (name, value, vm) {
  34285. if (!isPlainObject(value)) {
  34286. warn(
  34287. "Invalid value for option \"" + name + "\": expected an Object, " +
  34288. "but got " + (toRawType(value)) + ".",
  34289. vm
  34290. );
  34291. }
  34292. }
  34293. /**
  34294. * Merge two option objects into a new one.
  34295. * Core utility used in both instantiation and inheritance.
  34296. */
  34297. function mergeOptions (
  34298. parent,
  34299. child,
  34300. vm
  34301. ) {
  34302. {
  34303. checkComponents(child);
  34304. }
  34305. if (typeof child === 'function') {
  34306. child = child.options;
  34307. }
  34308. normalizeProps(child, vm);
  34309. normalizeInject(child, vm);
  34310. normalizeDirectives(child);
  34311. // Apply extends and mixins on the child options,
  34312. // but only if it is a raw options object that isn't
  34313. // the result of another mergeOptions call.
  34314. // Only merged options has the _base property.
  34315. if (!child._base) {
  34316. if (child.extends) {
  34317. parent = mergeOptions(parent, child.extends, vm);
  34318. }
  34319. if (child.mixins) {
  34320. for (var i = 0, l = child.mixins.length; i < l; i++) {
  34321. parent = mergeOptions(parent, child.mixins[i], vm);
  34322. }
  34323. }
  34324. }
  34325. var options = {};
  34326. var key;
  34327. for (key in parent) {
  34328. mergeField(key);
  34329. }
  34330. for (key in child) {
  34331. if (!hasOwn(parent, key)) {
  34332. mergeField(key);
  34333. }
  34334. }
  34335. function mergeField (key) {
  34336. var strat = strats[key] || defaultStrat;
  34337. options[key] = strat(parent[key], child[key], vm, key);
  34338. }
  34339. return options
  34340. }
  34341. /**
  34342. * Resolve an asset.
  34343. * This function is used because child instances need access
  34344. * to assets defined in its ancestor chain.
  34345. */
  34346. function resolveAsset (
  34347. options,
  34348. type,
  34349. id,
  34350. warnMissing
  34351. ) {
  34352. /* istanbul ignore if */
  34353. if (typeof id !== 'string') {
  34354. return
  34355. }
  34356. var assets = options[type];
  34357. // check local registration variations first
  34358. if (hasOwn(assets, id)) { return assets[id] }
  34359. var camelizedId = camelize(id);
  34360. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  34361. var PascalCaseId = capitalize(camelizedId);
  34362. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  34363. // fallback to prototype chain
  34364. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  34365. if (warnMissing && !res) {
  34366. warn(
  34367. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  34368. options
  34369. );
  34370. }
  34371. return res
  34372. }
  34373. /* */
  34374. function validateProp (
  34375. key,
  34376. propOptions,
  34377. propsData,
  34378. vm
  34379. ) {
  34380. var prop = propOptions[key];
  34381. var absent = !hasOwn(propsData, key);
  34382. var value = propsData[key];
  34383. // boolean casting
  34384. var booleanIndex = getTypeIndex(Boolean, prop.type);
  34385. if (booleanIndex > -1) {
  34386. if (absent && !hasOwn(prop, 'default')) {
  34387. value = false;
  34388. } else if (value === '' || value === hyphenate(key)) {
  34389. // only cast empty string / same name to boolean if
  34390. // boolean has higher priority
  34391. var stringIndex = getTypeIndex(String, prop.type);
  34392. if (stringIndex < 0 || booleanIndex < stringIndex) {
  34393. value = true;
  34394. }
  34395. }
  34396. }
  34397. // check default value
  34398. if (value === undefined) {
  34399. value = getPropDefaultValue(vm, prop, key);
  34400. // since the default value is a fresh copy,
  34401. // make sure to observe it.
  34402. var prevShouldObserve = shouldObserve;
  34403. toggleObserving(true);
  34404. observe(value);
  34405. toggleObserving(prevShouldObserve);
  34406. }
  34407. {
  34408. assertProp(prop, key, value, vm, absent);
  34409. }
  34410. return value
  34411. }
  34412. /**
  34413. * Get the default value of a prop.
  34414. */
  34415. function getPropDefaultValue (vm, prop, key) {
  34416. // no default, return undefined
  34417. if (!hasOwn(prop, 'default')) {
  34418. return undefined
  34419. }
  34420. var def = prop.default;
  34421. // warn against non-factory defaults for Object & Array
  34422. if (isObject(def)) {
  34423. warn(
  34424. 'Invalid default value for prop "' + key + '": ' +
  34425. 'Props with type Object/Array must use a factory function ' +
  34426. 'to return the default value.',
  34427. vm
  34428. );
  34429. }
  34430. // the raw prop value was also undefined from previous render,
  34431. // return previous default value to avoid unnecessary watcher trigger
  34432. if (vm && vm.$options.propsData &&
  34433. vm.$options.propsData[key] === undefined &&
  34434. vm._props[key] !== undefined
  34435. ) {
  34436. return vm._props[key]
  34437. }
  34438. // call factory function for non-Function types
  34439. // a value is Function if its prototype is function even across different execution context
  34440. return typeof def === 'function' && getType(prop.type) !== 'Function'
  34441. ? def.call(vm)
  34442. : def
  34443. }
  34444. /**
  34445. * Assert whether a prop is valid.
  34446. */
  34447. function assertProp (
  34448. prop,
  34449. name,
  34450. value,
  34451. vm,
  34452. absent
  34453. ) {
  34454. if (prop.required && absent) {
  34455. warn(
  34456. 'Missing required prop: "' + name + '"',
  34457. vm
  34458. );
  34459. return
  34460. }
  34461. if (value == null && !prop.required) {
  34462. return
  34463. }
  34464. var type = prop.type;
  34465. var valid = !type || type === true;
  34466. var expectedTypes = [];
  34467. if (type) {
  34468. if (!Array.isArray(type)) {
  34469. type = [type];
  34470. }
  34471. for (var i = 0; i < type.length && !valid; i++) {
  34472. var assertedType = assertType(value, type[i]);
  34473. expectedTypes.push(assertedType.expectedType || '');
  34474. valid = assertedType.valid;
  34475. }
  34476. }
  34477. if (!valid) {
  34478. warn(
  34479. getInvalidTypeMessage(name, value, expectedTypes),
  34480. vm
  34481. );
  34482. return
  34483. }
  34484. var validator = prop.validator;
  34485. if (validator) {
  34486. if (!validator(value)) {
  34487. warn(
  34488. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  34489. vm
  34490. );
  34491. }
  34492. }
  34493. }
  34494. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  34495. function assertType (value, type) {
  34496. var valid;
  34497. var expectedType = getType(type);
  34498. if (simpleCheckRE.test(expectedType)) {
  34499. var t = typeof value;
  34500. valid = t === expectedType.toLowerCase();
  34501. // for primitive wrapper objects
  34502. if (!valid && t === 'object') {
  34503. valid = value instanceof type;
  34504. }
  34505. } else if (expectedType === 'Object') {
  34506. valid = isPlainObject(value);
  34507. } else if (expectedType === 'Array') {
  34508. valid = Array.isArray(value);
  34509. } else {
  34510. valid = value instanceof type;
  34511. }
  34512. return {
  34513. valid: valid,
  34514. expectedType: expectedType
  34515. }
  34516. }
  34517. /**
  34518. * Use function string name to check built-in types,
  34519. * because a simple equality check will fail when running
  34520. * across different vms / iframes.
  34521. */
  34522. function getType (fn) {
  34523. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  34524. return match ? match[1] : ''
  34525. }
  34526. function isSameType (a, b) {
  34527. return getType(a) === getType(b)
  34528. }
  34529. function getTypeIndex (type, expectedTypes) {
  34530. if (!Array.isArray(expectedTypes)) {
  34531. return isSameType(expectedTypes, type) ? 0 : -1
  34532. }
  34533. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  34534. if (isSameType(expectedTypes[i], type)) {
  34535. return i
  34536. }
  34537. }
  34538. return -1
  34539. }
  34540. function getInvalidTypeMessage (name, value, expectedTypes) {
  34541. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  34542. " Expected " + (expectedTypes.map(capitalize).join(', '));
  34543. var expectedType = expectedTypes[0];
  34544. var receivedType = toRawType(value);
  34545. var expectedValue = styleValue(value, expectedType);
  34546. var receivedValue = styleValue(value, receivedType);
  34547. // check if we need to specify expected value
  34548. if (expectedTypes.length === 1 &&
  34549. isExplicable(expectedType) &&
  34550. !isBoolean(expectedType, receivedType)) {
  34551. message += " with value " + expectedValue;
  34552. }
  34553. message += ", got " + receivedType + " ";
  34554. // check if we need to specify received value
  34555. if (isExplicable(receivedType)) {
  34556. message += "with value " + receivedValue + ".";
  34557. }
  34558. return message
  34559. }
  34560. function styleValue (value, type) {
  34561. if (type === 'String') {
  34562. return ("\"" + value + "\"")
  34563. } else if (type === 'Number') {
  34564. return ("" + (Number(value)))
  34565. } else {
  34566. return ("" + value)
  34567. }
  34568. }
  34569. function isExplicable (value) {
  34570. var explicitTypes = ['string', 'number', 'boolean'];
  34571. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  34572. }
  34573. function isBoolean () {
  34574. var args = [], len = arguments.length;
  34575. while ( len-- ) args[ len ] = arguments[ len ];
  34576. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  34577. }
  34578. /* */
  34579. function handleError (err, vm, info) {
  34580. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  34581. // See: https://github.com/vuejs/vuex/issues/1505
  34582. pushTarget();
  34583. try {
  34584. if (vm) {
  34585. var cur = vm;
  34586. while ((cur = cur.$parent)) {
  34587. var hooks = cur.$options.errorCaptured;
  34588. if (hooks) {
  34589. for (var i = 0; i < hooks.length; i++) {
  34590. try {
  34591. var capture = hooks[i].call(cur, err, vm, info) === false;
  34592. if (capture) { return }
  34593. } catch (e) {
  34594. globalHandleError(e, cur, 'errorCaptured hook');
  34595. }
  34596. }
  34597. }
  34598. }
  34599. }
  34600. globalHandleError(err, vm, info);
  34601. } finally {
  34602. popTarget();
  34603. }
  34604. }
  34605. function invokeWithErrorHandling (
  34606. handler,
  34607. context,
  34608. args,
  34609. vm,
  34610. info
  34611. ) {
  34612. var res;
  34613. try {
  34614. res = args ? handler.apply(context, args) : handler.call(context);
  34615. if (res && !res._isVue && isPromise(res) && !res._handled) {
  34616. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  34617. // issue #9511
  34618. // avoid catch triggering multiple times when nested calls
  34619. res._handled = true;
  34620. }
  34621. } catch (e) {
  34622. handleError(e, vm, info);
  34623. }
  34624. return res
  34625. }
  34626. function globalHandleError (err, vm, info) {
  34627. if (config.errorHandler) {
  34628. try {
  34629. return config.errorHandler.call(null, err, vm, info)
  34630. } catch (e) {
  34631. // if the user intentionally throws the original error in the handler,
  34632. // do not log it twice
  34633. if (e !== err) {
  34634. logError(e, null, 'config.errorHandler');
  34635. }
  34636. }
  34637. }
  34638. logError(err, vm, info);
  34639. }
  34640. function logError (err, vm, info) {
  34641. {
  34642. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  34643. }
  34644. /* istanbul ignore else */
  34645. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  34646. console.error(err);
  34647. } else {
  34648. throw err
  34649. }
  34650. }
  34651. /* */
  34652. var isUsingMicroTask = false;
  34653. var callbacks = [];
  34654. var pending = false;
  34655. function flushCallbacks () {
  34656. pending = false;
  34657. var copies = callbacks.slice(0);
  34658. callbacks.length = 0;
  34659. for (var i = 0; i < copies.length; i++) {
  34660. copies[i]();
  34661. }
  34662. }
  34663. // Here we have async deferring wrappers using microtasks.
  34664. // In 2.5 we used (macro) tasks (in combination with microtasks).
  34665. // However, it has subtle problems when state is changed right before repaint
  34666. // (e.g. #6813, out-in transitions).
  34667. // Also, using (macro) tasks in event handler would cause some weird behaviors
  34668. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  34669. // So we now use microtasks everywhere, again.
  34670. // A major drawback of this tradeoff is that there are some scenarios
  34671. // where microtasks have too high a priority and fire in between supposedly
  34672. // sequential events (e.g. #4521, #6690, which have workarounds)
  34673. // or even between bubbling of the same event (#6566).
  34674. var timerFunc;
  34675. // The nextTick behavior leverages the microtask queue, which can be accessed
  34676. // via either native Promise.then or MutationObserver.
  34677. // MutationObserver has wider support, however it is seriously bugged in
  34678. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  34679. // completely stops working after triggering a few times... so, if native
  34680. // Promise is available, we will use it:
  34681. /* istanbul ignore next, $flow-disable-line */
  34682. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  34683. var p = Promise.resolve();
  34684. timerFunc = function () {
  34685. p.then(flushCallbacks);
  34686. // In problematic UIWebViews, Promise.then doesn't completely break, but
  34687. // it can get stuck in a weird state where callbacks are pushed into the
  34688. // microtask queue but the queue isn't being flushed, until the browser
  34689. // needs to do some other work, e.g. handle a timer. Therefore we can
  34690. // "force" the microtask queue to be flushed by adding an empty timer.
  34691. if (isIOS) { setTimeout(noop); }
  34692. };
  34693. isUsingMicroTask = true;
  34694. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  34695. isNative(MutationObserver) ||
  34696. // PhantomJS and iOS 7.x
  34697. MutationObserver.toString() === '[object MutationObserverConstructor]'
  34698. )) {
  34699. // Use MutationObserver where native Promise is not available,
  34700. // e.g. PhantomJS, iOS7, Android 4.4
  34701. // (#6466 MutationObserver is unreliable in IE11)
  34702. var counter = 1;
  34703. var observer = new MutationObserver(flushCallbacks);
  34704. var textNode = document.createTextNode(String(counter));
  34705. observer.observe(textNode, {
  34706. characterData: true
  34707. });
  34708. timerFunc = function () {
  34709. counter = (counter + 1) % 2;
  34710. textNode.data = String(counter);
  34711. };
  34712. isUsingMicroTask = true;
  34713. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  34714. // Fallback to setImmediate.
  34715. // Technically it leverages the (macro) task queue,
  34716. // but it is still a better choice than setTimeout.
  34717. timerFunc = function () {
  34718. setImmediate(flushCallbacks);
  34719. };
  34720. } else {
  34721. // Fallback to setTimeout.
  34722. timerFunc = function () {
  34723. setTimeout(flushCallbacks, 0);
  34724. };
  34725. }
  34726. function nextTick (cb, ctx) {
  34727. var _resolve;
  34728. callbacks.push(function () {
  34729. if (cb) {
  34730. try {
  34731. cb.call(ctx);
  34732. } catch (e) {
  34733. handleError(e, ctx, 'nextTick');
  34734. }
  34735. } else if (_resolve) {
  34736. _resolve(ctx);
  34737. }
  34738. });
  34739. if (!pending) {
  34740. pending = true;
  34741. timerFunc();
  34742. }
  34743. // $flow-disable-line
  34744. if (!cb && typeof Promise !== 'undefined') {
  34745. return new Promise(function (resolve) {
  34746. _resolve = resolve;
  34747. })
  34748. }
  34749. }
  34750. /* */
  34751. var mark;
  34752. var measure;
  34753. {
  34754. var perf = inBrowser && window.performance;
  34755. /* istanbul ignore if */
  34756. if (
  34757. perf &&
  34758. perf.mark &&
  34759. perf.measure &&
  34760. perf.clearMarks &&
  34761. perf.clearMeasures
  34762. ) {
  34763. mark = function (tag) { return perf.mark(tag); };
  34764. measure = function (name, startTag, endTag) {
  34765. perf.measure(name, startTag, endTag);
  34766. perf.clearMarks(startTag);
  34767. perf.clearMarks(endTag);
  34768. // perf.clearMeasures(name)
  34769. };
  34770. }
  34771. }
  34772. /* not type checking this file because flow doesn't play well with Proxy */
  34773. var initProxy;
  34774. {
  34775. var allowedGlobals = makeMap(
  34776. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  34777. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  34778. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  34779. 'require' // for Webpack/Browserify
  34780. );
  34781. var warnNonPresent = function (target, key) {
  34782. warn(
  34783. "Property or method \"" + key + "\" is not defined on the instance but " +
  34784. 'referenced during render. Make sure that this property is reactive, ' +
  34785. 'either in the data option, or for class-based components, by ' +
  34786. 'initializing the property. ' +
  34787. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  34788. target
  34789. );
  34790. };
  34791. var warnReservedPrefix = function (target, key) {
  34792. warn(
  34793. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  34794. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  34795. 'prevent conflicts with Vue internals. ' +
  34796. 'See: https://vuejs.org/v2/api/#data',
  34797. target
  34798. );
  34799. };
  34800. var hasProxy =
  34801. typeof Proxy !== 'undefined' && isNative(Proxy);
  34802. if (hasProxy) {
  34803. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  34804. config.keyCodes = new Proxy(config.keyCodes, {
  34805. set: function set (target, key, value) {
  34806. if (isBuiltInModifier(key)) {
  34807. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  34808. return false
  34809. } else {
  34810. target[key] = value;
  34811. return true
  34812. }
  34813. }
  34814. });
  34815. }
  34816. var hasHandler = {
  34817. has: function has (target, key) {
  34818. var has = key in target;
  34819. var isAllowed = allowedGlobals(key) ||
  34820. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  34821. if (!has && !isAllowed) {
  34822. if (key in target.$data) { warnReservedPrefix(target, key); }
  34823. else { warnNonPresent(target, key); }
  34824. }
  34825. return has || !isAllowed
  34826. }
  34827. };
  34828. var getHandler = {
  34829. get: function get (target, key) {
  34830. if (typeof key === 'string' && !(key in target)) {
  34831. if (key in target.$data) { warnReservedPrefix(target, key); }
  34832. else { warnNonPresent(target, key); }
  34833. }
  34834. return target[key]
  34835. }
  34836. };
  34837. initProxy = function initProxy (vm) {
  34838. if (hasProxy) {
  34839. // determine which proxy handler to use
  34840. var options = vm.$options;
  34841. var handlers = options.render && options.render._withStripped
  34842. ? getHandler
  34843. : hasHandler;
  34844. vm._renderProxy = new Proxy(vm, handlers);
  34845. } else {
  34846. vm._renderProxy = vm;
  34847. }
  34848. };
  34849. }
  34850. /* */
  34851. var seenObjects = new _Set();
  34852. /**
  34853. * Recursively traverse an object to evoke all converted
  34854. * getters, so that every nested property inside the object
  34855. * is collected as a "deep" dependency.
  34856. */
  34857. function traverse (val) {
  34858. _traverse(val, seenObjects);
  34859. seenObjects.clear();
  34860. }
  34861. function _traverse (val, seen) {
  34862. var i, keys;
  34863. var isA = Array.isArray(val);
  34864. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  34865. return
  34866. }
  34867. if (val.__ob__) {
  34868. var depId = val.__ob__.dep.id;
  34869. if (seen.has(depId)) {
  34870. return
  34871. }
  34872. seen.add(depId);
  34873. }
  34874. if (isA) {
  34875. i = val.length;
  34876. while (i--) { _traverse(val[i], seen); }
  34877. } else {
  34878. keys = Object.keys(val);
  34879. i = keys.length;
  34880. while (i--) { _traverse(val[keys[i]], seen); }
  34881. }
  34882. }
  34883. /* */
  34884. var normalizeEvent = cached(function (name) {
  34885. var passive = name.charAt(0) === '&';
  34886. name = passive ? name.slice(1) : name;
  34887. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  34888. name = once$$1 ? name.slice(1) : name;
  34889. var capture = name.charAt(0) === '!';
  34890. name = capture ? name.slice(1) : name;
  34891. return {
  34892. name: name,
  34893. once: once$$1,
  34894. capture: capture,
  34895. passive: passive
  34896. }
  34897. });
  34898. function createFnInvoker (fns, vm) {
  34899. function invoker () {
  34900. var arguments$1 = arguments;
  34901. var fns = invoker.fns;
  34902. if (Array.isArray(fns)) {
  34903. var cloned = fns.slice();
  34904. for (var i = 0; i < cloned.length; i++) {
  34905. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  34906. }
  34907. } else {
  34908. // return handler return value for single handlers
  34909. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  34910. }
  34911. }
  34912. invoker.fns = fns;
  34913. return invoker
  34914. }
  34915. function updateListeners (
  34916. on,
  34917. oldOn,
  34918. add,
  34919. remove$$1,
  34920. createOnceHandler,
  34921. vm
  34922. ) {
  34923. var name, def$$1, cur, old, event;
  34924. for (name in on) {
  34925. def$$1 = cur = on[name];
  34926. old = oldOn[name];
  34927. event = normalizeEvent(name);
  34928. if (isUndef(cur)) {
  34929. warn(
  34930. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  34931. vm
  34932. );
  34933. } else if (isUndef(old)) {
  34934. if (isUndef(cur.fns)) {
  34935. cur = on[name] = createFnInvoker(cur, vm);
  34936. }
  34937. if (isTrue(event.once)) {
  34938. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  34939. }
  34940. add(event.name, cur, event.capture, event.passive, event.params);
  34941. } else if (cur !== old) {
  34942. old.fns = cur;
  34943. on[name] = old;
  34944. }
  34945. }
  34946. for (name in oldOn) {
  34947. if (isUndef(on[name])) {
  34948. event = normalizeEvent(name);
  34949. remove$$1(event.name, oldOn[name], event.capture);
  34950. }
  34951. }
  34952. }
  34953. /* */
  34954. function mergeVNodeHook (def, hookKey, hook) {
  34955. if (def instanceof VNode) {
  34956. def = def.data.hook || (def.data.hook = {});
  34957. }
  34958. var invoker;
  34959. var oldHook = def[hookKey];
  34960. function wrappedHook () {
  34961. hook.apply(this, arguments);
  34962. // important: remove merged hook to ensure it's called only once
  34963. // and prevent memory leak
  34964. remove(invoker.fns, wrappedHook);
  34965. }
  34966. if (isUndef(oldHook)) {
  34967. // no existing hook
  34968. invoker = createFnInvoker([wrappedHook]);
  34969. } else {
  34970. /* istanbul ignore if */
  34971. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  34972. // already a merged invoker
  34973. invoker = oldHook;
  34974. invoker.fns.push(wrappedHook);
  34975. } else {
  34976. // existing plain hook
  34977. invoker = createFnInvoker([oldHook, wrappedHook]);
  34978. }
  34979. }
  34980. invoker.merged = true;
  34981. def[hookKey] = invoker;
  34982. }
  34983. /* */
  34984. function extractPropsFromVNodeData (
  34985. data,
  34986. Ctor,
  34987. tag
  34988. ) {
  34989. // we are only extracting raw values here.
  34990. // validation and default values are handled in the child
  34991. // component itself.
  34992. var propOptions = Ctor.options.props;
  34993. if (isUndef(propOptions)) {
  34994. return
  34995. }
  34996. var res = {};
  34997. var attrs = data.attrs;
  34998. var props = data.props;
  34999. if (isDef(attrs) || isDef(props)) {
  35000. for (var key in propOptions) {
  35001. var altKey = hyphenate(key);
  35002. {
  35003. var keyInLowerCase = key.toLowerCase();
  35004. if (
  35005. key !== keyInLowerCase &&
  35006. attrs && hasOwn(attrs, keyInLowerCase)
  35007. ) {
  35008. tip(
  35009. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  35010. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  35011. " \"" + key + "\". " +
  35012. "Note that HTML attributes are case-insensitive and camelCased " +
  35013. "props need to use their kebab-case equivalents when using in-DOM " +
  35014. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  35015. );
  35016. }
  35017. }
  35018. checkProp(res, props, key, altKey, true) ||
  35019. checkProp(res, attrs, key, altKey, false);
  35020. }
  35021. }
  35022. return res
  35023. }
  35024. function checkProp (
  35025. res,
  35026. hash,
  35027. key,
  35028. altKey,
  35029. preserve
  35030. ) {
  35031. if (isDef(hash)) {
  35032. if (hasOwn(hash, key)) {
  35033. res[key] = hash[key];
  35034. if (!preserve) {
  35035. delete hash[key];
  35036. }
  35037. return true
  35038. } else if (hasOwn(hash, altKey)) {
  35039. res[key] = hash[altKey];
  35040. if (!preserve) {
  35041. delete hash[altKey];
  35042. }
  35043. return true
  35044. }
  35045. }
  35046. return false
  35047. }
  35048. /* */
  35049. // The template compiler attempts to minimize the need for normalization by
  35050. // statically analyzing the template at compile time.
  35051. //
  35052. // For plain HTML markup, normalization can be completely skipped because the
  35053. // generated render function is guaranteed to return Array<VNode>. There are
  35054. // two cases where extra normalization is needed:
  35055. // 1. When the children contains components - because a functional component
  35056. // may return an Array instead of a single root. In this case, just a simple
  35057. // normalization is needed - if any child is an Array, we flatten the whole
  35058. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  35059. // because functional components already normalize their own children.
  35060. function simpleNormalizeChildren (children) {
  35061. for (var i = 0; i < children.length; i++) {
  35062. if (Array.isArray(children[i])) {
  35063. return Array.prototype.concat.apply([], children)
  35064. }
  35065. }
  35066. return children
  35067. }
  35068. // 2. When the children contains constructs that always generated nested Arrays,
  35069. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  35070. // with hand-written render functions / JSX. In such cases a full normalization
  35071. // is needed to cater to all possible types of children values.
  35072. function normalizeChildren (children) {
  35073. return isPrimitive(children)
  35074. ? [createTextVNode(children)]
  35075. : Array.isArray(children)
  35076. ? normalizeArrayChildren(children)
  35077. : undefined
  35078. }
  35079. function isTextNode (node) {
  35080. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  35081. }
  35082. function normalizeArrayChildren (children, nestedIndex) {
  35083. var res = [];
  35084. var i, c, lastIndex, last;
  35085. for (i = 0; i < children.length; i++) {
  35086. c = children[i];
  35087. if (isUndef(c) || typeof c === 'boolean') { continue }
  35088. lastIndex = res.length - 1;
  35089. last = res[lastIndex];
  35090. // nested
  35091. if (Array.isArray(c)) {
  35092. if (c.length > 0) {
  35093. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  35094. // merge adjacent text nodes
  35095. if (isTextNode(c[0]) && isTextNode(last)) {
  35096. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  35097. c.shift();
  35098. }
  35099. res.push.apply(res, c);
  35100. }
  35101. } else if (isPrimitive(c)) {
  35102. if (isTextNode(last)) {
  35103. // merge adjacent text nodes
  35104. // this is necessary for SSR hydration because text nodes are
  35105. // essentially merged when rendered to HTML strings
  35106. res[lastIndex] = createTextVNode(last.text + c);
  35107. } else if (c !== '') {
  35108. // convert primitive to vnode
  35109. res.push(createTextVNode(c));
  35110. }
  35111. } else {
  35112. if (isTextNode(c) && isTextNode(last)) {
  35113. // merge adjacent text nodes
  35114. res[lastIndex] = createTextVNode(last.text + c.text);
  35115. } else {
  35116. // default key for nested array children (likely generated by v-for)
  35117. if (isTrue(children._isVList) &&
  35118. isDef(c.tag) &&
  35119. isUndef(c.key) &&
  35120. isDef(nestedIndex)) {
  35121. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  35122. }
  35123. res.push(c);
  35124. }
  35125. }
  35126. }
  35127. return res
  35128. }
  35129. /* */
  35130. function initProvide (vm) {
  35131. var provide = vm.$options.provide;
  35132. if (provide) {
  35133. vm._provided = typeof provide === 'function'
  35134. ? provide.call(vm)
  35135. : provide;
  35136. }
  35137. }
  35138. function initInjections (vm) {
  35139. var result = resolveInject(vm.$options.inject, vm);
  35140. if (result) {
  35141. toggleObserving(false);
  35142. Object.keys(result).forEach(function (key) {
  35143. /* istanbul ignore else */
  35144. {
  35145. defineReactive$$1(vm, key, result[key], function () {
  35146. warn(
  35147. "Avoid mutating an injected value directly since the changes will be " +
  35148. "overwritten whenever the provided component re-renders. " +
  35149. "injection being mutated: \"" + key + "\"",
  35150. vm
  35151. );
  35152. });
  35153. }
  35154. });
  35155. toggleObserving(true);
  35156. }
  35157. }
  35158. function resolveInject (inject, vm) {
  35159. if (inject) {
  35160. // inject is :any because flow is not smart enough to figure out cached
  35161. var result = Object.create(null);
  35162. var keys = hasSymbol
  35163. ? Reflect.ownKeys(inject)
  35164. : Object.keys(inject);
  35165. for (var i = 0; i < keys.length; i++) {
  35166. var key = keys[i];
  35167. // #6574 in case the inject object is observed...
  35168. if (key === '__ob__') { continue }
  35169. var provideKey = inject[key].from;
  35170. var source = vm;
  35171. while (source) {
  35172. if (source._provided && hasOwn(source._provided, provideKey)) {
  35173. result[key] = source._provided[provideKey];
  35174. break
  35175. }
  35176. source = source.$parent;
  35177. }
  35178. if (!source) {
  35179. if ('default' in inject[key]) {
  35180. var provideDefault = inject[key].default;
  35181. result[key] = typeof provideDefault === 'function'
  35182. ? provideDefault.call(vm)
  35183. : provideDefault;
  35184. } else {
  35185. warn(("Injection \"" + key + "\" not found"), vm);
  35186. }
  35187. }
  35188. }
  35189. return result
  35190. }
  35191. }
  35192. /* */
  35193. /**
  35194. * Runtime helper for resolving raw children VNodes into a slot object.
  35195. */
  35196. function resolveSlots (
  35197. children,
  35198. context
  35199. ) {
  35200. if (!children || !children.length) {
  35201. return {}
  35202. }
  35203. var slots = {};
  35204. for (var i = 0, l = children.length; i < l; i++) {
  35205. var child = children[i];
  35206. var data = child.data;
  35207. // remove slot attribute if the node is resolved as a Vue slot node
  35208. if (data && data.attrs && data.attrs.slot) {
  35209. delete data.attrs.slot;
  35210. }
  35211. // named slots should only be respected if the vnode was rendered in the
  35212. // same context.
  35213. if ((child.context === context || child.fnContext === context) &&
  35214. data && data.slot != null
  35215. ) {
  35216. var name = data.slot;
  35217. var slot = (slots[name] || (slots[name] = []));
  35218. if (child.tag === 'template') {
  35219. slot.push.apply(slot, child.children || []);
  35220. } else {
  35221. slot.push(child);
  35222. }
  35223. } else {
  35224. (slots.default || (slots.default = [])).push(child);
  35225. }
  35226. }
  35227. // ignore slots that contains only whitespace
  35228. for (var name$1 in slots) {
  35229. if (slots[name$1].every(isWhitespace)) {
  35230. delete slots[name$1];
  35231. }
  35232. }
  35233. return slots
  35234. }
  35235. function isWhitespace (node) {
  35236. return (node.isComment && !node.asyncFactory) || node.text === ' '
  35237. }
  35238. /* */
  35239. function normalizeScopedSlots (
  35240. slots,
  35241. normalSlots,
  35242. prevSlots
  35243. ) {
  35244. var res;
  35245. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  35246. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  35247. var key = slots && slots.$key;
  35248. if (!slots) {
  35249. res = {};
  35250. } else if (slots._normalized) {
  35251. // fast path 1: child component re-render only, parent did not change
  35252. return slots._normalized
  35253. } else if (
  35254. isStable &&
  35255. prevSlots &&
  35256. prevSlots !== emptyObject &&
  35257. key === prevSlots.$key &&
  35258. !hasNormalSlots &&
  35259. !prevSlots.$hasNormal
  35260. ) {
  35261. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  35262. // only need to normalize once
  35263. return prevSlots
  35264. } else {
  35265. res = {};
  35266. for (var key$1 in slots) {
  35267. if (slots[key$1] && key$1[0] !== '$') {
  35268. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  35269. }
  35270. }
  35271. }
  35272. // expose normal slots on scopedSlots
  35273. for (var key$2 in normalSlots) {
  35274. if (!(key$2 in res)) {
  35275. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  35276. }
  35277. }
  35278. // avoriaz seems to mock a non-extensible $scopedSlots object
  35279. // and when that is passed down this would cause an error
  35280. if (slots && Object.isExtensible(slots)) {
  35281. (slots)._normalized = res;
  35282. }
  35283. def(res, '$stable', isStable);
  35284. def(res, '$key', key);
  35285. def(res, '$hasNormal', hasNormalSlots);
  35286. return res
  35287. }
  35288. function normalizeScopedSlot(normalSlots, key, fn) {
  35289. var normalized = function () {
  35290. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  35291. res = res && typeof res === 'object' && !Array.isArray(res)
  35292. ? [res] // single vnode
  35293. : normalizeChildren(res);
  35294. return res && (
  35295. res.length === 0 ||
  35296. (res.length === 1 && res[0].isComment) // #9658
  35297. ) ? undefined
  35298. : res
  35299. };
  35300. // this is a slot using the new v-slot syntax without scope. although it is
  35301. // compiled as a scoped slot, render fn users would expect it to be present
  35302. // on this.$slots because the usage is semantically a normal slot.
  35303. if (fn.proxy) {
  35304. Object.defineProperty(normalSlots, key, {
  35305. get: normalized,
  35306. enumerable: true,
  35307. configurable: true
  35308. });
  35309. }
  35310. return normalized
  35311. }
  35312. function proxyNormalSlot(slots, key) {
  35313. return function () { return slots[key]; }
  35314. }
  35315. /* */
  35316. /**
  35317. * Runtime helper for rendering v-for lists.
  35318. */
  35319. function renderList (
  35320. val,
  35321. render
  35322. ) {
  35323. var ret, i, l, keys, key;
  35324. if (Array.isArray(val) || typeof val === 'string') {
  35325. ret = new Array(val.length);
  35326. for (i = 0, l = val.length; i < l; i++) {
  35327. ret[i] = render(val[i], i);
  35328. }
  35329. } else if (typeof val === 'number') {
  35330. ret = new Array(val);
  35331. for (i = 0; i < val; i++) {
  35332. ret[i] = render(i + 1, i);
  35333. }
  35334. } else if (isObject(val)) {
  35335. if (hasSymbol && val[Symbol.iterator]) {
  35336. ret = [];
  35337. var iterator = val[Symbol.iterator]();
  35338. var result = iterator.next();
  35339. while (!result.done) {
  35340. ret.push(render(result.value, ret.length));
  35341. result = iterator.next();
  35342. }
  35343. } else {
  35344. keys = Object.keys(val);
  35345. ret = new Array(keys.length);
  35346. for (i = 0, l = keys.length; i < l; i++) {
  35347. key = keys[i];
  35348. ret[i] = render(val[key], key, i);
  35349. }
  35350. }
  35351. }
  35352. if (!isDef(ret)) {
  35353. ret = [];
  35354. }
  35355. (ret)._isVList = true;
  35356. return ret
  35357. }
  35358. /* */
  35359. /**
  35360. * Runtime helper for rendering <slot>
  35361. */
  35362. function renderSlot (
  35363. name,
  35364. fallback,
  35365. props,
  35366. bindObject
  35367. ) {
  35368. var scopedSlotFn = this.$scopedSlots[name];
  35369. var nodes;
  35370. if (scopedSlotFn) { // scoped slot
  35371. props = props || {};
  35372. if (bindObject) {
  35373. if (!isObject(bindObject)) {
  35374. warn(
  35375. 'slot v-bind without argument expects an Object',
  35376. this
  35377. );
  35378. }
  35379. props = extend(extend({}, bindObject), props);
  35380. }
  35381. nodes = scopedSlotFn(props) || fallback;
  35382. } else {
  35383. nodes = this.$slots[name] || fallback;
  35384. }
  35385. var target = props && props.slot;
  35386. if (target) {
  35387. return this.$createElement('template', { slot: target }, nodes)
  35388. } else {
  35389. return nodes
  35390. }
  35391. }
  35392. /* */
  35393. /**
  35394. * Runtime helper for resolving filters
  35395. */
  35396. function resolveFilter (id) {
  35397. return resolveAsset(this.$options, 'filters', id, true) || identity
  35398. }
  35399. /* */
  35400. function isKeyNotMatch (expect, actual) {
  35401. if (Array.isArray(expect)) {
  35402. return expect.indexOf(actual) === -1
  35403. } else {
  35404. return expect !== actual
  35405. }
  35406. }
  35407. /**
  35408. * Runtime helper for checking keyCodes from config.
  35409. * exposed as Vue.prototype._k
  35410. * passing in eventKeyName as last argument separately for backwards compat
  35411. */
  35412. function checkKeyCodes (
  35413. eventKeyCode,
  35414. key,
  35415. builtInKeyCode,
  35416. eventKeyName,
  35417. builtInKeyName
  35418. ) {
  35419. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  35420. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  35421. return isKeyNotMatch(builtInKeyName, eventKeyName)
  35422. } else if (mappedKeyCode) {
  35423. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  35424. } else if (eventKeyName) {
  35425. return hyphenate(eventKeyName) !== key
  35426. }
  35427. }
  35428. /* */
  35429. /**
  35430. * Runtime helper for merging v-bind="object" into a VNode's data.
  35431. */
  35432. function bindObjectProps (
  35433. data,
  35434. tag,
  35435. value,
  35436. asProp,
  35437. isSync
  35438. ) {
  35439. if (value) {
  35440. if (!isObject(value)) {
  35441. warn(
  35442. 'v-bind without argument expects an Object or Array value',
  35443. this
  35444. );
  35445. } else {
  35446. if (Array.isArray(value)) {
  35447. value = toObject(value);
  35448. }
  35449. var hash;
  35450. var loop = function ( key ) {
  35451. if (
  35452. key === 'class' ||
  35453. key === 'style' ||
  35454. isReservedAttribute(key)
  35455. ) {
  35456. hash = data;
  35457. } else {
  35458. var type = data.attrs && data.attrs.type;
  35459. hash = asProp || config.mustUseProp(tag, type, key)
  35460. ? data.domProps || (data.domProps = {})
  35461. : data.attrs || (data.attrs = {});
  35462. }
  35463. var camelizedKey = camelize(key);
  35464. var hyphenatedKey = hyphenate(key);
  35465. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  35466. hash[key] = value[key];
  35467. if (isSync) {
  35468. var on = data.on || (data.on = {});
  35469. on[("update:" + key)] = function ($event) {
  35470. value[key] = $event;
  35471. };
  35472. }
  35473. }
  35474. };
  35475. for (var key in value) loop( key );
  35476. }
  35477. }
  35478. return data
  35479. }
  35480. /* */
  35481. /**
  35482. * Runtime helper for rendering static trees.
  35483. */
  35484. function renderStatic (
  35485. index,
  35486. isInFor
  35487. ) {
  35488. var cached = this._staticTrees || (this._staticTrees = []);
  35489. var tree = cached[index];
  35490. // if has already-rendered static tree and not inside v-for,
  35491. // we can reuse the same tree.
  35492. if (tree && !isInFor) {
  35493. return tree
  35494. }
  35495. // otherwise, render a fresh tree.
  35496. tree = cached[index] = this.$options.staticRenderFns[index].call(
  35497. this._renderProxy,
  35498. null,
  35499. this // for render fns generated for functional component templates
  35500. );
  35501. markStatic(tree, ("__static__" + index), false);
  35502. return tree
  35503. }
  35504. /**
  35505. * Runtime helper for v-once.
  35506. * Effectively it means marking the node as static with a unique key.
  35507. */
  35508. function markOnce (
  35509. tree,
  35510. index,
  35511. key
  35512. ) {
  35513. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  35514. return tree
  35515. }
  35516. function markStatic (
  35517. tree,
  35518. key,
  35519. isOnce
  35520. ) {
  35521. if (Array.isArray(tree)) {
  35522. for (var i = 0; i < tree.length; i++) {
  35523. if (tree[i] && typeof tree[i] !== 'string') {
  35524. markStaticNode(tree[i], (key + "_" + i), isOnce);
  35525. }
  35526. }
  35527. } else {
  35528. markStaticNode(tree, key, isOnce);
  35529. }
  35530. }
  35531. function markStaticNode (node, key, isOnce) {
  35532. node.isStatic = true;
  35533. node.key = key;
  35534. node.isOnce = isOnce;
  35535. }
  35536. /* */
  35537. function bindObjectListeners (data, value) {
  35538. if (value) {
  35539. if (!isPlainObject(value)) {
  35540. warn(
  35541. 'v-on without argument expects an Object value',
  35542. this
  35543. );
  35544. } else {
  35545. var on = data.on = data.on ? extend({}, data.on) : {};
  35546. for (var key in value) {
  35547. var existing = on[key];
  35548. var ours = value[key];
  35549. on[key] = existing ? [].concat(existing, ours) : ours;
  35550. }
  35551. }
  35552. }
  35553. return data
  35554. }
  35555. /* */
  35556. function resolveScopedSlots (
  35557. fns, // see flow/vnode
  35558. res,
  35559. // the following are added in 2.6
  35560. hasDynamicKeys,
  35561. contentHashKey
  35562. ) {
  35563. res = res || { $stable: !hasDynamicKeys };
  35564. for (var i = 0; i < fns.length; i++) {
  35565. var slot = fns[i];
  35566. if (Array.isArray(slot)) {
  35567. resolveScopedSlots(slot, res, hasDynamicKeys);
  35568. } else if (slot) {
  35569. // marker for reverse proxying v-slot without scope on this.$slots
  35570. if (slot.proxy) {
  35571. slot.fn.proxy = true;
  35572. }
  35573. res[slot.key] = slot.fn;
  35574. }
  35575. }
  35576. if (contentHashKey) {
  35577. (res).$key = contentHashKey;
  35578. }
  35579. return res
  35580. }
  35581. /* */
  35582. function bindDynamicKeys (baseObj, values) {
  35583. for (var i = 0; i < values.length; i += 2) {
  35584. var key = values[i];
  35585. if (typeof key === 'string' && key) {
  35586. baseObj[values[i]] = values[i + 1];
  35587. } else if (key !== '' && key !== null) {
  35588. // null is a special value for explicitly removing a binding
  35589. warn(
  35590. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  35591. this
  35592. );
  35593. }
  35594. }
  35595. return baseObj
  35596. }
  35597. // helper to dynamically append modifier runtime markers to event names.
  35598. // ensure only append when value is already string, otherwise it will be cast
  35599. // to string and cause the type check to miss.
  35600. function prependModifier (value, symbol) {
  35601. return typeof value === 'string' ? symbol + value : value
  35602. }
  35603. /* */
  35604. function installRenderHelpers (target) {
  35605. target._o = markOnce;
  35606. target._n = toNumber;
  35607. target._s = toString;
  35608. target._l = renderList;
  35609. target._t = renderSlot;
  35610. target._q = looseEqual;
  35611. target._i = looseIndexOf;
  35612. target._m = renderStatic;
  35613. target._f = resolveFilter;
  35614. target._k = checkKeyCodes;
  35615. target._b = bindObjectProps;
  35616. target._v = createTextVNode;
  35617. target._e = createEmptyVNode;
  35618. target._u = resolveScopedSlots;
  35619. target._g = bindObjectListeners;
  35620. target._d = bindDynamicKeys;
  35621. target._p = prependModifier;
  35622. }
  35623. /* */
  35624. function FunctionalRenderContext (
  35625. data,
  35626. props,
  35627. children,
  35628. parent,
  35629. Ctor
  35630. ) {
  35631. var this$1 = this;
  35632. var options = Ctor.options;
  35633. // ensure the createElement function in functional components
  35634. // gets a unique context - this is necessary for correct named slot check
  35635. var contextVm;
  35636. if (hasOwn(parent, '_uid')) {
  35637. contextVm = Object.create(parent);
  35638. // $flow-disable-line
  35639. contextVm._original = parent;
  35640. } else {
  35641. // the context vm passed in is a functional context as well.
  35642. // in this case we want to make sure we are able to get a hold to the
  35643. // real context instance.
  35644. contextVm = parent;
  35645. // $flow-disable-line
  35646. parent = parent._original;
  35647. }
  35648. var isCompiled = isTrue(options._compiled);
  35649. var needNormalization = !isCompiled;
  35650. this.data = data;
  35651. this.props = props;
  35652. this.children = children;
  35653. this.parent = parent;
  35654. this.listeners = data.on || emptyObject;
  35655. this.injections = resolveInject(options.inject, parent);
  35656. this.slots = function () {
  35657. if (!this$1.$slots) {
  35658. normalizeScopedSlots(
  35659. data.scopedSlots,
  35660. this$1.$slots = resolveSlots(children, parent)
  35661. );
  35662. }
  35663. return this$1.$slots
  35664. };
  35665. Object.defineProperty(this, 'scopedSlots', ({
  35666. enumerable: true,
  35667. get: function get () {
  35668. return normalizeScopedSlots(data.scopedSlots, this.slots())
  35669. }
  35670. }));
  35671. // support for compiled functional template
  35672. if (isCompiled) {
  35673. // exposing $options for renderStatic()
  35674. this.$options = options;
  35675. // pre-resolve slots for renderSlot()
  35676. this.$slots = this.slots();
  35677. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  35678. }
  35679. if (options._scopeId) {
  35680. this._c = function (a, b, c, d) {
  35681. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  35682. if (vnode && !Array.isArray(vnode)) {
  35683. vnode.fnScopeId = options._scopeId;
  35684. vnode.fnContext = parent;
  35685. }
  35686. return vnode
  35687. };
  35688. } else {
  35689. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  35690. }
  35691. }
  35692. installRenderHelpers(FunctionalRenderContext.prototype);
  35693. function createFunctionalComponent (
  35694. Ctor,
  35695. propsData,
  35696. data,
  35697. contextVm,
  35698. children
  35699. ) {
  35700. var options = Ctor.options;
  35701. var props = {};
  35702. var propOptions = options.props;
  35703. if (isDef(propOptions)) {
  35704. for (var key in propOptions) {
  35705. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  35706. }
  35707. } else {
  35708. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  35709. if (isDef(data.props)) { mergeProps(props, data.props); }
  35710. }
  35711. var renderContext = new FunctionalRenderContext(
  35712. data,
  35713. props,
  35714. children,
  35715. contextVm,
  35716. Ctor
  35717. );
  35718. var vnode = options.render.call(null, renderContext._c, renderContext);
  35719. if (vnode instanceof VNode) {
  35720. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  35721. } else if (Array.isArray(vnode)) {
  35722. var vnodes = normalizeChildren(vnode) || [];
  35723. var res = new Array(vnodes.length);
  35724. for (var i = 0; i < vnodes.length; i++) {
  35725. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  35726. }
  35727. return res
  35728. }
  35729. }
  35730. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  35731. // #7817 clone node before setting fnContext, otherwise if the node is reused
  35732. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  35733. // that should not be matched to match.
  35734. var clone = cloneVNode(vnode);
  35735. clone.fnContext = contextVm;
  35736. clone.fnOptions = options;
  35737. {
  35738. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  35739. }
  35740. if (data.slot) {
  35741. (clone.data || (clone.data = {})).slot = data.slot;
  35742. }
  35743. return clone
  35744. }
  35745. function mergeProps (to, from) {
  35746. for (var key in from) {
  35747. to[camelize(key)] = from[key];
  35748. }
  35749. }
  35750. /* */
  35751. /* */
  35752. /* */
  35753. /* */
  35754. // inline hooks to be invoked on component VNodes during patch
  35755. var componentVNodeHooks = {
  35756. init: function init (vnode, hydrating) {
  35757. if (
  35758. vnode.componentInstance &&
  35759. !vnode.componentInstance._isDestroyed &&
  35760. vnode.data.keepAlive
  35761. ) {
  35762. // kept-alive components, treat as a patch
  35763. var mountedNode = vnode; // work around flow
  35764. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  35765. } else {
  35766. var child = vnode.componentInstance = createComponentInstanceForVnode(
  35767. vnode,
  35768. activeInstance
  35769. );
  35770. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  35771. }
  35772. },
  35773. prepatch: function prepatch (oldVnode, vnode) {
  35774. var options = vnode.componentOptions;
  35775. var child = vnode.componentInstance = oldVnode.componentInstance;
  35776. updateChildComponent(
  35777. child,
  35778. options.propsData, // updated props
  35779. options.listeners, // updated listeners
  35780. vnode, // new parent vnode
  35781. options.children // new children
  35782. );
  35783. },
  35784. insert: function insert (vnode) {
  35785. var context = vnode.context;
  35786. var componentInstance = vnode.componentInstance;
  35787. if (!componentInstance._isMounted) {
  35788. componentInstance._isMounted = true;
  35789. callHook(componentInstance, 'mounted');
  35790. }
  35791. if (vnode.data.keepAlive) {
  35792. if (context._isMounted) {
  35793. // vue-router#1212
  35794. // During updates, a kept-alive component's child components may
  35795. // change, so directly walking the tree here may call activated hooks
  35796. // on incorrect children. Instead we push them into a queue which will
  35797. // be processed after the whole patch process ended.
  35798. queueActivatedComponent(componentInstance);
  35799. } else {
  35800. activateChildComponent(componentInstance, true /* direct */);
  35801. }
  35802. }
  35803. },
  35804. destroy: function destroy (vnode) {
  35805. var componentInstance = vnode.componentInstance;
  35806. if (!componentInstance._isDestroyed) {
  35807. if (!vnode.data.keepAlive) {
  35808. componentInstance.$destroy();
  35809. } else {
  35810. deactivateChildComponent(componentInstance, true /* direct */);
  35811. }
  35812. }
  35813. }
  35814. };
  35815. var hooksToMerge = Object.keys(componentVNodeHooks);
  35816. function createComponent (
  35817. Ctor,
  35818. data,
  35819. context,
  35820. children,
  35821. tag
  35822. ) {
  35823. if (isUndef(Ctor)) {
  35824. return
  35825. }
  35826. var baseCtor = context.$options._base;
  35827. // plain options object: turn it into a constructor
  35828. if (isObject(Ctor)) {
  35829. Ctor = baseCtor.extend(Ctor);
  35830. }
  35831. // if at this stage it's not a constructor or an async component factory,
  35832. // reject.
  35833. if (typeof Ctor !== 'function') {
  35834. {
  35835. warn(("Invalid Component definition: " + (String(Ctor))), context);
  35836. }
  35837. return
  35838. }
  35839. // async component
  35840. var asyncFactory;
  35841. if (isUndef(Ctor.cid)) {
  35842. asyncFactory = Ctor;
  35843. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  35844. if (Ctor === undefined) {
  35845. // return a placeholder node for async component, which is rendered
  35846. // as a comment node but preserves all the raw information for the node.
  35847. // the information will be used for async server-rendering and hydration.
  35848. return createAsyncPlaceholder(
  35849. asyncFactory,
  35850. data,
  35851. context,
  35852. children,
  35853. tag
  35854. )
  35855. }
  35856. }
  35857. data = data || {};
  35858. // resolve constructor options in case global mixins are applied after
  35859. // component constructor creation
  35860. resolveConstructorOptions(Ctor);
  35861. // transform component v-model data into props & events
  35862. if (isDef(data.model)) {
  35863. transformModel(Ctor.options, data);
  35864. }
  35865. // extract props
  35866. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  35867. // functional component
  35868. if (isTrue(Ctor.options.functional)) {
  35869. return createFunctionalComponent(Ctor, propsData, data, context, children)
  35870. }
  35871. // extract listeners, since these needs to be treated as
  35872. // child component listeners instead of DOM listeners
  35873. var listeners = data.on;
  35874. // replace with listeners with .native modifier
  35875. // so it gets processed during parent component patch.
  35876. data.on = data.nativeOn;
  35877. if (isTrue(Ctor.options.abstract)) {
  35878. // abstract components do not keep anything
  35879. // other than props & listeners & slot
  35880. // work around flow
  35881. var slot = data.slot;
  35882. data = {};
  35883. if (slot) {
  35884. data.slot = slot;
  35885. }
  35886. }
  35887. // install component management hooks onto the placeholder node
  35888. installComponentHooks(data);
  35889. // return a placeholder vnode
  35890. var name = Ctor.options.name || tag;
  35891. var vnode = new VNode(
  35892. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  35893. data, undefined, undefined, undefined, context,
  35894. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  35895. asyncFactory
  35896. );
  35897. return vnode
  35898. }
  35899. function createComponentInstanceForVnode (
  35900. vnode, // we know it's MountedComponentVNode but flow doesn't
  35901. parent // activeInstance in lifecycle state
  35902. ) {
  35903. var options = {
  35904. _isComponent: true,
  35905. _parentVnode: vnode,
  35906. parent: parent
  35907. };
  35908. // check inline-template render functions
  35909. var inlineTemplate = vnode.data.inlineTemplate;
  35910. if (isDef(inlineTemplate)) {
  35911. options.render = inlineTemplate.render;
  35912. options.staticRenderFns = inlineTemplate.staticRenderFns;
  35913. }
  35914. return new vnode.componentOptions.Ctor(options)
  35915. }
  35916. function installComponentHooks (data) {
  35917. var hooks = data.hook || (data.hook = {});
  35918. for (var i = 0; i < hooksToMerge.length; i++) {
  35919. var key = hooksToMerge[i];
  35920. var existing = hooks[key];
  35921. var toMerge = componentVNodeHooks[key];
  35922. if (existing !== toMerge && !(existing && existing._merged)) {
  35923. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  35924. }
  35925. }
  35926. }
  35927. function mergeHook$1 (f1, f2) {
  35928. var merged = function (a, b) {
  35929. // flow complains about extra args which is why we use any
  35930. f1(a, b);
  35931. f2(a, b);
  35932. };
  35933. merged._merged = true;
  35934. return merged
  35935. }
  35936. // transform component v-model info (value and callback) into
  35937. // prop and event handler respectively.
  35938. function transformModel (options, data) {
  35939. var prop = (options.model && options.model.prop) || 'value';
  35940. var event = (options.model && options.model.event) || 'input'
  35941. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  35942. var on = data.on || (data.on = {});
  35943. var existing = on[event];
  35944. var callback = data.model.callback;
  35945. if (isDef(existing)) {
  35946. if (
  35947. Array.isArray(existing)
  35948. ? existing.indexOf(callback) === -1
  35949. : existing !== callback
  35950. ) {
  35951. on[event] = [callback].concat(existing);
  35952. }
  35953. } else {
  35954. on[event] = callback;
  35955. }
  35956. }
  35957. /* */
  35958. var SIMPLE_NORMALIZE = 1;
  35959. var ALWAYS_NORMALIZE = 2;
  35960. // wrapper function for providing a more flexible interface
  35961. // without getting yelled at by flow
  35962. function createElement (
  35963. context,
  35964. tag,
  35965. data,
  35966. children,
  35967. normalizationType,
  35968. alwaysNormalize
  35969. ) {
  35970. if (Array.isArray(data) || isPrimitive(data)) {
  35971. normalizationType = children;
  35972. children = data;
  35973. data = undefined;
  35974. }
  35975. if (isTrue(alwaysNormalize)) {
  35976. normalizationType = ALWAYS_NORMALIZE;
  35977. }
  35978. return _createElement(context, tag, data, children, normalizationType)
  35979. }
  35980. function _createElement (
  35981. context,
  35982. tag,
  35983. data,
  35984. children,
  35985. normalizationType
  35986. ) {
  35987. if (isDef(data) && isDef((data).__ob__)) {
  35988. warn(
  35989. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  35990. 'Always create fresh vnode data objects in each render!',
  35991. context
  35992. );
  35993. return createEmptyVNode()
  35994. }
  35995. // object syntax in v-bind
  35996. if (isDef(data) && isDef(data.is)) {
  35997. tag = data.is;
  35998. }
  35999. if (!tag) {
  36000. // in case of component :is set to falsy value
  36001. return createEmptyVNode()
  36002. }
  36003. // warn against non-primitive key
  36004. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  36005. ) {
  36006. {
  36007. warn(
  36008. 'Avoid using non-primitive value as key, ' +
  36009. 'use string/number value instead.',
  36010. context
  36011. );
  36012. }
  36013. }
  36014. // support single function children as default scoped slot
  36015. if (Array.isArray(children) &&
  36016. typeof children[0] === 'function'
  36017. ) {
  36018. data = data || {};
  36019. data.scopedSlots = { default: children[0] };
  36020. children.length = 0;
  36021. }
  36022. if (normalizationType === ALWAYS_NORMALIZE) {
  36023. children = normalizeChildren(children);
  36024. } else if (normalizationType === SIMPLE_NORMALIZE) {
  36025. children = simpleNormalizeChildren(children);
  36026. }
  36027. var vnode, ns;
  36028. if (typeof tag === 'string') {
  36029. var Ctor;
  36030. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  36031. if (config.isReservedTag(tag)) {
  36032. // platform built-in elements
  36033. if (isDef(data) && isDef(data.nativeOn)) {
  36034. warn(
  36035. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  36036. context
  36037. );
  36038. }
  36039. vnode = new VNode(
  36040. config.parsePlatformTagName(tag), data, children,
  36041. undefined, undefined, context
  36042. );
  36043. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  36044. // component
  36045. vnode = createComponent(Ctor, data, context, children, tag);
  36046. } else {
  36047. // unknown or unlisted namespaced elements
  36048. // check at runtime because it may get assigned a namespace when its
  36049. // parent normalizes children
  36050. vnode = new VNode(
  36051. tag, data, children,
  36052. undefined, undefined, context
  36053. );
  36054. }
  36055. } else {
  36056. // direct component options / constructor
  36057. vnode = createComponent(tag, data, context, children);
  36058. }
  36059. if (Array.isArray(vnode)) {
  36060. return vnode
  36061. } else if (isDef(vnode)) {
  36062. if (isDef(ns)) { applyNS(vnode, ns); }
  36063. if (isDef(data)) { registerDeepBindings(data); }
  36064. return vnode
  36065. } else {
  36066. return createEmptyVNode()
  36067. }
  36068. }
  36069. function applyNS (vnode, ns, force) {
  36070. vnode.ns = ns;
  36071. if (vnode.tag === 'foreignObject') {
  36072. // use default namespace inside foreignObject
  36073. ns = undefined;
  36074. force = true;
  36075. }
  36076. if (isDef(vnode.children)) {
  36077. for (var i = 0, l = vnode.children.length; i < l; i++) {
  36078. var child = vnode.children[i];
  36079. if (isDef(child.tag) && (
  36080. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  36081. applyNS(child, ns, force);
  36082. }
  36083. }
  36084. }
  36085. }
  36086. // ref #5318
  36087. // necessary to ensure parent re-render when deep bindings like :style and
  36088. // :class are used on slot nodes
  36089. function registerDeepBindings (data) {
  36090. if (isObject(data.style)) {
  36091. traverse(data.style);
  36092. }
  36093. if (isObject(data.class)) {
  36094. traverse(data.class);
  36095. }
  36096. }
  36097. /* */
  36098. function initRender (vm) {
  36099. vm._vnode = null; // the root of the child tree
  36100. vm._staticTrees = null; // v-once cached trees
  36101. var options = vm.$options;
  36102. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  36103. var renderContext = parentVnode && parentVnode.context;
  36104. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  36105. vm.$scopedSlots = emptyObject;
  36106. // bind the createElement fn to this instance
  36107. // so that we get proper render context inside it.
  36108. // args order: tag, data, children, normalizationType, alwaysNormalize
  36109. // internal version is used by render functions compiled from templates
  36110. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  36111. // normalization is always applied for the public version, used in
  36112. // user-written render functions.
  36113. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  36114. // $attrs & $listeners are exposed for easier HOC creation.
  36115. // they need to be reactive so that HOCs using them are always updated
  36116. var parentData = parentVnode && parentVnode.data;
  36117. /* istanbul ignore else */
  36118. {
  36119. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  36120. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  36121. }, true);
  36122. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  36123. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  36124. }, true);
  36125. }
  36126. }
  36127. var currentRenderingInstance = null;
  36128. function renderMixin (Vue) {
  36129. // install runtime convenience helpers
  36130. installRenderHelpers(Vue.prototype);
  36131. Vue.prototype.$nextTick = function (fn) {
  36132. return nextTick(fn, this)
  36133. };
  36134. Vue.prototype._render = function () {
  36135. var vm = this;
  36136. var ref = vm.$options;
  36137. var render = ref.render;
  36138. var _parentVnode = ref._parentVnode;
  36139. if (_parentVnode) {
  36140. vm.$scopedSlots = normalizeScopedSlots(
  36141. _parentVnode.data.scopedSlots,
  36142. vm.$slots,
  36143. vm.$scopedSlots
  36144. );
  36145. }
  36146. // set parent vnode. this allows render functions to have access
  36147. // to the data on the placeholder node.
  36148. vm.$vnode = _parentVnode;
  36149. // render self
  36150. var vnode;
  36151. try {
  36152. // There's no need to maintain a stack because all render fns are called
  36153. // separately from one another. Nested component's render fns are called
  36154. // when parent component is patched.
  36155. currentRenderingInstance = vm;
  36156. vnode = render.call(vm._renderProxy, vm.$createElement);
  36157. } catch (e) {
  36158. handleError(e, vm, "render");
  36159. // return error render result,
  36160. // or previous vnode to prevent render error causing blank component
  36161. /* istanbul ignore else */
  36162. if (vm.$options.renderError) {
  36163. try {
  36164. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  36165. } catch (e) {
  36166. handleError(e, vm, "renderError");
  36167. vnode = vm._vnode;
  36168. }
  36169. } else {
  36170. vnode = vm._vnode;
  36171. }
  36172. } finally {
  36173. currentRenderingInstance = null;
  36174. }
  36175. // if the returned array contains only a single node, allow it
  36176. if (Array.isArray(vnode) && vnode.length === 1) {
  36177. vnode = vnode[0];
  36178. }
  36179. // return empty vnode in case the render function errored out
  36180. if (!(vnode instanceof VNode)) {
  36181. if (Array.isArray(vnode)) {
  36182. warn(
  36183. 'Multiple root nodes returned from render function. Render function ' +
  36184. 'should return a single root node.',
  36185. vm
  36186. );
  36187. }
  36188. vnode = createEmptyVNode();
  36189. }
  36190. // set parent
  36191. vnode.parent = _parentVnode;
  36192. return vnode
  36193. };
  36194. }
  36195. /* */
  36196. function ensureCtor (comp, base) {
  36197. if (
  36198. comp.__esModule ||
  36199. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  36200. ) {
  36201. comp = comp.default;
  36202. }
  36203. return isObject(comp)
  36204. ? base.extend(comp)
  36205. : comp
  36206. }
  36207. function createAsyncPlaceholder (
  36208. factory,
  36209. data,
  36210. context,
  36211. children,
  36212. tag
  36213. ) {
  36214. var node = createEmptyVNode();
  36215. node.asyncFactory = factory;
  36216. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  36217. return node
  36218. }
  36219. function resolveAsyncComponent (
  36220. factory,
  36221. baseCtor
  36222. ) {
  36223. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  36224. return factory.errorComp
  36225. }
  36226. if (isDef(factory.resolved)) {
  36227. return factory.resolved
  36228. }
  36229. var owner = currentRenderingInstance;
  36230. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  36231. // already pending
  36232. factory.owners.push(owner);
  36233. }
  36234. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  36235. return factory.loadingComp
  36236. }
  36237. if (owner && !isDef(factory.owners)) {
  36238. var owners = factory.owners = [owner];
  36239. var sync = true;
  36240. var timerLoading = null;
  36241. var timerTimeout = null
  36242. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  36243. var forceRender = function (renderCompleted) {
  36244. for (var i = 0, l = owners.length; i < l; i++) {
  36245. (owners[i]).$forceUpdate();
  36246. }
  36247. if (renderCompleted) {
  36248. owners.length = 0;
  36249. if (timerLoading !== null) {
  36250. clearTimeout(timerLoading);
  36251. timerLoading = null;
  36252. }
  36253. if (timerTimeout !== null) {
  36254. clearTimeout(timerTimeout);
  36255. timerTimeout = null;
  36256. }
  36257. }
  36258. };
  36259. var resolve = once(function (res) {
  36260. // cache resolved
  36261. factory.resolved = ensureCtor(res, baseCtor);
  36262. // invoke callbacks only if this is not a synchronous resolve
  36263. // (async resolves are shimmed as synchronous during SSR)
  36264. if (!sync) {
  36265. forceRender(true);
  36266. } else {
  36267. owners.length = 0;
  36268. }
  36269. });
  36270. var reject = once(function (reason) {
  36271. warn(
  36272. "Failed to resolve async component: " + (String(factory)) +
  36273. (reason ? ("\nReason: " + reason) : '')
  36274. );
  36275. if (isDef(factory.errorComp)) {
  36276. factory.error = true;
  36277. forceRender(true);
  36278. }
  36279. });
  36280. var res = factory(resolve, reject);
  36281. if (isObject(res)) {
  36282. if (isPromise(res)) {
  36283. // () => Promise
  36284. if (isUndef(factory.resolved)) {
  36285. res.then(resolve, reject);
  36286. }
  36287. } else if (isPromise(res.component)) {
  36288. res.component.then(resolve, reject);
  36289. if (isDef(res.error)) {
  36290. factory.errorComp = ensureCtor(res.error, baseCtor);
  36291. }
  36292. if (isDef(res.loading)) {
  36293. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  36294. if (res.delay === 0) {
  36295. factory.loading = true;
  36296. } else {
  36297. timerLoading = setTimeout(function () {
  36298. timerLoading = null;
  36299. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  36300. factory.loading = true;
  36301. forceRender(false);
  36302. }
  36303. }, res.delay || 200);
  36304. }
  36305. }
  36306. if (isDef(res.timeout)) {
  36307. timerTimeout = setTimeout(function () {
  36308. timerTimeout = null;
  36309. if (isUndef(factory.resolved)) {
  36310. reject(
  36311. "timeout (" + (res.timeout) + "ms)"
  36312. );
  36313. }
  36314. }, res.timeout);
  36315. }
  36316. }
  36317. }
  36318. sync = false;
  36319. // return in case resolved synchronously
  36320. return factory.loading
  36321. ? factory.loadingComp
  36322. : factory.resolved
  36323. }
  36324. }
  36325. /* */
  36326. function isAsyncPlaceholder (node) {
  36327. return node.isComment && node.asyncFactory
  36328. }
  36329. /* */
  36330. function getFirstComponentChild (children) {
  36331. if (Array.isArray(children)) {
  36332. for (var i = 0; i < children.length; i++) {
  36333. var c = children[i];
  36334. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  36335. return c
  36336. }
  36337. }
  36338. }
  36339. }
  36340. /* */
  36341. /* */
  36342. function initEvents (vm) {
  36343. vm._events = Object.create(null);
  36344. vm._hasHookEvent = false;
  36345. // init parent attached events
  36346. var listeners = vm.$options._parentListeners;
  36347. if (listeners) {
  36348. updateComponentListeners(vm, listeners);
  36349. }
  36350. }
  36351. var target;
  36352. function add (event, fn) {
  36353. target.$on(event, fn);
  36354. }
  36355. function remove$1 (event, fn) {
  36356. target.$off(event, fn);
  36357. }
  36358. function createOnceHandler (event, fn) {
  36359. var _target = target;
  36360. return function onceHandler () {
  36361. var res = fn.apply(null, arguments);
  36362. if (res !== null) {
  36363. _target.$off(event, onceHandler);
  36364. }
  36365. }
  36366. }
  36367. function updateComponentListeners (
  36368. vm,
  36369. listeners,
  36370. oldListeners
  36371. ) {
  36372. target = vm;
  36373. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  36374. target = undefined;
  36375. }
  36376. function eventsMixin (Vue) {
  36377. var hookRE = /^hook:/;
  36378. Vue.prototype.$on = function (event, fn) {
  36379. var vm = this;
  36380. if (Array.isArray(event)) {
  36381. for (var i = 0, l = event.length; i < l; i++) {
  36382. vm.$on(event[i], fn);
  36383. }
  36384. } else {
  36385. (vm._events[event] || (vm._events[event] = [])).push(fn);
  36386. // optimize hook:event cost by using a boolean flag marked at registration
  36387. // instead of a hash lookup
  36388. if (hookRE.test(event)) {
  36389. vm._hasHookEvent = true;
  36390. }
  36391. }
  36392. return vm
  36393. };
  36394. Vue.prototype.$once = function (event, fn) {
  36395. var vm = this;
  36396. function on () {
  36397. vm.$off(event, on);
  36398. fn.apply(vm, arguments);
  36399. }
  36400. on.fn = fn;
  36401. vm.$on(event, on);
  36402. return vm
  36403. };
  36404. Vue.prototype.$off = function (event, fn) {
  36405. var vm = this;
  36406. // all
  36407. if (!arguments.length) {
  36408. vm._events = Object.create(null);
  36409. return vm
  36410. }
  36411. // array of events
  36412. if (Array.isArray(event)) {
  36413. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  36414. vm.$off(event[i$1], fn);
  36415. }
  36416. return vm
  36417. }
  36418. // specific event
  36419. var cbs = vm._events[event];
  36420. if (!cbs) {
  36421. return vm
  36422. }
  36423. if (!fn) {
  36424. vm._events[event] = null;
  36425. return vm
  36426. }
  36427. // specific handler
  36428. var cb;
  36429. var i = cbs.length;
  36430. while (i--) {
  36431. cb = cbs[i];
  36432. if (cb === fn || cb.fn === fn) {
  36433. cbs.splice(i, 1);
  36434. break
  36435. }
  36436. }
  36437. return vm
  36438. };
  36439. Vue.prototype.$emit = function (event) {
  36440. var vm = this;
  36441. {
  36442. var lowerCaseEvent = event.toLowerCase();
  36443. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  36444. tip(
  36445. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  36446. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  36447. "Note that HTML attributes are case-insensitive and you cannot use " +
  36448. "v-on to listen to camelCase events when using in-DOM templates. " +
  36449. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  36450. );
  36451. }
  36452. }
  36453. var cbs = vm._events[event];
  36454. if (cbs) {
  36455. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  36456. var args = toArray(arguments, 1);
  36457. var info = "event handler for \"" + event + "\"";
  36458. for (var i = 0, l = cbs.length; i < l; i++) {
  36459. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  36460. }
  36461. }
  36462. return vm
  36463. };
  36464. }
  36465. /* */
  36466. var activeInstance = null;
  36467. var isUpdatingChildComponent = false;
  36468. function setActiveInstance(vm) {
  36469. var prevActiveInstance = activeInstance;
  36470. activeInstance = vm;
  36471. return function () {
  36472. activeInstance = prevActiveInstance;
  36473. }
  36474. }
  36475. function initLifecycle (vm) {
  36476. var options = vm.$options;
  36477. // locate first non-abstract parent
  36478. var parent = options.parent;
  36479. if (parent && !options.abstract) {
  36480. while (parent.$options.abstract && parent.$parent) {
  36481. parent = parent.$parent;
  36482. }
  36483. parent.$children.push(vm);
  36484. }
  36485. vm.$parent = parent;
  36486. vm.$root = parent ? parent.$root : vm;
  36487. vm.$children = [];
  36488. vm.$refs = {};
  36489. vm._watcher = null;
  36490. vm._inactive = null;
  36491. vm._directInactive = false;
  36492. vm._isMounted = false;
  36493. vm._isDestroyed = false;
  36494. vm._isBeingDestroyed = false;
  36495. }
  36496. function lifecycleMixin (Vue) {
  36497. Vue.prototype._update = function (vnode, hydrating) {
  36498. var vm = this;
  36499. var prevEl = vm.$el;
  36500. var prevVnode = vm._vnode;
  36501. var restoreActiveInstance = setActiveInstance(vm);
  36502. vm._vnode = vnode;
  36503. // Vue.prototype.__patch__ is injected in entry points
  36504. // based on the rendering backend used.
  36505. if (!prevVnode) {
  36506. // initial render
  36507. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  36508. } else {
  36509. // updates
  36510. vm.$el = vm.__patch__(prevVnode, vnode);
  36511. }
  36512. restoreActiveInstance();
  36513. // update __vue__ reference
  36514. if (prevEl) {
  36515. prevEl.__vue__ = null;
  36516. }
  36517. if (vm.$el) {
  36518. vm.$el.__vue__ = vm;
  36519. }
  36520. // if parent is an HOC, update its $el as well
  36521. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  36522. vm.$parent.$el = vm.$el;
  36523. }
  36524. // updated hook is called by the scheduler to ensure that children are
  36525. // updated in a parent's updated hook.
  36526. };
  36527. Vue.prototype.$forceUpdate = function () {
  36528. var vm = this;
  36529. if (vm._watcher) {
  36530. vm._watcher.update();
  36531. }
  36532. };
  36533. Vue.prototype.$destroy = function () {
  36534. var vm = this;
  36535. if (vm._isBeingDestroyed) {
  36536. return
  36537. }
  36538. callHook(vm, 'beforeDestroy');
  36539. vm._isBeingDestroyed = true;
  36540. // remove self from parent
  36541. var parent = vm.$parent;
  36542. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  36543. remove(parent.$children, vm);
  36544. }
  36545. // teardown watchers
  36546. if (vm._watcher) {
  36547. vm._watcher.teardown();
  36548. }
  36549. var i = vm._watchers.length;
  36550. while (i--) {
  36551. vm._watchers[i].teardown();
  36552. }
  36553. // remove reference from data ob
  36554. // frozen object may not have observer.
  36555. if (vm._data.__ob__) {
  36556. vm._data.__ob__.vmCount--;
  36557. }
  36558. // call the last hook...
  36559. vm._isDestroyed = true;
  36560. // invoke destroy hooks on current rendered tree
  36561. vm.__patch__(vm._vnode, null);
  36562. // fire destroyed hook
  36563. callHook(vm, 'destroyed');
  36564. // turn off all instance listeners.
  36565. vm.$off();
  36566. // remove __vue__ reference
  36567. if (vm.$el) {
  36568. vm.$el.__vue__ = null;
  36569. }
  36570. // release circular reference (#6759)
  36571. if (vm.$vnode) {
  36572. vm.$vnode.parent = null;
  36573. }
  36574. };
  36575. }
  36576. function mountComponent (
  36577. vm,
  36578. el,
  36579. hydrating
  36580. ) {
  36581. vm.$el = el;
  36582. if (!vm.$options.render) {
  36583. vm.$options.render = createEmptyVNode;
  36584. {
  36585. /* istanbul ignore if */
  36586. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  36587. vm.$options.el || el) {
  36588. warn(
  36589. 'You are using the runtime-only build of Vue where the template ' +
  36590. 'compiler is not available. Either pre-compile the templates into ' +
  36591. 'render functions, or use the compiler-included build.',
  36592. vm
  36593. );
  36594. } else {
  36595. warn(
  36596. 'Failed to mount component: template or render function not defined.',
  36597. vm
  36598. );
  36599. }
  36600. }
  36601. }
  36602. callHook(vm, 'beforeMount');
  36603. var updateComponent;
  36604. /* istanbul ignore if */
  36605. if (config.performance && mark) {
  36606. updateComponent = function () {
  36607. var name = vm._name;
  36608. var id = vm._uid;
  36609. var startTag = "vue-perf-start:" + id;
  36610. var endTag = "vue-perf-end:" + id;
  36611. mark(startTag);
  36612. var vnode = vm._render();
  36613. mark(endTag);
  36614. measure(("vue " + name + " render"), startTag, endTag);
  36615. mark(startTag);
  36616. vm._update(vnode, hydrating);
  36617. mark(endTag);
  36618. measure(("vue " + name + " patch"), startTag, endTag);
  36619. };
  36620. } else {
  36621. updateComponent = function () {
  36622. vm._update(vm._render(), hydrating);
  36623. };
  36624. }
  36625. // we set this to vm._watcher inside the watcher's constructor
  36626. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  36627. // component's mounted hook), which relies on vm._watcher being already defined
  36628. new Watcher(vm, updateComponent, noop, {
  36629. before: function before () {
  36630. if (vm._isMounted && !vm._isDestroyed) {
  36631. callHook(vm, 'beforeUpdate');
  36632. }
  36633. }
  36634. }, true /* isRenderWatcher */);
  36635. hydrating = false;
  36636. // manually mounted instance, call mounted on self
  36637. // mounted is called for render-created child components in its inserted hook
  36638. if (vm.$vnode == null) {
  36639. vm._isMounted = true;
  36640. callHook(vm, 'mounted');
  36641. }
  36642. return vm
  36643. }
  36644. function updateChildComponent (
  36645. vm,
  36646. propsData,
  36647. listeners,
  36648. parentVnode,
  36649. renderChildren
  36650. ) {
  36651. {
  36652. isUpdatingChildComponent = true;
  36653. }
  36654. // determine whether component has slot children
  36655. // we need to do this before overwriting $options._renderChildren.
  36656. // check if there are dynamic scopedSlots (hand-written or compiled but with
  36657. // dynamic slot names). Static scoped slots compiled from template has the
  36658. // "$stable" marker.
  36659. var newScopedSlots = parentVnode.data.scopedSlots;
  36660. var oldScopedSlots = vm.$scopedSlots;
  36661. var hasDynamicScopedSlot = !!(
  36662. (newScopedSlots && !newScopedSlots.$stable) ||
  36663. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  36664. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  36665. );
  36666. // Any static slot children from the parent may have changed during parent's
  36667. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  36668. // update is necessary to ensure correctness.
  36669. var needsForceUpdate = !!(
  36670. renderChildren || // has new static slots
  36671. vm.$options._renderChildren || // has old static slots
  36672. hasDynamicScopedSlot
  36673. );
  36674. vm.$options._parentVnode = parentVnode;
  36675. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  36676. if (vm._vnode) { // update child tree's parent
  36677. vm._vnode.parent = parentVnode;
  36678. }
  36679. vm.$options._renderChildren = renderChildren;
  36680. // update $attrs and $listeners hash
  36681. // these are also reactive so they may trigger child update if the child
  36682. // used them during render
  36683. vm.$attrs = parentVnode.data.attrs || emptyObject;
  36684. vm.$listeners = listeners || emptyObject;
  36685. // update props
  36686. if (propsData && vm.$options.props) {
  36687. toggleObserving(false);
  36688. var props = vm._props;
  36689. var propKeys = vm.$options._propKeys || [];
  36690. for (var i = 0; i < propKeys.length; i++) {
  36691. var key = propKeys[i];
  36692. var propOptions = vm.$options.props; // wtf flow?
  36693. props[key] = validateProp(key, propOptions, propsData, vm);
  36694. }
  36695. toggleObserving(true);
  36696. // keep a copy of raw propsData
  36697. vm.$options.propsData = propsData;
  36698. }
  36699. // update listeners
  36700. listeners = listeners || emptyObject;
  36701. var oldListeners = vm.$options._parentListeners;
  36702. vm.$options._parentListeners = listeners;
  36703. updateComponentListeners(vm, listeners, oldListeners);
  36704. // resolve slots + force update if has children
  36705. if (needsForceUpdate) {
  36706. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  36707. vm.$forceUpdate();
  36708. }
  36709. {
  36710. isUpdatingChildComponent = false;
  36711. }
  36712. }
  36713. function isInInactiveTree (vm) {
  36714. while (vm && (vm = vm.$parent)) {
  36715. if (vm._inactive) { return true }
  36716. }
  36717. return false
  36718. }
  36719. function activateChildComponent (vm, direct) {
  36720. if (direct) {
  36721. vm._directInactive = false;
  36722. if (isInInactiveTree(vm)) {
  36723. return
  36724. }
  36725. } else if (vm._directInactive) {
  36726. return
  36727. }
  36728. if (vm._inactive || vm._inactive === null) {
  36729. vm._inactive = false;
  36730. for (var i = 0; i < vm.$children.length; i++) {
  36731. activateChildComponent(vm.$children[i]);
  36732. }
  36733. callHook(vm, 'activated');
  36734. }
  36735. }
  36736. function deactivateChildComponent (vm, direct) {
  36737. if (direct) {
  36738. vm._directInactive = true;
  36739. if (isInInactiveTree(vm)) {
  36740. return
  36741. }
  36742. }
  36743. if (!vm._inactive) {
  36744. vm._inactive = true;
  36745. for (var i = 0; i < vm.$children.length; i++) {
  36746. deactivateChildComponent(vm.$children[i]);
  36747. }
  36748. callHook(vm, 'deactivated');
  36749. }
  36750. }
  36751. function callHook (vm, hook) {
  36752. // #7573 disable dep collection when invoking lifecycle hooks
  36753. pushTarget();
  36754. var handlers = vm.$options[hook];
  36755. var info = hook + " hook";
  36756. if (handlers) {
  36757. for (var i = 0, j = handlers.length; i < j; i++) {
  36758. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  36759. }
  36760. }
  36761. if (vm._hasHookEvent) {
  36762. vm.$emit('hook:' + hook);
  36763. }
  36764. popTarget();
  36765. }
  36766. /* */
  36767. var MAX_UPDATE_COUNT = 100;
  36768. var queue = [];
  36769. var activatedChildren = [];
  36770. var has = {};
  36771. var circular = {};
  36772. var waiting = false;
  36773. var flushing = false;
  36774. var index = 0;
  36775. /**
  36776. * Reset the scheduler's state.
  36777. */
  36778. function resetSchedulerState () {
  36779. index = queue.length = activatedChildren.length = 0;
  36780. has = {};
  36781. {
  36782. circular = {};
  36783. }
  36784. waiting = flushing = false;
  36785. }
  36786. // Async edge case #6566 requires saving the timestamp when event listeners are
  36787. // attached. However, calling performance.now() has a perf overhead especially
  36788. // if the page has thousands of event listeners. Instead, we take a timestamp
  36789. // every time the scheduler flushes and use that for all event listeners
  36790. // attached during that flush.
  36791. var currentFlushTimestamp = 0;
  36792. // Async edge case fix requires storing an event listener's attach timestamp.
  36793. var getNow = Date.now;
  36794. // Determine what event timestamp the browser is using. Annoyingly, the
  36795. // timestamp can either be hi-res (relative to page load) or low-res
  36796. // (relative to UNIX epoch), so in order to compare time we have to use the
  36797. // same timestamp type when saving the flush timestamp.
  36798. // All IE versions use low-res event timestamps, and have problematic clock
  36799. // implementations (#9632)
  36800. if (inBrowser && !isIE) {
  36801. var performance = window.performance;
  36802. if (
  36803. performance &&
  36804. typeof performance.now === 'function' &&
  36805. getNow() > document.createEvent('Event').timeStamp
  36806. ) {
  36807. // if the event timestamp, although evaluated AFTER the Date.now(), is
  36808. // smaller than it, it means the event is using a hi-res timestamp,
  36809. // and we need to use the hi-res version for event listener timestamps as
  36810. // well.
  36811. getNow = function () { return performance.now(); };
  36812. }
  36813. }
  36814. /**
  36815. * Flush both queues and run the watchers.
  36816. */
  36817. function flushSchedulerQueue () {
  36818. currentFlushTimestamp = getNow();
  36819. flushing = true;
  36820. var watcher, id;
  36821. // Sort queue before flush.
  36822. // This ensures that:
  36823. // 1. Components are updated from parent to child. (because parent is always
  36824. // created before the child)
  36825. // 2. A component's user watchers are run before its render watcher (because
  36826. // user watchers are created before the render watcher)
  36827. // 3. If a component is destroyed during a parent component's watcher run,
  36828. // its watchers can be skipped.
  36829. queue.sort(function (a, b) { return a.id - b.id; });
  36830. // do not cache length because more watchers might be pushed
  36831. // as we run existing watchers
  36832. for (index = 0; index < queue.length; index++) {
  36833. watcher = queue[index];
  36834. if (watcher.before) {
  36835. watcher.before();
  36836. }
  36837. id = watcher.id;
  36838. has[id] = null;
  36839. watcher.run();
  36840. // in dev build, check and stop circular updates.
  36841. if (has[id] != null) {
  36842. circular[id] = (circular[id] || 0) + 1;
  36843. if (circular[id] > MAX_UPDATE_COUNT) {
  36844. warn(
  36845. 'You may have an infinite update loop ' + (
  36846. watcher.user
  36847. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  36848. : "in a component render function."
  36849. ),
  36850. watcher.vm
  36851. );
  36852. break
  36853. }
  36854. }
  36855. }
  36856. // keep copies of post queues before resetting state
  36857. var activatedQueue = activatedChildren.slice();
  36858. var updatedQueue = queue.slice();
  36859. resetSchedulerState();
  36860. // call component updated and activated hooks
  36861. callActivatedHooks(activatedQueue);
  36862. callUpdatedHooks(updatedQueue);
  36863. // devtool hook
  36864. /* istanbul ignore if */
  36865. if (devtools && config.devtools) {
  36866. devtools.emit('flush');
  36867. }
  36868. }
  36869. function callUpdatedHooks (queue) {
  36870. var i = queue.length;
  36871. while (i--) {
  36872. var watcher = queue[i];
  36873. var vm = watcher.vm;
  36874. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  36875. callHook(vm, 'updated');
  36876. }
  36877. }
  36878. }
  36879. /**
  36880. * Queue a kept-alive component that was activated during patch.
  36881. * The queue will be processed after the entire tree has been patched.
  36882. */
  36883. function queueActivatedComponent (vm) {
  36884. // setting _inactive to false here so that a render function can
  36885. // rely on checking whether it's in an inactive tree (e.g. router-view)
  36886. vm._inactive = false;
  36887. activatedChildren.push(vm);
  36888. }
  36889. function callActivatedHooks (queue) {
  36890. for (var i = 0; i < queue.length; i++) {
  36891. queue[i]._inactive = true;
  36892. activateChildComponent(queue[i], true /* true */);
  36893. }
  36894. }
  36895. /**
  36896. * Push a watcher into the watcher queue.
  36897. * Jobs with duplicate IDs will be skipped unless it's
  36898. * pushed when the queue is being flushed.
  36899. */
  36900. function queueWatcher (watcher) {
  36901. var id = watcher.id;
  36902. if (has[id] == null) {
  36903. has[id] = true;
  36904. if (!flushing) {
  36905. queue.push(watcher);
  36906. } else {
  36907. // if already flushing, splice the watcher based on its id
  36908. // if already past its id, it will be run next immediately.
  36909. var i = queue.length - 1;
  36910. while (i > index && queue[i].id > watcher.id) {
  36911. i--;
  36912. }
  36913. queue.splice(i + 1, 0, watcher);
  36914. }
  36915. // queue the flush
  36916. if (!waiting) {
  36917. waiting = true;
  36918. if (!config.async) {
  36919. flushSchedulerQueue();
  36920. return
  36921. }
  36922. nextTick(flushSchedulerQueue);
  36923. }
  36924. }
  36925. }
  36926. /* */
  36927. var uid$2 = 0;
  36928. /**
  36929. * A watcher parses an expression, collects dependencies,
  36930. * and fires callback when the expression value changes.
  36931. * This is used for both the $watch() api and directives.
  36932. */
  36933. var Watcher = function Watcher (
  36934. vm,
  36935. expOrFn,
  36936. cb,
  36937. options,
  36938. isRenderWatcher
  36939. ) {
  36940. this.vm = vm;
  36941. if (isRenderWatcher) {
  36942. vm._watcher = this;
  36943. }
  36944. vm._watchers.push(this);
  36945. // options
  36946. if (options) {
  36947. this.deep = !!options.deep;
  36948. this.user = !!options.user;
  36949. this.lazy = !!options.lazy;
  36950. this.sync = !!options.sync;
  36951. this.before = options.before;
  36952. } else {
  36953. this.deep = this.user = this.lazy = this.sync = false;
  36954. }
  36955. this.cb = cb;
  36956. this.id = ++uid$2; // uid for batching
  36957. this.active = true;
  36958. this.dirty = this.lazy; // for lazy watchers
  36959. this.deps = [];
  36960. this.newDeps = [];
  36961. this.depIds = new _Set();
  36962. this.newDepIds = new _Set();
  36963. this.expression = expOrFn.toString();
  36964. // parse expression for getter
  36965. if (typeof expOrFn === 'function') {
  36966. this.getter = expOrFn;
  36967. } else {
  36968. this.getter = parsePath(expOrFn);
  36969. if (!this.getter) {
  36970. this.getter = noop;
  36971. warn(
  36972. "Failed watching path: \"" + expOrFn + "\" " +
  36973. 'Watcher only accepts simple dot-delimited paths. ' +
  36974. 'For full control, use a function instead.',
  36975. vm
  36976. );
  36977. }
  36978. }
  36979. this.value = this.lazy
  36980. ? undefined
  36981. : this.get();
  36982. };
  36983. /**
  36984. * Evaluate the getter, and re-collect dependencies.
  36985. */
  36986. Watcher.prototype.get = function get () {
  36987. pushTarget(this);
  36988. var value;
  36989. var vm = this.vm;
  36990. try {
  36991. value = this.getter.call(vm, vm);
  36992. } catch (e) {
  36993. if (this.user) {
  36994. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  36995. } else {
  36996. throw e
  36997. }
  36998. } finally {
  36999. // "touch" every property so they are all tracked as
  37000. // dependencies for deep watching
  37001. if (this.deep) {
  37002. traverse(value);
  37003. }
  37004. popTarget();
  37005. this.cleanupDeps();
  37006. }
  37007. return value
  37008. };
  37009. /**
  37010. * Add a dependency to this directive.
  37011. */
  37012. Watcher.prototype.addDep = function addDep (dep) {
  37013. var id = dep.id;
  37014. if (!this.newDepIds.has(id)) {
  37015. this.newDepIds.add(id);
  37016. this.newDeps.push(dep);
  37017. if (!this.depIds.has(id)) {
  37018. dep.addSub(this);
  37019. }
  37020. }
  37021. };
  37022. /**
  37023. * Clean up for dependency collection.
  37024. */
  37025. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  37026. var i = this.deps.length;
  37027. while (i--) {
  37028. var dep = this.deps[i];
  37029. if (!this.newDepIds.has(dep.id)) {
  37030. dep.removeSub(this);
  37031. }
  37032. }
  37033. var tmp = this.depIds;
  37034. this.depIds = this.newDepIds;
  37035. this.newDepIds = tmp;
  37036. this.newDepIds.clear();
  37037. tmp = this.deps;
  37038. this.deps = this.newDeps;
  37039. this.newDeps = tmp;
  37040. this.newDeps.length = 0;
  37041. };
  37042. /**
  37043. * Subscriber interface.
  37044. * Will be called when a dependency changes.
  37045. */
  37046. Watcher.prototype.update = function update () {
  37047. /* istanbul ignore else */
  37048. if (this.lazy) {
  37049. this.dirty = true;
  37050. } else if (this.sync) {
  37051. this.run();
  37052. } else {
  37053. queueWatcher(this);
  37054. }
  37055. };
  37056. /**
  37057. * Scheduler job interface.
  37058. * Will be called by the scheduler.
  37059. */
  37060. Watcher.prototype.run = function run () {
  37061. if (this.active) {
  37062. var value = this.get();
  37063. if (
  37064. value !== this.value ||
  37065. // Deep watchers and watchers on Object/Arrays should fire even
  37066. // when the value is the same, because the value may
  37067. // have mutated.
  37068. isObject(value) ||
  37069. this.deep
  37070. ) {
  37071. // set new value
  37072. var oldValue = this.value;
  37073. this.value = value;
  37074. if (this.user) {
  37075. try {
  37076. this.cb.call(this.vm, value, oldValue);
  37077. } catch (e) {
  37078. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  37079. }
  37080. } else {
  37081. this.cb.call(this.vm, value, oldValue);
  37082. }
  37083. }
  37084. }
  37085. };
  37086. /**
  37087. * Evaluate the value of the watcher.
  37088. * This only gets called for lazy watchers.
  37089. */
  37090. Watcher.prototype.evaluate = function evaluate () {
  37091. this.value = this.get();
  37092. this.dirty = false;
  37093. };
  37094. /**
  37095. * Depend on all deps collected by this watcher.
  37096. */
  37097. Watcher.prototype.depend = function depend () {
  37098. var i = this.deps.length;
  37099. while (i--) {
  37100. this.deps[i].depend();
  37101. }
  37102. };
  37103. /**
  37104. * Remove self from all dependencies' subscriber list.
  37105. */
  37106. Watcher.prototype.teardown = function teardown () {
  37107. if (this.active) {
  37108. // remove self from vm's watcher list
  37109. // this is a somewhat expensive operation so we skip it
  37110. // if the vm is being destroyed.
  37111. if (!this.vm._isBeingDestroyed) {
  37112. remove(this.vm._watchers, this);
  37113. }
  37114. var i = this.deps.length;
  37115. while (i--) {
  37116. this.deps[i].removeSub(this);
  37117. }
  37118. this.active = false;
  37119. }
  37120. };
  37121. /* */
  37122. var sharedPropertyDefinition = {
  37123. enumerable: true,
  37124. configurable: true,
  37125. get: noop,
  37126. set: noop
  37127. };
  37128. function proxy (target, sourceKey, key) {
  37129. sharedPropertyDefinition.get = function proxyGetter () {
  37130. return this[sourceKey][key]
  37131. };
  37132. sharedPropertyDefinition.set = function proxySetter (val) {
  37133. this[sourceKey][key] = val;
  37134. };
  37135. Object.defineProperty(target, key, sharedPropertyDefinition);
  37136. }
  37137. function initState (vm) {
  37138. vm._watchers = [];
  37139. var opts = vm.$options;
  37140. if (opts.props) { initProps(vm, opts.props); }
  37141. if (opts.methods) { initMethods(vm, opts.methods); }
  37142. if (opts.data) {
  37143. initData(vm);
  37144. } else {
  37145. observe(vm._data = {}, true /* asRootData */);
  37146. }
  37147. if (opts.computed) { initComputed(vm, opts.computed); }
  37148. if (opts.watch && opts.watch !== nativeWatch) {
  37149. initWatch(vm, opts.watch);
  37150. }
  37151. }
  37152. function initProps (vm, propsOptions) {
  37153. var propsData = vm.$options.propsData || {};
  37154. var props = vm._props = {};
  37155. // cache prop keys so that future props updates can iterate using Array
  37156. // instead of dynamic object key enumeration.
  37157. var keys = vm.$options._propKeys = [];
  37158. var isRoot = !vm.$parent;
  37159. // root instance props should be converted
  37160. if (!isRoot) {
  37161. toggleObserving(false);
  37162. }
  37163. var loop = function ( key ) {
  37164. keys.push(key);
  37165. var value = validateProp(key, propsOptions, propsData, vm);
  37166. /* istanbul ignore else */
  37167. {
  37168. var hyphenatedKey = hyphenate(key);
  37169. if (isReservedAttribute(hyphenatedKey) ||
  37170. config.isReservedAttr(hyphenatedKey)) {
  37171. warn(
  37172. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  37173. vm
  37174. );
  37175. }
  37176. defineReactive$$1(props, key, value, function () {
  37177. if (!isRoot && !isUpdatingChildComponent) {
  37178. warn(
  37179. "Avoid mutating a prop directly since the value will be " +
  37180. "overwritten whenever the parent component re-renders. " +
  37181. "Instead, use a data or computed property based on the prop's " +
  37182. "value. Prop being mutated: \"" + key + "\"",
  37183. vm
  37184. );
  37185. }
  37186. });
  37187. }
  37188. // static props are already proxied on the component's prototype
  37189. // during Vue.extend(). We only need to proxy props defined at
  37190. // instantiation here.
  37191. if (!(key in vm)) {
  37192. proxy(vm, "_props", key);
  37193. }
  37194. };
  37195. for (var key in propsOptions) loop( key );
  37196. toggleObserving(true);
  37197. }
  37198. function initData (vm) {
  37199. var data = vm.$options.data;
  37200. data = vm._data = typeof data === 'function'
  37201. ? getData(data, vm)
  37202. : data || {};
  37203. if (!isPlainObject(data)) {
  37204. data = {};
  37205. warn(
  37206. 'data functions should return an object:\n' +
  37207. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  37208. vm
  37209. );
  37210. }
  37211. // proxy data on instance
  37212. var keys = Object.keys(data);
  37213. var props = vm.$options.props;
  37214. var methods = vm.$options.methods;
  37215. var i = keys.length;
  37216. while (i--) {
  37217. var key = keys[i];
  37218. {
  37219. if (methods && hasOwn(methods, key)) {
  37220. warn(
  37221. ("Method \"" + key + "\" has already been defined as a data property."),
  37222. vm
  37223. );
  37224. }
  37225. }
  37226. if (props && hasOwn(props, key)) {
  37227. warn(
  37228. "The data property \"" + key + "\" is already declared as a prop. " +
  37229. "Use prop default value instead.",
  37230. vm
  37231. );
  37232. } else if (!isReserved(key)) {
  37233. proxy(vm, "_data", key);
  37234. }
  37235. }
  37236. // observe data
  37237. observe(data, true /* asRootData */);
  37238. }
  37239. function getData (data, vm) {
  37240. // #7573 disable dep collection when invoking data getters
  37241. pushTarget();
  37242. try {
  37243. return data.call(vm, vm)
  37244. } catch (e) {
  37245. handleError(e, vm, "data()");
  37246. return {}
  37247. } finally {
  37248. popTarget();
  37249. }
  37250. }
  37251. var computedWatcherOptions = { lazy: true };
  37252. function initComputed (vm, computed) {
  37253. // $flow-disable-line
  37254. var watchers = vm._computedWatchers = Object.create(null);
  37255. // computed properties are just getters during SSR
  37256. var isSSR = isServerRendering();
  37257. for (var key in computed) {
  37258. var userDef = computed[key];
  37259. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  37260. if (getter == null) {
  37261. warn(
  37262. ("Getter is missing for computed property \"" + key + "\"."),
  37263. vm
  37264. );
  37265. }
  37266. if (!isSSR) {
  37267. // create internal watcher for the computed property.
  37268. watchers[key] = new Watcher(
  37269. vm,
  37270. getter || noop,
  37271. noop,
  37272. computedWatcherOptions
  37273. );
  37274. }
  37275. // component-defined computed properties are already defined on the
  37276. // component prototype. We only need to define computed properties defined
  37277. // at instantiation here.
  37278. if (!(key in vm)) {
  37279. defineComputed(vm, key, userDef);
  37280. } else {
  37281. if (key in vm.$data) {
  37282. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  37283. } else if (vm.$options.props && key in vm.$options.props) {
  37284. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  37285. }
  37286. }
  37287. }
  37288. }
  37289. function defineComputed (
  37290. target,
  37291. key,
  37292. userDef
  37293. ) {
  37294. var shouldCache = !isServerRendering();
  37295. if (typeof userDef === 'function') {
  37296. sharedPropertyDefinition.get = shouldCache
  37297. ? createComputedGetter(key)
  37298. : createGetterInvoker(userDef);
  37299. sharedPropertyDefinition.set = noop;
  37300. } else {
  37301. sharedPropertyDefinition.get = userDef.get
  37302. ? shouldCache && userDef.cache !== false
  37303. ? createComputedGetter(key)
  37304. : createGetterInvoker(userDef.get)
  37305. : noop;
  37306. sharedPropertyDefinition.set = userDef.set || noop;
  37307. }
  37308. if (sharedPropertyDefinition.set === noop) {
  37309. sharedPropertyDefinition.set = function () {
  37310. warn(
  37311. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  37312. this
  37313. );
  37314. };
  37315. }
  37316. Object.defineProperty(target, key, sharedPropertyDefinition);
  37317. }
  37318. function createComputedGetter (key) {
  37319. return function computedGetter () {
  37320. var watcher = this._computedWatchers && this._computedWatchers[key];
  37321. if (watcher) {
  37322. if (watcher.dirty) {
  37323. watcher.evaluate();
  37324. }
  37325. if (Dep.target) {
  37326. watcher.depend();
  37327. }
  37328. return watcher.value
  37329. }
  37330. }
  37331. }
  37332. function createGetterInvoker(fn) {
  37333. return function computedGetter () {
  37334. return fn.call(this, this)
  37335. }
  37336. }
  37337. function initMethods (vm, methods) {
  37338. var props = vm.$options.props;
  37339. for (var key in methods) {
  37340. {
  37341. if (typeof methods[key] !== 'function') {
  37342. warn(
  37343. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  37344. "Did you reference the function correctly?",
  37345. vm
  37346. );
  37347. }
  37348. if (props && hasOwn(props, key)) {
  37349. warn(
  37350. ("Method \"" + key + "\" has already been defined as a prop."),
  37351. vm
  37352. );
  37353. }
  37354. if ((key in vm) && isReserved(key)) {
  37355. warn(
  37356. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  37357. "Avoid defining component methods that start with _ or $."
  37358. );
  37359. }
  37360. }
  37361. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  37362. }
  37363. }
  37364. function initWatch (vm, watch) {
  37365. for (var key in watch) {
  37366. var handler = watch[key];
  37367. if (Array.isArray(handler)) {
  37368. for (var i = 0; i < handler.length; i++) {
  37369. createWatcher(vm, key, handler[i]);
  37370. }
  37371. } else {
  37372. createWatcher(vm, key, handler);
  37373. }
  37374. }
  37375. }
  37376. function createWatcher (
  37377. vm,
  37378. expOrFn,
  37379. handler,
  37380. options
  37381. ) {
  37382. if (isPlainObject(handler)) {
  37383. options = handler;
  37384. handler = handler.handler;
  37385. }
  37386. if (typeof handler === 'string') {
  37387. handler = vm[handler];
  37388. }
  37389. return vm.$watch(expOrFn, handler, options)
  37390. }
  37391. function stateMixin (Vue) {
  37392. // flow somehow has problems with directly declared definition object
  37393. // when using Object.defineProperty, so we have to procedurally build up
  37394. // the object here.
  37395. var dataDef = {};
  37396. dataDef.get = function () { return this._data };
  37397. var propsDef = {};
  37398. propsDef.get = function () { return this._props };
  37399. {
  37400. dataDef.set = function () {
  37401. warn(
  37402. 'Avoid replacing instance root $data. ' +
  37403. 'Use nested data properties instead.',
  37404. this
  37405. );
  37406. };
  37407. propsDef.set = function () {
  37408. warn("$props is readonly.", this);
  37409. };
  37410. }
  37411. Object.defineProperty(Vue.prototype, '$data', dataDef);
  37412. Object.defineProperty(Vue.prototype, '$props', propsDef);
  37413. Vue.prototype.$set = set;
  37414. Vue.prototype.$delete = del;
  37415. Vue.prototype.$watch = function (
  37416. expOrFn,
  37417. cb,
  37418. options
  37419. ) {
  37420. var vm = this;
  37421. if (isPlainObject(cb)) {
  37422. return createWatcher(vm, expOrFn, cb, options)
  37423. }
  37424. options = options || {};
  37425. options.user = true;
  37426. var watcher = new Watcher(vm, expOrFn, cb, options);
  37427. if (options.immediate) {
  37428. try {
  37429. cb.call(vm, watcher.value);
  37430. } catch (error) {
  37431. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  37432. }
  37433. }
  37434. return function unwatchFn () {
  37435. watcher.teardown();
  37436. }
  37437. };
  37438. }
  37439. /* */
  37440. var uid$3 = 0;
  37441. function initMixin (Vue) {
  37442. Vue.prototype._init = function (options) {
  37443. var vm = this;
  37444. // a uid
  37445. vm._uid = uid$3++;
  37446. var startTag, endTag;
  37447. /* istanbul ignore if */
  37448. if (config.performance && mark) {
  37449. startTag = "vue-perf-start:" + (vm._uid);
  37450. endTag = "vue-perf-end:" + (vm._uid);
  37451. mark(startTag);
  37452. }
  37453. // a flag to avoid this being observed
  37454. vm._isVue = true;
  37455. // merge options
  37456. if (options && options._isComponent) {
  37457. // optimize internal component instantiation
  37458. // since dynamic options merging is pretty slow, and none of the
  37459. // internal component options needs special treatment.
  37460. initInternalComponent(vm, options);
  37461. } else {
  37462. vm.$options = mergeOptions(
  37463. resolveConstructorOptions(vm.constructor),
  37464. options || {},
  37465. vm
  37466. );
  37467. }
  37468. /* istanbul ignore else */
  37469. {
  37470. initProxy(vm);
  37471. }
  37472. // expose real self
  37473. vm._self = vm;
  37474. initLifecycle(vm);
  37475. initEvents(vm);
  37476. initRender(vm);
  37477. callHook(vm, 'beforeCreate');
  37478. initInjections(vm); // resolve injections before data/props
  37479. initState(vm);
  37480. initProvide(vm); // resolve provide after data/props
  37481. callHook(vm, 'created');
  37482. /* istanbul ignore if */
  37483. if (config.performance && mark) {
  37484. vm._name = formatComponentName(vm, false);
  37485. mark(endTag);
  37486. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  37487. }
  37488. if (vm.$options.el) {
  37489. vm.$mount(vm.$options.el);
  37490. }
  37491. };
  37492. }
  37493. function initInternalComponent (vm, options) {
  37494. var opts = vm.$options = Object.create(vm.constructor.options);
  37495. // doing this because it's faster than dynamic enumeration.
  37496. var parentVnode = options._parentVnode;
  37497. opts.parent = options.parent;
  37498. opts._parentVnode = parentVnode;
  37499. var vnodeComponentOptions = parentVnode.componentOptions;
  37500. opts.propsData = vnodeComponentOptions.propsData;
  37501. opts._parentListeners = vnodeComponentOptions.listeners;
  37502. opts._renderChildren = vnodeComponentOptions.children;
  37503. opts._componentTag = vnodeComponentOptions.tag;
  37504. if (options.render) {
  37505. opts.render = options.render;
  37506. opts.staticRenderFns = options.staticRenderFns;
  37507. }
  37508. }
  37509. function resolveConstructorOptions (Ctor) {
  37510. var options = Ctor.options;
  37511. if (Ctor.super) {
  37512. var superOptions = resolveConstructorOptions(Ctor.super);
  37513. var cachedSuperOptions = Ctor.superOptions;
  37514. if (superOptions !== cachedSuperOptions) {
  37515. // super option changed,
  37516. // need to resolve new options.
  37517. Ctor.superOptions = superOptions;
  37518. // check if there are any late-modified/attached options (#4976)
  37519. var modifiedOptions = resolveModifiedOptions(Ctor);
  37520. // update base extend options
  37521. if (modifiedOptions) {
  37522. extend(Ctor.extendOptions, modifiedOptions);
  37523. }
  37524. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  37525. if (options.name) {
  37526. options.components[options.name] = Ctor;
  37527. }
  37528. }
  37529. }
  37530. return options
  37531. }
  37532. function resolveModifiedOptions (Ctor) {
  37533. var modified;
  37534. var latest = Ctor.options;
  37535. var sealed = Ctor.sealedOptions;
  37536. for (var key in latest) {
  37537. if (latest[key] !== sealed[key]) {
  37538. if (!modified) { modified = {}; }
  37539. modified[key] = latest[key];
  37540. }
  37541. }
  37542. return modified
  37543. }
  37544. function Vue (options) {
  37545. if (!(this instanceof Vue)
  37546. ) {
  37547. warn('Vue is a constructor and should be called with the `new` keyword');
  37548. }
  37549. this._init(options);
  37550. }
  37551. initMixin(Vue);
  37552. stateMixin(Vue);
  37553. eventsMixin(Vue);
  37554. lifecycleMixin(Vue);
  37555. renderMixin(Vue);
  37556. /* */
  37557. function initUse (Vue) {
  37558. Vue.use = function (plugin) {
  37559. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  37560. if (installedPlugins.indexOf(plugin) > -1) {
  37561. return this
  37562. }
  37563. // additional parameters
  37564. var args = toArray(arguments, 1);
  37565. args.unshift(this);
  37566. if (typeof plugin.install === 'function') {
  37567. plugin.install.apply(plugin, args);
  37568. } else if (typeof plugin === 'function') {
  37569. plugin.apply(null, args);
  37570. }
  37571. installedPlugins.push(plugin);
  37572. return this
  37573. };
  37574. }
  37575. /* */
  37576. function initMixin$1 (Vue) {
  37577. Vue.mixin = function (mixin) {
  37578. this.options = mergeOptions(this.options, mixin);
  37579. return this
  37580. };
  37581. }
  37582. /* */
  37583. function initExtend (Vue) {
  37584. /**
  37585. * Each instance constructor, including Vue, has a unique
  37586. * cid. This enables us to create wrapped "child
  37587. * constructors" for prototypal inheritance and cache them.
  37588. */
  37589. Vue.cid = 0;
  37590. var cid = 1;
  37591. /**
  37592. * Class inheritance
  37593. */
  37594. Vue.extend = function (extendOptions) {
  37595. extendOptions = extendOptions || {};
  37596. var Super = this;
  37597. var SuperId = Super.cid;
  37598. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  37599. if (cachedCtors[SuperId]) {
  37600. return cachedCtors[SuperId]
  37601. }
  37602. var name = extendOptions.name || Super.options.name;
  37603. if (name) {
  37604. validateComponentName(name);
  37605. }
  37606. var Sub = function VueComponent (options) {
  37607. this._init(options);
  37608. };
  37609. Sub.prototype = Object.create(Super.prototype);
  37610. Sub.prototype.constructor = Sub;
  37611. Sub.cid = cid++;
  37612. Sub.options = mergeOptions(
  37613. Super.options,
  37614. extendOptions
  37615. );
  37616. Sub['super'] = Super;
  37617. // For props and computed properties, we define the proxy getters on
  37618. // the Vue instances at extension time, on the extended prototype. This
  37619. // avoids Object.defineProperty calls for each instance created.
  37620. if (Sub.options.props) {
  37621. initProps$1(Sub);
  37622. }
  37623. if (Sub.options.computed) {
  37624. initComputed$1(Sub);
  37625. }
  37626. // allow further extension/mixin/plugin usage
  37627. Sub.extend = Super.extend;
  37628. Sub.mixin = Super.mixin;
  37629. Sub.use = Super.use;
  37630. // create asset registers, so extended classes
  37631. // can have their private assets too.
  37632. ASSET_TYPES.forEach(function (type) {
  37633. Sub[type] = Super[type];
  37634. });
  37635. // enable recursive self-lookup
  37636. if (name) {
  37637. Sub.options.components[name] = Sub;
  37638. }
  37639. // keep a reference to the super options at extension time.
  37640. // later at instantiation we can check if Super's options have
  37641. // been updated.
  37642. Sub.superOptions = Super.options;
  37643. Sub.extendOptions = extendOptions;
  37644. Sub.sealedOptions = extend({}, Sub.options);
  37645. // cache constructor
  37646. cachedCtors[SuperId] = Sub;
  37647. return Sub
  37648. };
  37649. }
  37650. function initProps$1 (Comp) {
  37651. var props = Comp.options.props;
  37652. for (var key in props) {
  37653. proxy(Comp.prototype, "_props", key);
  37654. }
  37655. }
  37656. function initComputed$1 (Comp) {
  37657. var computed = Comp.options.computed;
  37658. for (var key in computed) {
  37659. defineComputed(Comp.prototype, key, computed[key]);
  37660. }
  37661. }
  37662. /* */
  37663. function initAssetRegisters (Vue) {
  37664. /**
  37665. * Create asset registration methods.
  37666. */
  37667. ASSET_TYPES.forEach(function (type) {
  37668. Vue[type] = function (
  37669. id,
  37670. definition
  37671. ) {
  37672. if (!definition) {
  37673. return this.options[type + 's'][id]
  37674. } else {
  37675. /* istanbul ignore if */
  37676. if (type === 'component') {
  37677. validateComponentName(id);
  37678. }
  37679. if (type === 'component' && isPlainObject(definition)) {
  37680. definition.name = definition.name || id;
  37681. definition = this.options._base.extend(definition);
  37682. }
  37683. if (type === 'directive' && typeof definition === 'function') {
  37684. definition = { bind: definition, update: definition };
  37685. }
  37686. this.options[type + 's'][id] = definition;
  37687. return definition
  37688. }
  37689. };
  37690. });
  37691. }
  37692. /* */
  37693. function getComponentName (opts) {
  37694. return opts && (opts.Ctor.options.name || opts.tag)
  37695. }
  37696. function matches (pattern, name) {
  37697. if (Array.isArray(pattern)) {
  37698. return pattern.indexOf(name) > -1
  37699. } else if (typeof pattern === 'string') {
  37700. return pattern.split(',').indexOf(name) > -1
  37701. } else if (isRegExp(pattern)) {
  37702. return pattern.test(name)
  37703. }
  37704. /* istanbul ignore next */
  37705. return false
  37706. }
  37707. function pruneCache (keepAliveInstance, filter) {
  37708. var cache = keepAliveInstance.cache;
  37709. var keys = keepAliveInstance.keys;
  37710. var _vnode = keepAliveInstance._vnode;
  37711. for (var key in cache) {
  37712. var cachedNode = cache[key];
  37713. if (cachedNode) {
  37714. var name = getComponentName(cachedNode.componentOptions);
  37715. if (name && !filter(name)) {
  37716. pruneCacheEntry(cache, key, keys, _vnode);
  37717. }
  37718. }
  37719. }
  37720. }
  37721. function pruneCacheEntry (
  37722. cache,
  37723. key,
  37724. keys,
  37725. current
  37726. ) {
  37727. var cached$$1 = cache[key];
  37728. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  37729. cached$$1.componentInstance.$destroy();
  37730. }
  37731. cache[key] = null;
  37732. remove(keys, key);
  37733. }
  37734. var patternTypes = [String, RegExp, Array];
  37735. var KeepAlive = {
  37736. name: 'keep-alive',
  37737. abstract: true,
  37738. props: {
  37739. include: patternTypes,
  37740. exclude: patternTypes,
  37741. max: [String, Number]
  37742. },
  37743. created: function created () {
  37744. this.cache = Object.create(null);
  37745. this.keys = [];
  37746. },
  37747. destroyed: function destroyed () {
  37748. for (var key in this.cache) {
  37749. pruneCacheEntry(this.cache, key, this.keys);
  37750. }
  37751. },
  37752. mounted: function mounted () {
  37753. var this$1 = this;
  37754. this.$watch('include', function (val) {
  37755. pruneCache(this$1, function (name) { return matches(val, name); });
  37756. });
  37757. this.$watch('exclude', function (val) {
  37758. pruneCache(this$1, function (name) { return !matches(val, name); });
  37759. });
  37760. },
  37761. render: function render () {
  37762. var slot = this.$slots.default;
  37763. var vnode = getFirstComponentChild(slot);
  37764. var componentOptions = vnode && vnode.componentOptions;
  37765. if (componentOptions) {
  37766. // check pattern
  37767. var name = getComponentName(componentOptions);
  37768. var ref = this;
  37769. var include = ref.include;
  37770. var exclude = ref.exclude;
  37771. if (
  37772. // not included
  37773. (include && (!name || !matches(include, name))) ||
  37774. // excluded
  37775. (exclude && name && matches(exclude, name))
  37776. ) {
  37777. return vnode
  37778. }
  37779. var ref$1 = this;
  37780. var cache = ref$1.cache;
  37781. var keys = ref$1.keys;
  37782. var key = vnode.key == null
  37783. // same constructor may get registered as different local components
  37784. // so cid alone is not enough (#3269)
  37785. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  37786. : vnode.key;
  37787. if (cache[key]) {
  37788. vnode.componentInstance = cache[key].componentInstance;
  37789. // make current key freshest
  37790. remove(keys, key);
  37791. keys.push(key);
  37792. } else {
  37793. cache[key] = vnode;
  37794. keys.push(key);
  37795. // prune oldest entry
  37796. if (this.max && keys.length > parseInt(this.max)) {
  37797. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  37798. }
  37799. }
  37800. vnode.data.keepAlive = true;
  37801. }
  37802. return vnode || (slot && slot[0])
  37803. }
  37804. };
  37805. var builtInComponents = {
  37806. KeepAlive: KeepAlive
  37807. };
  37808. /* */
  37809. function initGlobalAPI (Vue) {
  37810. // config
  37811. var configDef = {};
  37812. configDef.get = function () { return config; };
  37813. {
  37814. configDef.set = function () {
  37815. warn(
  37816. 'Do not replace the Vue.config object, set individual fields instead.'
  37817. );
  37818. };
  37819. }
  37820. Object.defineProperty(Vue, 'config', configDef);
  37821. // exposed util methods.
  37822. // NOTE: these are not considered part of the public API - avoid relying on
  37823. // them unless you are aware of the risk.
  37824. Vue.util = {
  37825. warn: warn,
  37826. extend: extend,
  37827. mergeOptions: mergeOptions,
  37828. defineReactive: defineReactive$$1
  37829. };
  37830. Vue.set = set;
  37831. Vue.delete = del;
  37832. Vue.nextTick = nextTick;
  37833. // 2.6 explicit observable API
  37834. Vue.observable = function (obj) {
  37835. observe(obj);
  37836. return obj
  37837. };
  37838. Vue.options = Object.create(null);
  37839. ASSET_TYPES.forEach(function (type) {
  37840. Vue.options[type + 's'] = Object.create(null);
  37841. });
  37842. // this is used to identify the "base" constructor to extend all plain-object
  37843. // components with in Weex's multi-instance scenarios.
  37844. Vue.options._base = Vue;
  37845. extend(Vue.options.components, builtInComponents);
  37846. initUse(Vue);
  37847. initMixin$1(Vue);
  37848. initExtend(Vue);
  37849. initAssetRegisters(Vue);
  37850. }
  37851. initGlobalAPI(Vue);
  37852. Object.defineProperty(Vue.prototype, '$isServer', {
  37853. get: isServerRendering
  37854. });
  37855. Object.defineProperty(Vue.prototype, '$ssrContext', {
  37856. get: function get () {
  37857. /* istanbul ignore next */
  37858. return this.$vnode && this.$vnode.ssrContext
  37859. }
  37860. });
  37861. // expose FunctionalRenderContext for ssr runtime helper installation
  37862. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  37863. value: FunctionalRenderContext
  37864. });
  37865. Vue.version = '2.6.12';
  37866. /* */
  37867. // these are reserved for web because they are directly compiled away
  37868. // during template compilation
  37869. var isReservedAttr = makeMap('style,class');
  37870. // attributes that should be using props for binding
  37871. var acceptValue = makeMap('input,textarea,option,select,progress');
  37872. var mustUseProp = function (tag, type, attr) {
  37873. return (
  37874. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  37875. (attr === 'selected' && tag === 'option') ||
  37876. (attr === 'checked' && tag === 'input') ||
  37877. (attr === 'muted' && tag === 'video')
  37878. )
  37879. };
  37880. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  37881. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  37882. var convertEnumeratedValue = function (key, value) {
  37883. return isFalsyAttrValue(value) || value === 'false'
  37884. ? 'false'
  37885. // allow arbitrary string value for contenteditable
  37886. : key === 'contenteditable' && isValidContentEditableValue(value)
  37887. ? value
  37888. : 'true'
  37889. };
  37890. var isBooleanAttr = makeMap(
  37891. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  37892. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  37893. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  37894. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  37895. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  37896. 'truespeed,typemustmatch,visible'
  37897. );
  37898. var xlinkNS = 'http://www.w3.org/1999/xlink';
  37899. var isXlink = function (name) {
  37900. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  37901. };
  37902. var getXlinkProp = function (name) {
  37903. return isXlink(name) ? name.slice(6, name.length) : ''
  37904. };
  37905. var isFalsyAttrValue = function (val) {
  37906. return val == null || val === false
  37907. };
  37908. /* */
  37909. function genClassForVnode (vnode) {
  37910. var data = vnode.data;
  37911. var parentNode = vnode;
  37912. var childNode = vnode;
  37913. while (isDef(childNode.componentInstance)) {
  37914. childNode = childNode.componentInstance._vnode;
  37915. if (childNode && childNode.data) {
  37916. data = mergeClassData(childNode.data, data);
  37917. }
  37918. }
  37919. while (isDef(parentNode = parentNode.parent)) {
  37920. if (parentNode && parentNode.data) {
  37921. data = mergeClassData(data, parentNode.data);
  37922. }
  37923. }
  37924. return renderClass(data.staticClass, data.class)
  37925. }
  37926. function mergeClassData (child, parent) {
  37927. return {
  37928. staticClass: concat(child.staticClass, parent.staticClass),
  37929. class: isDef(child.class)
  37930. ? [child.class, parent.class]
  37931. : parent.class
  37932. }
  37933. }
  37934. function renderClass (
  37935. staticClass,
  37936. dynamicClass
  37937. ) {
  37938. if (isDef(staticClass) || isDef(dynamicClass)) {
  37939. return concat(staticClass, stringifyClass(dynamicClass))
  37940. }
  37941. /* istanbul ignore next */
  37942. return ''
  37943. }
  37944. function concat (a, b) {
  37945. return a ? b ? (a + ' ' + b) : a : (b || '')
  37946. }
  37947. function stringifyClass (value) {
  37948. if (Array.isArray(value)) {
  37949. return stringifyArray(value)
  37950. }
  37951. if (isObject(value)) {
  37952. return stringifyObject(value)
  37953. }
  37954. if (typeof value === 'string') {
  37955. return value
  37956. }
  37957. /* istanbul ignore next */
  37958. return ''
  37959. }
  37960. function stringifyArray (value) {
  37961. var res = '';
  37962. var stringified;
  37963. for (var i = 0, l = value.length; i < l; i++) {
  37964. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  37965. if (res) { res += ' '; }
  37966. res += stringified;
  37967. }
  37968. }
  37969. return res
  37970. }
  37971. function stringifyObject (value) {
  37972. var res = '';
  37973. for (var key in value) {
  37974. if (value[key]) {
  37975. if (res) { res += ' '; }
  37976. res += key;
  37977. }
  37978. }
  37979. return res
  37980. }
  37981. /* */
  37982. var namespaceMap = {
  37983. svg: 'http://www.w3.org/2000/svg',
  37984. math: 'http://www.w3.org/1998/Math/MathML'
  37985. };
  37986. var isHTMLTag = makeMap(
  37987. 'html,body,base,head,link,meta,style,title,' +
  37988. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  37989. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  37990. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  37991. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  37992. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  37993. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  37994. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  37995. 'output,progress,select,textarea,' +
  37996. 'details,dialog,menu,menuitem,summary,' +
  37997. 'content,element,shadow,template,blockquote,iframe,tfoot'
  37998. );
  37999. // this map is intentionally selective, only covering SVG elements that may
  38000. // contain child elements.
  38001. var isSVG = makeMap(
  38002. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  38003. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  38004. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  38005. true
  38006. );
  38007. var isPreTag = function (tag) { return tag === 'pre'; };
  38008. var isReservedTag = function (tag) {
  38009. return isHTMLTag(tag) || isSVG(tag)
  38010. };
  38011. function getTagNamespace (tag) {
  38012. if (isSVG(tag)) {
  38013. return 'svg'
  38014. }
  38015. // basic support for MathML
  38016. // note it doesn't support other MathML elements being component roots
  38017. if (tag === 'math') {
  38018. return 'math'
  38019. }
  38020. }
  38021. var unknownElementCache = Object.create(null);
  38022. function isUnknownElement (tag) {
  38023. /* istanbul ignore if */
  38024. if (!inBrowser) {
  38025. return true
  38026. }
  38027. if (isReservedTag(tag)) {
  38028. return false
  38029. }
  38030. tag = tag.toLowerCase();
  38031. /* istanbul ignore if */
  38032. if (unknownElementCache[tag] != null) {
  38033. return unknownElementCache[tag]
  38034. }
  38035. var el = document.createElement(tag);
  38036. if (tag.indexOf('-') > -1) {
  38037. // http://stackoverflow.com/a/28210364/1070244
  38038. return (unknownElementCache[tag] = (
  38039. el.constructor === window.HTMLUnknownElement ||
  38040. el.constructor === window.HTMLElement
  38041. ))
  38042. } else {
  38043. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  38044. }
  38045. }
  38046. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  38047. /* */
  38048. /**
  38049. * Query an element selector if it's not an element already.
  38050. */
  38051. function query (el) {
  38052. if (typeof el === 'string') {
  38053. var selected = document.querySelector(el);
  38054. if (!selected) {
  38055. warn(
  38056. 'Cannot find element: ' + el
  38057. );
  38058. return document.createElement('div')
  38059. }
  38060. return selected
  38061. } else {
  38062. return el
  38063. }
  38064. }
  38065. /* */
  38066. function createElement$1 (tagName, vnode) {
  38067. var elm = document.createElement(tagName);
  38068. if (tagName !== 'select') {
  38069. return elm
  38070. }
  38071. // false or null will remove the attribute but undefined will not
  38072. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  38073. elm.setAttribute('multiple', 'multiple');
  38074. }
  38075. return elm
  38076. }
  38077. function createElementNS (namespace, tagName) {
  38078. return document.createElementNS(namespaceMap[namespace], tagName)
  38079. }
  38080. function createTextNode (text) {
  38081. return document.createTextNode(text)
  38082. }
  38083. function createComment (text) {
  38084. return document.createComment(text)
  38085. }
  38086. function insertBefore (parentNode, newNode, referenceNode) {
  38087. parentNode.insertBefore(newNode, referenceNode);
  38088. }
  38089. function removeChild (node, child) {
  38090. node.removeChild(child);
  38091. }
  38092. function appendChild (node, child) {
  38093. node.appendChild(child);
  38094. }
  38095. function parentNode (node) {
  38096. return node.parentNode
  38097. }
  38098. function nextSibling (node) {
  38099. return node.nextSibling
  38100. }
  38101. function tagName (node) {
  38102. return node.tagName
  38103. }
  38104. function setTextContent (node, text) {
  38105. node.textContent = text;
  38106. }
  38107. function setStyleScope (node, scopeId) {
  38108. node.setAttribute(scopeId, '');
  38109. }
  38110. var nodeOps = /*#__PURE__*/Object.freeze({
  38111. createElement: createElement$1,
  38112. createElementNS: createElementNS,
  38113. createTextNode: createTextNode,
  38114. createComment: createComment,
  38115. insertBefore: insertBefore,
  38116. removeChild: removeChild,
  38117. appendChild: appendChild,
  38118. parentNode: parentNode,
  38119. nextSibling: nextSibling,
  38120. tagName: tagName,
  38121. setTextContent: setTextContent,
  38122. setStyleScope: setStyleScope
  38123. });
  38124. /* */
  38125. var ref = {
  38126. create: function create (_, vnode) {
  38127. registerRef(vnode);
  38128. },
  38129. update: function update (oldVnode, vnode) {
  38130. if (oldVnode.data.ref !== vnode.data.ref) {
  38131. registerRef(oldVnode, true);
  38132. registerRef(vnode);
  38133. }
  38134. },
  38135. destroy: function destroy (vnode) {
  38136. registerRef(vnode, true);
  38137. }
  38138. };
  38139. function registerRef (vnode, isRemoval) {
  38140. var key = vnode.data.ref;
  38141. if (!isDef(key)) { return }
  38142. var vm = vnode.context;
  38143. var ref = vnode.componentInstance || vnode.elm;
  38144. var refs = vm.$refs;
  38145. if (isRemoval) {
  38146. if (Array.isArray(refs[key])) {
  38147. remove(refs[key], ref);
  38148. } else if (refs[key] === ref) {
  38149. refs[key] = undefined;
  38150. }
  38151. } else {
  38152. if (vnode.data.refInFor) {
  38153. if (!Array.isArray(refs[key])) {
  38154. refs[key] = [ref];
  38155. } else if (refs[key].indexOf(ref) < 0) {
  38156. // $flow-disable-line
  38157. refs[key].push(ref);
  38158. }
  38159. } else {
  38160. refs[key] = ref;
  38161. }
  38162. }
  38163. }
  38164. /**
  38165. * Virtual DOM patching algorithm based on Snabbdom by
  38166. * Simon Friis Vindum (@paldepind)
  38167. * Licensed under the MIT License
  38168. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  38169. *
  38170. * modified by Evan You (@yyx990803)
  38171. *
  38172. * Not type-checking this because this file is perf-critical and the cost
  38173. * of making flow understand it is not worth it.
  38174. */
  38175. var emptyNode = new VNode('', {}, []);
  38176. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  38177. function sameVnode (a, b) {
  38178. return (
  38179. a.key === b.key && (
  38180. (
  38181. a.tag === b.tag &&
  38182. a.isComment === b.isComment &&
  38183. isDef(a.data) === isDef(b.data) &&
  38184. sameInputType(a, b)
  38185. ) || (
  38186. isTrue(a.isAsyncPlaceholder) &&
  38187. a.asyncFactory === b.asyncFactory &&
  38188. isUndef(b.asyncFactory.error)
  38189. )
  38190. )
  38191. )
  38192. }
  38193. function sameInputType (a, b) {
  38194. if (a.tag !== 'input') { return true }
  38195. var i;
  38196. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  38197. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  38198. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  38199. }
  38200. function createKeyToOldIdx (children, beginIdx, endIdx) {
  38201. var i, key;
  38202. var map = {};
  38203. for (i = beginIdx; i <= endIdx; ++i) {
  38204. key = children[i].key;
  38205. if (isDef(key)) { map[key] = i; }
  38206. }
  38207. return map
  38208. }
  38209. function createPatchFunction (backend) {
  38210. var i, j;
  38211. var cbs = {};
  38212. var modules = backend.modules;
  38213. var nodeOps = backend.nodeOps;
  38214. for (i = 0; i < hooks.length; ++i) {
  38215. cbs[hooks[i]] = [];
  38216. for (j = 0; j < modules.length; ++j) {
  38217. if (isDef(modules[j][hooks[i]])) {
  38218. cbs[hooks[i]].push(modules[j][hooks[i]]);
  38219. }
  38220. }
  38221. }
  38222. function emptyNodeAt (elm) {
  38223. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  38224. }
  38225. function createRmCb (childElm, listeners) {
  38226. function remove$$1 () {
  38227. if (--remove$$1.listeners === 0) {
  38228. removeNode(childElm);
  38229. }
  38230. }
  38231. remove$$1.listeners = listeners;
  38232. return remove$$1
  38233. }
  38234. function removeNode (el) {
  38235. var parent = nodeOps.parentNode(el);
  38236. // element may have already been removed due to v-html / v-text
  38237. if (isDef(parent)) {
  38238. nodeOps.removeChild(parent, el);
  38239. }
  38240. }
  38241. function isUnknownElement$$1 (vnode, inVPre) {
  38242. return (
  38243. !inVPre &&
  38244. !vnode.ns &&
  38245. !(
  38246. config.ignoredElements.length &&
  38247. config.ignoredElements.some(function (ignore) {
  38248. return isRegExp(ignore)
  38249. ? ignore.test(vnode.tag)
  38250. : ignore === vnode.tag
  38251. })
  38252. ) &&
  38253. config.isUnknownElement(vnode.tag)
  38254. )
  38255. }
  38256. var creatingElmInVPre = 0;
  38257. function createElm (
  38258. vnode,
  38259. insertedVnodeQueue,
  38260. parentElm,
  38261. refElm,
  38262. nested,
  38263. ownerArray,
  38264. index
  38265. ) {
  38266. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38267. // This vnode was used in a previous render!
  38268. // now it's used as a new node, overwriting its elm would cause
  38269. // potential patch errors down the road when it's used as an insertion
  38270. // reference node. Instead, we clone the node on-demand before creating
  38271. // associated DOM element for it.
  38272. vnode = ownerArray[index] = cloneVNode(vnode);
  38273. }
  38274. vnode.isRootInsert = !nested; // for transition enter check
  38275. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  38276. return
  38277. }
  38278. var data = vnode.data;
  38279. var children = vnode.children;
  38280. var tag = vnode.tag;
  38281. if (isDef(tag)) {
  38282. {
  38283. if (data && data.pre) {
  38284. creatingElmInVPre++;
  38285. }
  38286. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  38287. warn(
  38288. 'Unknown custom element: <' + tag + '> - did you ' +
  38289. 'register the component correctly? For recursive components, ' +
  38290. 'make sure to provide the "name" option.',
  38291. vnode.context
  38292. );
  38293. }
  38294. }
  38295. vnode.elm = vnode.ns
  38296. ? nodeOps.createElementNS(vnode.ns, tag)
  38297. : nodeOps.createElement(tag, vnode);
  38298. setScope(vnode);
  38299. /* istanbul ignore if */
  38300. {
  38301. createChildren(vnode, children, insertedVnodeQueue);
  38302. if (isDef(data)) {
  38303. invokeCreateHooks(vnode, insertedVnodeQueue);
  38304. }
  38305. insert(parentElm, vnode.elm, refElm);
  38306. }
  38307. if (data && data.pre) {
  38308. creatingElmInVPre--;
  38309. }
  38310. } else if (isTrue(vnode.isComment)) {
  38311. vnode.elm = nodeOps.createComment(vnode.text);
  38312. insert(parentElm, vnode.elm, refElm);
  38313. } else {
  38314. vnode.elm = nodeOps.createTextNode(vnode.text);
  38315. insert(parentElm, vnode.elm, refElm);
  38316. }
  38317. }
  38318. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38319. var i = vnode.data;
  38320. if (isDef(i)) {
  38321. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  38322. if (isDef(i = i.hook) && isDef(i = i.init)) {
  38323. i(vnode, false /* hydrating */);
  38324. }
  38325. // after calling the init hook, if the vnode is a child component
  38326. // it should've created a child instance and mounted it. the child
  38327. // component also has set the placeholder vnode's elm.
  38328. // in that case we can just return the element and be done.
  38329. if (isDef(vnode.componentInstance)) {
  38330. initComponent(vnode, insertedVnodeQueue);
  38331. insert(parentElm, vnode.elm, refElm);
  38332. if (isTrue(isReactivated)) {
  38333. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  38334. }
  38335. return true
  38336. }
  38337. }
  38338. }
  38339. function initComponent (vnode, insertedVnodeQueue) {
  38340. if (isDef(vnode.data.pendingInsert)) {
  38341. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  38342. vnode.data.pendingInsert = null;
  38343. }
  38344. vnode.elm = vnode.componentInstance.$el;
  38345. if (isPatchable(vnode)) {
  38346. invokeCreateHooks(vnode, insertedVnodeQueue);
  38347. setScope(vnode);
  38348. } else {
  38349. // empty component root.
  38350. // skip all element-related modules except for ref (#3455)
  38351. registerRef(vnode);
  38352. // make sure to invoke the insert hook
  38353. insertedVnodeQueue.push(vnode);
  38354. }
  38355. }
  38356. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38357. var i;
  38358. // hack for #4339: a reactivated component with inner transition
  38359. // does not trigger because the inner node's created hooks are not called
  38360. // again. It's not ideal to involve module-specific logic in here but
  38361. // there doesn't seem to be a better way to do it.
  38362. var innerNode = vnode;
  38363. while (innerNode.componentInstance) {
  38364. innerNode = innerNode.componentInstance._vnode;
  38365. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  38366. for (i = 0; i < cbs.activate.length; ++i) {
  38367. cbs.activate[i](emptyNode, innerNode);
  38368. }
  38369. insertedVnodeQueue.push(innerNode);
  38370. break
  38371. }
  38372. }
  38373. // unlike a newly created component,
  38374. // a reactivated keep-alive component doesn't insert itself
  38375. insert(parentElm, vnode.elm, refElm);
  38376. }
  38377. function insert (parent, elm, ref$$1) {
  38378. if (isDef(parent)) {
  38379. if (isDef(ref$$1)) {
  38380. if (nodeOps.parentNode(ref$$1) === parent) {
  38381. nodeOps.insertBefore(parent, elm, ref$$1);
  38382. }
  38383. } else {
  38384. nodeOps.appendChild(parent, elm);
  38385. }
  38386. }
  38387. }
  38388. function createChildren (vnode, children, insertedVnodeQueue) {
  38389. if (Array.isArray(children)) {
  38390. {
  38391. checkDuplicateKeys(children);
  38392. }
  38393. for (var i = 0; i < children.length; ++i) {
  38394. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  38395. }
  38396. } else if (isPrimitive(vnode.text)) {
  38397. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  38398. }
  38399. }
  38400. function isPatchable (vnode) {
  38401. while (vnode.componentInstance) {
  38402. vnode = vnode.componentInstance._vnode;
  38403. }
  38404. return isDef(vnode.tag)
  38405. }
  38406. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  38407. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38408. cbs.create[i$1](emptyNode, vnode);
  38409. }
  38410. i = vnode.data.hook; // Reuse variable
  38411. if (isDef(i)) {
  38412. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  38413. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  38414. }
  38415. }
  38416. // set scope id attribute for scoped CSS.
  38417. // this is implemented as a special case to avoid the overhead
  38418. // of going through the normal attribute patching process.
  38419. function setScope (vnode) {
  38420. var i;
  38421. if (isDef(i = vnode.fnScopeId)) {
  38422. nodeOps.setStyleScope(vnode.elm, i);
  38423. } else {
  38424. var ancestor = vnode;
  38425. while (ancestor) {
  38426. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  38427. nodeOps.setStyleScope(vnode.elm, i);
  38428. }
  38429. ancestor = ancestor.parent;
  38430. }
  38431. }
  38432. // for slot content they should also get the scopeId from the host instance.
  38433. if (isDef(i = activeInstance) &&
  38434. i !== vnode.context &&
  38435. i !== vnode.fnContext &&
  38436. isDef(i = i.$options._scopeId)
  38437. ) {
  38438. nodeOps.setStyleScope(vnode.elm, i);
  38439. }
  38440. }
  38441. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  38442. for (; startIdx <= endIdx; ++startIdx) {
  38443. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  38444. }
  38445. }
  38446. function invokeDestroyHook (vnode) {
  38447. var i, j;
  38448. var data = vnode.data;
  38449. if (isDef(data)) {
  38450. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  38451. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  38452. }
  38453. if (isDef(i = vnode.children)) {
  38454. for (j = 0; j < vnode.children.length; ++j) {
  38455. invokeDestroyHook(vnode.children[j]);
  38456. }
  38457. }
  38458. }
  38459. function removeVnodes (vnodes, startIdx, endIdx) {
  38460. for (; startIdx <= endIdx; ++startIdx) {
  38461. var ch = vnodes[startIdx];
  38462. if (isDef(ch)) {
  38463. if (isDef(ch.tag)) {
  38464. removeAndInvokeRemoveHook(ch);
  38465. invokeDestroyHook(ch);
  38466. } else { // Text node
  38467. removeNode(ch.elm);
  38468. }
  38469. }
  38470. }
  38471. }
  38472. function removeAndInvokeRemoveHook (vnode, rm) {
  38473. if (isDef(rm) || isDef(vnode.data)) {
  38474. var i;
  38475. var listeners = cbs.remove.length + 1;
  38476. if (isDef(rm)) {
  38477. // we have a recursively passed down rm callback
  38478. // increase the listeners count
  38479. rm.listeners += listeners;
  38480. } else {
  38481. // directly removing
  38482. rm = createRmCb(vnode.elm, listeners);
  38483. }
  38484. // recursively invoke hooks on child component root node
  38485. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  38486. removeAndInvokeRemoveHook(i, rm);
  38487. }
  38488. for (i = 0; i < cbs.remove.length; ++i) {
  38489. cbs.remove[i](vnode, rm);
  38490. }
  38491. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  38492. i(vnode, rm);
  38493. } else {
  38494. rm();
  38495. }
  38496. } else {
  38497. removeNode(vnode.elm);
  38498. }
  38499. }
  38500. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  38501. var oldStartIdx = 0;
  38502. var newStartIdx = 0;
  38503. var oldEndIdx = oldCh.length - 1;
  38504. var oldStartVnode = oldCh[0];
  38505. var oldEndVnode = oldCh[oldEndIdx];
  38506. var newEndIdx = newCh.length - 1;
  38507. var newStartVnode = newCh[0];
  38508. var newEndVnode = newCh[newEndIdx];
  38509. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  38510. // removeOnly is a special flag used only by <transition-group>
  38511. // to ensure removed elements stay in correct relative positions
  38512. // during leaving transitions
  38513. var canMove = !removeOnly;
  38514. {
  38515. checkDuplicateKeys(newCh);
  38516. }
  38517. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  38518. if (isUndef(oldStartVnode)) {
  38519. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  38520. } else if (isUndef(oldEndVnode)) {
  38521. oldEndVnode = oldCh[--oldEndIdx];
  38522. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  38523. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38524. oldStartVnode = oldCh[++oldStartIdx];
  38525. newStartVnode = newCh[++newStartIdx];
  38526. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  38527. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38528. oldEndVnode = oldCh[--oldEndIdx];
  38529. newEndVnode = newCh[--newEndIdx];
  38530. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  38531. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38532. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  38533. oldStartVnode = oldCh[++oldStartIdx];
  38534. newEndVnode = newCh[--newEndIdx];
  38535. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  38536. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38537. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  38538. oldEndVnode = oldCh[--oldEndIdx];
  38539. newStartVnode = newCh[++newStartIdx];
  38540. } else {
  38541. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  38542. idxInOld = isDef(newStartVnode.key)
  38543. ? oldKeyToIdx[newStartVnode.key]
  38544. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  38545. if (isUndef(idxInOld)) { // New element
  38546. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38547. } else {
  38548. vnodeToMove = oldCh[idxInOld];
  38549. if (sameVnode(vnodeToMove, newStartVnode)) {
  38550. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38551. oldCh[idxInOld] = undefined;
  38552. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  38553. } else {
  38554. // same key but different element. treat as new element
  38555. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38556. }
  38557. }
  38558. newStartVnode = newCh[++newStartIdx];
  38559. }
  38560. }
  38561. if (oldStartIdx > oldEndIdx) {
  38562. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  38563. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  38564. } else if (newStartIdx > newEndIdx) {
  38565. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  38566. }
  38567. }
  38568. function checkDuplicateKeys (children) {
  38569. var seenKeys = {};
  38570. for (var i = 0; i < children.length; i++) {
  38571. var vnode = children[i];
  38572. var key = vnode.key;
  38573. if (isDef(key)) {
  38574. if (seenKeys[key]) {
  38575. warn(
  38576. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  38577. vnode.context
  38578. );
  38579. } else {
  38580. seenKeys[key] = true;
  38581. }
  38582. }
  38583. }
  38584. }
  38585. function findIdxInOld (node, oldCh, start, end) {
  38586. for (var i = start; i < end; i++) {
  38587. var c = oldCh[i];
  38588. if (isDef(c) && sameVnode(node, c)) { return i }
  38589. }
  38590. }
  38591. function patchVnode (
  38592. oldVnode,
  38593. vnode,
  38594. insertedVnodeQueue,
  38595. ownerArray,
  38596. index,
  38597. removeOnly
  38598. ) {
  38599. if (oldVnode === vnode) {
  38600. return
  38601. }
  38602. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38603. // clone reused vnode
  38604. vnode = ownerArray[index] = cloneVNode(vnode);
  38605. }
  38606. var elm = vnode.elm = oldVnode.elm;
  38607. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  38608. if (isDef(vnode.asyncFactory.resolved)) {
  38609. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  38610. } else {
  38611. vnode.isAsyncPlaceholder = true;
  38612. }
  38613. return
  38614. }
  38615. // reuse element for static trees.
  38616. // note we only do this if the vnode is cloned -
  38617. // if the new node is not cloned it means the render functions have been
  38618. // reset by the hot-reload-api and we need to do a proper re-render.
  38619. if (isTrue(vnode.isStatic) &&
  38620. isTrue(oldVnode.isStatic) &&
  38621. vnode.key === oldVnode.key &&
  38622. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  38623. ) {
  38624. vnode.componentInstance = oldVnode.componentInstance;
  38625. return
  38626. }
  38627. var i;
  38628. var data = vnode.data;
  38629. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  38630. i(oldVnode, vnode);
  38631. }
  38632. var oldCh = oldVnode.children;
  38633. var ch = vnode.children;
  38634. if (isDef(data) && isPatchable(vnode)) {
  38635. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  38636. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  38637. }
  38638. if (isUndef(vnode.text)) {
  38639. if (isDef(oldCh) && isDef(ch)) {
  38640. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  38641. } else if (isDef(ch)) {
  38642. {
  38643. checkDuplicateKeys(ch);
  38644. }
  38645. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  38646. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  38647. } else if (isDef(oldCh)) {
  38648. removeVnodes(oldCh, 0, oldCh.length - 1);
  38649. } else if (isDef(oldVnode.text)) {
  38650. nodeOps.setTextContent(elm, '');
  38651. }
  38652. } else if (oldVnode.text !== vnode.text) {
  38653. nodeOps.setTextContent(elm, vnode.text);
  38654. }
  38655. if (isDef(data)) {
  38656. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  38657. }
  38658. }
  38659. function invokeInsertHook (vnode, queue, initial) {
  38660. // delay insert hooks for component root nodes, invoke them after the
  38661. // element is really inserted
  38662. if (isTrue(initial) && isDef(vnode.parent)) {
  38663. vnode.parent.data.pendingInsert = queue;
  38664. } else {
  38665. for (var i = 0; i < queue.length; ++i) {
  38666. queue[i].data.hook.insert(queue[i]);
  38667. }
  38668. }
  38669. }
  38670. var hydrationBailed = false;
  38671. // list of modules that can skip create hook during hydration because they
  38672. // are already rendered on the client or has no need for initialization
  38673. // Note: style is excluded because it relies on initial clone for future
  38674. // deep updates (#7063).
  38675. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  38676. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  38677. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  38678. var i;
  38679. var tag = vnode.tag;
  38680. var data = vnode.data;
  38681. var children = vnode.children;
  38682. inVPre = inVPre || (data && data.pre);
  38683. vnode.elm = elm;
  38684. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  38685. vnode.isAsyncPlaceholder = true;
  38686. return true
  38687. }
  38688. // assert node match
  38689. {
  38690. if (!assertNodeMatch(elm, vnode, inVPre)) {
  38691. return false
  38692. }
  38693. }
  38694. if (isDef(data)) {
  38695. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  38696. if (isDef(i = vnode.componentInstance)) {
  38697. // child component. it should have hydrated its own tree.
  38698. initComponent(vnode, insertedVnodeQueue);
  38699. return true
  38700. }
  38701. }
  38702. if (isDef(tag)) {
  38703. if (isDef(children)) {
  38704. // empty element, allow client to pick up and populate children
  38705. if (!elm.hasChildNodes()) {
  38706. createChildren(vnode, children, insertedVnodeQueue);
  38707. } else {
  38708. // v-html and domProps: innerHTML
  38709. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  38710. if (i !== elm.innerHTML) {
  38711. /* istanbul ignore if */
  38712. if (typeof console !== 'undefined' &&
  38713. !hydrationBailed
  38714. ) {
  38715. hydrationBailed = true;
  38716. console.warn('Parent: ', elm);
  38717. console.warn('server innerHTML: ', i);
  38718. console.warn('client innerHTML: ', elm.innerHTML);
  38719. }
  38720. return false
  38721. }
  38722. } else {
  38723. // iterate and compare children lists
  38724. var childrenMatch = true;
  38725. var childNode = elm.firstChild;
  38726. for (var i$1 = 0; i$1 < children.length; i$1++) {
  38727. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  38728. childrenMatch = false;
  38729. break
  38730. }
  38731. childNode = childNode.nextSibling;
  38732. }
  38733. // if childNode is not null, it means the actual childNodes list is
  38734. // longer than the virtual children list.
  38735. if (!childrenMatch || childNode) {
  38736. /* istanbul ignore if */
  38737. if (typeof console !== 'undefined' &&
  38738. !hydrationBailed
  38739. ) {
  38740. hydrationBailed = true;
  38741. console.warn('Parent: ', elm);
  38742. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  38743. }
  38744. return false
  38745. }
  38746. }
  38747. }
  38748. }
  38749. if (isDef(data)) {
  38750. var fullInvoke = false;
  38751. for (var key in data) {
  38752. if (!isRenderedModule(key)) {
  38753. fullInvoke = true;
  38754. invokeCreateHooks(vnode, insertedVnodeQueue);
  38755. break
  38756. }
  38757. }
  38758. if (!fullInvoke && data['class']) {
  38759. // ensure collecting deps for deep class bindings for future updates
  38760. traverse(data['class']);
  38761. }
  38762. }
  38763. } else if (elm.data !== vnode.text) {
  38764. elm.data = vnode.text;
  38765. }
  38766. return true
  38767. }
  38768. function assertNodeMatch (node, vnode, inVPre) {
  38769. if (isDef(vnode.tag)) {
  38770. return vnode.tag.indexOf('vue-component') === 0 || (
  38771. !isUnknownElement$$1(vnode, inVPre) &&
  38772. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  38773. )
  38774. } else {
  38775. return node.nodeType === (vnode.isComment ? 8 : 3)
  38776. }
  38777. }
  38778. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  38779. if (isUndef(vnode)) {
  38780. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  38781. return
  38782. }
  38783. var isInitialPatch = false;
  38784. var insertedVnodeQueue = [];
  38785. if (isUndef(oldVnode)) {
  38786. // empty mount (likely as component), create new root element
  38787. isInitialPatch = true;
  38788. createElm(vnode, insertedVnodeQueue);
  38789. } else {
  38790. var isRealElement = isDef(oldVnode.nodeType);
  38791. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  38792. // patch existing root node
  38793. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  38794. } else {
  38795. if (isRealElement) {
  38796. // mounting to a real element
  38797. // check if this is server-rendered content and if we can perform
  38798. // a successful hydration.
  38799. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  38800. oldVnode.removeAttribute(SSR_ATTR);
  38801. hydrating = true;
  38802. }
  38803. if (isTrue(hydrating)) {
  38804. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  38805. invokeInsertHook(vnode, insertedVnodeQueue, true);
  38806. return oldVnode
  38807. } else {
  38808. warn(
  38809. 'The client-side rendered virtual DOM tree is not matching ' +
  38810. 'server-rendered content. This is likely caused by incorrect ' +
  38811. 'HTML markup, for example nesting block-level elements inside ' +
  38812. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  38813. 'full client-side render.'
  38814. );
  38815. }
  38816. }
  38817. // either not server-rendered, or hydration failed.
  38818. // create an empty node and replace it
  38819. oldVnode = emptyNodeAt(oldVnode);
  38820. }
  38821. // replacing existing element
  38822. var oldElm = oldVnode.elm;
  38823. var parentElm = nodeOps.parentNode(oldElm);
  38824. // create new node
  38825. createElm(
  38826. vnode,
  38827. insertedVnodeQueue,
  38828. // extremely rare edge case: do not insert if old element is in a
  38829. // leaving transition. Only happens when combining transition +
  38830. // keep-alive + HOCs. (#4590)
  38831. oldElm._leaveCb ? null : parentElm,
  38832. nodeOps.nextSibling(oldElm)
  38833. );
  38834. // update parent placeholder node element, recursively
  38835. if (isDef(vnode.parent)) {
  38836. var ancestor = vnode.parent;
  38837. var patchable = isPatchable(vnode);
  38838. while (ancestor) {
  38839. for (var i = 0; i < cbs.destroy.length; ++i) {
  38840. cbs.destroy[i](ancestor);
  38841. }
  38842. ancestor.elm = vnode.elm;
  38843. if (patchable) {
  38844. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38845. cbs.create[i$1](emptyNode, ancestor);
  38846. }
  38847. // #6513
  38848. // invoke insert hooks that may have been merged by create hooks.
  38849. // e.g. for directives that uses the "inserted" hook.
  38850. var insert = ancestor.data.hook.insert;
  38851. if (insert.merged) {
  38852. // start at index 1 to avoid re-invoking component mounted hook
  38853. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  38854. insert.fns[i$2]();
  38855. }
  38856. }
  38857. } else {
  38858. registerRef(ancestor);
  38859. }
  38860. ancestor = ancestor.parent;
  38861. }
  38862. }
  38863. // destroy old node
  38864. if (isDef(parentElm)) {
  38865. removeVnodes([oldVnode], 0, 0);
  38866. } else if (isDef(oldVnode.tag)) {
  38867. invokeDestroyHook(oldVnode);
  38868. }
  38869. }
  38870. }
  38871. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  38872. return vnode.elm
  38873. }
  38874. }
  38875. /* */
  38876. var directives = {
  38877. create: updateDirectives,
  38878. update: updateDirectives,
  38879. destroy: function unbindDirectives (vnode) {
  38880. updateDirectives(vnode, emptyNode);
  38881. }
  38882. };
  38883. function updateDirectives (oldVnode, vnode) {
  38884. if (oldVnode.data.directives || vnode.data.directives) {
  38885. _update(oldVnode, vnode);
  38886. }
  38887. }
  38888. function _update (oldVnode, vnode) {
  38889. var isCreate = oldVnode === emptyNode;
  38890. var isDestroy = vnode === emptyNode;
  38891. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  38892. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  38893. var dirsWithInsert = [];
  38894. var dirsWithPostpatch = [];
  38895. var key, oldDir, dir;
  38896. for (key in newDirs) {
  38897. oldDir = oldDirs[key];
  38898. dir = newDirs[key];
  38899. if (!oldDir) {
  38900. // new directive, bind
  38901. callHook$1(dir, 'bind', vnode, oldVnode);
  38902. if (dir.def && dir.def.inserted) {
  38903. dirsWithInsert.push(dir);
  38904. }
  38905. } else {
  38906. // existing directive, update
  38907. dir.oldValue = oldDir.value;
  38908. dir.oldArg = oldDir.arg;
  38909. callHook$1(dir, 'update', vnode, oldVnode);
  38910. if (dir.def && dir.def.componentUpdated) {
  38911. dirsWithPostpatch.push(dir);
  38912. }
  38913. }
  38914. }
  38915. if (dirsWithInsert.length) {
  38916. var callInsert = function () {
  38917. for (var i = 0; i < dirsWithInsert.length; i++) {
  38918. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  38919. }
  38920. };
  38921. if (isCreate) {
  38922. mergeVNodeHook(vnode, 'insert', callInsert);
  38923. } else {
  38924. callInsert();
  38925. }
  38926. }
  38927. if (dirsWithPostpatch.length) {
  38928. mergeVNodeHook(vnode, 'postpatch', function () {
  38929. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  38930. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  38931. }
  38932. });
  38933. }
  38934. if (!isCreate) {
  38935. for (key in oldDirs) {
  38936. if (!newDirs[key]) {
  38937. // no longer present, unbind
  38938. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  38939. }
  38940. }
  38941. }
  38942. }
  38943. var emptyModifiers = Object.create(null);
  38944. function normalizeDirectives$1 (
  38945. dirs,
  38946. vm
  38947. ) {
  38948. var res = Object.create(null);
  38949. if (!dirs) {
  38950. // $flow-disable-line
  38951. return res
  38952. }
  38953. var i, dir;
  38954. for (i = 0; i < dirs.length; i++) {
  38955. dir = dirs[i];
  38956. if (!dir.modifiers) {
  38957. // $flow-disable-line
  38958. dir.modifiers = emptyModifiers;
  38959. }
  38960. res[getRawDirName(dir)] = dir;
  38961. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  38962. }
  38963. // $flow-disable-line
  38964. return res
  38965. }
  38966. function getRawDirName (dir) {
  38967. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  38968. }
  38969. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  38970. var fn = dir.def && dir.def[hook];
  38971. if (fn) {
  38972. try {
  38973. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  38974. } catch (e) {
  38975. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  38976. }
  38977. }
  38978. }
  38979. var baseModules = [
  38980. ref,
  38981. directives
  38982. ];
  38983. /* */
  38984. function updateAttrs (oldVnode, vnode) {
  38985. var opts = vnode.componentOptions;
  38986. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  38987. return
  38988. }
  38989. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  38990. return
  38991. }
  38992. var key, cur, old;
  38993. var elm = vnode.elm;
  38994. var oldAttrs = oldVnode.data.attrs || {};
  38995. var attrs = vnode.data.attrs || {};
  38996. // clone observed objects, as the user probably wants to mutate it
  38997. if (isDef(attrs.__ob__)) {
  38998. attrs = vnode.data.attrs = extend({}, attrs);
  38999. }
  39000. for (key in attrs) {
  39001. cur = attrs[key];
  39002. old = oldAttrs[key];
  39003. if (old !== cur) {
  39004. setAttr(elm, key, cur);
  39005. }
  39006. }
  39007. // #4391: in IE9, setting type can reset value for input[type=radio]
  39008. // #6666: IE/Edge forces progress value down to 1 before setting a max
  39009. /* istanbul ignore if */
  39010. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  39011. setAttr(elm, 'value', attrs.value);
  39012. }
  39013. for (key in oldAttrs) {
  39014. if (isUndef(attrs[key])) {
  39015. if (isXlink(key)) {
  39016. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  39017. } else if (!isEnumeratedAttr(key)) {
  39018. elm.removeAttribute(key);
  39019. }
  39020. }
  39021. }
  39022. }
  39023. function setAttr (el, key, value) {
  39024. if (el.tagName.indexOf('-') > -1) {
  39025. baseSetAttr(el, key, value);
  39026. } else if (isBooleanAttr(key)) {
  39027. // set attribute for blank value
  39028. // e.g. <option disabled>Select one</option>
  39029. if (isFalsyAttrValue(value)) {
  39030. el.removeAttribute(key);
  39031. } else {
  39032. // technically allowfullscreen is a boolean attribute for <iframe>,
  39033. // but Flash expects a value of "true" when used on <embed> tag
  39034. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  39035. ? 'true'
  39036. : key;
  39037. el.setAttribute(key, value);
  39038. }
  39039. } else if (isEnumeratedAttr(key)) {
  39040. el.setAttribute(key, convertEnumeratedValue(key, value));
  39041. } else if (isXlink(key)) {
  39042. if (isFalsyAttrValue(value)) {
  39043. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  39044. } else {
  39045. el.setAttributeNS(xlinkNS, key, value);
  39046. }
  39047. } else {
  39048. baseSetAttr(el, key, value);
  39049. }
  39050. }
  39051. function baseSetAttr (el, key, value) {
  39052. if (isFalsyAttrValue(value)) {
  39053. el.removeAttribute(key);
  39054. } else {
  39055. // #7138: IE10 & 11 fires input event when setting placeholder on
  39056. // <textarea>... block the first input event and remove the blocker
  39057. // immediately.
  39058. /* istanbul ignore if */
  39059. if (
  39060. isIE && !isIE9 &&
  39061. el.tagName === 'TEXTAREA' &&
  39062. key === 'placeholder' && value !== '' && !el.__ieph
  39063. ) {
  39064. var blocker = function (e) {
  39065. e.stopImmediatePropagation();
  39066. el.removeEventListener('input', blocker);
  39067. };
  39068. el.addEventListener('input', blocker);
  39069. // $flow-disable-line
  39070. el.__ieph = true; /* IE placeholder patched */
  39071. }
  39072. el.setAttribute(key, value);
  39073. }
  39074. }
  39075. var attrs = {
  39076. create: updateAttrs,
  39077. update: updateAttrs
  39078. };
  39079. /* */
  39080. function updateClass (oldVnode, vnode) {
  39081. var el = vnode.elm;
  39082. var data = vnode.data;
  39083. var oldData = oldVnode.data;
  39084. if (
  39085. isUndef(data.staticClass) &&
  39086. isUndef(data.class) && (
  39087. isUndef(oldData) || (
  39088. isUndef(oldData.staticClass) &&
  39089. isUndef(oldData.class)
  39090. )
  39091. )
  39092. ) {
  39093. return
  39094. }
  39095. var cls = genClassForVnode(vnode);
  39096. // handle transition classes
  39097. var transitionClass = el._transitionClasses;
  39098. if (isDef(transitionClass)) {
  39099. cls = concat(cls, stringifyClass(transitionClass));
  39100. }
  39101. // set the class
  39102. if (cls !== el._prevClass) {
  39103. el.setAttribute('class', cls);
  39104. el._prevClass = cls;
  39105. }
  39106. }
  39107. var klass = {
  39108. create: updateClass,
  39109. update: updateClass
  39110. };
  39111. /* */
  39112. var validDivisionCharRE = /[\w).+\-_$\]]/;
  39113. function parseFilters (exp) {
  39114. var inSingle = false;
  39115. var inDouble = false;
  39116. var inTemplateString = false;
  39117. var inRegex = false;
  39118. var curly = 0;
  39119. var square = 0;
  39120. var paren = 0;
  39121. var lastFilterIndex = 0;
  39122. var c, prev, i, expression, filters;
  39123. for (i = 0; i < exp.length; i++) {
  39124. prev = c;
  39125. c = exp.charCodeAt(i);
  39126. if (inSingle) {
  39127. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  39128. } else if (inDouble) {
  39129. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  39130. } else if (inTemplateString) {
  39131. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  39132. } else if (inRegex) {
  39133. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  39134. } else if (
  39135. c === 0x7C && // pipe
  39136. exp.charCodeAt(i + 1) !== 0x7C &&
  39137. exp.charCodeAt(i - 1) !== 0x7C &&
  39138. !curly && !square && !paren
  39139. ) {
  39140. if (expression === undefined) {
  39141. // first filter, end of expression
  39142. lastFilterIndex = i + 1;
  39143. expression = exp.slice(0, i).trim();
  39144. } else {
  39145. pushFilter();
  39146. }
  39147. } else {
  39148. switch (c) {
  39149. case 0x22: inDouble = true; break // "
  39150. case 0x27: inSingle = true; break // '
  39151. case 0x60: inTemplateString = true; break // `
  39152. case 0x28: paren++; break // (
  39153. case 0x29: paren--; break // )
  39154. case 0x5B: square++; break // [
  39155. case 0x5D: square--; break // ]
  39156. case 0x7B: curly++; break // {
  39157. case 0x7D: curly--; break // }
  39158. }
  39159. if (c === 0x2f) { // /
  39160. var j = i - 1;
  39161. var p = (void 0);
  39162. // find first non-whitespace prev char
  39163. for (; j >= 0; j--) {
  39164. p = exp.charAt(j);
  39165. if (p !== ' ') { break }
  39166. }
  39167. if (!p || !validDivisionCharRE.test(p)) {
  39168. inRegex = true;
  39169. }
  39170. }
  39171. }
  39172. }
  39173. if (expression === undefined) {
  39174. expression = exp.slice(0, i).trim();
  39175. } else if (lastFilterIndex !== 0) {
  39176. pushFilter();
  39177. }
  39178. function pushFilter () {
  39179. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  39180. lastFilterIndex = i + 1;
  39181. }
  39182. if (filters) {
  39183. for (i = 0; i < filters.length; i++) {
  39184. expression = wrapFilter(expression, filters[i]);
  39185. }
  39186. }
  39187. return expression
  39188. }
  39189. function wrapFilter (exp, filter) {
  39190. var i = filter.indexOf('(');
  39191. if (i < 0) {
  39192. // _f: resolveFilter
  39193. return ("_f(\"" + filter + "\")(" + exp + ")")
  39194. } else {
  39195. var name = filter.slice(0, i);
  39196. var args = filter.slice(i + 1);
  39197. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  39198. }
  39199. }
  39200. /* */
  39201. /* eslint-disable no-unused-vars */
  39202. function baseWarn (msg, range) {
  39203. console.error(("[Vue compiler]: " + msg));
  39204. }
  39205. /* eslint-enable no-unused-vars */
  39206. function pluckModuleFunction (
  39207. modules,
  39208. key
  39209. ) {
  39210. return modules
  39211. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  39212. : []
  39213. }
  39214. function addProp (el, name, value, range, dynamic) {
  39215. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39216. el.plain = false;
  39217. }
  39218. function addAttr (el, name, value, range, dynamic) {
  39219. var attrs = dynamic
  39220. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  39221. : (el.attrs || (el.attrs = []));
  39222. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39223. el.plain = false;
  39224. }
  39225. // add a raw attr (use this in preTransforms)
  39226. function addRawAttr (el, name, value, range) {
  39227. el.attrsMap[name] = value;
  39228. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  39229. }
  39230. function addDirective (
  39231. el,
  39232. name,
  39233. rawName,
  39234. value,
  39235. arg,
  39236. isDynamicArg,
  39237. modifiers,
  39238. range
  39239. ) {
  39240. (el.directives || (el.directives = [])).push(rangeSetItem({
  39241. name: name,
  39242. rawName: rawName,
  39243. value: value,
  39244. arg: arg,
  39245. isDynamicArg: isDynamicArg,
  39246. modifiers: modifiers
  39247. }, range));
  39248. el.plain = false;
  39249. }
  39250. function prependModifierMarker (symbol, name, dynamic) {
  39251. return dynamic
  39252. ? ("_p(" + name + ",\"" + symbol + "\")")
  39253. : symbol + name // mark the event as captured
  39254. }
  39255. function addHandler (
  39256. el,
  39257. name,
  39258. value,
  39259. modifiers,
  39260. important,
  39261. warn,
  39262. range,
  39263. dynamic
  39264. ) {
  39265. modifiers = modifiers || emptyObject;
  39266. // warn prevent and passive modifier
  39267. /* istanbul ignore if */
  39268. if (
  39269. warn &&
  39270. modifiers.prevent && modifiers.passive
  39271. ) {
  39272. warn(
  39273. 'passive and prevent can\'t be used together. ' +
  39274. 'Passive handler can\'t prevent default event.',
  39275. range
  39276. );
  39277. }
  39278. // normalize click.right and click.middle since they don't actually fire
  39279. // this is technically browser-specific, but at least for now browsers are
  39280. // the only target envs that have right/middle clicks.
  39281. if (modifiers.right) {
  39282. if (dynamic) {
  39283. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  39284. } else if (name === 'click') {
  39285. name = 'contextmenu';
  39286. delete modifiers.right;
  39287. }
  39288. } else if (modifiers.middle) {
  39289. if (dynamic) {
  39290. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  39291. } else if (name === 'click') {
  39292. name = 'mouseup';
  39293. }
  39294. }
  39295. // check capture modifier
  39296. if (modifiers.capture) {
  39297. delete modifiers.capture;
  39298. name = prependModifierMarker('!', name, dynamic);
  39299. }
  39300. if (modifiers.once) {
  39301. delete modifiers.once;
  39302. name = prependModifierMarker('~', name, dynamic);
  39303. }
  39304. /* istanbul ignore if */
  39305. if (modifiers.passive) {
  39306. delete modifiers.passive;
  39307. name = prependModifierMarker('&', name, dynamic);
  39308. }
  39309. var events;
  39310. if (modifiers.native) {
  39311. delete modifiers.native;
  39312. events = el.nativeEvents || (el.nativeEvents = {});
  39313. } else {
  39314. events = el.events || (el.events = {});
  39315. }
  39316. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  39317. if (modifiers !== emptyObject) {
  39318. newHandler.modifiers = modifiers;
  39319. }
  39320. var handlers = events[name];
  39321. /* istanbul ignore if */
  39322. if (Array.isArray(handlers)) {
  39323. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  39324. } else if (handlers) {
  39325. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  39326. } else {
  39327. events[name] = newHandler;
  39328. }
  39329. el.plain = false;
  39330. }
  39331. function getRawBindingAttr (
  39332. el,
  39333. name
  39334. ) {
  39335. return el.rawAttrsMap[':' + name] ||
  39336. el.rawAttrsMap['v-bind:' + name] ||
  39337. el.rawAttrsMap[name]
  39338. }
  39339. function getBindingAttr (
  39340. el,
  39341. name,
  39342. getStatic
  39343. ) {
  39344. var dynamicValue =
  39345. getAndRemoveAttr(el, ':' + name) ||
  39346. getAndRemoveAttr(el, 'v-bind:' + name);
  39347. if (dynamicValue != null) {
  39348. return parseFilters(dynamicValue)
  39349. } else if (getStatic !== false) {
  39350. var staticValue = getAndRemoveAttr(el, name);
  39351. if (staticValue != null) {
  39352. return JSON.stringify(staticValue)
  39353. }
  39354. }
  39355. }
  39356. // note: this only removes the attr from the Array (attrsList) so that it
  39357. // doesn't get processed by processAttrs.
  39358. // By default it does NOT remove it from the map (attrsMap) because the map is
  39359. // needed during codegen.
  39360. function getAndRemoveAttr (
  39361. el,
  39362. name,
  39363. removeFromMap
  39364. ) {
  39365. var val;
  39366. if ((val = el.attrsMap[name]) != null) {
  39367. var list = el.attrsList;
  39368. for (var i = 0, l = list.length; i < l; i++) {
  39369. if (list[i].name === name) {
  39370. list.splice(i, 1);
  39371. break
  39372. }
  39373. }
  39374. }
  39375. if (removeFromMap) {
  39376. delete el.attrsMap[name];
  39377. }
  39378. return val
  39379. }
  39380. function getAndRemoveAttrByRegex (
  39381. el,
  39382. name
  39383. ) {
  39384. var list = el.attrsList;
  39385. for (var i = 0, l = list.length; i < l; i++) {
  39386. var attr = list[i];
  39387. if (name.test(attr.name)) {
  39388. list.splice(i, 1);
  39389. return attr
  39390. }
  39391. }
  39392. }
  39393. function rangeSetItem (
  39394. item,
  39395. range
  39396. ) {
  39397. if (range) {
  39398. if (range.start != null) {
  39399. item.start = range.start;
  39400. }
  39401. if (range.end != null) {
  39402. item.end = range.end;
  39403. }
  39404. }
  39405. return item
  39406. }
  39407. /* */
  39408. /**
  39409. * Cross-platform code generation for component v-model
  39410. */
  39411. function genComponentModel (
  39412. el,
  39413. value,
  39414. modifiers
  39415. ) {
  39416. var ref = modifiers || {};
  39417. var number = ref.number;
  39418. var trim = ref.trim;
  39419. var baseValueExpression = '$$v';
  39420. var valueExpression = baseValueExpression;
  39421. if (trim) {
  39422. valueExpression =
  39423. "(typeof " + baseValueExpression + " === 'string'" +
  39424. "? " + baseValueExpression + ".trim()" +
  39425. ": " + baseValueExpression + ")";
  39426. }
  39427. if (number) {
  39428. valueExpression = "_n(" + valueExpression + ")";
  39429. }
  39430. var assignment = genAssignmentCode(value, valueExpression);
  39431. el.model = {
  39432. value: ("(" + value + ")"),
  39433. expression: JSON.stringify(value),
  39434. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  39435. };
  39436. }
  39437. /**
  39438. * Cross-platform codegen helper for generating v-model value assignment code.
  39439. */
  39440. function genAssignmentCode (
  39441. value,
  39442. assignment
  39443. ) {
  39444. var res = parseModel(value);
  39445. if (res.key === null) {
  39446. return (value + "=" + assignment)
  39447. } else {
  39448. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  39449. }
  39450. }
  39451. /**
  39452. * Parse a v-model expression into a base path and a final key segment.
  39453. * Handles both dot-path and possible square brackets.
  39454. *
  39455. * Possible cases:
  39456. *
  39457. * - test
  39458. * - test[key]
  39459. * - test[test1[key]]
  39460. * - test["a"][key]
  39461. * - xxx.test[a[a].test1[key]]
  39462. * - test.xxx.a["asa"][test1[key]]
  39463. *
  39464. */
  39465. var len, str, chr, index$1, expressionPos, expressionEndPos;
  39466. function parseModel (val) {
  39467. // Fix https://github.com/vuejs/vue/pull/7730
  39468. // allow v-model="obj.val " (trailing whitespace)
  39469. val = val.trim();
  39470. len = val.length;
  39471. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  39472. index$1 = val.lastIndexOf('.');
  39473. if (index$1 > -1) {
  39474. return {
  39475. exp: val.slice(0, index$1),
  39476. key: '"' + val.slice(index$1 + 1) + '"'
  39477. }
  39478. } else {
  39479. return {
  39480. exp: val,
  39481. key: null
  39482. }
  39483. }
  39484. }
  39485. str = val;
  39486. index$1 = expressionPos = expressionEndPos = 0;
  39487. while (!eof()) {
  39488. chr = next();
  39489. /* istanbul ignore if */
  39490. if (isStringStart(chr)) {
  39491. parseString(chr);
  39492. } else if (chr === 0x5B) {
  39493. parseBracket(chr);
  39494. }
  39495. }
  39496. return {
  39497. exp: val.slice(0, expressionPos),
  39498. key: val.slice(expressionPos + 1, expressionEndPos)
  39499. }
  39500. }
  39501. function next () {
  39502. return str.charCodeAt(++index$1)
  39503. }
  39504. function eof () {
  39505. return index$1 >= len
  39506. }
  39507. function isStringStart (chr) {
  39508. return chr === 0x22 || chr === 0x27
  39509. }
  39510. function parseBracket (chr) {
  39511. var inBracket = 1;
  39512. expressionPos = index$1;
  39513. while (!eof()) {
  39514. chr = next();
  39515. if (isStringStart(chr)) {
  39516. parseString(chr);
  39517. continue
  39518. }
  39519. if (chr === 0x5B) { inBracket++; }
  39520. if (chr === 0x5D) { inBracket--; }
  39521. if (inBracket === 0) {
  39522. expressionEndPos = index$1;
  39523. break
  39524. }
  39525. }
  39526. }
  39527. function parseString (chr) {
  39528. var stringQuote = chr;
  39529. while (!eof()) {
  39530. chr = next();
  39531. if (chr === stringQuote) {
  39532. break
  39533. }
  39534. }
  39535. }
  39536. /* */
  39537. var warn$1;
  39538. // in some cases, the event used has to be determined at runtime
  39539. // so we used some reserved tokens during compile.
  39540. var RANGE_TOKEN = '__r';
  39541. var CHECKBOX_RADIO_TOKEN = '__c';
  39542. function model (
  39543. el,
  39544. dir,
  39545. _warn
  39546. ) {
  39547. warn$1 = _warn;
  39548. var value = dir.value;
  39549. var modifiers = dir.modifiers;
  39550. var tag = el.tag;
  39551. var type = el.attrsMap.type;
  39552. {
  39553. // inputs with type="file" are read only and setting the input's
  39554. // value will throw an error.
  39555. if (tag === 'input' && type === 'file') {
  39556. warn$1(
  39557. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  39558. "File inputs are read only. Use a v-on:change listener instead.",
  39559. el.rawAttrsMap['v-model']
  39560. );
  39561. }
  39562. }
  39563. if (el.component) {
  39564. genComponentModel(el, value, modifiers);
  39565. // component v-model doesn't need extra runtime
  39566. return false
  39567. } else if (tag === 'select') {
  39568. genSelect(el, value, modifiers);
  39569. } else if (tag === 'input' && type === 'checkbox') {
  39570. genCheckboxModel(el, value, modifiers);
  39571. } else if (tag === 'input' && type === 'radio') {
  39572. genRadioModel(el, value, modifiers);
  39573. } else if (tag === 'input' || tag === 'textarea') {
  39574. genDefaultModel(el, value, modifiers);
  39575. } else if (!config.isReservedTag(tag)) {
  39576. genComponentModel(el, value, modifiers);
  39577. // component v-model doesn't need extra runtime
  39578. return false
  39579. } else {
  39580. warn$1(
  39581. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  39582. "v-model is not supported on this element type. " +
  39583. 'If you are working with contenteditable, it\'s recommended to ' +
  39584. 'wrap a library dedicated for that purpose inside a custom component.',
  39585. el.rawAttrsMap['v-model']
  39586. );
  39587. }
  39588. // ensure runtime directive metadata
  39589. return true
  39590. }
  39591. function genCheckboxModel (
  39592. el,
  39593. value,
  39594. modifiers
  39595. ) {
  39596. var number = modifiers && modifiers.number;
  39597. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39598. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  39599. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  39600. addProp(el, 'checked',
  39601. "Array.isArray(" + value + ")" +
  39602. "?_i(" + value + "," + valueBinding + ")>-1" + (
  39603. trueValueBinding === 'true'
  39604. ? (":(" + value + ")")
  39605. : (":_q(" + value + "," + trueValueBinding + ")")
  39606. )
  39607. );
  39608. addHandler(el, 'change',
  39609. "var $$a=" + value + "," +
  39610. '$$el=$event.target,' +
  39611. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  39612. 'if(Array.isArray($$a)){' +
  39613. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  39614. '$$i=_i($$a,$$v);' +
  39615. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  39616. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  39617. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  39618. null, true
  39619. );
  39620. }
  39621. function genRadioModel (
  39622. el,
  39623. value,
  39624. modifiers
  39625. ) {
  39626. var number = modifiers && modifiers.number;
  39627. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39628. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  39629. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  39630. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  39631. }
  39632. function genSelect (
  39633. el,
  39634. value,
  39635. modifiers
  39636. ) {
  39637. var number = modifiers && modifiers.number;
  39638. var selectedVal = "Array.prototype.filter" +
  39639. ".call($event.target.options,function(o){return o.selected})" +
  39640. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  39641. "return " + (number ? '_n(val)' : 'val') + "})";
  39642. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  39643. var code = "var $$selectedVal = " + selectedVal + ";";
  39644. code = code + " " + (genAssignmentCode(value, assignment));
  39645. addHandler(el, 'change', code, null, true);
  39646. }
  39647. function genDefaultModel (
  39648. el,
  39649. value,
  39650. modifiers
  39651. ) {
  39652. var type = el.attrsMap.type;
  39653. // warn if v-bind:value conflicts with v-model
  39654. // except for inputs with v-bind:type
  39655. {
  39656. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  39657. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  39658. if (value$1 && !typeBinding) {
  39659. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  39660. warn$1(
  39661. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  39662. 'because the latter already expands to a value binding internally',
  39663. el.rawAttrsMap[binding]
  39664. );
  39665. }
  39666. }
  39667. var ref = modifiers || {};
  39668. var lazy = ref.lazy;
  39669. var number = ref.number;
  39670. var trim = ref.trim;
  39671. var needCompositionGuard = !lazy && type !== 'range';
  39672. var event = lazy
  39673. ? 'change'
  39674. : type === 'range'
  39675. ? RANGE_TOKEN
  39676. : 'input';
  39677. var valueExpression = '$event.target.value';
  39678. if (trim) {
  39679. valueExpression = "$event.target.value.trim()";
  39680. }
  39681. if (number) {
  39682. valueExpression = "_n(" + valueExpression + ")";
  39683. }
  39684. var code = genAssignmentCode(value, valueExpression);
  39685. if (needCompositionGuard) {
  39686. code = "if($event.target.composing)return;" + code;
  39687. }
  39688. addProp(el, 'value', ("(" + value + ")"));
  39689. addHandler(el, event, code, null, true);
  39690. if (trim || number) {
  39691. addHandler(el, 'blur', '$forceUpdate()');
  39692. }
  39693. }
  39694. /* */
  39695. // normalize v-model event tokens that can only be determined at runtime.
  39696. // it's important to place the event as the first in the array because
  39697. // the whole point is ensuring the v-model callback gets called before
  39698. // user-attached handlers.
  39699. function normalizeEvents (on) {
  39700. /* istanbul ignore if */
  39701. if (isDef(on[RANGE_TOKEN])) {
  39702. // IE input[type=range] only supports `change` event
  39703. var event = isIE ? 'change' : 'input';
  39704. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  39705. delete on[RANGE_TOKEN];
  39706. }
  39707. // This was originally intended to fix #4521 but no longer necessary
  39708. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  39709. /* istanbul ignore if */
  39710. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  39711. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  39712. delete on[CHECKBOX_RADIO_TOKEN];
  39713. }
  39714. }
  39715. var target$1;
  39716. function createOnceHandler$1 (event, handler, capture) {
  39717. var _target = target$1; // save current target element in closure
  39718. return function onceHandler () {
  39719. var res = handler.apply(null, arguments);
  39720. if (res !== null) {
  39721. remove$2(event, onceHandler, capture, _target);
  39722. }
  39723. }
  39724. }
  39725. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  39726. // implementation and does not fire microtasks in between event propagation, so
  39727. // safe to exclude.
  39728. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  39729. function add$1 (
  39730. name,
  39731. handler,
  39732. capture,
  39733. passive
  39734. ) {
  39735. // async edge case #6566: inner click event triggers patch, event handler
  39736. // attached to outer element during patch, and triggered again. This
  39737. // happens because browsers fire microtask ticks between event propagation.
  39738. // the solution is simple: we save the timestamp when a handler is attached,
  39739. // and the handler would only fire if the event passed to it was fired
  39740. // AFTER it was attached.
  39741. if (useMicrotaskFix) {
  39742. var attachedTimestamp = currentFlushTimestamp;
  39743. var original = handler;
  39744. handler = original._wrapper = function (e) {
  39745. if (
  39746. // no bubbling, should always fire.
  39747. // this is just a safety net in case event.timeStamp is unreliable in
  39748. // certain weird environments...
  39749. e.target === e.currentTarget ||
  39750. // event is fired after handler attachment
  39751. e.timeStamp >= attachedTimestamp ||
  39752. // bail for environments that have buggy event.timeStamp implementations
  39753. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  39754. // #9681 QtWebEngine event.timeStamp is negative value
  39755. e.timeStamp <= 0 ||
  39756. // #9448 bail if event is fired in another document in a multi-page
  39757. // electron/nw.js app, since event.timeStamp will be using a different
  39758. // starting reference
  39759. e.target.ownerDocument !== document
  39760. ) {
  39761. return original.apply(this, arguments)
  39762. }
  39763. };
  39764. }
  39765. target$1.addEventListener(
  39766. name,
  39767. handler,
  39768. supportsPassive
  39769. ? { capture: capture, passive: passive }
  39770. : capture
  39771. );
  39772. }
  39773. function remove$2 (
  39774. name,
  39775. handler,
  39776. capture,
  39777. _target
  39778. ) {
  39779. (_target || target$1).removeEventListener(
  39780. name,
  39781. handler._wrapper || handler,
  39782. capture
  39783. );
  39784. }
  39785. function updateDOMListeners (oldVnode, vnode) {
  39786. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  39787. return
  39788. }
  39789. var on = vnode.data.on || {};
  39790. var oldOn = oldVnode.data.on || {};
  39791. target$1 = vnode.elm;
  39792. normalizeEvents(on);
  39793. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  39794. target$1 = undefined;
  39795. }
  39796. var events = {
  39797. create: updateDOMListeners,
  39798. update: updateDOMListeners
  39799. };
  39800. /* */
  39801. var svgContainer;
  39802. function updateDOMProps (oldVnode, vnode) {
  39803. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  39804. return
  39805. }
  39806. var key, cur;
  39807. var elm = vnode.elm;
  39808. var oldProps = oldVnode.data.domProps || {};
  39809. var props = vnode.data.domProps || {};
  39810. // clone observed objects, as the user probably wants to mutate it
  39811. if (isDef(props.__ob__)) {
  39812. props = vnode.data.domProps = extend({}, props);
  39813. }
  39814. for (key in oldProps) {
  39815. if (!(key in props)) {
  39816. elm[key] = '';
  39817. }
  39818. }
  39819. for (key in props) {
  39820. cur = props[key];
  39821. // ignore children if the node has textContent or innerHTML,
  39822. // as these will throw away existing DOM nodes and cause removal errors
  39823. // on subsequent patches (#3360)
  39824. if (key === 'textContent' || key === 'innerHTML') {
  39825. if (vnode.children) { vnode.children.length = 0; }
  39826. if (cur === oldProps[key]) { continue }
  39827. // #6601 work around Chrome version <= 55 bug where single textNode
  39828. // replaced by innerHTML/textContent retains its parentNode property
  39829. if (elm.childNodes.length === 1) {
  39830. elm.removeChild(elm.childNodes[0]);
  39831. }
  39832. }
  39833. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  39834. // store value as _value as well since
  39835. // non-string values will be stringified
  39836. elm._value = cur;
  39837. // avoid resetting cursor position when value is the same
  39838. var strCur = isUndef(cur) ? '' : String(cur);
  39839. if (shouldUpdateValue(elm, strCur)) {
  39840. elm.value = strCur;
  39841. }
  39842. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  39843. // IE doesn't support innerHTML for SVG elements
  39844. svgContainer = svgContainer || document.createElement('div');
  39845. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  39846. var svg = svgContainer.firstChild;
  39847. while (elm.firstChild) {
  39848. elm.removeChild(elm.firstChild);
  39849. }
  39850. while (svg.firstChild) {
  39851. elm.appendChild(svg.firstChild);
  39852. }
  39853. } else if (
  39854. // skip the update if old and new VDOM state is the same.
  39855. // `value` is handled separately because the DOM value may be temporarily
  39856. // out of sync with VDOM state due to focus, composition and modifiers.
  39857. // This #4521 by skipping the unnecessary `checked` update.
  39858. cur !== oldProps[key]
  39859. ) {
  39860. // some property updates can throw
  39861. // e.g. `value` on <progress> w/ non-finite value
  39862. try {
  39863. elm[key] = cur;
  39864. } catch (e) {}
  39865. }
  39866. }
  39867. }
  39868. // check platforms/web/util/attrs.js acceptValue
  39869. function shouldUpdateValue (elm, checkVal) {
  39870. return (!elm.composing && (
  39871. elm.tagName === 'OPTION' ||
  39872. isNotInFocusAndDirty(elm, checkVal) ||
  39873. isDirtyWithModifiers(elm, checkVal)
  39874. ))
  39875. }
  39876. function isNotInFocusAndDirty (elm, checkVal) {
  39877. // return true when textbox (.number and .trim) loses focus and its value is
  39878. // not equal to the updated value
  39879. var notInFocus = true;
  39880. // #6157
  39881. // work around IE bug when accessing document.activeElement in an iframe
  39882. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  39883. return notInFocus && elm.value !== checkVal
  39884. }
  39885. function isDirtyWithModifiers (elm, newVal) {
  39886. var value = elm.value;
  39887. var modifiers = elm._vModifiers; // injected by v-model runtime
  39888. if (isDef(modifiers)) {
  39889. if (modifiers.number) {
  39890. return toNumber(value) !== toNumber(newVal)
  39891. }
  39892. if (modifiers.trim) {
  39893. return value.trim() !== newVal.trim()
  39894. }
  39895. }
  39896. return value !== newVal
  39897. }
  39898. var domProps = {
  39899. create: updateDOMProps,
  39900. update: updateDOMProps
  39901. };
  39902. /* */
  39903. var parseStyleText = cached(function (cssText) {
  39904. var res = {};
  39905. var listDelimiter = /;(?![^(]*\))/g;
  39906. var propertyDelimiter = /:(.+)/;
  39907. cssText.split(listDelimiter).forEach(function (item) {
  39908. if (item) {
  39909. var tmp = item.split(propertyDelimiter);
  39910. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  39911. }
  39912. });
  39913. return res
  39914. });
  39915. // merge static and dynamic style data on the same vnode
  39916. function normalizeStyleData (data) {
  39917. var style = normalizeStyleBinding(data.style);
  39918. // static style is pre-processed into an object during compilation
  39919. // and is always a fresh object, so it's safe to merge into it
  39920. return data.staticStyle
  39921. ? extend(data.staticStyle, style)
  39922. : style
  39923. }
  39924. // normalize possible array / string values into Object
  39925. function normalizeStyleBinding (bindingStyle) {
  39926. if (Array.isArray(bindingStyle)) {
  39927. return toObject(bindingStyle)
  39928. }
  39929. if (typeof bindingStyle === 'string') {
  39930. return parseStyleText(bindingStyle)
  39931. }
  39932. return bindingStyle
  39933. }
  39934. /**
  39935. * parent component style should be after child's
  39936. * so that parent component's style could override it
  39937. */
  39938. function getStyle (vnode, checkChild) {
  39939. var res = {};
  39940. var styleData;
  39941. if (checkChild) {
  39942. var childNode = vnode;
  39943. while (childNode.componentInstance) {
  39944. childNode = childNode.componentInstance._vnode;
  39945. if (
  39946. childNode && childNode.data &&
  39947. (styleData = normalizeStyleData(childNode.data))
  39948. ) {
  39949. extend(res, styleData);
  39950. }
  39951. }
  39952. }
  39953. if ((styleData = normalizeStyleData(vnode.data))) {
  39954. extend(res, styleData);
  39955. }
  39956. var parentNode = vnode;
  39957. while ((parentNode = parentNode.parent)) {
  39958. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  39959. extend(res, styleData);
  39960. }
  39961. }
  39962. return res
  39963. }
  39964. /* */
  39965. var cssVarRE = /^--/;
  39966. var importantRE = /\s*!important$/;
  39967. var setProp = function (el, name, val) {
  39968. /* istanbul ignore if */
  39969. if (cssVarRE.test(name)) {
  39970. el.style.setProperty(name, val);
  39971. } else if (importantRE.test(val)) {
  39972. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  39973. } else {
  39974. var normalizedName = normalize(name);
  39975. if (Array.isArray(val)) {
  39976. // Support values array created by autoprefixer, e.g.
  39977. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  39978. // Set them one by one, and the browser will only set those it can recognize
  39979. for (var i = 0, len = val.length; i < len; i++) {
  39980. el.style[normalizedName] = val[i];
  39981. }
  39982. } else {
  39983. el.style[normalizedName] = val;
  39984. }
  39985. }
  39986. };
  39987. var vendorNames = ['Webkit', 'Moz', 'ms'];
  39988. var emptyStyle;
  39989. var normalize = cached(function (prop) {
  39990. emptyStyle = emptyStyle || document.createElement('div').style;
  39991. prop = camelize(prop);
  39992. if (prop !== 'filter' && (prop in emptyStyle)) {
  39993. return prop
  39994. }
  39995. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  39996. for (var i = 0; i < vendorNames.length; i++) {
  39997. var name = vendorNames[i] + capName;
  39998. if (name in emptyStyle) {
  39999. return name
  40000. }
  40001. }
  40002. });
  40003. function updateStyle (oldVnode, vnode) {
  40004. var data = vnode.data;
  40005. var oldData = oldVnode.data;
  40006. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  40007. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  40008. ) {
  40009. return
  40010. }
  40011. var cur, name;
  40012. var el = vnode.elm;
  40013. var oldStaticStyle = oldData.staticStyle;
  40014. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  40015. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  40016. var oldStyle = oldStaticStyle || oldStyleBinding;
  40017. var style = normalizeStyleBinding(vnode.data.style) || {};
  40018. // store normalized style under a different key for next diff
  40019. // make sure to clone it if it's reactive, since the user likely wants
  40020. // to mutate it.
  40021. vnode.data.normalizedStyle = isDef(style.__ob__)
  40022. ? extend({}, style)
  40023. : style;
  40024. var newStyle = getStyle(vnode, true);
  40025. for (name in oldStyle) {
  40026. if (isUndef(newStyle[name])) {
  40027. setProp(el, name, '');
  40028. }
  40029. }
  40030. for (name in newStyle) {
  40031. cur = newStyle[name];
  40032. if (cur !== oldStyle[name]) {
  40033. // ie9 setting to null has no effect, must use empty string
  40034. setProp(el, name, cur == null ? '' : cur);
  40035. }
  40036. }
  40037. }
  40038. var style = {
  40039. create: updateStyle,
  40040. update: updateStyle
  40041. };
  40042. /* */
  40043. var whitespaceRE = /\s+/;
  40044. /**
  40045. * Add class with compatibility for SVG since classList is not supported on
  40046. * SVG elements in IE
  40047. */
  40048. function addClass (el, cls) {
  40049. /* istanbul ignore if */
  40050. if (!cls || !(cls = cls.trim())) {
  40051. return
  40052. }
  40053. /* istanbul ignore else */
  40054. if (el.classList) {
  40055. if (cls.indexOf(' ') > -1) {
  40056. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  40057. } else {
  40058. el.classList.add(cls);
  40059. }
  40060. } else {
  40061. var cur = " " + (el.getAttribute('class') || '') + " ";
  40062. if (cur.indexOf(' ' + cls + ' ') < 0) {
  40063. el.setAttribute('class', (cur + cls).trim());
  40064. }
  40065. }
  40066. }
  40067. /**
  40068. * Remove class with compatibility for SVG since classList is not supported on
  40069. * SVG elements in IE
  40070. */
  40071. function removeClass (el, cls) {
  40072. /* istanbul ignore if */
  40073. if (!cls || !(cls = cls.trim())) {
  40074. return
  40075. }
  40076. /* istanbul ignore else */
  40077. if (el.classList) {
  40078. if (cls.indexOf(' ') > -1) {
  40079. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  40080. } else {
  40081. el.classList.remove(cls);
  40082. }
  40083. if (!el.classList.length) {
  40084. el.removeAttribute('class');
  40085. }
  40086. } else {
  40087. var cur = " " + (el.getAttribute('class') || '') + " ";
  40088. var tar = ' ' + cls + ' ';
  40089. while (cur.indexOf(tar) >= 0) {
  40090. cur = cur.replace(tar, ' ');
  40091. }
  40092. cur = cur.trim();
  40093. if (cur) {
  40094. el.setAttribute('class', cur);
  40095. } else {
  40096. el.removeAttribute('class');
  40097. }
  40098. }
  40099. }
  40100. /* */
  40101. function resolveTransition (def$$1) {
  40102. if (!def$$1) {
  40103. return
  40104. }
  40105. /* istanbul ignore else */
  40106. if (typeof def$$1 === 'object') {
  40107. var res = {};
  40108. if (def$$1.css !== false) {
  40109. extend(res, autoCssTransition(def$$1.name || 'v'));
  40110. }
  40111. extend(res, def$$1);
  40112. return res
  40113. } else if (typeof def$$1 === 'string') {
  40114. return autoCssTransition(def$$1)
  40115. }
  40116. }
  40117. var autoCssTransition = cached(function (name) {
  40118. return {
  40119. enterClass: (name + "-enter"),
  40120. enterToClass: (name + "-enter-to"),
  40121. enterActiveClass: (name + "-enter-active"),
  40122. leaveClass: (name + "-leave"),
  40123. leaveToClass: (name + "-leave-to"),
  40124. leaveActiveClass: (name + "-leave-active")
  40125. }
  40126. });
  40127. var hasTransition = inBrowser && !isIE9;
  40128. var TRANSITION = 'transition';
  40129. var ANIMATION = 'animation';
  40130. // Transition property/event sniffing
  40131. var transitionProp = 'transition';
  40132. var transitionEndEvent = 'transitionend';
  40133. var animationProp = 'animation';
  40134. var animationEndEvent = 'animationend';
  40135. if (hasTransition) {
  40136. /* istanbul ignore if */
  40137. if (window.ontransitionend === undefined &&
  40138. window.onwebkittransitionend !== undefined
  40139. ) {
  40140. transitionProp = 'WebkitTransition';
  40141. transitionEndEvent = 'webkitTransitionEnd';
  40142. }
  40143. if (window.onanimationend === undefined &&
  40144. window.onwebkitanimationend !== undefined
  40145. ) {
  40146. animationProp = 'WebkitAnimation';
  40147. animationEndEvent = 'webkitAnimationEnd';
  40148. }
  40149. }
  40150. // binding to window is necessary to make hot reload work in IE in strict mode
  40151. var raf = inBrowser
  40152. ? window.requestAnimationFrame
  40153. ? window.requestAnimationFrame.bind(window)
  40154. : setTimeout
  40155. : /* istanbul ignore next */ function (fn) { return fn(); };
  40156. function nextFrame (fn) {
  40157. raf(function () {
  40158. raf(fn);
  40159. });
  40160. }
  40161. function addTransitionClass (el, cls) {
  40162. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  40163. if (transitionClasses.indexOf(cls) < 0) {
  40164. transitionClasses.push(cls);
  40165. addClass(el, cls);
  40166. }
  40167. }
  40168. function removeTransitionClass (el, cls) {
  40169. if (el._transitionClasses) {
  40170. remove(el._transitionClasses, cls);
  40171. }
  40172. removeClass(el, cls);
  40173. }
  40174. function whenTransitionEnds (
  40175. el,
  40176. expectedType,
  40177. cb
  40178. ) {
  40179. var ref = getTransitionInfo(el, expectedType);
  40180. var type = ref.type;
  40181. var timeout = ref.timeout;
  40182. var propCount = ref.propCount;
  40183. if (!type) { return cb() }
  40184. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  40185. var ended = 0;
  40186. var end = function () {
  40187. el.removeEventListener(event, onEnd);
  40188. cb();
  40189. };
  40190. var onEnd = function (e) {
  40191. if (e.target === el) {
  40192. if (++ended >= propCount) {
  40193. end();
  40194. }
  40195. }
  40196. };
  40197. setTimeout(function () {
  40198. if (ended < propCount) {
  40199. end();
  40200. }
  40201. }, timeout + 1);
  40202. el.addEventListener(event, onEnd);
  40203. }
  40204. var transformRE = /\b(transform|all)(,|$)/;
  40205. function getTransitionInfo (el, expectedType) {
  40206. var styles = window.getComputedStyle(el);
  40207. // JSDOM may return undefined for transition properties
  40208. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  40209. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  40210. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  40211. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  40212. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  40213. var animationTimeout = getTimeout(animationDelays, animationDurations);
  40214. var type;
  40215. var timeout = 0;
  40216. var propCount = 0;
  40217. /* istanbul ignore if */
  40218. if (expectedType === TRANSITION) {
  40219. if (transitionTimeout > 0) {
  40220. type = TRANSITION;
  40221. timeout = transitionTimeout;
  40222. propCount = transitionDurations.length;
  40223. }
  40224. } else if (expectedType === ANIMATION) {
  40225. if (animationTimeout > 0) {
  40226. type = ANIMATION;
  40227. timeout = animationTimeout;
  40228. propCount = animationDurations.length;
  40229. }
  40230. } else {
  40231. timeout = Math.max(transitionTimeout, animationTimeout);
  40232. type = timeout > 0
  40233. ? transitionTimeout > animationTimeout
  40234. ? TRANSITION
  40235. : ANIMATION
  40236. : null;
  40237. propCount = type
  40238. ? type === TRANSITION
  40239. ? transitionDurations.length
  40240. : animationDurations.length
  40241. : 0;
  40242. }
  40243. var hasTransform =
  40244. type === TRANSITION &&
  40245. transformRE.test(styles[transitionProp + 'Property']);
  40246. return {
  40247. type: type,
  40248. timeout: timeout,
  40249. propCount: propCount,
  40250. hasTransform: hasTransform
  40251. }
  40252. }
  40253. function getTimeout (delays, durations) {
  40254. /* istanbul ignore next */
  40255. while (delays.length < durations.length) {
  40256. delays = delays.concat(delays);
  40257. }
  40258. return Math.max.apply(null, durations.map(function (d, i) {
  40259. return toMs(d) + toMs(delays[i])
  40260. }))
  40261. }
  40262. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  40263. // in a locale-dependent way, using a comma instead of a dot.
  40264. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  40265. // as a floor function) causing unexpected behaviors
  40266. function toMs (s) {
  40267. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  40268. }
  40269. /* */
  40270. function enter (vnode, toggleDisplay) {
  40271. var el = vnode.elm;
  40272. // call leave callback now
  40273. if (isDef(el._leaveCb)) {
  40274. el._leaveCb.cancelled = true;
  40275. el._leaveCb();
  40276. }
  40277. var data = resolveTransition(vnode.data.transition);
  40278. if (isUndef(data)) {
  40279. return
  40280. }
  40281. /* istanbul ignore if */
  40282. if (isDef(el._enterCb) || el.nodeType !== 1) {
  40283. return
  40284. }
  40285. var css = data.css;
  40286. var type = data.type;
  40287. var enterClass = data.enterClass;
  40288. var enterToClass = data.enterToClass;
  40289. var enterActiveClass = data.enterActiveClass;
  40290. var appearClass = data.appearClass;
  40291. var appearToClass = data.appearToClass;
  40292. var appearActiveClass = data.appearActiveClass;
  40293. var beforeEnter = data.beforeEnter;
  40294. var enter = data.enter;
  40295. var afterEnter = data.afterEnter;
  40296. var enterCancelled = data.enterCancelled;
  40297. var beforeAppear = data.beforeAppear;
  40298. var appear = data.appear;
  40299. var afterAppear = data.afterAppear;
  40300. var appearCancelled = data.appearCancelled;
  40301. var duration = data.duration;
  40302. // activeInstance will always be the <transition> component managing this
  40303. // transition. One edge case to check is when the <transition> is placed
  40304. // as the root node of a child component. In that case we need to check
  40305. // <transition>'s parent for appear check.
  40306. var context = activeInstance;
  40307. var transitionNode = activeInstance.$vnode;
  40308. while (transitionNode && transitionNode.parent) {
  40309. context = transitionNode.context;
  40310. transitionNode = transitionNode.parent;
  40311. }
  40312. var isAppear = !context._isMounted || !vnode.isRootInsert;
  40313. if (isAppear && !appear && appear !== '') {
  40314. return
  40315. }
  40316. var startClass = isAppear && appearClass
  40317. ? appearClass
  40318. : enterClass;
  40319. var activeClass = isAppear && appearActiveClass
  40320. ? appearActiveClass
  40321. : enterActiveClass;
  40322. var toClass = isAppear && appearToClass
  40323. ? appearToClass
  40324. : enterToClass;
  40325. var beforeEnterHook = isAppear
  40326. ? (beforeAppear || beforeEnter)
  40327. : beforeEnter;
  40328. var enterHook = isAppear
  40329. ? (typeof appear === 'function' ? appear : enter)
  40330. : enter;
  40331. var afterEnterHook = isAppear
  40332. ? (afterAppear || afterEnter)
  40333. : afterEnter;
  40334. var enterCancelledHook = isAppear
  40335. ? (appearCancelled || enterCancelled)
  40336. : enterCancelled;
  40337. var explicitEnterDuration = toNumber(
  40338. isObject(duration)
  40339. ? duration.enter
  40340. : duration
  40341. );
  40342. if (explicitEnterDuration != null) {
  40343. checkDuration(explicitEnterDuration, 'enter', vnode);
  40344. }
  40345. var expectsCSS = css !== false && !isIE9;
  40346. var userWantsControl = getHookArgumentsLength(enterHook);
  40347. var cb = el._enterCb = once(function () {
  40348. if (expectsCSS) {
  40349. removeTransitionClass(el, toClass);
  40350. removeTransitionClass(el, activeClass);
  40351. }
  40352. if (cb.cancelled) {
  40353. if (expectsCSS) {
  40354. removeTransitionClass(el, startClass);
  40355. }
  40356. enterCancelledHook && enterCancelledHook(el);
  40357. } else {
  40358. afterEnterHook && afterEnterHook(el);
  40359. }
  40360. el._enterCb = null;
  40361. });
  40362. if (!vnode.data.show) {
  40363. // remove pending leave element on enter by injecting an insert hook
  40364. mergeVNodeHook(vnode, 'insert', function () {
  40365. var parent = el.parentNode;
  40366. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  40367. if (pendingNode &&
  40368. pendingNode.tag === vnode.tag &&
  40369. pendingNode.elm._leaveCb
  40370. ) {
  40371. pendingNode.elm._leaveCb();
  40372. }
  40373. enterHook && enterHook(el, cb);
  40374. });
  40375. }
  40376. // start enter transition
  40377. beforeEnterHook && beforeEnterHook(el);
  40378. if (expectsCSS) {
  40379. addTransitionClass(el, startClass);
  40380. addTransitionClass(el, activeClass);
  40381. nextFrame(function () {
  40382. removeTransitionClass(el, startClass);
  40383. if (!cb.cancelled) {
  40384. addTransitionClass(el, toClass);
  40385. if (!userWantsControl) {
  40386. if (isValidDuration(explicitEnterDuration)) {
  40387. setTimeout(cb, explicitEnterDuration);
  40388. } else {
  40389. whenTransitionEnds(el, type, cb);
  40390. }
  40391. }
  40392. }
  40393. });
  40394. }
  40395. if (vnode.data.show) {
  40396. toggleDisplay && toggleDisplay();
  40397. enterHook && enterHook(el, cb);
  40398. }
  40399. if (!expectsCSS && !userWantsControl) {
  40400. cb();
  40401. }
  40402. }
  40403. function leave (vnode, rm) {
  40404. var el = vnode.elm;
  40405. // call enter callback now
  40406. if (isDef(el._enterCb)) {
  40407. el._enterCb.cancelled = true;
  40408. el._enterCb();
  40409. }
  40410. var data = resolveTransition(vnode.data.transition);
  40411. if (isUndef(data) || el.nodeType !== 1) {
  40412. return rm()
  40413. }
  40414. /* istanbul ignore if */
  40415. if (isDef(el._leaveCb)) {
  40416. return
  40417. }
  40418. var css = data.css;
  40419. var type = data.type;
  40420. var leaveClass = data.leaveClass;
  40421. var leaveToClass = data.leaveToClass;
  40422. var leaveActiveClass = data.leaveActiveClass;
  40423. var beforeLeave = data.beforeLeave;
  40424. var leave = data.leave;
  40425. var afterLeave = data.afterLeave;
  40426. var leaveCancelled = data.leaveCancelled;
  40427. var delayLeave = data.delayLeave;
  40428. var duration = data.duration;
  40429. var expectsCSS = css !== false && !isIE9;
  40430. var userWantsControl = getHookArgumentsLength(leave);
  40431. var explicitLeaveDuration = toNumber(
  40432. isObject(duration)
  40433. ? duration.leave
  40434. : duration
  40435. );
  40436. if (isDef(explicitLeaveDuration)) {
  40437. checkDuration(explicitLeaveDuration, 'leave', vnode);
  40438. }
  40439. var cb = el._leaveCb = once(function () {
  40440. if (el.parentNode && el.parentNode._pending) {
  40441. el.parentNode._pending[vnode.key] = null;
  40442. }
  40443. if (expectsCSS) {
  40444. removeTransitionClass(el, leaveToClass);
  40445. removeTransitionClass(el, leaveActiveClass);
  40446. }
  40447. if (cb.cancelled) {
  40448. if (expectsCSS) {
  40449. removeTransitionClass(el, leaveClass);
  40450. }
  40451. leaveCancelled && leaveCancelled(el);
  40452. } else {
  40453. rm();
  40454. afterLeave && afterLeave(el);
  40455. }
  40456. el._leaveCb = null;
  40457. });
  40458. if (delayLeave) {
  40459. delayLeave(performLeave);
  40460. } else {
  40461. performLeave();
  40462. }
  40463. function performLeave () {
  40464. // the delayed leave may have already been cancelled
  40465. if (cb.cancelled) {
  40466. return
  40467. }
  40468. // record leaving element
  40469. if (!vnode.data.show && el.parentNode) {
  40470. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  40471. }
  40472. beforeLeave && beforeLeave(el);
  40473. if (expectsCSS) {
  40474. addTransitionClass(el, leaveClass);
  40475. addTransitionClass(el, leaveActiveClass);
  40476. nextFrame(function () {
  40477. removeTransitionClass(el, leaveClass);
  40478. if (!cb.cancelled) {
  40479. addTransitionClass(el, leaveToClass);
  40480. if (!userWantsControl) {
  40481. if (isValidDuration(explicitLeaveDuration)) {
  40482. setTimeout(cb, explicitLeaveDuration);
  40483. } else {
  40484. whenTransitionEnds(el, type, cb);
  40485. }
  40486. }
  40487. }
  40488. });
  40489. }
  40490. leave && leave(el, cb);
  40491. if (!expectsCSS && !userWantsControl) {
  40492. cb();
  40493. }
  40494. }
  40495. }
  40496. // only used in dev mode
  40497. function checkDuration (val, name, vnode) {
  40498. if (typeof val !== 'number') {
  40499. warn(
  40500. "<transition> explicit " + name + " duration is not a valid number - " +
  40501. "got " + (JSON.stringify(val)) + ".",
  40502. vnode.context
  40503. );
  40504. } else if (isNaN(val)) {
  40505. warn(
  40506. "<transition> explicit " + name + " duration is NaN - " +
  40507. 'the duration expression might be incorrect.',
  40508. vnode.context
  40509. );
  40510. }
  40511. }
  40512. function isValidDuration (val) {
  40513. return typeof val === 'number' && !isNaN(val)
  40514. }
  40515. /**
  40516. * Normalize a transition hook's argument length. The hook may be:
  40517. * - a merged hook (invoker) with the original in .fns
  40518. * - a wrapped component method (check ._length)
  40519. * - a plain function (.length)
  40520. */
  40521. function getHookArgumentsLength (fn) {
  40522. if (isUndef(fn)) {
  40523. return false
  40524. }
  40525. var invokerFns = fn.fns;
  40526. if (isDef(invokerFns)) {
  40527. // invoker
  40528. return getHookArgumentsLength(
  40529. Array.isArray(invokerFns)
  40530. ? invokerFns[0]
  40531. : invokerFns
  40532. )
  40533. } else {
  40534. return (fn._length || fn.length) > 1
  40535. }
  40536. }
  40537. function _enter (_, vnode) {
  40538. if (vnode.data.show !== true) {
  40539. enter(vnode);
  40540. }
  40541. }
  40542. var transition = inBrowser ? {
  40543. create: _enter,
  40544. activate: _enter,
  40545. remove: function remove$$1 (vnode, rm) {
  40546. /* istanbul ignore else */
  40547. if (vnode.data.show !== true) {
  40548. leave(vnode, rm);
  40549. } else {
  40550. rm();
  40551. }
  40552. }
  40553. } : {};
  40554. var platformModules = [
  40555. attrs,
  40556. klass,
  40557. events,
  40558. domProps,
  40559. style,
  40560. transition
  40561. ];
  40562. /* */
  40563. // the directive module should be applied last, after all
  40564. // built-in modules have been applied.
  40565. var modules = platformModules.concat(baseModules);
  40566. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  40567. /**
  40568. * Not type checking this file because flow doesn't like attaching
  40569. * properties to Elements.
  40570. */
  40571. /* istanbul ignore if */
  40572. if (isIE9) {
  40573. // http://www.matts411.com/post/internet-explorer-9-oninput/
  40574. document.addEventListener('selectionchange', function () {
  40575. var el = document.activeElement;
  40576. if (el && el.vmodel) {
  40577. trigger(el, 'input');
  40578. }
  40579. });
  40580. }
  40581. var directive = {
  40582. inserted: function inserted (el, binding, vnode, oldVnode) {
  40583. if (vnode.tag === 'select') {
  40584. // #6903
  40585. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  40586. mergeVNodeHook(vnode, 'postpatch', function () {
  40587. directive.componentUpdated(el, binding, vnode);
  40588. });
  40589. } else {
  40590. setSelected(el, binding, vnode.context);
  40591. }
  40592. el._vOptions = [].map.call(el.options, getValue);
  40593. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  40594. el._vModifiers = binding.modifiers;
  40595. if (!binding.modifiers.lazy) {
  40596. el.addEventListener('compositionstart', onCompositionStart);
  40597. el.addEventListener('compositionend', onCompositionEnd);
  40598. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  40599. // switching focus before confirming composition choice
  40600. // this also fixes the issue where some browsers e.g. iOS Chrome
  40601. // fires "change" instead of "input" on autocomplete.
  40602. el.addEventListener('change', onCompositionEnd);
  40603. /* istanbul ignore if */
  40604. if (isIE9) {
  40605. el.vmodel = true;
  40606. }
  40607. }
  40608. }
  40609. },
  40610. componentUpdated: function componentUpdated (el, binding, vnode) {
  40611. if (vnode.tag === 'select') {
  40612. setSelected(el, binding, vnode.context);
  40613. // in case the options rendered by v-for have changed,
  40614. // it's possible that the value is out-of-sync with the rendered options.
  40615. // detect such cases and filter out values that no longer has a matching
  40616. // option in the DOM.
  40617. var prevOptions = el._vOptions;
  40618. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  40619. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  40620. // trigger change event if
  40621. // no matching option found for at least one value
  40622. var needReset = el.multiple
  40623. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  40624. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  40625. if (needReset) {
  40626. trigger(el, 'change');
  40627. }
  40628. }
  40629. }
  40630. }
  40631. };
  40632. function setSelected (el, binding, vm) {
  40633. actuallySetSelected(el, binding, vm);
  40634. /* istanbul ignore if */
  40635. if (isIE || isEdge) {
  40636. setTimeout(function () {
  40637. actuallySetSelected(el, binding, vm);
  40638. }, 0);
  40639. }
  40640. }
  40641. function actuallySetSelected (el, binding, vm) {
  40642. var value = binding.value;
  40643. var isMultiple = el.multiple;
  40644. if (isMultiple && !Array.isArray(value)) {
  40645. warn(
  40646. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  40647. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  40648. vm
  40649. );
  40650. return
  40651. }
  40652. var selected, option;
  40653. for (var i = 0, l = el.options.length; i < l; i++) {
  40654. option = el.options[i];
  40655. if (isMultiple) {
  40656. selected = looseIndexOf(value, getValue(option)) > -1;
  40657. if (option.selected !== selected) {
  40658. option.selected = selected;
  40659. }
  40660. } else {
  40661. if (looseEqual(getValue(option), value)) {
  40662. if (el.selectedIndex !== i) {
  40663. el.selectedIndex = i;
  40664. }
  40665. return
  40666. }
  40667. }
  40668. }
  40669. if (!isMultiple) {
  40670. el.selectedIndex = -1;
  40671. }
  40672. }
  40673. function hasNoMatchingOption (value, options) {
  40674. return options.every(function (o) { return !looseEqual(o, value); })
  40675. }
  40676. function getValue (option) {
  40677. return '_value' in option
  40678. ? option._value
  40679. : option.value
  40680. }
  40681. function onCompositionStart (e) {
  40682. e.target.composing = true;
  40683. }
  40684. function onCompositionEnd (e) {
  40685. // prevent triggering an input event for no reason
  40686. if (!e.target.composing) { return }
  40687. e.target.composing = false;
  40688. trigger(e.target, 'input');
  40689. }
  40690. function trigger (el, type) {
  40691. var e = document.createEvent('HTMLEvents');
  40692. e.initEvent(type, true, true);
  40693. el.dispatchEvent(e);
  40694. }
  40695. /* */
  40696. // recursively search for possible transition defined inside the component root
  40697. function locateNode (vnode) {
  40698. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  40699. ? locateNode(vnode.componentInstance._vnode)
  40700. : vnode
  40701. }
  40702. var show = {
  40703. bind: function bind (el, ref, vnode) {
  40704. var value = ref.value;
  40705. vnode = locateNode(vnode);
  40706. var transition$$1 = vnode.data && vnode.data.transition;
  40707. var originalDisplay = el.__vOriginalDisplay =
  40708. el.style.display === 'none' ? '' : el.style.display;
  40709. if (value && transition$$1) {
  40710. vnode.data.show = true;
  40711. enter(vnode, function () {
  40712. el.style.display = originalDisplay;
  40713. });
  40714. } else {
  40715. el.style.display = value ? originalDisplay : 'none';
  40716. }
  40717. },
  40718. update: function update (el, ref, vnode) {
  40719. var value = ref.value;
  40720. var oldValue = ref.oldValue;
  40721. /* istanbul ignore if */
  40722. if (!value === !oldValue) { return }
  40723. vnode = locateNode(vnode);
  40724. var transition$$1 = vnode.data && vnode.data.transition;
  40725. if (transition$$1) {
  40726. vnode.data.show = true;
  40727. if (value) {
  40728. enter(vnode, function () {
  40729. el.style.display = el.__vOriginalDisplay;
  40730. });
  40731. } else {
  40732. leave(vnode, function () {
  40733. el.style.display = 'none';
  40734. });
  40735. }
  40736. } else {
  40737. el.style.display = value ? el.__vOriginalDisplay : 'none';
  40738. }
  40739. },
  40740. unbind: function unbind (
  40741. el,
  40742. binding,
  40743. vnode,
  40744. oldVnode,
  40745. isDestroy
  40746. ) {
  40747. if (!isDestroy) {
  40748. el.style.display = el.__vOriginalDisplay;
  40749. }
  40750. }
  40751. };
  40752. var platformDirectives = {
  40753. model: directive,
  40754. show: show
  40755. };
  40756. /* */
  40757. var transitionProps = {
  40758. name: String,
  40759. appear: Boolean,
  40760. css: Boolean,
  40761. mode: String,
  40762. type: String,
  40763. enterClass: String,
  40764. leaveClass: String,
  40765. enterToClass: String,
  40766. leaveToClass: String,
  40767. enterActiveClass: String,
  40768. leaveActiveClass: String,
  40769. appearClass: String,
  40770. appearActiveClass: String,
  40771. appearToClass: String,
  40772. duration: [Number, String, Object]
  40773. };
  40774. // in case the child is also an abstract component, e.g. <keep-alive>
  40775. // we want to recursively retrieve the real component to be rendered
  40776. function getRealChild (vnode) {
  40777. var compOptions = vnode && vnode.componentOptions;
  40778. if (compOptions && compOptions.Ctor.options.abstract) {
  40779. return getRealChild(getFirstComponentChild(compOptions.children))
  40780. } else {
  40781. return vnode
  40782. }
  40783. }
  40784. function extractTransitionData (comp) {
  40785. var data = {};
  40786. var options = comp.$options;
  40787. // props
  40788. for (var key in options.propsData) {
  40789. data[key] = comp[key];
  40790. }
  40791. // events.
  40792. // extract listeners and pass them directly to the transition methods
  40793. var listeners = options._parentListeners;
  40794. for (var key$1 in listeners) {
  40795. data[camelize(key$1)] = listeners[key$1];
  40796. }
  40797. return data
  40798. }
  40799. function placeholder (h, rawChild) {
  40800. if (/\d-keep-alive$/.test(rawChild.tag)) {
  40801. return h('keep-alive', {
  40802. props: rawChild.componentOptions.propsData
  40803. })
  40804. }
  40805. }
  40806. function hasParentTransition (vnode) {
  40807. while ((vnode = vnode.parent)) {
  40808. if (vnode.data.transition) {
  40809. return true
  40810. }
  40811. }
  40812. }
  40813. function isSameChild (child, oldChild) {
  40814. return oldChild.key === child.key && oldChild.tag === child.tag
  40815. }
  40816. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  40817. var isVShowDirective = function (d) { return d.name === 'show'; };
  40818. var Transition = {
  40819. name: 'transition',
  40820. props: transitionProps,
  40821. abstract: true,
  40822. render: function render (h) {
  40823. var this$1 = this;
  40824. var children = this.$slots.default;
  40825. if (!children) {
  40826. return
  40827. }
  40828. // filter out text nodes (possible whitespaces)
  40829. children = children.filter(isNotTextNode);
  40830. /* istanbul ignore if */
  40831. if (!children.length) {
  40832. return
  40833. }
  40834. // warn multiple elements
  40835. if (children.length > 1) {
  40836. warn(
  40837. '<transition> can only be used on a single element. Use ' +
  40838. '<transition-group> for lists.',
  40839. this.$parent
  40840. );
  40841. }
  40842. var mode = this.mode;
  40843. // warn invalid mode
  40844. if (mode && mode !== 'in-out' && mode !== 'out-in'
  40845. ) {
  40846. warn(
  40847. 'invalid <transition> mode: ' + mode,
  40848. this.$parent
  40849. );
  40850. }
  40851. var rawChild = children[0];
  40852. // if this is a component root node and the component's
  40853. // parent container node also has transition, skip.
  40854. if (hasParentTransition(this.$vnode)) {
  40855. return rawChild
  40856. }
  40857. // apply transition data to child
  40858. // use getRealChild() to ignore abstract components e.g. keep-alive
  40859. var child = getRealChild(rawChild);
  40860. /* istanbul ignore if */
  40861. if (!child) {
  40862. return rawChild
  40863. }
  40864. if (this._leaving) {
  40865. return placeholder(h, rawChild)
  40866. }
  40867. // ensure a key that is unique to the vnode type and to this transition
  40868. // component instance. This key will be used to remove pending leaving nodes
  40869. // during entering.
  40870. var id = "__transition-" + (this._uid) + "-";
  40871. child.key = child.key == null
  40872. ? child.isComment
  40873. ? id + 'comment'
  40874. : id + child.tag
  40875. : isPrimitive(child.key)
  40876. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  40877. : child.key;
  40878. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  40879. var oldRawChild = this._vnode;
  40880. var oldChild = getRealChild(oldRawChild);
  40881. // mark v-show
  40882. // so that the transition module can hand over the control to the directive
  40883. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  40884. child.data.show = true;
  40885. }
  40886. if (
  40887. oldChild &&
  40888. oldChild.data &&
  40889. !isSameChild(child, oldChild) &&
  40890. !isAsyncPlaceholder(oldChild) &&
  40891. // #6687 component root is a comment node
  40892. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  40893. ) {
  40894. // replace old child transition data with fresh one
  40895. // important for dynamic transitions!
  40896. var oldData = oldChild.data.transition = extend({}, data);
  40897. // handle transition mode
  40898. if (mode === 'out-in') {
  40899. // return placeholder node and queue update when leave finishes
  40900. this._leaving = true;
  40901. mergeVNodeHook(oldData, 'afterLeave', function () {
  40902. this$1._leaving = false;
  40903. this$1.$forceUpdate();
  40904. });
  40905. return placeholder(h, rawChild)
  40906. } else if (mode === 'in-out') {
  40907. if (isAsyncPlaceholder(child)) {
  40908. return oldRawChild
  40909. }
  40910. var delayedLeave;
  40911. var performLeave = function () { delayedLeave(); };
  40912. mergeVNodeHook(data, 'afterEnter', performLeave);
  40913. mergeVNodeHook(data, 'enterCancelled', performLeave);
  40914. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  40915. }
  40916. }
  40917. return rawChild
  40918. }
  40919. };
  40920. /* */
  40921. var props = extend({
  40922. tag: String,
  40923. moveClass: String
  40924. }, transitionProps);
  40925. delete props.mode;
  40926. var TransitionGroup = {
  40927. props: props,
  40928. beforeMount: function beforeMount () {
  40929. var this$1 = this;
  40930. var update = this._update;
  40931. this._update = function (vnode, hydrating) {
  40932. var restoreActiveInstance = setActiveInstance(this$1);
  40933. // force removing pass
  40934. this$1.__patch__(
  40935. this$1._vnode,
  40936. this$1.kept,
  40937. false, // hydrating
  40938. true // removeOnly (!important, avoids unnecessary moves)
  40939. );
  40940. this$1._vnode = this$1.kept;
  40941. restoreActiveInstance();
  40942. update.call(this$1, vnode, hydrating);
  40943. };
  40944. },
  40945. render: function render (h) {
  40946. var tag = this.tag || this.$vnode.data.tag || 'span';
  40947. var map = Object.create(null);
  40948. var prevChildren = this.prevChildren = this.children;
  40949. var rawChildren = this.$slots.default || [];
  40950. var children = this.children = [];
  40951. var transitionData = extractTransitionData(this);
  40952. for (var i = 0; i < rawChildren.length; i++) {
  40953. var c = rawChildren[i];
  40954. if (c.tag) {
  40955. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  40956. children.push(c);
  40957. map[c.key] = c
  40958. ;(c.data || (c.data = {})).transition = transitionData;
  40959. } else {
  40960. var opts = c.componentOptions;
  40961. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  40962. warn(("<transition-group> children must be keyed: <" + name + ">"));
  40963. }
  40964. }
  40965. }
  40966. if (prevChildren) {
  40967. var kept = [];
  40968. var removed = [];
  40969. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  40970. var c$1 = prevChildren[i$1];
  40971. c$1.data.transition = transitionData;
  40972. c$1.data.pos = c$1.elm.getBoundingClientRect();
  40973. if (map[c$1.key]) {
  40974. kept.push(c$1);
  40975. } else {
  40976. removed.push(c$1);
  40977. }
  40978. }
  40979. this.kept = h(tag, null, kept);
  40980. this.removed = removed;
  40981. }
  40982. return h(tag, null, children)
  40983. },
  40984. updated: function updated () {
  40985. var children = this.prevChildren;
  40986. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  40987. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  40988. return
  40989. }
  40990. // we divide the work into three loops to avoid mixing DOM reads and writes
  40991. // in each iteration - which helps prevent layout thrashing.
  40992. children.forEach(callPendingCbs);
  40993. children.forEach(recordPosition);
  40994. children.forEach(applyTranslation);
  40995. // force reflow to put everything in position
  40996. // assign to this to avoid being removed in tree-shaking
  40997. // $flow-disable-line
  40998. this._reflow = document.body.offsetHeight;
  40999. children.forEach(function (c) {
  41000. if (c.data.moved) {
  41001. var el = c.elm;
  41002. var s = el.style;
  41003. addTransitionClass(el, moveClass);
  41004. s.transform = s.WebkitTransform = s.transitionDuration = '';
  41005. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  41006. if (e && e.target !== el) {
  41007. return
  41008. }
  41009. if (!e || /transform$/.test(e.propertyName)) {
  41010. el.removeEventListener(transitionEndEvent, cb);
  41011. el._moveCb = null;
  41012. removeTransitionClass(el, moveClass);
  41013. }
  41014. });
  41015. }
  41016. });
  41017. },
  41018. methods: {
  41019. hasMove: function hasMove (el, moveClass) {
  41020. /* istanbul ignore if */
  41021. if (!hasTransition) {
  41022. return false
  41023. }
  41024. /* istanbul ignore if */
  41025. if (this._hasMove) {
  41026. return this._hasMove
  41027. }
  41028. // Detect whether an element with the move class applied has
  41029. // CSS transitions. Since the element may be inside an entering
  41030. // transition at this very moment, we make a clone of it and remove
  41031. // all other transition classes applied to ensure only the move class
  41032. // is applied.
  41033. var clone = el.cloneNode();
  41034. if (el._transitionClasses) {
  41035. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  41036. }
  41037. addClass(clone, moveClass);
  41038. clone.style.display = 'none';
  41039. this.$el.appendChild(clone);
  41040. var info = getTransitionInfo(clone);
  41041. this.$el.removeChild(clone);
  41042. return (this._hasMove = info.hasTransform)
  41043. }
  41044. }
  41045. };
  41046. function callPendingCbs (c) {
  41047. /* istanbul ignore if */
  41048. if (c.elm._moveCb) {
  41049. c.elm._moveCb();
  41050. }
  41051. /* istanbul ignore if */
  41052. if (c.elm._enterCb) {
  41053. c.elm._enterCb();
  41054. }
  41055. }
  41056. function recordPosition (c) {
  41057. c.data.newPos = c.elm.getBoundingClientRect();
  41058. }
  41059. function applyTranslation (c) {
  41060. var oldPos = c.data.pos;
  41061. var newPos = c.data.newPos;
  41062. var dx = oldPos.left - newPos.left;
  41063. var dy = oldPos.top - newPos.top;
  41064. if (dx || dy) {
  41065. c.data.moved = true;
  41066. var s = c.elm.style;
  41067. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  41068. s.transitionDuration = '0s';
  41069. }
  41070. }
  41071. var platformComponents = {
  41072. Transition: Transition,
  41073. TransitionGroup: TransitionGroup
  41074. };
  41075. /* */
  41076. // install platform specific utils
  41077. Vue.config.mustUseProp = mustUseProp;
  41078. Vue.config.isReservedTag = isReservedTag;
  41079. Vue.config.isReservedAttr = isReservedAttr;
  41080. Vue.config.getTagNamespace = getTagNamespace;
  41081. Vue.config.isUnknownElement = isUnknownElement;
  41082. // install platform runtime directives & components
  41083. extend(Vue.options.directives, platformDirectives);
  41084. extend(Vue.options.components, platformComponents);
  41085. // install platform patch function
  41086. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  41087. // public mount method
  41088. Vue.prototype.$mount = function (
  41089. el,
  41090. hydrating
  41091. ) {
  41092. el = el && inBrowser ? query(el) : undefined;
  41093. return mountComponent(this, el, hydrating)
  41094. };
  41095. // devtools global hook
  41096. /* istanbul ignore next */
  41097. if (inBrowser) {
  41098. setTimeout(function () {
  41099. if (config.devtools) {
  41100. if (devtools) {
  41101. devtools.emit('init', Vue);
  41102. } else {
  41103. console[console.info ? 'info' : 'log'](
  41104. 'Download the Vue Devtools extension for a better development experience:\n' +
  41105. 'https://github.com/vuejs/vue-devtools'
  41106. );
  41107. }
  41108. }
  41109. if (config.productionTip !== false &&
  41110. typeof console !== 'undefined'
  41111. ) {
  41112. console[console.info ? 'info' : 'log'](
  41113. "You are running Vue in development mode.\n" +
  41114. "Make sure to turn on production mode when deploying for production.\n" +
  41115. "See more tips at https://vuejs.org/guide/deployment.html"
  41116. );
  41117. }
  41118. }, 0);
  41119. }
  41120. /* */
  41121. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  41122. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  41123. var buildRegex = cached(function (delimiters) {
  41124. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  41125. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  41126. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  41127. });
  41128. function parseText (
  41129. text,
  41130. delimiters
  41131. ) {
  41132. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  41133. if (!tagRE.test(text)) {
  41134. return
  41135. }
  41136. var tokens = [];
  41137. var rawTokens = [];
  41138. var lastIndex = tagRE.lastIndex = 0;
  41139. var match, index, tokenValue;
  41140. while ((match = tagRE.exec(text))) {
  41141. index = match.index;
  41142. // push text token
  41143. if (index > lastIndex) {
  41144. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  41145. tokens.push(JSON.stringify(tokenValue));
  41146. }
  41147. // tag token
  41148. var exp = parseFilters(match[1].trim());
  41149. tokens.push(("_s(" + exp + ")"));
  41150. rawTokens.push({ '@binding': exp });
  41151. lastIndex = index + match[0].length;
  41152. }
  41153. if (lastIndex < text.length) {
  41154. rawTokens.push(tokenValue = text.slice(lastIndex));
  41155. tokens.push(JSON.stringify(tokenValue));
  41156. }
  41157. return {
  41158. expression: tokens.join('+'),
  41159. tokens: rawTokens
  41160. }
  41161. }
  41162. /* */
  41163. function transformNode (el, options) {
  41164. var warn = options.warn || baseWarn;
  41165. var staticClass = getAndRemoveAttr(el, 'class');
  41166. if (staticClass) {
  41167. var res = parseText(staticClass, options.delimiters);
  41168. if (res) {
  41169. warn(
  41170. "class=\"" + staticClass + "\": " +
  41171. 'Interpolation inside attributes has been removed. ' +
  41172. 'Use v-bind or the colon shorthand instead. For example, ' +
  41173. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  41174. el.rawAttrsMap['class']
  41175. );
  41176. }
  41177. }
  41178. if (staticClass) {
  41179. el.staticClass = JSON.stringify(staticClass);
  41180. }
  41181. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  41182. if (classBinding) {
  41183. el.classBinding = classBinding;
  41184. }
  41185. }
  41186. function genData (el) {
  41187. var data = '';
  41188. if (el.staticClass) {
  41189. data += "staticClass:" + (el.staticClass) + ",";
  41190. }
  41191. if (el.classBinding) {
  41192. data += "class:" + (el.classBinding) + ",";
  41193. }
  41194. return data
  41195. }
  41196. var klass$1 = {
  41197. staticKeys: ['staticClass'],
  41198. transformNode: transformNode,
  41199. genData: genData
  41200. };
  41201. /* */
  41202. function transformNode$1 (el, options) {
  41203. var warn = options.warn || baseWarn;
  41204. var staticStyle = getAndRemoveAttr(el, 'style');
  41205. if (staticStyle) {
  41206. /* istanbul ignore if */
  41207. {
  41208. var res = parseText(staticStyle, options.delimiters);
  41209. if (res) {
  41210. warn(
  41211. "style=\"" + staticStyle + "\": " +
  41212. 'Interpolation inside attributes has been removed. ' +
  41213. 'Use v-bind or the colon shorthand instead. For example, ' +
  41214. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  41215. el.rawAttrsMap['style']
  41216. );
  41217. }
  41218. }
  41219. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  41220. }
  41221. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  41222. if (styleBinding) {
  41223. el.styleBinding = styleBinding;
  41224. }
  41225. }
  41226. function genData$1 (el) {
  41227. var data = '';
  41228. if (el.staticStyle) {
  41229. data += "staticStyle:" + (el.staticStyle) + ",";
  41230. }
  41231. if (el.styleBinding) {
  41232. data += "style:(" + (el.styleBinding) + "),";
  41233. }
  41234. return data
  41235. }
  41236. var style$1 = {
  41237. staticKeys: ['staticStyle'],
  41238. transformNode: transformNode$1,
  41239. genData: genData$1
  41240. };
  41241. /* */
  41242. var decoder;
  41243. var he = {
  41244. decode: function decode (html) {
  41245. decoder = decoder || document.createElement('div');
  41246. decoder.innerHTML = html;
  41247. return decoder.textContent
  41248. }
  41249. };
  41250. /* */
  41251. var isUnaryTag = makeMap(
  41252. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  41253. 'link,meta,param,source,track,wbr'
  41254. );
  41255. // Elements that you can, intentionally, leave open
  41256. // (and which close themselves)
  41257. var canBeLeftOpenTag = makeMap(
  41258. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  41259. );
  41260. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  41261. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  41262. var isNonPhrasingTag = makeMap(
  41263. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  41264. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  41265. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  41266. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  41267. 'title,tr,track'
  41268. );
  41269. /**
  41270. * Not type-checking this file because it's mostly vendor code.
  41271. */
  41272. // Regular Expressions for parsing tags and attributes
  41273. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41274. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41275. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  41276. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  41277. var startTagOpen = new RegExp(("^<" + qnameCapture));
  41278. var startTagClose = /^\s*(\/?)>/;
  41279. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  41280. var doctype = /^<!DOCTYPE [^>]+>/i;
  41281. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  41282. var comment = /^<!\--/;
  41283. var conditionalComment = /^<!\[/;
  41284. // Special Elements (can contain anything)
  41285. var isPlainTextElement = makeMap('script,style,textarea', true);
  41286. var reCache = {};
  41287. var decodingMap = {
  41288. '&lt;': '<',
  41289. '&gt;': '>',
  41290. '&quot;': '"',
  41291. '&amp;': '&',
  41292. '&#10;': '\n',
  41293. '&#9;': '\t',
  41294. '&#39;': "'"
  41295. };
  41296. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  41297. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  41298. // #5992
  41299. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  41300. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  41301. function decodeAttr (value, shouldDecodeNewlines) {
  41302. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  41303. return value.replace(re, function (match) { return decodingMap[match]; })
  41304. }
  41305. function parseHTML (html, options) {
  41306. var stack = [];
  41307. var expectHTML = options.expectHTML;
  41308. var isUnaryTag$$1 = options.isUnaryTag || no;
  41309. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  41310. var index = 0;
  41311. var last, lastTag;
  41312. while (html) {
  41313. last = html;
  41314. // Make sure we're not in a plaintext content element like script/style
  41315. if (!lastTag || !isPlainTextElement(lastTag)) {
  41316. var textEnd = html.indexOf('<');
  41317. if (textEnd === 0) {
  41318. // Comment:
  41319. if (comment.test(html)) {
  41320. var commentEnd = html.indexOf('-->');
  41321. if (commentEnd >= 0) {
  41322. if (options.shouldKeepComment) {
  41323. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  41324. }
  41325. advance(commentEnd + 3);
  41326. continue
  41327. }
  41328. }
  41329. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  41330. if (conditionalComment.test(html)) {
  41331. var conditionalEnd = html.indexOf(']>');
  41332. if (conditionalEnd >= 0) {
  41333. advance(conditionalEnd + 2);
  41334. continue
  41335. }
  41336. }
  41337. // Doctype:
  41338. var doctypeMatch = html.match(doctype);
  41339. if (doctypeMatch) {
  41340. advance(doctypeMatch[0].length);
  41341. continue
  41342. }
  41343. // End tag:
  41344. var endTagMatch = html.match(endTag);
  41345. if (endTagMatch) {
  41346. var curIndex = index;
  41347. advance(endTagMatch[0].length);
  41348. parseEndTag(endTagMatch[1], curIndex, index);
  41349. continue
  41350. }
  41351. // Start tag:
  41352. var startTagMatch = parseStartTag();
  41353. if (startTagMatch) {
  41354. handleStartTag(startTagMatch);
  41355. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  41356. advance(1);
  41357. }
  41358. continue
  41359. }
  41360. }
  41361. var text = (void 0), rest = (void 0), next = (void 0);
  41362. if (textEnd >= 0) {
  41363. rest = html.slice(textEnd);
  41364. while (
  41365. !endTag.test(rest) &&
  41366. !startTagOpen.test(rest) &&
  41367. !comment.test(rest) &&
  41368. !conditionalComment.test(rest)
  41369. ) {
  41370. // < in plain text, be forgiving and treat it as text
  41371. next = rest.indexOf('<', 1);
  41372. if (next < 0) { break }
  41373. textEnd += next;
  41374. rest = html.slice(textEnd);
  41375. }
  41376. text = html.substring(0, textEnd);
  41377. }
  41378. if (textEnd < 0) {
  41379. text = html;
  41380. }
  41381. if (text) {
  41382. advance(text.length);
  41383. }
  41384. if (options.chars && text) {
  41385. options.chars(text, index - text.length, index);
  41386. }
  41387. } else {
  41388. var endTagLength = 0;
  41389. var stackedTag = lastTag.toLowerCase();
  41390. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  41391. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  41392. endTagLength = endTag.length;
  41393. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  41394. text = text
  41395. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  41396. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  41397. }
  41398. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  41399. text = text.slice(1);
  41400. }
  41401. if (options.chars) {
  41402. options.chars(text);
  41403. }
  41404. return ''
  41405. });
  41406. index += html.length - rest$1.length;
  41407. html = rest$1;
  41408. parseEndTag(stackedTag, index - endTagLength, index);
  41409. }
  41410. if (html === last) {
  41411. options.chars && options.chars(html);
  41412. if (!stack.length && options.warn) {
  41413. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  41414. }
  41415. break
  41416. }
  41417. }
  41418. // Clean up any remaining tags
  41419. parseEndTag();
  41420. function advance (n) {
  41421. index += n;
  41422. html = html.substring(n);
  41423. }
  41424. function parseStartTag () {
  41425. var start = html.match(startTagOpen);
  41426. if (start) {
  41427. var match = {
  41428. tagName: start[1],
  41429. attrs: [],
  41430. start: index
  41431. };
  41432. advance(start[0].length);
  41433. var end, attr;
  41434. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  41435. attr.start = index;
  41436. advance(attr[0].length);
  41437. attr.end = index;
  41438. match.attrs.push(attr);
  41439. }
  41440. if (end) {
  41441. match.unarySlash = end[1];
  41442. advance(end[0].length);
  41443. match.end = index;
  41444. return match
  41445. }
  41446. }
  41447. }
  41448. function handleStartTag (match) {
  41449. var tagName = match.tagName;
  41450. var unarySlash = match.unarySlash;
  41451. if (expectHTML) {
  41452. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  41453. parseEndTag(lastTag);
  41454. }
  41455. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  41456. parseEndTag(tagName);
  41457. }
  41458. }
  41459. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  41460. var l = match.attrs.length;
  41461. var attrs = new Array(l);
  41462. for (var i = 0; i < l; i++) {
  41463. var args = match.attrs[i];
  41464. var value = args[3] || args[4] || args[5] || '';
  41465. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  41466. ? options.shouldDecodeNewlinesForHref
  41467. : options.shouldDecodeNewlines;
  41468. attrs[i] = {
  41469. name: args[1],
  41470. value: decodeAttr(value, shouldDecodeNewlines)
  41471. };
  41472. if (options.outputSourceRange) {
  41473. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  41474. attrs[i].end = args.end;
  41475. }
  41476. }
  41477. if (!unary) {
  41478. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  41479. lastTag = tagName;
  41480. }
  41481. if (options.start) {
  41482. options.start(tagName, attrs, unary, match.start, match.end);
  41483. }
  41484. }
  41485. function parseEndTag (tagName, start, end) {
  41486. var pos, lowerCasedTagName;
  41487. if (start == null) { start = index; }
  41488. if (end == null) { end = index; }
  41489. // Find the closest opened tag of the same type
  41490. if (tagName) {
  41491. lowerCasedTagName = tagName.toLowerCase();
  41492. for (pos = stack.length - 1; pos >= 0; pos--) {
  41493. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  41494. break
  41495. }
  41496. }
  41497. } else {
  41498. // If no tag name is provided, clean shop
  41499. pos = 0;
  41500. }
  41501. if (pos >= 0) {
  41502. // Close all the open elements, up the stack
  41503. for (var i = stack.length - 1; i >= pos; i--) {
  41504. if (i > pos || !tagName &&
  41505. options.warn
  41506. ) {
  41507. options.warn(
  41508. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  41509. { start: stack[i].start, end: stack[i].end }
  41510. );
  41511. }
  41512. if (options.end) {
  41513. options.end(stack[i].tag, start, end);
  41514. }
  41515. }
  41516. // Remove the open elements from the stack
  41517. stack.length = pos;
  41518. lastTag = pos && stack[pos - 1].tag;
  41519. } else if (lowerCasedTagName === 'br') {
  41520. if (options.start) {
  41521. options.start(tagName, [], true, start, end);
  41522. }
  41523. } else if (lowerCasedTagName === 'p') {
  41524. if (options.start) {
  41525. options.start(tagName, [], false, start, end);
  41526. }
  41527. if (options.end) {
  41528. options.end(tagName, start, end);
  41529. }
  41530. }
  41531. }
  41532. }
  41533. /* */
  41534. var onRE = /^@|^v-on:/;
  41535. var dirRE = /^v-|^@|^:|^#/;
  41536. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  41537. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  41538. var stripParensRE = /^\(|\)$/g;
  41539. var dynamicArgRE = /^\[.*\]$/;
  41540. var argRE = /:(.*)$/;
  41541. var bindRE = /^:|^\.|^v-bind:/;
  41542. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  41543. var slotRE = /^v-slot(:|$)|^#/;
  41544. var lineBreakRE = /[\r\n]/;
  41545. var whitespaceRE$1 = /\s+/g;
  41546. var invalidAttributeRE = /[\s"'<>\/=]/;
  41547. var decodeHTMLCached = cached(he.decode);
  41548. var emptySlotScopeToken = "_empty_";
  41549. // configurable state
  41550. var warn$2;
  41551. var delimiters;
  41552. var transforms;
  41553. var preTransforms;
  41554. var postTransforms;
  41555. var platformIsPreTag;
  41556. var platformMustUseProp;
  41557. var platformGetTagNamespace;
  41558. var maybeComponent;
  41559. function createASTElement (
  41560. tag,
  41561. attrs,
  41562. parent
  41563. ) {
  41564. return {
  41565. type: 1,
  41566. tag: tag,
  41567. attrsList: attrs,
  41568. attrsMap: makeAttrsMap(attrs),
  41569. rawAttrsMap: {},
  41570. parent: parent,
  41571. children: []
  41572. }
  41573. }
  41574. /**
  41575. * Convert HTML string to AST.
  41576. */
  41577. function parse (
  41578. template,
  41579. options
  41580. ) {
  41581. warn$2 = options.warn || baseWarn;
  41582. platformIsPreTag = options.isPreTag || no;
  41583. platformMustUseProp = options.mustUseProp || no;
  41584. platformGetTagNamespace = options.getTagNamespace || no;
  41585. var isReservedTag = options.isReservedTag || no;
  41586. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  41587. transforms = pluckModuleFunction(options.modules, 'transformNode');
  41588. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  41589. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  41590. delimiters = options.delimiters;
  41591. var stack = [];
  41592. var preserveWhitespace = options.preserveWhitespace !== false;
  41593. var whitespaceOption = options.whitespace;
  41594. var root;
  41595. var currentParent;
  41596. var inVPre = false;
  41597. var inPre = false;
  41598. var warned = false;
  41599. function warnOnce (msg, range) {
  41600. if (!warned) {
  41601. warned = true;
  41602. warn$2(msg, range);
  41603. }
  41604. }
  41605. function closeElement (element) {
  41606. trimEndingWhitespace(element);
  41607. if (!inVPre && !element.processed) {
  41608. element = processElement(element, options);
  41609. }
  41610. // tree management
  41611. if (!stack.length && element !== root) {
  41612. // allow root elements with v-if, v-else-if and v-else
  41613. if (root.if && (element.elseif || element.else)) {
  41614. {
  41615. checkRootConstraints(element);
  41616. }
  41617. addIfCondition(root, {
  41618. exp: element.elseif,
  41619. block: element
  41620. });
  41621. } else {
  41622. warnOnce(
  41623. "Component template should contain exactly one root element. " +
  41624. "If you are using v-if on multiple elements, " +
  41625. "use v-else-if to chain them instead.",
  41626. { start: element.start }
  41627. );
  41628. }
  41629. }
  41630. if (currentParent && !element.forbidden) {
  41631. if (element.elseif || element.else) {
  41632. processIfConditions(element, currentParent);
  41633. } else {
  41634. if (element.slotScope) {
  41635. // scoped slot
  41636. // keep it in the children list so that v-else(-if) conditions can
  41637. // find it as the prev node.
  41638. var name = element.slotTarget || '"default"'
  41639. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  41640. }
  41641. currentParent.children.push(element);
  41642. element.parent = currentParent;
  41643. }
  41644. }
  41645. // final children cleanup
  41646. // filter out scoped slots
  41647. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  41648. // remove trailing whitespace node again
  41649. trimEndingWhitespace(element);
  41650. // check pre state
  41651. if (element.pre) {
  41652. inVPre = false;
  41653. }
  41654. if (platformIsPreTag(element.tag)) {
  41655. inPre = false;
  41656. }
  41657. // apply post-transforms
  41658. for (var i = 0; i < postTransforms.length; i++) {
  41659. postTransforms[i](element, options);
  41660. }
  41661. }
  41662. function trimEndingWhitespace (el) {
  41663. // remove trailing whitespace node
  41664. if (!inPre) {
  41665. var lastNode;
  41666. while (
  41667. (lastNode = el.children[el.children.length - 1]) &&
  41668. lastNode.type === 3 &&
  41669. lastNode.text === ' '
  41670. ) {
  41671. el.children.pop();
  41672. }
  41673. }
  41674. }
  41675. function checkRootConstraints (el) {
  41676. if (el.tag === 'slot' || el.tag === 'template') {
  41677. warnOnce(
  41678. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  41679. 'contain multiple nodes.',
  41680. { start: el.start }
  41681. );
  41682. }
  41683. if (el.attrsMap.hasOwnProperty('v-for')) {
  41684. warnOnce(
  41685. 'Cannot use v-for on stateful component root element because ' +
  41686. 'it renders multiple elements.',
  41687. el.rawAttrsMap['v-for']
  41688. );
  41689. }
  41690. }
  41691. parseHTML(template, {
  41692. warn: warn$2,
  41693. expectHTML: options.expectHTML,
  41694. isUnaryTag: options.isUnaryTag,
  41695. canBeLeftOpenTag: options.canBeLeftOpenTag,
  41696. shouldDecodeNewlines: options.shouldDecodeNewlines,
  41697. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  41698. shouldKeepComment: options.comments,
  41699. outputSourceRange: options.outputSourceRange,
  41700. start: function start (tag, attrs, unary, start$1, end) {
  41701. // check namespace.
  41702. // inherit parent ns if there is one
  41703. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  41704. // handle IE svg bug
  41705. /* istanbul ignore if */
  41706. if (isIE && ns === 'svg') {
  41707. attrs = guardIESVGBug(attrs);
  41708. }
  41709. var element = createASTElement(tag, attrs, currentParent);
  41710. if (ns) {
  41711. element.ns = ns;
  41712. }
  41713. {
  41714. if (options.outputSourceRange) {
  41715. element.start = start$1;
  41716. element.end = end;
  41717. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  41718. cumulated[attr.name] = attr;
  41719. return cumulated
  41720. }, {});
  41721. }
  41722. attrs.forEach(function (attr) {
  41723. if (invalidAttributeRE.test(attr.name)) {
  41724. warn$2(
  41725. "Invalid dynamic argument expression: attribute names cannot contain " +
  41726. "spaces, quotes, <, >, / or =.",
  41727. {
  41728. start: attr.start + attr.name.indexOf("["),
  41729. end: attr.start + attr.name.length
  41730. }
  41731. );
  41732. }
  41733. });
  41734. }
  41735. if (isForbiddenTag(element) && !isServerRendering()) {
  41736. element.forbidden = true;
  41737. warn$2(
  41738. 'Templates should only be responsible for mapping the state to the ' +
  41739. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  41740. "<" + tag + ">" + ', as they will not be parsed.',
  41741. { start: element.start }
  41742. );
  41743. }
  41744. // apply pre-transforms
  41745. for (var i = 0; i < preTransforms.length; i++) {
  41746. element = preTransforms[i](element, options) || element;
  41747. }
  41748. if (!inVPre) {
  41749. processPre(element);
  41750. if (element.pre) {
  41751. inVPre = true;
  41752. }
  41753. }
  41754. if (platformIsPreTag(element.tag)) {
  41755. inPre = true;
  41756. }
  41757. if (inVPre) {
  41758. processRawAttrs(element);
  41759. } else if (!element.processed) {
  41760. // structural directives
  41761. processFor(element);
  41762. processIf(element);
  41763. processOnce(element);
  41764. }
  41765. if (!root) {
  41766. root = element;
  41767. {
  41768. checkRootConstraints(root);
  41769. }
  41770. }
  41771. if (!unary) {
  41772. currentParent = element;
  41773. stack.push(element);
  41774. } else {
  41775. closeElement(element);
  41776. }
  41777. },
  41778. end: function end (tag, start, end$1) {
  41779. var element = stack[stack.length - 1];
  41780. // pop stack
  41781. stack.length -= 1;
  41782. currentParent = stack[stack.length - 1];
  41783. if (options.outputSourceRange) {
  41784. element.end = end$1;
  41785. }
  41786. closeElement(element);
  41787. },
  41788. chars: function chars (text, start, end) {
  41789. if (!currentParent) {
  41790. {
  41791. if (text === template) {
  41792. warnOnce(
  41793. 'Component template requires a root element, rather than just text.',
  41794. { start: start }
  41795. );
  41796. } else if ((text = text.trim())) {
  41797. warnOnce(
  41798. ("text \"" + text + "\" outside root element will be ignored."),
  41799. { start: start }
  41800. );
  41801. }
  41802. }
  41803. return
  41804. }
  41805. // IE textarea placeholder bug
  41806. /* istanbul ignore if */
  41807. if (isIE &&
  41808. currentParent.tag === 'textarea' &&
  41809. currentParent.attrsMap.placeholder === text
  41810. ) {
  41811. return
  41812. }
  41813. var children = currentParent.children;
  41814. if (inPre || text.trim()) {
  41815. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  41816. } else if (!children.length) {
  41817. // remove the whitespace-only node right after an opening tag
  41818. text = '';
  41819. } else if (whitespaceOption) {
  41820. if (whitespaceOption === 'condense') {
  41821. // in condense mode, remove the whitespace node if it contains
  41822. // line break, otherwise condense to a single space
  41823. text = lineBreakRE.test(text) ? '' : ' ';
  41824. } else {
  41825. text = ' ';
  41826. }
  41827. } else {
  41828. text = preserveWhitespace ? ' ' : '';
  41829. }
  41830. if (text) {
  41831. if (!inPre && whitespaceOption === 'condense') {
  41832. // condense consecutive whitespaces into single space
  41833. text = text.replace(whitespaceRE$1, ' ');
  41834. }
  41835. var res;
  41836. var child;
  41837. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  41838. child = {
  41839. type: 2,
  41840. expression: res.expression,
  41841. tokens: res.tokens,
  41842. text: text
  41843. };
  41844. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  41845. child = {
  41846. type: 3,
  41847. text: text
  41848. };
  41849. }
  41850. if (child) {
  41851. if (options.outputSourceRange) {
  41852. child.start = start;
  41853. child.end = end;
  41854. }
  41855. children.push(child);
  41856. }
  41857. }
  41858. },
  41859. comment: function comment (text, start, end) {
  41860. // adding anything as a sibling to the root node is forbidden
  41861. // comments should still be allowed, but ignored
  41862. if (currentParent) {
  41863. var child = {
  41864. type: 3,
  41865. text: text,
  41866. isComment: true
  41867. };
  41868. if (options.outputSourceRange) {
  41869. child.start = start;
  41870. child.end = end;
  41871. }
  41872. currentParent.children.push(child);
  41873. }
  41874. }
  41875. });
  41876. return root
  41877. }
  41878. function processPre (el) {
  41879. if (getAndRemoveAttr(el, 'v-pre') != null) {
  41880. el.pre = true;
  41881. }
  41882. }
  41883. function processRawAttrs (el) {
  41884. var list = el.attrsList;
  41885. var len = list.length;
  41886. if (len) {
  41887. var attrs = el.attrs = new Array(len);
  41888. for (var i = 0; i < len; i++) {
  41889. attrs[i] = {
  41890. name: list[i].name,
  41891. value: JSON.stringify(list[i].value)
  41892. };
  41893. if (list[i].start != null) {
  41894. attrs[i].start = list[i].start;
  41895. attrs[i].end = list[i].end;
  41896. }
  41897. }
  41898. } else if (!el.pre) {
  41899. // non root node in pre blocks with no attributes
  41900. el.plain = true;
  41901. }
  41902. }
  41903. function processElement (
  41904. element,
  41905. options
  41906. ) {
  41907. processKey(element);
  41908. // determine whether this is a plain element after
  41909. // removing structural attributes
  41910. element.plain = (
  41911. !element.key &&
  41912. !element.scopedSlots &&
  41913. !element.attrsList.length
  41914. );
  41915. processRef(element);
  41916. processSlotContent(element);
  41917. processSlotOutlet(element);
  41918. processComponent(element);
  41919. for (var i = 0; i < transforms.length; i++) {
  41920. element = transforms[i](element, options) || element;
  41921. }
  41922. processAttrs(element);
  41923. return element
  41924. }
  41925. function processKey (el) {
  41926. var exp = getBindingAttr(el, 'key');
  41927. if (exp) {
  41928. {
  41929. if (el.tag === 'template') {
  41930. warn$2(
  41931. "<template> cannot be keyed. Place the key on real elements instead.",
  41932. getRawBindingAttr(el, 'key')
  41933. );
  41934. }
  41935. if (el.for) {
  41936. var iterator = el.iterator2 || el.iterator1;
  41937. var parent = el.parent;
  41938. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  41939. warn$2(
  41940. "Do not use v-for index as key on <transition-group> children, " +
  41941. "this is the same as not using keys.",
  41942. getRawBindingAttr(el, 'key'),
  41943. true /* tip */
  41944. );
  41945. }
  41946. }
  41947. }
  41948. el.key = exp;
  41949. }
  41950. }
  41951. function processRef (el) {
  41952. var ref = getBindingAttr(el, 'ref');
  41953. if (ref) {
  41954. el.ref = ref;
  41955. el.refInFor = checkInFor(el);
  41956. }
  41957. }
  41958. function processFor (el) {
  41959. var exp;
  41960. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  41961. var res = parseFor(exp);
  41962. if (res) {
  41963. extend(el, res);
  41964. } else {
  41965. warn$2(
  41966. ("Invalid v-for expression: " + exp),
  41967. el.rawAttrsMap['v-for']
  41968. );
  41969. }
  41970. }
  41971. }
  41972. function parseFor (exp) {
  41973. var inMatch = exp.match(forAliasRE);
  41974. if (!inMatch) { return }
  41975. var res = {};
  41976. res.for = inMatch[2].trim();
  41977. var alias = inMatch[1].trim().replace(stripParensRE, '');
  41978. var iteratorMatch = alias.match(forIteratorRE);
  41979. if (iteratorMatch) {
  41980. res.alias = alias.replace(forIteratorRE, '').trim();
  41981. res.iterator1 = iteratorMatch[1].trim();
  41982. if (iteratorMatch[2]) {
  41983. res.iterator2 = iteratorMatch[2].trim();
  41984. }
  41985. } else {
  41986. res.alias = alias;
  41987. }
  41988. return res
  41989. }
  41990. function processIf (el) {
  41991. var exp = getAndRemoveAttr(el, 'v-if');
  41992. if (exp) {
  41993. el.if = exp;
  41994. addIfCondition(el, {
  41995. exp: exp,
  41996. block: el
  41997. });
  41998. } else {
  41999. if (getAndRemoveAttr(el, 'v-else') != null) {
  42000. el.else = true;
  42001. }
  42002. var elseif = getAndRemoveAttr(el, 'v-else-if');
  42003. if (elseif) {
  42004. el.elseif = elseif;
  42005. }
  42006. }
  42007. }
  42008. function processIfConditions (el, parent) {
  42009. var prev = findPrevElement(parent.children);
  42010. if (prev && prev.if) {
  42011. addIfCondition(prev, {
  42012. exp: el.elseif,
  42013. block: el
  42014. });
  42015. } else {
  42016. warn$2(
  42017. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  42018. "used on element <" + (el.tag) + "> without corresponding v-if.",
  42019. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  42020. );
  42021. }
  42022. }
  42023. function findPrevElement (children) {
  42024. var i = children.length;
  42025. while (i--) {
  42026. if (children[i].type === 1) {
  42027. return children[i]
  42028. } else {
  42029. if (children[i].text !== ' ') {
  42030. warn$2(
  42031. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  42032. "will be ignored.",
  42033. children[i]
  42034. );
  42035. }
  42036. children.pop();
  42037. }
  42038. }
  42039. }
  42040. function addIfCondition (el, condition) {
  42041. if (!el.ifConditions) {
  42042. el.ifConditions = [];
  42043. }
  42044. el.ifConditions.push(condition);
  42045. }
  42046. function processOnce (el) {
  42047. var once$$1 = getAndRemoveAttr(el, 'v-once');
  42048. if (once$$1 != null) {
  42049. el.once = true;
  42050. }
  42051. }
  42052. // handle content being passed to a component as slot,
  42053. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  42054. function processSlotContent (el) {
  42055. var slotScope;
  42056. if (el.tag === 'template') {
  42057. slotScope = getAndRemoveAttr(el, 'scope');
  42058. /* istanbul ignore if */
  42059. if (slotScope) {
  42060. warn$2(
  42061. "the \"scope\" attribute for scoped slots have been deprecated and " +
  42062. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  42063. "can also be used on plain elements in addition to <template> to " +
  42064. "denote scoped slots.",
  42065. el.rawAttrsMap['scope'],
  42066. true
  42067. );
  42068. }
  42069. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  42070. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  42071. /* istanbul ignore if */
  42072. if (el.attrsMap['v-for']) {
  42073. warn$2(
  42074. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  42075. "(v-for takes higher priority). Use a wrapper <template> for the " +
  42076. "scoped slot to make it clearer.",
  42077. el.rawAttrsMap['slot-scope'],
  42078. true
  42079. );
  42080. }
  42081. el.slotScope = slotScope;
  42082. }
  42083. // slot="xxx"
  42084. var slotTarget = getBindingAttr(el, 'slot');
  42085. if (slotTarget) {
  42086. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  42087. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  42088. // preserve slot as an attribute for native shadow DOM compat
  42089. // only for non-scoped slots.
  42090. if (el.tag !== 'template' && !el.slotScope) {
  42091. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  42092. }
  42093. }
  42094. // 2.6 v-slot syntax
  42095. {
  42096. if (el.tag === 'template') {
  42097. // v-slot on <template>
  42098. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  42099. if (slotBinding) {
  42100. {
  42101. if (el.slotTarget || el.slotScope) {
  42102. warn$2(
  42103. "Unexpected mixed usage of different slot syntaxes.",
  42104. el
  42105. );
  42106. }
  42107. if (el.parent && !maybeComponent(el.parent)) {
  42108. warn$2(
  42109. "<template v-slot> can only appear at the root level inside " +
  42110. "the receiving component",
  42111. el
  42112. );
  42113. }
  42114. }
  42115. var ref = getSlotName(slotBinding);
  42116. var name = ref.name;
  42117. var dynamic = ref.dynamic;
  42118. el.slotTarget = name;
  42119. el.slotTargetDynamic = dynamic;
  42120. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  42121. }
  42122. } else {
  42123. // v-slot on component, denotes default slot
  42124. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  42125. if (slotBinding$1) {
  42126. {
  42127. if (!maybeComponent(el)) {
  42128. warn$2(
  42129. "v-slot can only be used on components or <template>.",
  42130. slotBinding$1
  42131. );
  42132. }
  42133. if (el.slotScope || el.slotTarget) {
  42134. warn$2(
  42135. "Unexpected mixed usage of different slot syntaxes.",
  42136. el
  42137. );
  42138. }
  42139. if (el.scopedSlots) {
  42140. warn$2(
  42141. "To avoid scope ambiguity, the default slot should also use " +
  42142. "<template> syntax when there are other named slots.",
  42143. slotBinding$1
  42144. );
  42145. }
  42146. }
  42147. // add the component's children to its default slot
  42148. var slots = el.scopedSlots || (el.scopedSlots = {});
  42149. var ref$1 = getSlotName(slotBinding$1);
  42150. var name$1 = ref$1.name;
  42151. var dynamic$1 = ref$1.dynamic;
  42152. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  42153. slotContainer.slotTarget = name$1;
  42154. slotContainer.slotTargetDynamic = dynamic$1;
  42155. slotContainer.children = el.children.filter(function (c) {
  42156. if (!c.slotScope) {
  42157. c.parent = slotContainer;
  42158. return true
  42159. }
  42160. });
  42161. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  42162. // remove children as they are returned from scopedSlots now
  42163. el.children = [];
  42164. // mark el non-plain so data gets generated
  42165. el.plain = false;
  42166. }
  42167. }
  42168. }
  42169. }
  42170. function getSlotName (binding) {
  42171. var name = binding.name.replace(slotRE, '');
  42172. if (!name) {
  42173. if (binding.name[0] !== '#') {
  42174. name = 'default';
  42175. } else {
  42176. warn$2(
  42177. "v-slot shorthand syntax requires a slot name.",
  42178. binding
  42179. );
  42180. }
  42181. }
  42182. return dynamicArgRE.test(name)
  42183. // dynamic [name]
  42184. ? { name: name.slice(1, -1), dynamic: true }
  42185. // static name
  42186. : { name: ("\"" + name + "\""), dynamic: false }
  42187. }
  42188. // handle <slot/> outlets
  42189. function processSlotOutlet (el) {
  42190. if (el.tag === 'slot') {
  42191. el.slotName = getBindingAttr(el, 'name');
  42192. if (el.key) {
  42193. warn$2(
  42194. "`key` does not work on <slot> because slots are abstract outlets " +
  42195. "and can possibly expand into multiple elements. " +
  42196. "Use the key on a wrapping element instead.",
  42197. getRawBindingAttr(el, 'key')
  42198. );
  42199. }
  42200. }
  42201. }
  42202. function processComponent (el) {
  42203. var binding;
  42204. if ((binding = getBindingAttr(el, 'is'))) {
  42205. el.component = binding;
  42206. }
  42207. if (getAndRemoveAttr(el, 'inline-template') != null) {
  42208. el.inlineTemplate = true;
  42209. }
  42210. }
  42211. function processAttrs (el) {
  42212. var list = el.attrsList;
  42213. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  42214. for (i = 0, l = list.length; i < l; i++) {
  42215. name = rawName = list[i].name;
  42216. value = list[i].value;
  42217. if (dirRE.test(name)) {
  42218. // mark element as dynamic
  42219. el.hasBindings = true;
  42220. // modifiers
  42221. modifiers = parseModifiers(name.replace(dirRE, ''));
  42222. // support .foo shorthand syntax for the .prop modifier
  42223. if (modifiers) {
  42224. name = name.replace(modifierRE, '');
  42225. }
  42226. if (bindRE.test(name)) { // v-bind
  42227. name = name.replace(bindRE, '');
  42228. value = parseFilters(value);
  42229. isDynamic = dynamicArgRE.test(name);
  42230. if (isDynamic) {
  42231. name = name.slice(1, -1);
  42232. }
  42233. if (
  42234. value.trim().length === 0
  42235. ) {
  42236. warn$2(
  42237. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  42238. );
  42239. }
  42240. if (modifiers) {
  42241. if (modifiers.prop && !isDynamic) {
  42242. name = camelize(name);
  42243. if (name === 'innerHtml') { name = 'innerHTML'; }
  42244. }
  42245. if (modifiers.camel && !isDynamic) {
  42246. name = camelize(name);
  42247. }
  42248. if (modifiers.sync) {
  42249. syncGen = genAssignmentCode(value, "$event");
  42250. if (!isDynamic) {
  42251. addHandler(
  42252. el,
  42253. ("update:" + (camelize(name))),
  42254. syncGen,
  42255. null,
  42256. false,
  42257. warn$2,
  42258. list[i]
  42259. );
  42260. if (hyphenate(name) !== camelize(name)) {
  42261. addHandler(
  42262. el,
  42263. ("update:" + (hyphenate(name))),
  42264. syncGen,
  42265. null,
  42266. false,
  42267. warn$2,
  42268. list[i]
  42269. );
  42270. }
  42271. } else {
  42272. // handler w/ dynamic event name
  42273. addHandler(
  42274. el,
  42275. ("\"update:\"+(" + name + ")"),
  42276. syncGen,
  42277. null,
  42278. false,
  42279. warn$2,
  42280. list[i],
  42281. true // dynamic
  42282. );
  42283. }
  42284. }
  42285. }
  42286. if ((modifiers && modifiers.prop) || (
  42287. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  42288. )) {
  42289. addProp(el, name, value, list[i], isDynamic);
  42290. } else {
  42291. addAttr(el, name, value, list[i], isDynamic);
  42292. }
  42293. } else if (onRE.test(name)) { // v-on
  42294. name = name.replace(onRE, '');
  42295. isDynamic = dynamicArgRE.test(name);
  42296. if (isDynamic) {
  42297. name = name.slice(1, -1);
  42298. }
  42299. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  42300. } else { // normal directives
  42301. name = name.replace(dirRE, '');
  42302. // parse arg
  42303. var argMatch = name.match(argRE);
  42304. var arg = argMatch && argMatch[1];
  42305. isDynamic = false;
  42306. if (arg) {
  42307. name = name.slice(0, -(arg.length + 1));
  42308. if (dynamicArgRE.test(arg)) {
  42309. arg = arg.slice(1, -1);
  42310. isDynamic = true;
  42311. }
  42312. }
  42313. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  42314. if (name === 'model') {
  42315. checkForAliasModel(el, value);
  42316. }
  42317. }
  42318. } else {
  42319. // literal attribute
  42320. {
  42321. var res = parseText(value, delimiters);
  42322. if (res) {
  42323. warn$2(
  42324. name + "=\"" + value + "\": " +
  42325. 'Interpolation inside attributes has been removed. ' +
  42326. 'Use v-bind or the colon shorthand instead. For example, ' +
  42327. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  42328. list[i]
  42329. );
  42330. }
  42331. }
  42332. addAttr(el, name, JSON.stringify(value), list[i]);
  42333. // #6887 firefox doesn't update muted state if set via attribute
  42334. // even immediately after element creation
  42335. if (!el.component &&
  42336. name === 'muted' &&
  42337. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  42338. addProp(el, name, 'true', list[i]);
  42339. }
  42340. }
  42341. }
  42342. }
  42343. function checkInFor (el) {
  42344. var parent = el;
  42345. while (parent) {
  42346. if (parent.for !== undefined) {
  42347. return true
  42348. }
  42349. parent = parent.parent;
  42350. }
  42351. return false
  42352. }
  42353. function parseModifiers (name) {
  42354. var match = name.match(modifierRE);
  42355. if (match) {
  42356. var ret = {};
  42357. match.forEach(function (m) { ret[m.slice(1)] = true; });
  42358. return ret
  42359. }
  42360. }
  42361. function makeAttrsMap (attrs) {
  42362. var map = {};
  42363. for (var i = 0, l = attrs.length; i < l; i++) {
  42364. if (
  42365. map[attrs[i].name] && !isIE && !isEdge
  42366. ) {
  42367. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  42368. }
  42369. map[attrs[i].name] = attrs[i].value;
  42370. }
  42371. return map
  42372. }
  42373. // for script (e.g. type="x/template") or style, do not decode content
  42374. function isTextTag (el) {
  42375. return el.tag === 'script' || el.tag === 'style'
  42376. }
  42377. function isForbiddenTag (el) {
  42378. return (
  42379. el.tag === 'style' ||
  42380. (el.tag === 'script' && (
  42381. !el.attrsMap.type ||
  42382. el.attrsMap.type === 'text/javascript'
  42383. ))
  42384. )
  42385. }
  42386. var ieNSBug = /^xmlns:NS\d+/;
  42387. var ieNSPrefix = /^NS\d+:/;
  42388. /* istanbul ignore next */
  42389. function guardIESVGBug (attrs) {
  42390. var res = [];
  42391. for (var i = 0; i < attrs.length; i++) {
  42392. var attr = attrs[i];
  42393. if (!ieNSBug.test(attr.name)) {
  42394. attr.name = attr.name.replace(ieNSPrefix, '');
  42395. res.push(attr);
  42396. }
  42397. }
  42398. return res
  42399. }
  42400. function checkForAliasModel (el, value) {
  42401. var _el = el;
  42402. while (_el) {
  42403. if (_el.for && _el.alias === value) {
  42404. warn$2(
  42405. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  42406. "You are binding v-model directly to a v-for iteration alias. " +
  42407. "This will not be able to modify the v-for source array because " +
  42408. "writing to the alias is like modifying a function local variable. " +
  42409. "Consider using an array of objects and use v-model on an object property instead.",
  42410. el.rawAttrsMap['v-model']
  42411. );
  42412. }
  42413. _el = _el.parent;
  42414. }
  42415. }
  42416. /* */
  42417. function preTransformNode (el, options) {
  42418. if (el.tag === 'input') {
  42419. var map = el.attrsMap;
  42420. if (!map['v-model']) {
  42421. return
  42422. }
  42423. var typeBinding;
  42424. if (map[':type'] || map['v-bind:type']) {
  42425. typeBinding = getBindingAttr(el, 'type');
  42426. }
  42427. if (!map.type && !typeBinding && map['v-bind']) {
  42428. typeBinding = "(" + (map['v-bind']) + ").type";
  42429. }
  42430. if (typeBinding) {
  42431. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  42432. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  42433. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  42434. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  42435. // 1. checkbox
  42436. var branch0 = cloneASTElement(el);
  42437. // process for on the main node
  42438. processFor(branch0);
  42439. addRawAttr(branch0, 'type', 'checkbox');
  42440. processElement(branch0, options);
  42441. branch0.processed = true; // prevent it from double-processed
  42442. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  42443. addIfCondition(branch0, {
  42444. exp: branch0.if,
  42445. block: branch0
  42446. });
  42447. // 2. add radio else-if condition
  42448. var branch1 = cloneASTElement(el);
  42449. getAndRemoveAttr(branch1, 'v-for', true);
  42450. addRawAttr(branch1, 'type', 'radio');
  42451. processElement(branch1, options);
  42452. addIfCondition(branch0, {
  42453. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  42454. block: branch1
  42455. });
  42456. // 3. other
  42457. var branch2 = cloneASTElement(el);
  42458. getAndRemoveAttr(branch2, 'v-for', true);
  42459. addRawAttr(branch2, ':type', typeBinding);
  42460. processElement(branch2, options);
  42461. addIfCondition(branch0, {
  42462. exp: ifCondition,
  42463. block: branch2
  42464. });
  42465. if (hasElse) {
  42466. branch0.else = true;
  42467. } else if (elseIfCondition) {
  42468. branch0.elseif = elseIfCondition;
  42469. }
  42470. return branch0
  42471. }
  42472. }
  42473. }
  42474. function cloneASTElement (el) {
  42475. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  42476. }
  42477. var model$1 = {
  42478. preTransformNode: preTransformNode
  42479. };
  42480. var modules$1 = [
  42481. klass$1,
  42482. style$1,
  42483. model$1
  42484. ];
  42485. /* */
  42486. function text (el, dir) {
  42487. if (dir.value) {
  42488. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  42489. }
  42490. }
  42491. /* */
  42492. function html (el, dir) {
  42493. if (dir.value) {
  42494. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  42495. }
  42496. }
  42497. var directives$1 = {
  42498. model: model,
  42499. text: text,
  42500. html: html
  42501. };
  42502. /* */
  42503. var baseOptions = {
  42504. expectHTML: true,
  42505. modules: modules$1,
  42506. directives: directives$1,
  42507. isPreTag: isPreTag,
  42508. isUnaryTag: isUnaryTag,
  42509. mustUseProp: mustUseProp,
  42510. canBeLeftOpenTag: canBeLeftOpenTag,
  42511. isReservedTag: isReservedTag,
  42512. getTagNamespace: getTagNamespace,
  42513. staticKeys: genStaticKeys(modules$1)
  42514. };
  42515. /* */
  42516. var isStaticKey;
  42517. var isPlatformReservedTag;
  42518. var genStaticKeysCached = cached(genStaticKeys$1);
  42519. /**
  42520. * Goal of the optimizer: walk the generated template AST tree
  42521. * and detect sub-trees that are purely static, i.e. parts of
  42522. * the DOM that never needs to change.
  42523. *
  42524. * Once we detect these sub-trees, we can:
  42525. *
  42526. * 1. Hoist them into constants, so that we no longer need to
  42527. * create fresh nodes for them on each re-render;
  42528. * 2. Completely skip them in the patching process.
  42529. */
  42530. function optimize (root, options) {
  42531. if (!root) { return }
  42532. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  42533. isPlatformReservedTag = options.isReservedTag || no;
  42534. // first pass: mark all non-static nodes.
  42535. markStatic$1(root);
  42536. // second pass: mark static roots.
  42537. markStaticRoots(root, false);
  42538. }
  42539. function genStaticKeys$1 (keys) {
  42540. return makeMap(
  42541. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  42542. (keys ? ',' + keys : '')
  42543. )
  42544. }
  42545. function markStatic$1 (node) {
  42546. node.static = isStatic(node);
  42547. if (node.type === 1) {
  42548. // do not make component slot content static. this avoids
  42549. // 1. components not able to mutate slot nodes
  42550. // 2. static slot content fails for hot-reloading
  42551. if (
  42552. !isPlatformReservedTag(node.tag) &&
  42553. node.tag !== 'slot' &&
  42554. node.attrsMap['inline-template'] == null
  42555. ) {
  42556. return
  42557. }
  42558. for (var i = 0, l = node.children.length; i < l; i++) {
  42559. var child = node.children[i];
  42560. markStatic$1(child);
  42561. if (!child.static) {
  42562. node.static = false;
  42563. }
  42564. }
  42565. if (node.ifConditions) {
  42566. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42567. var block = node.ifConditions[i$1].block;
  42568. markStatic$1(block);
  42569. if (!block.static) {
  42570. node.static = false;
  42571. }
  42572. }
  42573. }
  42574. }
  42575. }
  42576. function markStaticRoots (node, isInFor) {
  42577. if (node.type === 1) {
  42578. if (node.static || node.once) {
  42579. node.staticInFor = isInFor;
  42580. }
  42581. // For a node to qualify as a static root, it should have children that
  42582. // are not just static text. Otherwise the cost of hoisting out will
  42583. // outweigh the benefits and it's better off to just always render it fresh.
  42584. if (node.static && node.children.length && !(
  42585. node.children.length === 1 &&
  42586. node.children[0].type === 3
  42587. )) {
  42588. node.staticRoot = true;
  42589. return
  42590. } else {
  42591. node.staticRoot = false;
  42592. }
  42593. if (node.children) {
  42594. for (var i = 0, l = node.children.length; i < l; i++) {
  42595. markStaticRoots(node.children[i], isInFor || !!node.for);
  42596. }
  42597. }
  42598. if (node.ifConditions) {
  42599. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42600. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  42601. }
  42602. }
  42603. }
  42604. }
  42605. function isStatic (node) {
  42606. if (node.type === 2) { // expression
  42607. return false
  42608. }
  42609. if (node.type === 3) { // text
  42610. return true
  42611. }
  42612. return !!(node.pre || (
  42613. !node.hasBindings && // no dynamic bindings
  42614. !node.if && !node.for && // not v-if or v-for or v-else
  42615. !isBuiltInTag(node.tag) && // not a built-in
  42616. isPlatformReservedTag(node.tag) && // not a component
  42617. !isDirectChildOfTemplateFor(node) &&
  42618. Object.keys(node).every(isStaticKey)
  42619. ))
  42620. }
  42621. function isDirectChildOfTemplateFor (node) {
  42622. while (node.parent) {
  42623. node = node.parent;
  42624. if (node.tag !== 'template') {
  42625. return false
  42626. }
  42627. if (node.for) {
  42628. return true
  42629. }
  42630. }
  42631. return false
  42632. }
  42633. /* */
  42634. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  42635. var fnInvokeRE = /\([^)]*?\);*$/;
  42636. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  42637. // KeyboardEvent.keyCode aliases
  42638. var keyCodes = {
  42639. esc: 27,
  42640. tab: 9,
  42641. enter: 13,
  42642. space: 32,
  42643. up: 38,
  42644. left: 37,
  42645. right: 39,
  42646. down: 40,
  42647. 'delete': [8, 46]
  42648. };
  42649. // KeyboardEvent.key aliases
  42650. var keyNames = {
  42651. // #7880: IE11 and Edge use `Esc` for Escape key name.
  42652. esc: ['Esc', 'Escape'],
  42653. tab: 'Tab',
  42654. enter: 'Enter',
  42655. // #9112: IE11 uses `Spacebar` for Space key name.
  42656. space: [' ', 'Spacebar'],
  42657. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  42658. up: ['Up', 'ArrowUp'],
  42659. left: ['Left', 'ArrowLeft'],
  42660. right: ['Right', 'ArrowRight'],
  42661. down: ['Down', 'ArrowDown'],
  42662. // #9112: IE11 uses `Del` for Delete key name.
  42663. 'delete': ['Backspace', 'Delete', 'Del']
  42664. };
  42665. // #4868: modifiers that prevent the execution of the listener
  42666. // need to explicitly return null so that we can determine whether to remove
  42667. // the listener for .once
  42668. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  42669. var modifierCode = {
  42670. stop: '$event.stopPropagation();',
  42671. prevent: '$event.preventDefault();',
  42672. self: genGuard("$event.target !== $event.currentTarget"),
  42673. ctrl: genGuard("!$event.ctrlKey"),
  42674. shift: genGuard("!$event.shiftKey"),
  42675. alt: genGuard("!$event.altKey"),
  42676. meta: genGuard("!$event.metaKey"),
  42677. left: genGuard("'button' in $event && $event.button !== 0"),
  42678. middle: genGuard("'button' in $event && $event.button !== 1"),
  42679. right: genGuard("'button' in $event && $event.button !== 2")
  42680. };
  42681. function genHandlers (
  42682. events,
  42683. isNative
  42684. ) {
  42685. var prefix = isNative ? 'nativeOn:' : 'on:';
  42686. var staticHandlers = "";
  42687. var dynamicHandlers = "";
  42688. for (var name in events) {
  42689. var handlerCode = genHandler(events[name]);
  42690. if (events[name] && events[name].dynamic) {
  42691. dynamicHandlers += name + "," + handlerCode + ",";
  42692. } else {
  42693. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  42694. }
  42695. }
  42696. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  42697. if (dynamicHandlers) {
  42698. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  42699. } else {
  42700. return prefix + staticHandlers
  42701. }
  42702. }
  42703. function genHandler (handler) {
  42704. if (!handler) {
  42705. return 'function(){}'
  42706. }
  42707. if (Array.isArray(handler)) {
  42708. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  42709. }
  42710. var isMethodPath = simplePathRE.test(handler.value);
  42711. var isFunctionExpression = fnExpRE.test(handler.value);
  42712. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  42713. if (!handler.modifiers) {
  42714. if (isMethodPath || isFunctionExpression) {
  42715. return handler.value
  42716. }
  42717. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  42718. } else {
  42719. var code = '';
  42720. var genModifierCode = '';
  42721. var keys = [];
  42722. for (var key in handler.modifiers) {
  42723. if (modifierCode[key]) {
  42724. genModifierCode += modifierCode[key];
  42725. // left/right
  42726. if (keyCodes[key]) {
  42727. keys.push(key);
  42728. }
  42729. } else if (key === 'exact') {
  42730. var modifiers = (handler.modifiers);
  42731. genModifierCode += genGuard(
  42732. ['ctrl', 'shift', 'alt', 'meta']
  42733. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  42734. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  42735. .join('||')
  42736. );
  42737. } else {
  42738. keys.push(key);
  42739. }
  42740. }
  42741. if (keys.length) {
  42742. code += genKeyFilter(keys);
  42743. }
  42744. // Make sure modifiers like prevent and stop get executed after key filtering
  42745. if (genModifierCode) {
  42746. code += genModifierCode;
  42747. }
  42748. var handlerCode = isMethodPath
  42749. ? ("return " + (handler.value) + "($event)")
  42750. : isFunctionExpression
  42751. ? ("return (" + (handler.value) + ")($event)")
  42752. : isFunctionInvocation
  42753. ? ("return " + (handler.value))
  42754. : handler.value;
  42755. return ("function($event){" + code + handlerCode + "}")
  42756. }
  42757. }
  42758. function genKeyFilter (keys) {
  42759. return (
  42760. // make sure the key filters only apply to KeyboardEvents
  42761. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  42762. // key events that do not have keyCode property...
  42763. "if(!$event.type.indexOf('key')&&" +
  42764. (keys.map(genFilterCode).join('&&')) + ")return null;"
  42765. )
  42766. }
  42767. function genFilterCode (key) {
  42768. var keyVal = parseInt(key, 10);
  42769. if (keyVal) {
  42770. return ("$event.keyCode!==" + keyVal)
  42771. }
  42772. var keyCode = keyCodes[key];
  42773. var keyName = keyNames[key];
  42774. return (
  42775. "_k($event.keyCode," +
  42776. (JSON.stringify(key)) + "," +
  42777. (JSON.stringify(keyCode)) + "," +
  42778. "$event.key," +
  42779. "" + (JSON.stringify(keyName)) +
  42780. ")"
  42781. )
  42782. }
  42783. /* */
  42784. function on (el, dir) {
  42785. if (dir.modifiers) {
  42786. warn("v-on without argument does not support modifiers.");
  42787. }
  42788. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  42789. }
  42790. /* */
  42791. function bind$1 (el, dir) {
  42792. el.wrapData = function (code) {
  42793. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  42794. };
  42795. }
  42796. /* */
  42797. var baseDirectives = {
  42798. on: on,
  42799. bind: bind$1,
  42800. cloak: noop
  42801. };
  42802. /* */
  42803. var CodegenState = function CodegenState (options) {
  42804. this.options = options;
  42805. this.warn = options.warn || baseWarn;
  42806. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  42807. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  42808. this.directives = extend(extend({}, baseDirectives), options.directives);
  42809. var isReservedTag = options.isReservedTag || no;
  42810. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  42811. this.onceId = 0;
  42812. this.staticRenderFns = [];
  42813. this.pre = false;
  42814. };
  42815. function generate (
  42816. ast,
  42817. options
  42818. ) {
  42819. var state = new CodegenState(options);
  42820. var code = ast ? genElement(ast, state) : '_c("div")';
  42821. return {
  42822. render: ("with(this){return " + code + "}"),
  42823. staticRenderFns: state.staticRenderFns
  42824. }
  42825. }
  42826. function genElement (el, state) {
  42827. if (el.parent) {
  42828. el.pre = el.pre || el.parent.pre;
  42829. }
  42830. if (el.staticRoot && !el.staticProcessed) {
  42831. return genStatic(el, state)
  42832. } else if (el.once && !el.onceProcessed) {
  42833. return genOnce(el, state)
  42834. } else if (el.for && !el.forProcessed) {
  42835. return genFor(el, state)
  42836. } else if (el.if && !el.ifProcessed) {
  42837. return genIf(el, state)
  42838. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  42839. return genChildren(el, state) || 'void 0'
  42840. } else if (el.tag === 'slot') {
  42841. return genSlot(el, state)
  42842. } else {
  42843. // component or element
  42844. var code;
  42845. if (el.component) {
  42846. code = genComponent(el.component, el, state);
  42847. } else {
  42848. var data;
  42849. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  42850. data = genData$2(el, state);
  42851. }
  42852. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42853. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  42854. }
  42855. // module transforms
  42856. for (var i = 0; i < state.transforms.length; i++) {
  42857. code = state.transforms[i](el, code);
  42858. }
  42859. return code
  42860. }
  42861. }
  42862. // hoist static sub-trees out
  42863. function genStatic (el, state) {
  42864. el.staticProcessed = true;
  42865. // Some elements (templates) need to behave differently inside of a v-pre
  42866. // node. All pre nodes are static roots, so we can use this as a location to
  42867. // wrap a state change and reset it upon exiting the pre node.
  42868. var originalPreState = state.pre;
  42869. if (el.pre) {
  42870. state.pre = el.pre;
  42871. }
  42872. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  42873. state.pre = originalPreState;
  42874. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  42875. }
  42876. // v-once
  42877. function genOnce (el, state) {
  42878. el.onceProcessed = true;
  42879. if (el.if && !el.ifProcessed) {
  42880. return genIf(el, state)
  42881. } else if (el.staticInFor) {
  42882. var key = '';
  42883. var parent = el.parent;
  42884. while (parent) {
  42885. if (parent.for) {
  42886. key = parent.key;
  42887. break
  42888. }
  42889. parent = parent.parent;
  42890. }
  42891. if (!key) {
  42892. state.warn(
  42893. "v-once can only be used inside v-for that is keyed. ",
  42894. el.rawAttrsMap['v-once']
  42895. );
  42896. return genElement(el, state)
  42897. }
  42898. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  42899. } else {
  42900. return genStatic(el, state)
  42901. }
  42902. }
  42903. function genIf (
  42904. el,
  42905. state,
  42906. altGen,
  42907. altEmpty
  42908. ) {
  42909. el.ifProcessed = true; // avoid recursion
  42910. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  42911. }
  42912. function genIfConditions (
  42913. conditions,
  42914. state,
  42915. altGen,
  42916. altEmpty
  42917. ) {
  42918. if (!conditions.length) {
  42919. return altEmpty || '_e()'
  42920. }
  42921. var condition = conditions.shift();
  42922. if (condition.exp) {
  42923. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  42924. } else {
  42925. return ("" + (genTernaryExp(condition.block)))
  42926. }
  42927. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  42928. function genTernaryExp (el) {
  42929. return altGen
  42930. ? altGen(el, state)
  42931. : el.once
  42932. ? genOnce(el, state)
  42933. : genElement(el, state)
  42934. }
  42935. }
  42936. function genFor (
  42937. el,
  42938. state,
  42939. altGen,
  42940. altHelper
  42941. ) {
  42942. var exp = el.for;
  42943. var alias = el.alias;
  42944. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  42945. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  42946. if (state.maybeComponent(el) &&
  42947. el.tag !== 'slot' &&
  42948. el.tag !== 'template' &&
  42949. !el.key
  42950. ) {
  42951. state.warn(
  42952. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  42953. "v-for should have explicit keys. " +
  42954. "See https://vuejs.org/guide/list.html#key for more info.",
  42955. el.rawAttrsMap['v-for'],
  42956. true /* tip */
  42957. );
  42958. }
  42959. el.forProcessed = true; // avoid recursion
  42960. return (altHelper || '_l') + "((" + exp + ")," +
  42961. "function(" + alias + iterator1 + iterator2 + "){" +
  42962. "return " + ((altGen || genElement)(el, state)) +
  42963. '})'
  42964. }
  42965. function genData$2 (el, state) {
  42966. var data = '{';
  42967. // directives first.
  42968. // directives may mutate the el's other properties before they are generated.
  42969. var dirs = genDirectives(el, state);
  42970. if (dirs) { data += dirs + ','; }
  42971. // key
  42972. if (el.key) {
  42973. data += "key:" + (el.key) + ",";
  42974. }
  42975. // ref
  42976. if (el.ref) {
  42977. data += "ref:" + (el.ref) + ",";
  42978. }
  42979. if (el.refInFor) {
  42980. data += "refInFor:true,";
  42981. }
  42982. // pre
  42983. if (el.pre) {
  42984. data += "pre:true,";
  42985. }
  42986. // record original tag name for components using "is" attribute
  42987. if (el.component) {
  42988. data += "tag:\"" + (el.tag) + "\",";
  42989. }
  42990. // module data generation functions
  42991. for (var i = 0; i < state.dataGenFns.length; i++) {
  42992. data += state.dataGenFns[i](el);
  42993. }
  42994. // attributes
  42995. if (el.attrs) {
  42996. data += "attrs:" + (genProps(el.attrs)) + ",";
  42997. }
  42998. // DOM props
  42999. if (el.props) {
  43000. data += "domProps:" + (genProps(el.props)) + ",";
  43001. }
  43002. // event handlers
  43003. if (el.events) {
  43004. data += (genHandlers(el.events, false)) + ",";
  43005. }
  43006. if (el.nativeEvents) {
  43007. data += (genHandlers(el.nativeEvents, true)) + ",";
  43008. }
  43009. // slot target
  43010. // only for non-scoped slots
  43011. if (el.slotTarget && !el.slotScope) {
  43012. data += "slot:" + (el.slotTarget) + ",";
  43013. }
  43014. // scoped slots
  43015. if (el.scopedSlots) {
  43016. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  43017. }
  43018. // component v-model
  43019. if (el.model) {
  43020. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  43021. }
  43022. // inline-template
  43023. if (el.inlineTemplate) {
  43024. var inlineTemplate = genInlineTemplate(el, state);
  43025. if (inlineTemplate) {
  43026. data += inlineTemplate + ",";
  43027. }
  43028. }
  43029. data = data.replace(/,$/, '') + '}';
  43030. // v-bind dynamic argument wrap
  43031. // v-bind with dynamic arguments must be applied using the same v-bind object
  43032. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  43033. if (el.dynamicAttrs) {
  43034. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  43035. }
  43036. // v-bind data wrap
  43037. if (el.wrapData) {
  43038. data = el.wrapData(data);
  43039. }
  43040. // v-on data wrap
  43041. if (el.wrapListeners) {
  43042. data = el.wrapListeners(data);
  43043. }
  43044. return data
  43045. }
  43046. function genDirectives (el, state) {
  43047. var dirs = el.directives;
  43048. if (!dirs) { return }
  43049. var res = 'directives:[';
  43050. var hasRuntime = false;
  43051. var i, l, dir, needRuntime;
  43052. for (i = 0, l = dirs.length; i < l; i++) {
  43053. dir = dirs[i];
  43054. needRuntime = true;
  43055. var gen = state.directives[dir.name];
  43056. if (gen) {
  43057. // compile-time directive that manipulates AST.
  43058. // returns true if it also needs a runtime counterpart.
  43059. needRuntime = !!gen(el, dir, state.warn);
  43060. }
  43061. if (needRuntime) {
  43062. hasRuntime = true;
  43063. 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))) : '') + "},";
  43064. }
  43065. }
  43066. if (hasRuntime) {
  43067. return res.slice(0, -1) + ']'
  43068. }
  43069. }
  43070. function genInlineTemplate (el, state) {
  43071. var ast = el.children[0];
  43072. if (el.children.length !== 1 || ast.type !== 1) {
  43073. state.warn(
  43074. 'Inline-template components must have exactly one child element.',
  43075. { start: el.start }
  43076. );
  43077. }
  43078. if (ast && ast.type === 1) {
  43079. var inlineRenderFns = generate(ast, state.options);
  43080. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  43081. }
  43082. }
  43083. function genScopedSlots (
  43084. el,
  43085. slots,
  43086. state
  43087. ) {
  43088. // by default scoped slots are considered "stable", this allows child
  43089. // components with only scoped slots to skip forced updates from parent.
  43090. // but in some cases we have to bail-out of this optimization
  43091. // for example if the slot contains dynamic names, has v-if or v-for on them...
  43092. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  43093. var slot = slots[key];
  43094. return (
  43095. slot.slotTargetDynamic ||
  43096. slot.if ||
  43097. slot.for ||
  43098. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  43099. )
  43100. });
  43101. // #9534: if a component with scoped slots is inside a conditional branch,
  43102. // it's possible for the same component to be reused but with different
  43103. // compiled slot content. To avoid that, we generate a unique key based on
  43104. // the generated code of all the slot contents.
  43105. var needsKey = !!el.if;
  43106. // OR when it is inside another scoped slot or v-for (the reactivity may be
  43107. // disconnected due to the intermediate scope variable)
  43108. // #9438, #9506
  43109. // TODO: this can be further optimized by properly analyzing in-scope bindings
  43110. // and skip force updating ones that do not actually use scope variables.
  43111. if (!needsForceUpdate) {
  43112. var parent = el.parent;
  43113. while (parent) {
  43114. if (
  43115. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  43116. parent.for
  43117. ) {
  43118. needsForceUpdate = true;
  43119. break
  43120. }
  43121. if (parent.if) {
  43122. needsKey = true;
  43123. }
  43124. parent = parent.parent;
  43125. }
  43126. }
  43127. var generatedSlots = Object.keys(slots)
  43128. .map(function (key) { return genScopedSlot(slots[key], state); })
  43129. .join(',');
  43130. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  43131. }
  43132. function hash(str) {
  43133. var hash = 5381;
  43134. var i = str.length;
  43135. while(i) {
  43136. hash = (hash * 33) ^ str.charCodeAt(--i);
  43137. }
  43138. return hash >>> 0
  43139. }
  43140. function containsSlotChild (el) {
  43141. if (el.type === 1) {
  43142. if (el.tag === 'slot') {
  43143. return true
  43144. }
  43145. return el.children.some(containsSlotChild)
  43146. }
  43147. return false
  43148. }
  43149. function genScopedSlot (
  43150. el,
  43151. state
  43152. ) {
  43153. var isLegacySyntax = el.attrsMap['slot-scope'];
  43154. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  43155. return genIf(el, state, genScopedSlot, "null")
  43156. }
  43157. if (el.for && !el.forProcessed) {
  43158. return genFor(el, state, genScopedSlot)
  43159. }
  43160. var slotScope = el.slotScope === emptySlotScopeToken
  43161. ? ""
  43162. : String(el.slotScope);
  43163. var fn = "function(" + slotScope + "){" +
  43164. "return " + (el.tag === 'template'
  43165. ? el.if && isLegacySyntax
  43166. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  43167. : genChildren(el, state) || 'undefined'
  43168. : genElement(el, state)) + "}";
  43169. // reverse proxy v-slot without scope on this.$slots
  43170. var reverseProxy = slotScope ? "" : ",proxy:true";
  43171. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  43172. }
  43173. function genChildren (
  43174. el,
  43175. state,
  43176. checkSkip,
  43177. altGenElement,
  43178. altGenNode
  43179. ) {
  43180. var children = el.children;
  43181. if (children.length) {
  43182. var el$1 = children[0];
  43183. // optimize single v-for
  43184. if (children.length === 1 &&
  43185. el$1.for &&
  43186. el$1.tag !== 'template' &&
  43187. el$1.tag !== 'slot'
  43188. ) {
  43189. var normalizationType = checkSkip
  43190. ? state.maybeComponent(el$1) ? ",1" : ",0"
  43191. : "";
  43192. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  43193. }
  43194. var normalizationType$1 = checkSkip
  43195. ? getNormalizationType(children, state.maybeComponent)
  43196. : 0;
  43197. var gen = altGenNode || genNode;
  43198. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  43199. }
  43200. }
  43201. // determine the normalization needed for the children array.
  43202. // 0: no normalization needed
  43203. // 1: simple normalization needed (possible 1-level deep nested array)
  43204. // 2: full normalization needed
  43205. function getNormalizationType (
  43206. children,
  43207. maybeComponent
  43208. ) {
  43209. var res = 0;
  43210. for (var i = 0; i < children.length; i++) {
  43211. var el = children[i];
  43212. if (el.type !== 1) {
  43213. continue
  43214. }
  43215. if (needsNormalization(el) ||
  43216. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  43217. res = 2;
  43218. break
  43219. }
  43220. if (maybeComponent(el) ||
  43221. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  43222. res = 1;
  43223. }
  43224. }
  43225. return res
  43226. }
  43227. function needsNormalization (el) {
  43228. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  43229. }
  43230. function genNode (node, state) {
  43231. if (node.type === 1) {
  43232. return genElement(node, state)
  43233. } else if (node.type === 3 && node.isComment) {
  43234. return genComment(node)
  43235. } else {
  43236. return genText(node)
  43237. }
  43238. }
  43239. function genText (text) {
  43240. return ("_v(" + (text.type === 2
  43241. ? text.expression // no need for () because already wrapped in _s()
  43242. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  43243. }
  43244. function genComment (comment) {
  43245. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  43246. }
  43247. function genSlot (el, state) {
  43248. var slotName = el.slotName || '"default"';
  43249. var children = genChildren(el, state);
  43250. var res = "_t(" + slotName + (children ? ("," + children) : '');
  43251. var attrs = el.attrs || el.dynamicAttrs
  43252. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  43253. // slot props are camelized
  43254. name: camelize(attr.name),
  43255. value: attr.value,
  43256. dynamic: attr.dynamic
  43257. }); }))
  43258. : null;
  43259. var bind$$1 = el.attrsMap['v-bind'];
  43260. if ((attrs || bind$$1) && !children) {
  43261. res += ",null";
  43262. }
  43263. if (attrs) {
  43264. res += "," + attrs;
  43265. }
  43266. if (bind$$1) {
  43267. res += (attrs ? '' : ',null') + "," + bind$$1;
  43268. }
  43269. return res + ')'
  43270. }
  43271. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  43272. function genComponent (
  43273. componentName,
  43274. el,
  43275. state
  43276. ) {
  43277. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  43278. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  43279. }
  43280. function genProps (props) {
  43281. var staticProps = "";
  43282. var dynamicProps = "";
  43283. for (var i = 0; i < props.length; i++) {
  43284. var prop = props[i];
  43285. var value = transformSpecialNewlines(prop.value);
  43286. if (prop.dynamic) {
  43287. dynamicProps += (prop.name) + "," + value + ",";
  43288. } else {
  43289. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  43290. }
  43291. }
  43292. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  43293. if (dynamicProps) {
  43294. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  43295. } else {
  43296. return staticProps
  43297. }
  43298. }
  43299. // #3895, #4268
  43300. function transformSpecialNewlines (text) {
  43301. return text
  43302. .replace(/\u2028/g, '\\u2028')
  43303. .replace(/\u2029/g, '\\u2029')
  43304. }
  43305. /* */
  43306. // these keywords should not appear inside expressions, but operators like
  43307. // typeof, instanceof and in are allowed
  43308. var prohibitedKeywordRE = new RegExp('\\b' + (
  43309. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  43310. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  43311. 'extends,finally,continue,debugger,function,arguments'
  43312. ).split(',').join('\\b|\\b') + '\\b');
  43313. // these unary operators should not be used as property/method names
  43314. var unaryOperatorsRE = new RegExp('\\b' + (
  43315. 'delete,typeof,void'
  43316. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  43317. // strip strings in expressions
  43318. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  43319. // detect problematic expressions in a template
  43320. function detectErrors (ast, warn) {
  43321. if (ast) {
  43322. checkNode(ast, warn);
  43323. }
  43324. }
  43325. function checkNode (node, warn) {
  43326. if (node.type === 1) {
  43327. for (var name in node.attrsMap) {
  43328. if (dirRE.test(name)) {
  43329. var value = node.attrsMap[name];
  43330. if (value) {
  43331. var range = node.rawAttrsMap[name];
  43332. if (name === 'v-for') {
  43333. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  43334. } else if (name === 'v-slot' || name[0] === '#') {
  43335. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  43336. } else if (onRE.test(name)) {
  43337. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  43338. } else {
  43339. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  43340. }
  43341. }
  43342. }
  43343. }
  43344. if (node.children) {
  43345. for (var i = 0; i < node.children.length; i++) {
  43346. checkNode(node.children[i], warn);
  43347. }
  43348. }
  43349. } else if (node.type === 2) {
  43350. checkExpression(node.expression, node.text, warn, node);
  43351. }
  43352. }
  43353. function checkEvent (exp, text, warn, range) {
  43354. var stripped = exp.replace(stripStringRE, '');
  43355. var keywordMatch = stripped.match(unaryOperatorsRE);
  43356. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  43357. warn(
  43358. "avoid using JavaScript unary operator as property name: " +
  43359. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  43360. range
  43361. );
  43362. }
  43363. checkExpression(exp, text, warn, range);
  43364. }
  43365. function checkFor (node, text, warn, range) {
  43366. checkExpression(node.for || '', text, warn, range);
  43367. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  43368. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  43369. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  43370. }
  43371. function checkIdentifier (
  43372. ident,
  43373. type,
  43374. text,
  43375. warn,
  43376. range
  43377. ) {
  43378. if (typeof ident === 'string') {
  43379. try {
  43380. new Function(("var " + ident + "=_"));
  43381. } catch (e) {
  43382. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  43383. }
  43384. }
  43385. }
  43386. function checkExpression (exp, text, warn, range) {
  43387. try {
  43388. new Function(("return " + exp));
  43389. } catch (e) {
  43390. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  43391. if (keywordMatch) {
  43392. warn(
  43393. "avoid using JavaScript keyword as property name: " +
  43394. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  43395. range
  43396. );
  43397. } else {
  43398. warn(
  43399. "invalid expression: " + (e.message) + " in\n\n" +
  43400. " " + exp + "\n\n" +
  43401. " Raw expression: " + (text.trim()) + "\n",
  43402. range
  43403. );
  43404. }
  43405. }
  43406. }
  43407. function checkFunctionParameterExpression (exp, text, warn, range) {
  43408. try {
  43409. new Function(exp, '');
  43410. } catch (e) {
  43411. warn(
  43412. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  43413. " " + exp + "\n\n" +
  43414. " Raw expression: " + (text.trim()) + "\n",
  43415. range
  43416. );
  43417. }
  43418. }
  43419. /* */
  43420. var range = 2;
  43421. function generateCodeFrame (
  43422. source,
  43423. start,
  43424. end
  43425. ) {
  43426. if ( start === void 0 ) start = 0;
  43427. if ( end === void 0 ) end = source.length;
  43428. var lines = source.split(/\r?\n/);
  43429. var count = 0;
  43430. var res = [];
  43431. for (var i = 0; i < lines.length; i++) {
  43432. count += lines[i].length + 1;
  43433. if (count >= start) {
  43434. for (var j = i - range; j <= i + range || end > count; j++) {
  43435. if (j < 0 || j >= lines.length) { continue }
  43436. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  43437. var lineLength = lines[j].length;
  43438. if (j === i) {
  43439. // push underline
  43440. var pad = start - (count - lineLength) + 1;
  43441. var length = end > count ? lineLength - pad : end - start;
  43442. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  43443. } else if (j > i) {
  43444. if (end > count) {
  43445. var length$1 = Math.min(end - count, lineLength);
  43446. res.push(" | " + repeat$1("^", length$1));
  43447. }
  43448. count += lineLength + 1;
  43449. }
  43450. }
  43451. break
  43452. }
  43453. }
  43454. return res.join('\n')
  43455. }
  43456. function repeat$1 (str, n) {
  43457. var result = '';
  43458. if (n > 0) {
  43459. while (true) { // eslint-disable-line
  43460. if (n & 1) { result += str; }
  43461. n >>>= 1;
  43462. if (n <= 0) { break }
  43463. str += str;
  43464. }
  43465. }
  43466. return result
  43467. }
  43468. /* */
  43469. function createFunction (code, errors) {
  43470. try {
  43471. return new Function(code)
  43472. } catch (err) {
  43473. errors.push({ err: err, code: code });
  43474. return noop
  43475. }
  43476. }
  43477. function createCompileToFunctionFn (compile) {
  43478. var cache = Object.create(null);
  43479. return function compileToFunctions (
  43480. template,
  43481. options,
  43482. vm
  43483. ) {
  43484. options = extend({}, options);
  43485. var warn$$1 = options.warn || warn;
  43486. delete options.warn;
  43487. /* istanbul ignore if */
  43488. {
  43489. // detect possible CSP restriction
  43490. try {
  43491. new Function('return 1');
  43492. } catch (e) {
  43493. if (e.toString().match(/unsafe-eval|CSP/)) {
  43494. warn$$1(
  43495. 'It seems you are using the standalone build of Vue.js in an ' +
  43496. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  43497. 'The template compiler cannot work in this environment. Consider ' +
  43498. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  43499. 'templates into render functions.'
  43500. );
  43501. }
  43502. }
  43503. }
  43504. // check cache
  43505. var key = options.delimiters
  43506. ? String(options.delimiters) + template
  43507. : template;
  43508. if (cache[key]) {
  43509. return cache[key]
  43510. }
  43511. // compile
  43512. var compiled = compile(template, options);
  43513. // check compilation errors/tips
  43514. {
  43515. if (compiled.errors && compiled.errors.length) {
  43516. if (options.outputSourceRange) {
  43517. compiled.errors.forEach(function (e) {
  43518. warn$$1(
  43519. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  43520. generateCodeFrame(template, e.start, e.end),
  43521. vm
  43522. );
  43523. });
  43524. } else {
  43525. warn$$1(
  43526. "Error compiling template:\n\n" + template + "\n\n" +
  43527. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  43528. vm
  43529. );
  43530. }
  43531. }
  43532. if (compiled.tips && compiled.tips.length) {
  43533. if (options.outputSourceRange) {
  43534. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  43535. } else {
  43536. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  43537. }
  43538. }
  43539. }
  43540. // turn code into functions
  43541. var res = {};
  43542. var fnGenErrors = [];
  43543. res.render = createFunction(compiled.render, fnGenErrors);
  43544. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  43545. return createFunction(code, fnGenErrors)
  43546. });
  43547. // check function generation errors.
  43548. // this should only happen if there is a bug in the compiler itself.
  43549. // mostly for codegen development use
  43550. /* istanbul ignore if */
  43551. {
  43552. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  43553. warn$$1(
  43554. "Failed to generate render function:\n\n" +
  43555. fnGenErrors.map(function (ref) {
  43556. var err = ref.err;
  43557. var code = ref.code;
  43558. return ((err.toString()) + " in\n\n" + code + "\n");
  43559. }).join('\n'),
  43560. vm
  43561. );
  43562. }
  43563. }
  43564. return (cache[key] = res)
  43565. }
  43566. }
  43567. /* */
  43568. function createCompilerCreator (baseCompile) {
  43569. return function createCompiler (baseOptions) {
  43570. function compile (
  43571. template,
  43572. options
  43573. ) {
  43574. var finalOptions = Object.create(baseOptions);
  43575. var errors = [];
  43576. var tips = [];
  43577. var warn = function (msg, range, tip) {
  43578. (tip ? tips : errors).push(msg);
  43579. };
  43580. if (options) {
  43581. if (options.outputSourceRange) {
  43582. // $flow-disable-line
  43583. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  43584. warn = function (msg, range, tip) {
  43585. var data = { msg: msg };
  43586. if (range) {
  43587. if (range.start != null) {
  43588. data.start = range.start + leadingSpaceLength;
  43589. }
  43590. if (range.end != null) {
  43591. data.end = range.end + leadingSpaceLength;
  43592. }
  43593. }
  43594. (tip ? tips : errors).push(data);
  43595. };
  43596. }
  43597. // merge custom modules
  43598. if (options.modules) {
  43599. finalOptions.modules =
  43600. (baseOptions.modules || []).concat(options.modules);
  43601. }
  43602. // merge custom directives
  43603. if (options.directives) {
  43604. finalOptions.directives = extend(
  43605. Object.create(baseOptions.directives || null),
  43606. options.directives
  43607. );
  43608. }
  43609. // copy other options
  43610. for (var key in options) {
  43611. if (key !== 'modules' && key !== 'directives') {
  43612. finalOptions[key] = options[key];
  43613. }
  43614. }
  43615. }
  43616. finalOptions.warn = warn;
  43617. var compiled = baseCompile(template.trim(), finalOptions);
  43618. {
  43619. detectErrors(compiled.ast, warn);
  43620. }
  43621. compiled.errors = errors;
  43622. compiled.tips = tips;
  43623. return compiled
  43624. }
  43625. return {
  43626. compile: compile,
  43627. compileToFunctions: createCompileToFunctionFn(compile)
  43628. }
  43629. }
  43630. }
  43631. /* */
  43632. // `createCompilerCreator` allows creating compilers that use alternative
  43633. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  43634. // Here we just export a default compiler using the default parts.
  43635. var createCompiler = createCompilerCreator(function baseCompile (
  43636. template,
  43637. options
  43638. ) {
  43639. var ast = parse(template.trim(), options);
  43640. if (options.optimize !== false) {
  43641. optimize(ast, options);
  43642. }
  43643. var code = generate(ast, options);
  43644. return {
  43645. ast: ast,
  43646. render: code.render,
  43647. staticRenderFns: code.staticRenderFns
  43648. }
  43649. });
  43650. /* */
  43651. var ref$1 = createCompiler(baseOptions);
  43652. var compile = ref$1.compile;
  43653. var compileToFunctions = ref$1.compileToFunctions;
  43654. /* */
  43655. // check whether current browser encodes a char inside attribute values
  43656. var div;
  43657. function getShouldDecode (href) {
  43658. div = div || document.createElement('div');
  43659. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  43660. return div.innerHTML.indexOf('&#10;') > 0
  43661. }
  43662. // #3663: IE encodes newlines inside attribute values while other browsers don't
  43663. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  43664. // #6828: chrome encodes content in a[href]
  43665. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  43666. /* */
  43667. var idToTemplate = cached(function (id) {
  43668. var el = query(id);
  43669. return el && el.innerHTML
  43670. });
  43671. var mount = Vue.prototype.$mount;
  43672. Vue.prototype.$mount = function (
  43673. el,
  43674. hydrating
  43675. ) {
  43676. el = el && query(el);
  43677. /* istanbul ignore if */
  43678. if (el === document.body || el === document.documentElement) {
  43679. warn(
  43680. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  43681. );
  43682. return this
  43683. }
  43684. var options = this.$options;
  43685. // resolve template/el and convert to render function
  43686. if (!options.render) {
  43687. var template = options.template;
  43688. if (template) {
  43689. if (typeof template === 'string') {
  43690. if (template.charAt(0) === '#') {
  43691. template = idToTemplate(template);
  43692. /* istanbul ignore if */
  43693. if (!template) {
  43694. warn(
  43695. ("Template element not found or is empty: " + (options.template)),
  43696. this
  43697. );
  43698. }
  43699. }
  43700. } else if (template.nodeType) {
  43701. template = template.innerHTML;
  43702. } else {
  43703. {
  43704. warn('invalid template option:' + template, this);
  43705. }
  43706. return this
  43707. }
  43708. } else if (el) {
  43709. template = getOuterHTML(el);
  43710. }
  43711. if (template) {
  43712. /* istanbul ignore if */
  43713. if (config.performance && mark) {
  43714. mark('compile');
  43715. }
  43716. var ref = compileToFunctions(template, {
  43717. outputSourceRange: "development" !== 'production',
  43718. shouldDecodeNewlines: shouldDecodeNewlines,
  43719. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  43720. delimiters: options.delimiters,
  43721. comments: options.comments
  43722. }, this);
  43723. var render = ref.render;
  43724. var staticRenderFns = ref.staticRenderFns;
  43725. options.render = render;
  43726. options.staticRenderFns = staticRenderFns;
  43727. /* istanbul ignore if */
  43728. if (config.performance && mark) {
  43729. mark('compile end');
  43730. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  43731. }
  43732. }
  43733. }
  43734. return mount.call(this, el, hydrating)
  43735. };
  43736. /**
  43737. * Get outerHTML of elements, taking care
  43738. * of SVG elements in IE as well.
  43739. */
  43740. function getOuterHTML (el) {
  43741. if (el.outerHTML) {
  43742. return el.outerHTML
  43743. } else {
  43744. var container = document.createElement('div');
  43745. container.appendChild(el.cloneNode(true));
  43746. return container.innerHTML
  43747. }
  43748. }
  43749. Vue.compile = compileToFunctions;
  43750. module.exports = Vue;
  43751. /* 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))
  43752. /***/ }),
  43753. /***/ "./node_modules/vue/dist/vue.common.js":
  43754. /*!*********************************************!*\
  43755. !*** ./node_modules/vue/dist/vue.common.js ***!
  43756. \*********************************************/
  43757. /*! no static exports found */
  43758. /***/ (function(module, exports, __webpack_require__) {
  43759. if (false) {} else {
  43760. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  43761. }
  43762. /***/ }),
  43763. /***/ "./node_modules/webpack/buildin/global.js":
  43764. /*!***********************************!*\
  43765. !*** (webpack)/buildin/global.js ***!
  43766. \***********************************/
  43767. /*! no static exports found */
  43768. /***/ (function(module, exports) {
  43769. var g;
  43770. // This works in non-strict mode
  43771. g = (function() {
  43772. return this;
  43773. })();
  43774. try {
  43775. // This works if eval is allowed (see CSP)
  43776. g = g || new Function("return this")();
  43777. } catch (e) {
  43778. // This works if the window reference is available
  43779. if (typeof window === "object") g = window;
  43780. }
  43781. // g can still be undefined, but nothing to do about it...
  43782. // We return undefined, instead of nothing here, so it's
  43783. // easier to handle this case. if(!global) { ...}
  43784. module.exports = g;
  43785. /***/ }),
  43786. /***/ "./node_modules/webpack/buildin/module.js":
  43787. /*!***********************************!*\
  43788. !*** (webpack)/buildin/module.js ***!
  43789. \***********************************/
  43790. /*! no static exports found */
  43791. /***/ (function(module, exports) {
  43792. module.exports = function(module) {
  43793. if (!module.webpackPolyfill) {
  43794. module.deprecate = function() {};
  43795. module.paths = [];
  43796. // module.parent = undefined by default
  43797. if (!module.children) module.children = [];
  43798. Object.defineProperty(module, "loaded", {
  43799. enumerable: true,
  43800. get: function() {
  43801. return module.l;
  43802. }
  43803. });
  43804. Object.defineProperty(module, "id", {
  43805. enumerable: true,
  43806. get: function() {
  43807. return module.i;
  43808. }
  43809. });
  43810. module.webpackPolyfill = 1;
  43811. }
  43812. return module;
  43813. };
  43814. /***/ }),
  43815. /***/ "./resources/js/app.js":
  43816. /*!*****************************!*\
  43817. !*** ./resources/js/app.js ***!
  43818. \*****************************/
  43819. /*! no static exports found */
  43820. /***/ (function(module, exports, __webpack_require__) {
  43821. /**
  43822. * First we will load all of this project's JavaScript dependencies which
  43823. * includes Vue and other libraries. It is a great starting point when
  43824. * building robust, powerful web applications using Vue and Laravel.
  43825. */
  43826. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  43827. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  43828. /**
  43829. * The following block of code may be used to automatically register your
  43830. * Vue components. It will recursively scan this directory for the Vue
  43831. * components and automatically register them with their "basename".
  43832. *
  43833. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  43834. */
  43835. // const files = require.context('./', true, /\.vue$/i)
  43836. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  43837. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  43838. /**
  43839. * Next, we will create a fresh Vue application instance and attach it to
  43840. * the page. Then, you may begin adding components to this application
  43841. * or customize the JavaScript scaffolding to fit your unique needs.
  43842. */
  43843. var app = new Vue({
  43844. el: '#app'
  43845. });
  43846. /***/ }),
  43847. /***/ "./resources/js/bootstrap.js":
  43848. /*!***********************************!*\
  43849. !*** ./resources/js/bootstrap.js ***!
  43850. \***********************************/
  43851. /*! no static exports found */
  43852. /***/ (function(module, exports, __webpack_require__) {
  43853. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  43854. /**
  43855. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  43856. * for JavaScript based Bootstrap features such as modals and tabs. This
  43857. * code may be modified to fit the specific needs of your application.
  43858. */
  43859. try {
  43860. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  43861. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  43862. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  43863. } catch (e) {}
  43864. /**
  43865. * We'll load the axios HTTP library which allows us to easily issue requests
  43866. * to our Laravel back-end. This library automatically handles sending the
  43867. * CSRF token as a header based on the value of the "XSRF" token cookie.
  43868. */
  43869. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  43870. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  43871. /**
  43872. * Echo exposes an expressive API for subscribing to channels and listening
  43873. * for events that are broadcast by Laravel. Echo and event broadcasting
  43874. * allows your team to easily build robust real-time web applications.
  43875. */
  43876. // import Echo from 'laravel-echo';
  43877. // window.Pusher = require('pusher-js');
  43878. // window.Echo = new Echo({
  43879. // broadcaster: 'pusher',
  43880. // key: process.env.MIX_PUSHER_APP_KEY,
  43881. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  43882. // forceTLS: true
  43883. // });
  43884. /***/ }),
  43885. /***/ "./resources/js/components/ExampleComponent.vue":
  43886. /*!******************************************************!*\
  43887. !*** ./resources/js/components/ExampleComponent.vue ***!
  43888. \******************************************************/
  43889. /*! exports provided: default */
  43890. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43891. "use strict";
  43892. __webpack_require__.r(__webpack_exports__);
  43893. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  43894. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  43895. /* 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");
  43896. /* normalize component */
  43897. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  43898. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  43899. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  43900. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  43901. false,
  43902. null,
  43903. null,
  43904. null
  43905. )
  43906. /* hot reload */
  43907. if (false) { var api; }
  43908. component.options.__file = "resources/js/components/ExampleComponent.vue"
  43909. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  43910. /***/ }),
  43911. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  43912. /*!*******************************************************************************!*\
  43913. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  43914. \*******************************************************************************/
  43915. /*! exports provided: default */
  43916. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43917. "use strict";
  43918. __webpack_require__.r(__webpack_exports__);
  43919. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_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!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  43920. /* 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_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  43921. /***/ }),
  43922. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  43923. /*!*************************************************************************************!*\
  43924. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  43925. \*************************************************************************************/
  43926. /*! exports provided: render, staticRenderFns */
  43927. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43928. "use strict";
  43929. __webpack_require__.r(__webpack_exports__);
  43930. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___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!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  43931. /* 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_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  43932. /* 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_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  43933. /***/ }),
  43934. /***/ "./resources/sass/app.scss":
  43935. /*!*********************************!*\
  43936. !*** ./resources/sass/app.scss ***!
  43937. \*********************************/
  43938. /*! no static exports found */
  43939. /***/ (function(module, exports) {
  43940. // removed by extract-text-webpack-plugin
  43941. /***/ }),
  43942. /***/ 0:
  43943. /*!*************************************************************!*\
  43944. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  43945. \*************************************************************/
  43946. /*! no static exports found */
  43947. /***/ (function(module, exports, __webpack_require__) {
  43948. __webpack_require__(/*! C:\apps\aw-social\resources\js\app.js */"./resources/js/app.js");
  43949. module.exports = __webpack_require__(/*! C:\apps\aw-social\resources\sass\app.scss */"./resources/sass/app.scss");
  43950. /***/ })
  43951. /******/ });